Skip to content

Commit

Permalink
Added http type check and tags based design
Browse files Browse the repository at this point in the history
  • Loading branch information
tarun7singh committed Jul 17, 2023
1 parent 2e75142 commit 3f5641d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
3 changes: 2 additions & 1 deletion server/model/monitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class Monitor extends BeanModel {
id: this.id,
name: this.name,
sendUrl: this.sendUrl,
type: this.type,
};

if (this.sendUrl) {
Expand All @@ -52,7 +53,7 @@ class Monitor extends BeanModel {
obj.tags = await this.getTags();
}

if (certExpiry) {
if (certExpiry && this.type === "http") {
const { certExpiryDaysRemaining, validCert } = await this.getCertExpiry(this.id);
obj.certExpiryDaysRemaining = certExpiryDaysRemaining;
obj.validCert = validCert;
Expand Down
22 changes: 17 additions & 5 deletions src/components/PublicGroupList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,14 @@
@click="$refs.monitorSettingDialog.show(group, monitor)"
/>
</span>
<span v-if="showCertificateExpiry" class="badge rounded-pill" :class=" 'bg-' + certExpiryColor(monitor)"> {{ $t("Expiry") }}: {{ formattedCertExpiryMessage(monitor) }} </span>
</div>
<div v-if="showTags" class="tags">
<Tag v-for="tag in monitor.element.tags" :key="tag" :item="tag" :size="'sm'" />
<div class="extra-info">
<div v-if="showCertificateExpiry && monitor.element.type === 'http'">
<Tag :item="{name: $t('Cert Exp.'), value: formattedCertExpiryMessage(monitor), color: certExpiryColor(monitor)}" :size="'sm'" />
</div>
<div v-if="showTags">
<Tag v-for="tag in monitor.element.tags" :key="tag" :item="tag" :size="'sm'" />
</div>
</div>
</div>
<div :key="$root.userHeartbeatBar" class="col-3 col-md-4">
Expand Down Expand Up @@ -182,9 +186,9 @@ export default {
*/
certExpiryColor(monitor) {
if (monitor?.element?.validCert && monitor.element.certExpiryDaysRemaining > 7) {
return "primary";
return "#059669";
}
return "danger";
return "#DC2626";
},
}
};
Expand All @@ -193,6 +197,14 @@ export default {
<style lang="scss" scoped>
@import "../assets/vars";
.extra-info {
display: flex;
margin-bottom: 0.5rem;
}
.extra-info > div > div:first-child {
margin-left: 0 !important;
}
.no-monitor-msg {
position: absolute;
width: 100%;
Expand Down

0 comments on commit 3f5641d

Please # to comment.