-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathnext.js
69 lines (66 loc) · 2.13 KB
/
next.js
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
import { config } from './config.js'
import { boundCaption, entity2symbol, hasComparators, numL10n, percL10n } from './lib/fmt.js'
import { createApp} from './vendor/vue.js'
import { Indicator } from './models/indicator.js'
import AlertView from './views/alert-view.js'
import ObjectiveView from './views/objective-view.js'
import IndicatorView from './views/indicator-view.js'
import AlertChartComponent from './components/alert-chart.js'
import BurnRateComponent from './components/burn-rate.js'
import ErrorBudgetComponent from './components/error-budget.js'
import ExtLink from './components/ext-link.js'
import FooterComponent from './components/footer.js'
import HelpComponent from './components/help.js'
import ShowHideComponent from './components/show-hide.js'
import SLFractionComponent from './components/sl-fraction.js'
import { setTitle } from './lib/header.js'
import { percentToRatio } from './lib/math.js'
const app = createApp({
data() {
const indicator = new Indicator('requests', 'latency', 'ms')
indicator.bound.upperBound = 'lt'
indicator.addNewObjective()
indicator.objectives[0].addNewAlert()
return {
config,
indicator,
}
},
watch: {
title(newTitle) {
setTitle(document, newTitle)
},
},
components: {
AlertView,
ObjectiveView,
IndicatorView,
AlertChartComponent,
BurnRateComponent,
ErrorBudgetComponent,
ExtLink,
FooterComponent,
HelpComponent,
ShowHideComponent,
SLFractionComponent,
},
methods: {
boundCaption,
entity2symbol,
hasComparators,
numL10n,
percentToRatio,
percL10n,
async copy(elementId, label) {
try {
var copyText = document.getElementById(elementId).innerText
await navigator.clipboard.writeText(copyText)
this.toastCaption = 'Copied to clipboard!'
trackEvent('copy', 'button', label)
} catch(err) {
// ignore
}
},
}
})
app.mount('#app')