aboutsummaryrefslogtreecommitdiff
path: root/kamon-status/src/components/ModuleStatus.vue
blob: fff3373e492757b0bbc0d541155d73681f6bc7ae (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
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-3">
          <h5 class="mb-0">{{ moduleStatus.name }}</h5>
          <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>