Skip to content

Commit

Permalink
feat(xo-web/XOA/Support): button to restart xo-server service (#7056)
Browse files Browse the repository at this point in the history
  • Loading branch information
pdonias authored Sep 26, 2023
1 parent 6665d6a commit 869f7ff
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- [Host/Advanced] New button to download system logs [#3968](https://github.com/vatesfr/xen-orchestra/issues/3968) (PR [#7048](https://github.com/vatesfr/xen-orchestra/pull/7048))
- [Home/Hosts, Pools] Display host brand and version (PR [#7027](https://github.com/vatesfr/xen-orchestra/pull/7027))
- [SR] Ability to reclaim space [#1204](https://github.com/vatesfr/xen-orchestra/issues/1204) (PR [#7054](https://github.com/vatesfr/xen-orchestra/pull/7054))
- [XOA] New button to restart XO Server directly from the UI (PR [#7056](https://github.com/vatesfr/xen-orchestra/pull/7056))

### Bug fixes

Expand Down
2 changes: 2 additions & 0 deletions packages/xo-web/src/common/intl/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@ const messages = {
xoaCheck: 'XOA check',
closeTunnel: 'Close tunnel',
createSupportTicket: 'Create a support ticket',
restartXoServer: 'Restart XO Server',
restartXoServerConfirm: 'Restarting XO Server will interrupt any backup job or XO task that is currently running. Xen Orchestra will also be unavailable for a few seconds. Are you sure you want to restart XO Server?',
openTunnel: 'Open tunnel',
supportCommunity: 'The XOA check and the support tunnel are available in XOA.',
supportTunnel: 'Support tunnel',
Expand Down
13 changes: 13 additions & 0 deletions packages/xo-web/src/common/xo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3454,6 +3454,19 @@ export const getApplianceInfo = () => _call('xoa.getApplianceInfo')

export const getApiApplianceInfo = () => fetch('./rest/v0/appliance').then(resp => resp.json())

export const restartXoServer = async () => {
await confirm({
icon: 'restart',
title: _('restartXoServer'),
body: _('restartXoServerConfirm'),
strongConfirm: {
messageId: 'restartXoServer',
},
})

await _call('xoa.restartXoServer')
}

// Proxy --------------------------------------------------------------------

export const getAllProxies = () => _call('proxy.getAll')
Expand Down
4 changes: 4 additions & 0 deletions packages/xo-web/src/icons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1239,6 +1239,10 @@
@extend .fa;
@extend .fa-cloud-upload;
}
&-restart {
@extend .fa;
@extend .fa-refresh;
}

// XOSAN related

Expand Down
5 changes: 4 additions & 1 deletion packages/xo-web/src/xo-app/xoa/support/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { addSubscriptions, adminOnly, getXoaPlan } from 'utils'
import { Card, CardBlock, CardHeader } from 'card'
import { Container, Row, Col } from 'grid'
import { injectState, provideState } from 'reaclette'
import { closeTunnel, openTunnel, subscribeTunnelState } from 'xo'
import { closeTunnel, openTunnel, restartXoServer, subscribeTunnelState } from 'xo'
import { reportOnSupportPanel } from 'report-bug-button'

const ansiUp = new AnsiUp()
Expand Down Expand Up @@ -43,6 +43,9 @@ const Support = decorate([
<ActionButton btnStyle='primary' disabled={COMMUNITY} handler={reportOnSupportPanel} icon='ticket'>
{_('createSupportTicket')}
</ActionButton>
<ActionButton btnStyle='danger' disabled={COMMUNITY} handler={restartXoServer} icon='restart' className='ml-1'>
{_('restartXoServer')}
</ActionButton>
</Col>
</Row>
<Row>
Expand Down

0 comments on commit 869f7ff

Please sign in to comment.