aboutsummaryrefslogtreecommitdiff
path: root/kamon-status/src/components
diff options
context:
space:
mode:
Diffstat (limited to 'kamon-status/src/components')
-rw-r--r--kamon-status/src/components/Card.vue19
-rw-r--r--kamon-status/src/components/HelloWorld.vue65
-rw-r--r--kamon-status/src/components/MetricList.vue112
-rw-r--r--kamon-status/src/components/ModuleStatus.vue76
-rw-r--r--kamon-status/src/components/StatusCard.vue79
5 files changed, 207 insertions, 144 deletions
diff --git a/kamon-status/src/components/Card.vue b/kamon-status/src/components/Card.vue
new file mode 100644
index 00000000..745a1caf
--- /dev/null
+++ b/kamon-status/src/components/Card.vue
@@ -0,0 +1,19 @@
+<template>
+ <div class="outer py-1">
+ <slot/>
+ </div>
+</template>
+
+
+<!-- Add "scoped" attribute to limit CSS to this component only -->
+<style scoped lang="scss">
+.outer {
+ background-color: white;
+ box-shadow: 0 2px 9px 1px rgba(0, 0, 0, 0.1);
+}
+
+hr {
+ margin: 1px;
+ border-color: #f3f3f3;
+}
+</style>
diff --git a/kamon-status/src/components/HelloWorld.vue b/kamon-status/src/components/HelloWorld.vue
deleted file mode 100644
index af340a46..00000000
--- a/kamon-status/src/components/HelloWorld.vue
+++ /dev/null
@@ -1,65 +0,0 @@
-<template>
- <div class="hello">
- <h1>{{ msg }}</h1>
- <p>
- For a guide and recipes on how to configure / customize this project,<br>
- check out the
- <a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
- </p>
- <h3>Installed CLI Plugins</h3>
- <ul>
- <li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-typescript" target="_blank" rel="noopener">typescript</a></li>
- </ul>
- <h3>Essential Links</h3>
- <ul>
- <li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
- <li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
- <li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
- <li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
- <li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
- </ul>
- <h3>Ecosystem</h3>
- <ul>
- <li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
- <li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
- <li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
- <li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
- <li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
- </ul>
- </div>
-</template>
-
-<script lang="ts">
-import { Component, Prop, Vue } from 'vue-property-decorator'
-import axios from 'axios'
-
-@Component
-export default class HelloWorld extends Vue {
- @Prop() private msg!: string;
-
- private mounted() {
- console.log("I'm mounting the thing")
- axios.get("/status/config").then(result => {
- console.log("GOT A RESULT", result.data)
- })
- }
-}
-</script>
-
-<!-- Add "scoped" attribute to limit CSS to this component only -->
-<style scoped lang="scss">
-h3 {
- margin: 40px 0 0;
-}
-ul {
- list-style-type: none;
- padding: 0;
-}
-li {
- display: inline-block;
- margin: 0 10px;
-}
-a {
- color: #42b983;
-}
-</style>
diff --git a/kamon-status/src/components/MetricList.vue b/kamon-status/src/components/MetricList.vue
new file mode 100644
index 00000000..758252e7
--- /dev/null
+++ b/kamon-status/src/components/MetricList.vue
@@ -0,0 +1,112 @@
+<template>
+ <div class="row no-gutters">
+ <div class="col-12">
+ <div class="search-box mb-3">
+ <input class="w-100 px-3 py-2" v-model="filterPattern" type="text" placeholder="filter">
+ <span class="search-stats">{{ searchStats }}</span>
+ </div>
+ </div>
+
+ <div class="col-12">
+ <card v-if="matchedMetrics.length > 0">
+ <div class="row no-gutters" v-for="(metric, index) in matchedMetrics" :key="metric.search">
+ <div class="col-12 px-3 pt-1 pb-3">
+ <div class="text-uppercase text-label">{{ metric.type }}</div>
+ <h4>{{ metric.name }}</h4>
+ <div class="tag-container">
+ <span class="tag" v-for="tag in Object.keys(metric.tags)" :key="tag">
+ {{ tag }}=<span class="tag-value">{{ metric.tags[tag] }}</span>
+ </span>
+ </div>
+
+ </div>
+ <hr v-if="index < (matchedMetrics.length - 1)" class="w-100">
+ </div>
+ </card>
+ </div>
+ </div>
+</template>
+
+<script lang="ts">
+import { Component, Prop, Vue } from 'vue-property-decorator'
+import {Metric} from '../api/StatusApi'
+import Card from './Card.vue'
+
+
+@Component({
+ components: {
+ card: Card
+ }
+})
+export default class MetricList extends Vue {
+ @Prop() private metrics!: Metric[]
+ private filterPattern: string = ''
+
+ get totalMetrics(): number {
+ return this.metrics.length
+ }
+
+ get filterRegex(): RegExp {
+ return new RegExp(this.filterPattern)
+ }
+
+ get searchStats(): string {
+ if (this.filterPattern.length > 0) {
+ return this.matchedMetrics.length + ' matched'
+ } else {
+ return this.totalMetrics + ' metrics'
+ }
+ }
+
+ get matchedMetrics(): Metric[] {
+ if (this.filterPattern.length > 0) {
+ return this.metrics.filter(m => m.search.match(this.filterRegex) != null)
+ } else {
+ return this.metrics
+ }
+ }
+}
+</script>
+
+<style scoped lang="scss">
+.search-box {
+ input {
+ color: #676767;
+ height: 2.5rem;
+ border: none;
+ border-radius: 0.3rem;
+ background-color: #e8e8e8;
+
+ &:focus {
+ outline: none;
+ }
+ }
+
+ ::placeholder {
+ color: #929292;
+ }
+
+ .search-stats {
+ position: absolute;
+ line-height: 2.5rem;
+ right: 0;
+ padding-right: 1rem;
+ }
+}
+
+.tag-container {
+ margin: 0rem -0.3rem;
+}
+
+.tag {
+ background-color: #f4f4f4;
+ margin: 0.3rem;
+ padding: 0.1rem 0.5rem;
+ border-radius: 0.2rem;
+}
+
+.tag-value {
+ color: #676767;
+}
+
+</style>
diff --git a/kamon-status/src/components/ModuleStatus.vue b/kamon-status/src/components/ModuleStatus.vue
new file mode 100644
index 00000000..a92cf46f
--- /dev/null
+++ b/kamon-status/src/components/ModuleStatus.vue
@@ -0,0 +1,76 @@
+<template>
+ <card>
+ <div class="row">
+ <div class="col-12">
+ <div class="py-2 px-3 text-uppercase text-label">
+ {{ moduleStatus.kind }}
+ </div>
+ <hr>
+ </div>
+ <div class="col">
+ <div class="px-3 py-2">
+ <h4>{{ moduleStatus.name }}</h4>
+ <div class="text-label">
+ {{ moduleStatus.description }}
+ </div>
+ </div>
+ </div>
+ <div class="col-auto">
+ <div class="status-indicator text-center" :class="runStatus.class">{{ runStatus.message }}</div>
+ <div class="status-indicator text-center">{{ discoveryStatus.message }}</div>
+ </div>
+ </div>
+ </card>
+</template>
+
+<script lang="ts">
+import { Component, Prop, Vue } from 'vue-property-decorator'
+import {Module} from '../api/StatusApi'
+import Card from './Card.vue'
+
+
+@Component({
+ components: {
+ card: Card
+ }
+})
+export default class ModuleStatus extends Vue {
+ @Prop() private moduleStatus!: Module
+
+ get discoveryStatus(): { message: string, class: string } {
+ return this.moduleStatus.isProgrammaticallyRegistered ?
+ { message: 'manual', class: '' } :
+ { message: 'automatic', class: '' }
+ }
+
+ get runStatus(): { message: string, class: string } {
+ return this.moduleStatus.isStarted ?
+ { message: 'started', class: 'healthy' } :
+ { message: 'disabled', class: 'critical' }
+ }
+}
+</script>
+
+<style scoped lang="scss">
+.status-indicator {
+ font-size: 0.9rem;
+ border-radius: 0.3rem;
+ color: white;
+ margin: 0.5rem 1rem;
+ padding: 0.1rem 1rem;
+ background-color: #cccccc;
+}
+
+.critical {
+ background-color: #ff6e6b;
+}
+
+.healthy {
+ background-color: #6ada87;
+}
+
+hr {
+ margin: 1px;
+ border-color: #f3f3f3;
+}
+</style>
diff --git a/kamon-status/src/components/StatusCard.vue b/kamon-status/src/components/StatusCard.vue
deleted file mode 100644
index 05047a19..00000000
--- a/kamon-status/src/components/StatusCard.vue
+++ /dev/null
@@ -1,79 +0,0 @@
-<template>
- <div class="outer">
- <div class="py-2 px-3 heading text-uppercase">
- {{ statusInfo.heading }}
- </div>
- <hr>
- <div class="px-3 py-2">
- <div class="message" :class="messageStatusClass">
- {{ statusInfo.message }}
- </div>
- <div class="caption">
- {{ statusInfo.caption }}
- </div>
- </div>
- </div>
-</template>
-
-<script lang="ts">
-import { Component, Prop, Vue } from 'vue-property-decorator'
-import axios from 'axios'
-
-export enum Status {
- Healthy,
- Critical,
- Unknown
-}
-
-export interface StatusInfo {
- heading: string
- message: string
- caption?: string
- status: Status
-}
-
-@Component
-export default class StatusCard extends Vue {
- @Prop() private statusInfo!: StatusInfo
-
- get messageStatusClass(): string[] {
- if(this.statusInfo != null && this.statusInfo.status != Status.Unknown) {
- return this.statusInfo.status == Status.Healthy ? ['healthy'] : ['critical']
- } else {
- return []
- }
- }
-}
-</script>
-
-<!-- Add "scoped" attribute to limit CSS to this component only -->
-<style scoped lang="scss">
-.outer {
- background-color: white;
- box-shadow: 0 2px 9px 1px rgba(0, 0, 0, 0.1);
-
- .heading {
- font-size: 0.9rem;
- color: #a5a5a5;
- }
-
- .message {
- color: #868686;
- font-weight: 600;
- font-size: 1.5rem;
- }
-
- .caption {
- color: #a5a5a5;
- }
-
- .critical {
- color: #ff6e6b;
- }
-}
-
-hr {
- margin: 1px;
- border-color: #f3f3f3;
-}
-</style>