aboutsummaryrefslogtreecommitdiff
path: root/kamon-status/src/components/StatusCard.vue
blob: 05047a19d9857e1218047ea92b84033cc8e77689 (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
77
78
79
<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>