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
80
81
82
83
84
85
86
|
<template>
<div class="w-100">
<status-section title="Reporters">
<div class="row">
<div class="col-12 py-1" v-for="reporter in reporterModules" :key="reporter.name">
<module-status-card :module="reporter" />
</div>
<div v-if="!hasApmModule" class="col-12 py-1 apm-suggestion">
<a href="https://kamon.io/apm/?utm_source=kamon&utm_medium=status-page&utm_campaign=kamon-status" target="_blank">
<module-status-card :is-suggestion="true" :module="apmModuleSuggestion" />
</a>
</div>
</div>
</status-section>
<status-section title="Modules" v-if="plainModules.length > 0">
<div class="row">
<div class="col-12 py-1" v-for="module in plainModules" :key="module.name">
<module-status-card :module="module"/>
</div>
</div>
</status-section>
</div>
</template>
<script lang="ts">
import { Component, Prop, Vue } from 'vue-property-decorator'
import {Module, ModuleKind} from '../api/StatusApi'
import ModuleStatusCard from './ModuleStatusCard.vue'
import StatusSection from './StatusSection.vue'
@Component({
components: {
'status-section': StatusSection,
'module-status-card': ModuleStatusCard
}
})
export default class ModuleList extends Vue {
@Prop() private modules!: Module[]
private apmModuleSuggestion: Module = {
name: 'Kamon APM',
description: 'See your metrics and trace data for free with a Starter account.',
kind: ModuleKind.Combined,
programmaticallyRegistered: false,
enabled: false,
started: false,
clazz: ''
}
get sortedModules(): Module[] {
return this.modules.sort((left, right) => {
if (left.started === right.started) {
return left.name.localeCompare(right.name)
} else {
return left.started ? -1 : 1
}
})
}
get reporterModules(): Module[] {
return this.sortedModules.filter(this.isReporter)
}
get plainModules(): Module[] {
return this.sortedModules.filter(m => !this.isReporter(m))
}
get hasApmModule(): boolean {
const knownApmClasses = [
'kamon.kamino.KaminoReporter'
]
return this.modules.find(m => knownApmClasses.indexOf(m.clazz) > 0) !== undefined
}
private isReporter(module: Module): boolean {
return [ModuleKind.Combined, ModuleKind.Span, ModuleKind.Metric].indexOf(module.kind) > 0
}
private isStarted(module: Module): boolean {
return module.started
}
}
</script>
|