2022-08-15 21:06:19 -05:00
|
|
|
## -*- coding: utf-8; -*-
|
|
|
|
<%inherit file="/page.mako" />
|
|
|
|
|
2022-11-23 11:52:44 -06:00
|
|
|
<%def name="title()">${index_title}</%def>
|
|
|
|
|
2022-08-15 21:06:19 -05:00
|
|
|
<%def name="content_title()"></%def>
|
|
|
|
|
|
|
|
<%def name="context_menu_items()">
|
|
|
|
${parent.context_menu_items()}
|
|
|
|
% if request.has_perm('datasync_changes.list'):
|
|
|
|
<li>${h.link_to("View DataSync Changes", url('datasyncchanges'))}</li>
|
|
|
|
% endif
|
|
|
|
</%def>
|
|
|
|
|
|
|
|
<%def name="page_content()">
|
2022-08-17 19:06:02 -05:00
|
|
|
% if expose_websockets and not supervisor_error:
|
2022-08-17 18:19:37 -05:00
|
|
|
<b-notification type="is-warning"
|
2022-08-17 22:59:50 -05:00
|
|
|
:active="websocketBroken"
|
2022-08-17 18:19:37 -05:00
|
|
|
:closable="false">
|
|
|
|
Server connection was broken - please refresh page to see accurate status!
|
|
|
|
</b-notification>
|
|
|
|
% endif
|
2022-08-15 21:06:19 -05:00
|
|
|
<b-field label="Supervisor Status">
|
|
|
|
<div style="display: flex;">
|
|
|
|
|
2022-08-17 19:06:02 -05:00
|
|
|
% if supervisor_error:
|
|
|
|
<pre class="has-background-warning">${supervisor_error}</pre>
|
|
|
|
% else:
|
|
|
|
<pre :class="(processInfo && processInfo.statename == 'RUNNING') ? 'has-background-success' : 'has-background-warning'">{{ processDescription }}</pre>
|
|
|
|
% endif
|
2022-08-15 21:06:19 -05:00
|
|
|
|
|
|
|
<div style="margin-left: 1rem;">
|
|
|
|
% if request.has_perm('datasync.restart'):
|
|
|
|
${h.form(url('datasync.restart'), **{'@submit': 'restartProcess'})}
|
|
|
|
${h.csrf_token(request)}
|
|
|
|
<b-button type="is-primary"
|
|
|
|
native-type="submit"
|
|
|
|
icon-pack="fas"
|
|
|
|
icon-left="redo"
|
|
|
|
:disabled="restartingProcess">
|
|
|
|
{{ restartingProcess ? "Working, please wait..." : "Restart Process" }}
|
|
|
|
</b-button>
|
|
|
|
${h.end_form()}
|
|
|
|
% endif
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</b-field>
|
|
|
|
|
|
|
|
<b-field label="Watcher Status">
|
|
|
|
<b-table :data="watchers">
|
2023-02-01 18:44:55 -06:00
|
|
|
<b-table-column field="key"
|
|
|
|
label="Watcher"
|
|
|
|
v-slot="props">
|
|
|
|
{{ props.row.key }}
|
|
|
|
</b-table-column>
|
|
|
|
<b-table-column field="spec"
|
|
|
|
label="Spec"
|
|
|
|
v-slot="props">
|
|
|
|
{{ props.row.spec }}
|
|
|
|
</b-table-column>
|
|
|
|
<b-table-column field="dbkey"
|
|
|
|
label="DB Key"
|
|
|
|
v-slot="props">
|
|
|
|
{{ props.row.dbkey }}
|
|
|
|
</b-table-column>
|
|
|
|
<b-table-column field="delay"
|
|
|
|
label="Delay"
|
|
|
|
v-slot="props">
|
|
|
|
{{ props.row.delay }} second(s)
|
|
|
|
</b-table-column>
|
|
|
|
<b-table-column field="lastrun"
|
|
|
|
label="Last Watched"
|
|
|
|
v-slot="props">
|
|
|
|
<span v-html="props.row.lastrun"></span>
|
|
|
|
</b-table-column>
|
|
|
|
<b-table-column field="status"
|
|
|
|
label="Status"
|
|
|
|
v-slot="props">
|
|
|
|
<span :class="props.row.status == 'okay' ? 'has-background-success' : 'has-background-warning'">
|
|
|
|
{{ props.row.status }}
|
|
|
|
</span>
|
|
|
|
</b-table-column>
|
2022-08-15 21:06:19 -05:00
|
|
|
</b-table>
|
|
|
|
</b-field>
|
|
|
|
|
|
|
|
<b-field label="Consumer Status">
|
|
|
|
<b-table :data="consumers">
|
2023-02-01 18:44:55 -06:00
|
|
|
<b-table-column field="key"
|
|
|
|
label="Consumer"
|
|
|
|
v-slot="props">
|
|
|
|
{{ props.row.key }}
|
|
|
|
</b-table-column>
|
|
|
|
<b-table-column field="spec"
|
|
|
|
label="Spec"
|
|
|
|
v-slot="props">
|
|
|
|
{{ props.row.spec }}
|
|
|
|
</b-table-column>
|
|
|
|
<b-table-column field="dbkey"
|
|
|
|
label="DB Key"
|
|
|
|
v-slot="props">
|
|
|
|
{{ props.row.dbkey }}
|
|
|
|
</b-table-column>
|
|
|
|
<b-table-column field="delay"
|
|
|
|
label="Delay"
|
|
|
|
v-slot="props">
|
|
|
|
{{ props.row.delay }} second(s)
|
|
|
|
</b-table-column>
|
|
|
|
<b-table-column field="changes"
|
|
|
|
label="Pending Changes"
|
|
|
|
v-slot="props">
|
|
|
|
{{ props.row.changes }}
|
|
|
|
</b-table-column>
|
|
|
|
<b-table-column field="status"
|
|
|
|
label="Status"
|
|
|
|
v-slot="props">
|
|
|
|
<span :class="props.row.status == 'okay' ? 'has-background-success' : 'has-background-warning'">
|
|
|
|
{{ props.row.status }}
|
|
|
|
</span>
|
|
|
|
</b-table-column>
|
2022-08-15 21:06:19 -05:00
|
|
|
</b-table>
|
|
|
|
</b-field>
|
|
|
|
</%def>
|
|
|
|
|
|
|
|
<%def name="modify_this_page_vars()">
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
2022-08-17 18:19:37 -05:00
|
|
|
ThisPageData.processInfo = ${json.dumps(process_info)|n}
|
|
|
|
|
|
|
|
ThisPage.computed.processDescription = function() {
|
|
|
|
let info = this.processInfo
|
|
|
|
if (info) {
|
|
|
|
return `${'$'}{info.group}:${'$'}{info.name} ${'$'}{info.statename} ${'$'}{info.description}`
|
|
|
|
} else {
|
|
|
|
return "NO PROCESS INFO AVAILABLE"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-15 21:06:19 -05:00
|
|
|
ThisPageData.restartingProcess = false
|
|
|
|
ThisPageData.watchers = ${json.dumps(watcher_data)|n}
|
|
|
|
ThisPageData.consumers = ${json.dumps(consumer_data)|n}
|
|
|
|
|
|
|
|
ThisPage.methods.restartProcess = function() {
|
|
|
|
this.restartingProcess = true
|
|
|
|
}
|
|
|
|
|
2022-08-17 19:06:02 -05:00
|
|
|
% if expose_websockets and not supervisor_error:
|
2022-08-17 18:19:37 -05:00
|
|
|
|
|
|
|
ThisPageData.ws = null
|
2022-08-17 22:59:50 -05:00
|
|
|
ThisPageData.websocketBroken = false
|
2022-08-17 18:19:37 -05:00
|
|
|
|
|
|
|
ThisPage.mounted = function() {
|
|
|
|
|
|
|
|
## TODO: should be a cleaner way to get this url?
|
2022-12-25 15:37:54 -06:00
|
|
|
let url = '${url('ws.datasync.status')}'
|
|
|
|
url = url.replace(/^http(s?):/, 'ws$1:')
|
2022-08-17 18:19:37 -05:00
|
|
|
|
|
|
|
this.ws = new WebSocket(url)
|
|
|
|
let that = this
|
|
|
|
|
|
|
|
this.ws.onclose = (event) => {
|
2022-08-17 22:59:50 -05:00
|
|
|
// websocket closing means 1 of 2 things:
|
|
|
|
// - user navigated away from page intentionally
|
|
|
|
// - server connection was broken somehow
|
|
|
|
// only one of those is "bad" and we only want to
|
|
|
|
// display warning in 2nd case. so we simply use a
|
|
|
|
// brief delay to "rule out" the 1st scenario
|
|
|
|
setTimeout(() => { that.websocketBroken = true },
|
|
|
|
3000)
|
2022-08-17 18:19:37 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
this.ws.onmessage = (event) => {
|
|
|
|
that.processInfo = JSON.parse(event.data)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
% endif
|
|
|
|
|
2022-08-15 21:06:19 -05:00
|
|
|
</script>
|
|
|
|
</%def>
|
|
|
|
|
|
|
|
|
|
|
|
${parent.body()}
|