diff --git a/agent/hostmanager.yaml b/agent/hostmanager.yaml index 9ac446b..cb34fad 100644 --- a/agent/hostmanager.yaml +++ b/agent/hostmanager.yaml @@ -7,55 +7,64 @@ processes: 'timestamp_field': 'timestamp' } data: { + "orphans": {}, + "new_tags": {}, "child_states": [ { "next_action": "up", "target_state": "up", "stability": 1, "agent_class": "[docker]", - "instance_id": "ocs-aggregator" + "instance_id": "ocs-aggregator", + "restart_required": false }, { "next_action": "up", "target_state": "up", "stability": 1, "agent_class": "[docker]", - "instance_id": "ocs-influx-publisher" + "instance_id": "ocs-influx-publisher", + "restart_required": true }, { "next_action": "up", "target_state": "up", "stability": 1, "agent_class": "[docker]", - "instance_id": "ocs-registry" + "instance_id": "ocs-registry", + "restart_required": false }, { "next_action": "up", "target_state": "up", "stability": 1, "agent_class": "[docker]", - "instance_id": "hk-agent-01" + "instance_id": "hk-agent-01", + "restart_required": false }, { "next_action": "up", "target_state": "up", "stability": 1, "agent_class": "[docker]", - "instance_id": "ocs-ups-satp-c2-01" + "instance_id": "ocs-ups-satp-c2-01", + "restart_required": false }, { "next_action": "up", "target_state": "up", "stability": 1, "agent_class": "[docker]", - "instance_id": "ocs-ups-satp-c1-01" + "instance_id": "ocs-ups-satp-c1-01", + "restart_required": false }, { "next_action": "down", "target_state": "down", "stability": 0.9978726211941876, "agent_class": "[docker]", - "instance_id": "ocs-latr-pfeiffer-01" + "instance_id": "ocs-latr-pfeiffer-01", + "restart_required": false } ] } diff --git a/src/panels/HostManager.vue b/src/panels/HostManager.vue index dabbed9..a0639d0 100644 --- a/src/panels/HostManager.vue +++ b/src/panels/HostManager.vue @@ -7,14 +7,35 @@
Host Manager -

Connection

+

Status

- - + + + + + +
@@ -33,8 +54,9 @@ target set-target
-
- {{ item.instance_id }} +
+ {{ item.instance_id }}{{ item.restart_indicator }} {{ item.agent_class }} {{ item.next_action }} {{ item.target_state }} @@ -62,7 +84,28 @@ +
+ + +
+ + + + + + + +
@@ -75,12 +118,18 @@ return { panel: {}, children: [], + sessionSchema: 0, + restartCount: null, + pullCount: null, + orphanCount: null, ops: window.ocs_bundle.web.ops_data_init({ 'manager': {}, 'update': { params: {reload_config: false}, }, 'die': {}, + 'docker_pull': {}, + 'remove_orphans': {}, }), } }, @@ -88,10 +137,20 @@ address: String, }, methods: { - update_child_states(op_name, method, stat, msg, session) { + update_from_session_data(op_name, method, stat, msg, session) { if (!session.data || session.status != 'running') return; + if (Object.hasOwn(session.data, 'orphans')) + this.sessionSchema = 1; + else + this.sessionSchema = 0; + + if (this.sessionSchema > 0) { + this.orphanCount = Object.keys(session.data.orphans).length; + this.pullCount = Object.keys(session.data.new_tags).length; + } + function sortKey(state) { return [state.agent_class.toUpperCase(), state.agent_class, @@ -103,6 +162,17 @@ .map(state => [sortKey(state), state]) .toSorted() .map(([,state]) => state); + let rc = 0; + for (const child of this.children) { + if (child?.restart_required) { + child.restart_indicator = ' *update-pending*'; + rc += 1; + } else { + child.restart_indicator = ''; + } + } + + this.restartCount = rc; }, set_target(child, updn) { child.target_state = '(' + updn + ')'; @@ -111,11 +181,17 @@ }); }, refresh_config() { - window.ocs_bundle.ui_start_proc(this.address, 'update', - {'reload_config': true}); + window.ocs_bundle.ui_start_proc(this.address, 'update', + {'reload_config': true}); + }, + remove_orphans() { + window.ocs_bundle.ui_start_proc(this.address, 'remove_orphans', {}); + }, + docker_pull() { + window.ocs_bundle.ui_start_proc(this.address, 'docker_pull', {}); }, startListening() { - this.panel.client.add_watcher('manager', 5., this.update_child_states); + this.panel.client.add_watcher('manager', 5., this.update_from_session_data); }, }, } @@ -142,6 +218,10 @@ padding: 10px 0px; overflow: hidden; text-overflow: ellipsis; + white-space: nowrap; + } + .hm_row_emph { + font-style: italic; } .hm_header { border-bottom: 1px solid black;