Skip to content

Commit

Permalink
Merge pull request #277 from nfdi4plants/fix-broadcast-display
Browse files Browse the repository at this point in the history
fix #273, add "show past broadcast messages display"
  • Loading branch information
JonasLukasczyk authored Oct 2, 2024
2 parents 285843b + 210af8a commit c18b7b1
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 16 deletions.
15 changes: 12 additions & 3 deletions packages/renderer/src/AppProperties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,19 @@ const get_datahub_hosts_msgs = async ()=>{
let contains_critical = false;
for(let msg of AppProperties.datahub_hosts_msgs[host]){
const t = msg.message.toLowerCase();
msg.level = t.includes('downtime')||t.includes('maintenance') ? 1 : 0;
contains_critical = contains_critical || msg.level;
let contains_critical = false
let contains_active = false
msg.level = 2;
if (msg.active) {
contains_active = true;
}
msg.active
? msg.level = (t.includes('maintenance') || t.includes('downtime')) ? 0 : 1
: msg.level = 2;
contains_critical = contains_critical || msg.level < 2;
AppProperties.datahub_hosts_msgs[host].level = AppProperties.datahub_hosts_msgs[host].length<1 ? 2 : contains_critical ? 0 : 2;
AppProperties.datahub_hosts_msgs[host].active = contains_active;
}
AppProperties.datahub_hosts_msgs[host].level = AppProperties.datahub_hosts_msgs[host].length<1 ? 2 : contains_critical ? 1 : 0;
}
};

Expand Down
34 changes: 21 additions & 13 deletions packages/renderer/src/views/StatusView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,36 +21,44 @@ import AppProperties from '../AppProperties.ts';
>
<template v-slot:header>
<q-item-section avatar>
<q-avatar v-if='AppProperties.datahub_hosts_msgs[host].level<2' icon="warning" :text-color="AppProperties.datahub_hosts_msgs[host].level==1?'red-9' : 'grey-5'" />
<q-avatar v-if='AppProperties.datahub_hosts_msgs[host].level<2 && AppProperties.datahub_hosts_msgs[host].active' icon="warning" :text-color="AppProperties.datahub_hosts_msgs[host].level==1?'red-9' : 'grey-5'" />
<q-avatar v-else icon="check_circle" text-color="secondary" />
</q-item-section>

<q-item-section style="text-align:left">
<b>{{host}}</b>
</q-item-section>
</template>

<q-card>
<q-card-section>
<q-list dense bordered class="rounded-borders bg-grey-2">

<q-item v-for='msg of AppProperties.datahub_hosts_msgs[host]' style="border-bottom:1px solid #ccc">
<q-item
v-if='AppProperties.datahub_hosts_msgs[host].active'
v-for='msg of AppProperties.datahub_hosts_msgs[host]' style="border-bottom:1px solid #ccc"
>
<q-item-section avatar>
<q-icon :color="msg.level===1?'red-9' : 'grey-5'" name="warning" />
</q-item-section>

<q-item-section style="text-align:left;">{{msg.message}}</q-item-section>
</q-item>

<q-item v-if='AppProperties.datahub_hosts_msgs[host].level===2' style="border-bottom:1px solid #ccc">
<q-item-section avatar>
<q-icon color="grey-5" name="check_circle" />
</q-item-section>

<q-item-section style="text-align:left;">No Messages</q-item-section>
<q-item v-if='!AppProperties.datahub_hosts_msgs[host].active' style="text-align:left;">
<q-item-section >No active broadcast messages</q-item-section>
</q-item>
</q-list>
</q-card-section>
<q-card-section v-if='!AppProperties.datahub_hosts_msgs[host].active && AppProperties.datahub_hosts_msgs[host].length > 0'>
<q-expansion-item label="View past broadcast messages">
<q-list dense bordered class="rounded-borders bg-grey-2">
<q-item
v-for='msg of AppProperties.datahub_hosts_msgs[host]' style="border-bottom:1px solid #ccc"
>
<q-item-section avatar>
<q-icon :color="msg.level===1?'red-9' : 'grey-5'" name="warning" />
</q-item-section>
<q-item-section style="text-align:left;">{{msg.message}}</q-item-section>
</q-item>
</q-list>
</q-expansion-item>
</q-card-section>
</q-card>
</q-expansion-item>
<q-separator />
Expand Down

0 comments on commit c18b7b1

Please sign in to comment.