fluency-v8-components 1.3.5 → 1.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/fluency-v8-components.es.js +1 -1
- package/dist/fluency-v8-components.umd.js +99 -99
- package/dist/{index-q2NbjdVo.mjs → index-BBxccHNP.mjs} +7 -6
- package/dist/{index.es-PAPL4E6Y.mjs → index.es-D_XhLSeH.mjs} +1 -1
- package/package.json +3 -2
- package/src/assets/images/ai.svg +1 -0
- package/src/assets/images/github-dark.svg +1 -0
- package/src/assets/images/github.svg +1 -0
- package/src/assets/images/high-priority.svg +1 -0
- package/src/assets/images/power-off.svg +1 -0
- package/src/assets/images/save.svg +1 -0
- package/src/assets/index.ts +15 -0
- package/src/assets/main.css +505 -0
- package/src/assets/prism-theme.css +290 -0
- package/src/components/buttons/ActionButtons.vue +374 -0
- package/src/components/buttons/DropdownButton.vue +104 -0
- package/src/components/buttons/IconButton.vue +63 -0
- package/src/components/buttons/ImageButton.vue +16 -0
- package/src/components/buttons/MenuButton.vue +138 -0
- package/src/components/buttons/SubmitButtons.vue +51 -0
- package/src/components/buttons/TextButton.vue +40 -0
- package/src/components/charts/AlertChart.vue +376 -0
- package/src/components/charts/BarChart.vue +212 -0
- package/src/components/charts/BarChartHorizontal.vue +243 -0
- package/src/components/charts/CronChart.vue +146 -0
- package/src/components/charts/EmptyChart.vue +76 -0
- package/src/components/charts/GradientChart.vue +310 -0
- package/src/components/charts/LineChart.test.js +59 -0
- package/src/components/charts/LineChart.vue +434 -0
- package/src/components/charts/PieChart.vue +293 -0
- package/src/components/charts/ProgressChart.vue +106 -0
- package/src/components/charts/StackedChart.vue +364 -0
- package/src/components/charts/StackedChartClustered.vue +395 -0
- package/src/components/charts/TimelineChart.vue +215 -0
- package/src/components/charts/WorkflowChart.vue +520 -0
- package/src/components/common/AutoCompleteSearchBar.vue +100 -0
- package/src/components/common/AutoRefreshButton.vue +53 -0
- package/src/components/common/Breadcrumb.vue +45 -0
- package/src/components/common/ButtonToggle.vue +24 -0
- package/src/components/common/Card.vue +116 -0
- package/src/components/common/Carousel.vue +66 -0
- package/src/components/common/CategoryCard.vue +28 -0
- package/src/components/common/CodeEditor.vue +59 -0
- package/src/components/common/DatePicker.vue +21 -0
- package/src/components/common/DatePickerInput.vue +109 -0
- package/src/components/common/Dialog.vue +103 -0
- package/src/components/common/EditorHeading.vue +10 -0
- package/src/components/common/EventList.vue +41 -0
- package/src/components/common/Facet.vue +206 -0
- package/src/components/common/Feed.vue +58 -0
- package/src/components/common/Flag.vue +27 -0
- package/src/components/common/HomeCard.vue +20 -0
- package/src/components/common/ItemBox.vue +49 -0
- package/src/components/common/Loading.vue +19 -0
- package/src/components/common/LoadingDots.vue +12 -0
- package/src/components/common/PageHeading.vue +30 -0
- package/src/components/common/Pagination.vue +105 -0
- package/src/components/common/Popover.vue +24 -0
- package/src/components/common/PowerToggle.vue +130 -0
- package/src/components/common/ProgressBar.vue +33 -0
- package/src/components/common/RadioButtons.vue +52 -0
- package/src/components/common/Schedule.vue +79 -0
- package/src/components/common/SearchBar.vue +30 -0
- package/src/components/common/Separator.vue +3 -0
- package/src/components/common/Slideout.vue +95 -0
- package/src/components/common/Sort.vue +83 -0
- package/src/components/common/Table.vue +48 -0
- package/src/components/common/Tabs.vue +129 -0
- package/src/components/common/Tag.vue +53 -0
- package/src/components/common/Tooltip.vue +49 -0
- package/src/components/common/VerticalTabs.vue +34 -0
- package/src/components/common/card/CardItem.vue +27 -0
- package/src/components/common/card/CardItemGroup.vue +45 -0
- package/src/components/common/facet/Leaf.vue +97 -0
- package/src/components/common/facet/TriState.vue +37 -0
- package/src/components/common/table/TableData.vue +48 -0
- package/src/components/common/table/TableHeader.vue +21 -0
- package/src/components/dialogs/ChooseValueDialog.vue +97 -0
- package/src/components/dialogs/ConfirmDialog.vue +73 -0
- package/src/components/dialogs/CopyDialog.vue +51 -0
- package/src/components/dialogs/DownloadDialog.vue +48 -0
- package/src/components/dialogs/NameDescDialog.vue +74 -0
- package/src/components/dialogs/NameDialog.vue +56 -0
- package/src/components/dialogs/PopupEditor.vue +113 -0
- package/src/components/dialogs/ProgressDialog.vue +58 -0
- package/src/components/dialogs/ResetPasswordDialog.vue +58 -0
- package/src/components/dialogs/Wizard.vue +99 -0
- package/src/components/dialogs/wizard/Stepper.vue +31 -0
- package/src/components/form/CheckBox.vue +26 -0
- package/src/components/form/Editor.vue +93 -0
- package/src/components/form/FormCol.vue +19 -0
- package/src/components/form/FormRow.vue +19 -0
- package/src/components/form/FormSection.vue +21 -0
- package/src/components/form/GreyForm.vue +7 -0
- package/src/components/form/GreyInput.vue +51 -0
- package/src/components/form/GreyInputAutocomplete.vue +100 -0
- package/src/components/form/GreyInputCopy.vue +66 -0
- package/src/components/form/GreyInputGrow.vue +42 -0
- package/src/components/form/GreyInputToken.vue +78 -0
- package/src/components/form/GreyPassword.vue +36 -0
- package/src/components/form/GreySelect.vue +154 -0
- package/src/components/form/GreySelectInput.vue +123 -0
- package/src/components/form/GreySelectInputMultiple.vue +218 -0
- package/src/components/form/GreyTel.vue +58 -0
- package/src/components/form/HamburgerItem.vue +95 -0
- package/src/components/form/KeyValueEntry.vue +74 -0
- package/src/components/form/RadioInput.vue +38 -0
- package/src/components/form/UploadFile.vue +99 -0
- package/src/components/icons/AiIcon.vue +6 -0
- package/src/components/icons/GithubIcon.vue +18 -0
- package/src/components/icons/HighPriorityIcon.vue +6 -0
- package/src/components/icons/PowerOffIcon.vue +6 -0
- package/src/components/icons/SaveIcon.vue +6 -0
- package/src/components/index.js +134 -0
- package/src/components/menu/DialogMenu.vue +142 -0
- package/src/components/menu/GrandChild.vue +39 -0
- package/src/components/menu/GridMenu.vue +88 -0
- package/src/components/menu/MenuAvatar.vue +66 -0
- package/src/components/menu/MenuDesktop.vue +90 -0
- package/src/components/notifications/Notify.vue +123 -0
- package/src/components/notifications/NotifyList.vue +130 -0
- package/src/components/page-structure/FacetPage.vue +77 -0
- package/src/components/query/Child.vue +63 -0
- package/src/components/query/LVDBQuery.vue +38 -0
- package/src/components/status/Active.vue +44 -0
- package/src/components/status/ScoreLevel.vue +43 -0
- package/src/components/status/Status.vue +51 -0
- package/src/components/status/TaskDot.vue +25 -0
- package/src/components/status/TaskStatus.vue +26 -0
- package/src/components/status/TicketStatus.vue +201 -0
- package/src/components/status/Trend.vue +20 -0
- package/src/components/tables/ArgumentRunTable.vue +96 -0
- package/src/components/tables/ArgumentTable.vue +67 -0
- package/src/components/tables/CloudFormationParameters.vue +25 -0
- package/src/constants/colors.js +248 -0
- package/src/constants/font-map.js +128 -0
- package/src/constants/fpl2.js +162 -0
- package/src/constants/icon-svg.js +405 -0
- package/src/constants/schedule.js +52 -0
- package/src/fpl/AddPanel.vue +237 -0
- package/src/fpl/Configs/Alert.vue +16 -0
- package/src/fpl/Configs/AlertSprite.vue +2 -0
- package/src/fpl/Configs/Chart.vue +63 -0
- package/src/fpl/Configs/Config.js +154 -0
- package/src/fpl/Configs/Counter.vue +35 -0
- package/src/fpl/Configs/Histogram.vue +70 -0
- package/src/fpl/Configs/IPMap.vue +37 -0
- package/src/fpl/Configs/Image.vue +163 -0
- package/src/fpl/Configs/MetricChart.vue +20 -0
- package/src/fpl/Configs/PieChart.vue +37 -0
- package/src/fpl/Configs/SparkChart.vue +41 -0
- package/src/fpl/Configs/StackedBarChart.vue +49 -0
- package/src/fpl/Configs/Table.vue +211 -0
- package/src/fpl/Configs/Text.vue +14 -0
- package/src/fpl/Configs/TopNChart.vue +37 -0
- package/src/fpl/Outputs/FPLAlert.vue +64 -0
- package/src/fpl/Outputs/FPLStream.vue +41 -0
- package/src/fpl/Outputs/FPLTable.vue +77 -0
- package/src/fpl/Panel.vue +202 -0
- package/src/fpl/Panels/Alert.vue +85 -0
- package/src/fpl/Panels/AlertSprite.vue +9 -0
- package/src/fpl/Panels/Chart.vue +98 -0
- package/src/fpl/Panels/Counter.vue +43 -0
- package/src/fpl/Panels/Histogram.vue +138 -0
- package/src/fpl/Panels/IPMap.vue +48 -0
- package/src/fpl/Panels/Image.vue +35 -0
- package/src/fpl/Panels/MetricChart.vue +97 -0
- package/src/fpl/Panels/PieChart.vue +54 -0
- package/src/fpl/Panels/SparkChart.vue +166 -0
- package/src/fpl/Panels/StackedBarChart.vue +74 -0
- package/src/fpl/Panels/Table.vue +103 -0
- package/src/fpl/Panels/Text.vue +24 -0
- package/src/fpl/Panels/TopNChart.vue +69 -0
- package/src/fpl/index.js +39 -0
- package/src/utils/download.js +220 -0
- package/src/utils/formatOutput.js +156 -0
- package/src/utils/random.js +32 -0
- package/src/utils/timeUtils.js +138 -0
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :id="id">
|
|
3
|
+
<div :id="id + 'tooltip'" role="tooltip" class="tooltip"></div>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
<script>
|
|
7
|
+
import * as d3 from "d3";
|
|
8
|
+
import { chartColors } from "@/constants/colors";
|
|
9
|
+
import { humanCount, dataCount, costCount } from "@/utils/formatOutput";
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
props: {
|
|
13
|
+
id: {
|
|
14
|
+
type: String,
|
|
15
|
+
required: true,
|
|
16
|
+
},
|
|
17
|
+
data: {
|
|
18
|
+
type: Object,
|
|
19
|
+
required: true,
|
|
20
|
+
},
|
|
21
|
+
unit: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: "Cost ($)",
|
|
24
|
+
},
|
|
25
|
+
width: {
|
|
26
|
+
type: Number,
|
|
27
|
+
default: 300,
|
|
28
|
+
},
|
|
29
|
+
height: {
|
|
30
|
+
type: Number,
|
|
31
|
+
default: 600,
|
|
32
|
+
},
|
|
33
|
+
title: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: "",
|
|
36
|
+
},
|
|
37
|
+
resizable: {
|
|
38
|
+
type: Boolean,
|
|
39
|
+
default: false,
|
|
40
|
+
},
|
|
41
|
+
tooltipOffset: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: "layer",
|
|
44
|
+
},
|
|
45
|
+
valueName: {
|
|
46
|
+
type: String,
|
|
47
|
+
default: "Value",
|
|
48
|
+
},
|
|
49
|
+
theme: {
|
|
50
|
+
type: String,
|
|
51
|
+
default: "light",
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
data() {
|
|
55
|
+
return {
|
|
56
|
+
svg: null,
|
|
57
|
+
};
|
|
58
|
+
},
|
|
59
|
+
mounted() {
|
|
60
|
+
this.initializeChart();
|
|
61
|
+
this.createChart(this.data);
|
|
62
|
+
},
|
|
63
|
+
methods: {
|
|
64
|
+
initializeChart() {
|
|
65
|
+
if (this.resizable) {
|
|
66
|
+
this.svg = d3
|
|
67
|
+
.select("#" + this.id)
|
|
68
|
+
.append("svg")
|
|
69
|
+
.attr(
|
|
70
|
+
"viewBox",
|
|
71
|
+
`0 0 ${this.width} ${this.title ? this.height + 40 : this.height}`
|
|
72
|
+
);
|
|
73
|
+
} else {
|
|
74
|
+
this.svg = d3
|
|
75
|
+
.select("#" + this.id)
|
|
76
|
+
.append("svg")
|
|
77
|
+
.attr("width", this.width)
|
|
78
|
+
.attr("height", this.title ? this.height + 40 : this.height);
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
createChart(data) {
|
|
82
|
+
// Declare the chart dimensions and margins.
|
|
83
|
+
const width = this.width;
|
|
84
|
+
const height = this.title ? this.height + 30 : this.height;
|
|
85
|
+
const marginTop = 20;
|
|
86
|
+
const marginRight = 5;
|
|
87
|
+
const marginBottom = 5;
|
|
88
|
+
const marginLeft = 10;
|
|
89
|
+
|
|
90
|
+
const domainMap = data.fields.reduce((acc, field, i) => {
|
|
91
|
+
acc[i] = field ? field : "(no name)";
|
|
92
|
+
return acc;
|
|
93
|
+
}, {});
|
|
94
|
+
|
|
95
|
+
// Declare the tooltip mouseover functions
|
|
96
|
+
const mouseoverEmpty = (event, d) => {
|
|
97
|
+
const value =
|
|
98
|
+
this.unit === "Bytes (B)" || this.unit === "B"
|
|
99
|
+
? dataCount(d.values) + "B"
|
|
100
|
+
: this.unit === "Percent (%)"
|
|
101
|
+
? d.values.toFixed(2) + "%"
|
|
102
|
+
: humanCount(d.values);
|
|
103
|
+
event.target.style.opacity = 0.4;
|
|
104
|
+
d3.select("#" + this.id + "tooltip")
|
|
105
|
+
.html(
|
|
106
|
+
`${d.field ? d.field : "(no name)"}<br>${this.valueName}: ${value}`
|
|
107
|
+
)
|
|
108
|
+
.style("opacity", 1)
|
|
109
|
+
.style("left", event[this.tooltipOffset + "X"] + 10 + "px")
|
|
110
|
+
.style("top", event[this.tooltipOffset + "Y"] + "px");
|
|
111
|
+
};
|
|
112
|
+
const mouseoutEmpty = (event, d) => {
|
|
113
|
+
event.target.style.opacity = 0;
|
|
114
|
+
d3.select("#" + this.id + "tooltip")
|
|
115
|
+
.style("opacity", 0)
|
|
116
|
+
.style("left", "0px")
|
|
117
|
+
.style("top", "0px");
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
// Append a bar chart for each data point
|
|
121
|
+
if (data.fields && data.fields.length > 0) {
|
|
122
|
+
// get the largest value
|
|
123
|
+
let largestValue = this.unit === "Percent (%)" ? 100 : 0;
|
|
124
|
+
data.values.forEach((val) => {
|
|
125
|
+
if (val > largestValue) {
|
|
126
|
+
largestValue = val;
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
if (largestValue === 0) {
|
|
130
|
+
largestValue = 1;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Declare the x (horizontal position) scale.
|
|
134
|
+
const x = d3.scaleLinear(
|
|
135
|
+
[0, largestValue],
|
|
136
|
+
[marginLeft, width - marginRight - marginLeft]
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
// Declare the y (vertical position) scale.
|
|
140
|
+
const yScale = this.title
|
|
141
|
+
? [height - marginBottom, marginTop + 30]
|
|
142
|
+
: [height - marginBottom, marginTop];
|
|
143
|
+
const y = d3
|
|
144
|
+
.scaleBand()
|
|
145
|
+
.range(yScale)
|
|
146
|
+
.domain(data.fields.map((field, i) => i))
|
|
147
|
+
.padding(0.2);
|
|
148
|
+
|
|
149
|
+
const seriesData = data.fields.map((field, i) => {
|
|
150
|
+
return {
|
|
151
|
+
field: field,
|
|
152
|
+
values: data.values[i] || 0,
|
|
153
|
+
};
|
|
154
|
+
});
|
|
155
|
+
this.svg
|
|
156
|
+
.selectAll(".rect")
|
|
157
|
+
.data(seriesData)
|
|
158
|
+
.enter()
|
|
159
|
+
.append("rect")
|
|
160
|
+
.attr("class", (d) => this.id + "bar")
|
|
161
|
+
.attr("z-index", 1)
|
|
162
|
+
.attr("x", (d) => x(0))
|
|
163
|
+
.attr("y", (d, i) => y(i))
|
|
164
|
+
.attr("width", (d) => 0)
|
|
165
|
+
.attr("height", y.bandwidth())
|
|
166
|
+
.attr("fill", (d, i) => chartColors[i % chartColors.length])
|
|
167
|
+
.style("opacity", 0.8);
|
|
168
|
+
// Animation
|
|
169
|
+
this.svg
|
|
170
|
+
.selectAll("rect")
|
|
171
|
+
.transition()
|
|
172
|
+
.duration(500)
|
|
173
|
+
.attr("x", (d) => x(0))
|
|
174
|
+
.attr("width", (d) => x(d.values) - marginLeft)
|
|
175
|
+
.delay((d, i) => i * 50);
|
|
176
|
+
// empty bars for tooltip mouseover
|
|
177
|
+
this.svg
|
|
178
|
+
.selectAll(".rect")
|
|
179
|
+
.data(seriesData)
|
|
180
|
+
.enter()
|
|
181
|
+
.append("rect")
|
|
182
|
+
.attr("class", (d) => this.id + "barEmpty")
|
|
183
|
+
.attr("z-index", 1)
|
|
184
|
+
.attr("x", (d) => x(0))
|
|
185
|
+
.attr("y", (d, i) => y(i))
|
|
186
|
+
.attr("width", this.width - marginLeft)
|
|
187
|
+
.attr("height", y.bandwidth())
|
|
188
|
+
.attr("fill", (d, i) => chartColors[i % chartColors.length])
|
|
189
|
+
.style("opacity", 0)
|
|
190
|
+
.on("mouseover", mouseoverEmpty)
|
|
191
|
+
.on("mouseout", mouseoutEmpty);
|
|
192
|
+
|
|
193
|
+
// Add the x-axis.
|
|
194
|
+
this.svg
|
|
195
|
+
.append("g")
|
|
196
|
+
.attr("transform", `translate(0,${marginTop})`)
|
|
197
|
+
.call(
|
|
198
|
+
d3
|
|
199
|
+
.axisTop(x)
|
|
200
|
+
.ticks(5)
|
|
201
|
+
.tickFormat((d) => {
|
|
202
|
+
return this.unit === "Bytes (B)" || this.unit === "B"
|
|
203
|
+
? dataCount(d)
|
|
204
|
+
: this.unit === "Cost ($)"
|
|
205
|
+
? costCount(d)
|
|
206
|
+
: humanCount(d);
|
|
207
|
+
})
|
|
208
|
+
);
|
|
209
|
+
// Add the y-axis, remove the domain line, add grid lines and a label.
|
|
210
|
+
this.svg
|
|
211
|
+
.append("g")
|
|
212
|
+
.attr("transform", `translate(${marginLeft},0)`)
|
|
213
|
+
.call(
|
|
214
|
+
d3
|
|
215
|
+
.axisRight(y)
|
|
216
|
+
.tickSize(0)
|
|
217
|
+
.tickFormat((d) => {
|
|
218
|
+
return domainMap[d];
|
|
219
|
+
})
|
|
220
|
+
)
|
|
221
|
+
.call((g) => g.select(".domain").remove())
|
|
222
|
+
.call((g) =>
|
|
223
|
+
g
|
|
224
|
+
.append("text")
|
|
225
|
+
.attr("x", -marginLeft)
|
|
226
|
+
.attr("y", 20)
|
|
227
|
+
.attr("fill", "currentColor")
|
|
228
|
+
.attr("text-anchor", "start")
|
|
229
|
+
.attr("font-size", "2em")
|
|
230
|
+
.text(this.title)
|
|
231
|
+
);
|
|
232
|
+
} else {
|
|
233
|
+
this.svg
|
|
234
|
+
.append("text")
|
|
235
|
+
.attr("x", width / 2)
|
|
236
|
+
.attr("y", height / 2)
|
|
237
|
+
.attr("text-anchor", "middle")
|
|
238
|
+
.text("No data available");
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
};
|
|
243
|
+
</script>
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :id="id">
|
|
3
|
+
<div :id="id + 'tooltip'" role="tooltip" class="tooltip"></div>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
<script>
|
|
7
|
+
import * as d3 from "d3";
|
|
8
|
+
import { platformMetricsLabels } from "@/constants/colors";
|
|
9
|
+
import { formatReadableTime } from "@/utils/formatOutput";
|
|
10
|
+
import moment from "moment";
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
props: {
|
|
14
|
+
id: String,
|
|
15
|
+
tooltip: String,
|
|
16
|
+
runs: Array,
|
|
17
|
+
tooltipOffset: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: "client",
|
|
20
|
+
},
|
|
21
|
+
theme: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: "light",
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
data() {
|
|
27
|
+
return {
|
|
28
|
+
svg: null,
|
|
29
|
+
width: 250,
|
|
30
|
+
height: 60,
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
mounted() {
|
|
34
|
+
this.initializeChart();
|
|
35
|
+
this.createChart();
|
|
36
|
+
},
|
|
37
|
+
methods: {
|
|
38
|
+
initializeChart() {
|
|
39
|
+
this.svg = d3
|
|
40
|
+
.select("#" + this.id)
|
|
41
|
+
.append("svg")
|
|
42
|
+
.attr("width", this.width)
|
|
43
|
+
.attr("height", this.height)
|
|
44
|
+
.attr("style", "outline: thin solid;");
|
|
45
|
+
},
|
|
46
|
+
createChart() {
|
|
47
|
+
// Declare the chart dimensions and margins.
|
|
48
|
+
const width = this.width;
|
|
49
|
+
const height = this.height;
|
|
50
|
+
const marginTop = 3;
|
|
51
|
+
const marginRight = 18;
|
|
52
|
+
const marginBottom = 17;
|
|
53
|
+
const marginLeft = 18;
|
|
54
|
+
|
|
55
|
+
const mouseover = (event, d) => {
|
|
56
|
+
d3.selectAll("." + this.id + "run").attr("opacity", "0.5");
|
|
57
|
+
d3.select("." + this.id + d.taskID).attr("opacity", "1");
|
|
58
|
+
const launchTime = moment(d.launchTime).format("YYYY-MM-DD HH:mm:ss");
|
|
59
|
+
const completeTime = moment(d.completeTime).format(
|
|
60
|
+
"YYYY-MM-DD HH:mm:ss"
|
|
61
|
+
);
|
|
62
|
+
const timetaken = moment(d.completeTime).diff(moment(d.launchTime));
|
|
63
|
+
const text = `Task: ${d.taskID}<br>Status: ${
|
|
64
|
+
d.status
|
|
65
|
+
}<br>Launch Time: ${launchTime}<br>Complete Time: ${completeTime}<br>Duration: ${formatReadableTime(
|
|
66
|
+
timetaken
|
|
67
|
+
)}`;
|
|
68
|
+
d3.select("#" + this.id + "tooltip")
|
|
69
|
+
.html(text)
|
|
70
|
+
.style("opacity", 1)
|
|
71
|
+
.style("left", event[this.tooltipOffset + "X"] + 10 + "px")
|
|
72
|
+
.style("top", event[this.tooltipOffset + "Y"] + "px");
|
|
73
|
+
};
|
|
74
|
+
const mouseout = (event, d) => {
|
|
75
|
+
d3.selectAll("." + this.id + "run").attr("opacity", "1");
|
|
76
|
+
d3.select("#" + this.id + "tooltip")
|
|
77
|
+
.style("opacity", 0)
|
|
78
|
+
.style("left", "0px")
|
|
79
|
+
.style("top", "0px");
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
// get the x scale
|
|
83
|
+
const slots = this.runs.map((run) => moment(run.launchTime).valueOf());
|
|
84
|
+
if (slots.length === 1) {
|
|
85
|
+
slots.push(moment(slots[0]).add(2, "minute").valueOf());
|
|
86
|
+
slots.push(moment(slots[0]).subtract(2, "minute").valueOf());
|
|
87
|
+
}
|
|
88
|
+
const x = d3.scaleTime(d3.extent(slots), [
|
|
89
|
+
marginLeft,
|
|
90
|
+
width - marginRight,
|
|
91
|
+
]);
|
|
92
|
+
// Add the x-axis.
|
|
93
|
+
this.svg
|
|
94
|
+
.append("g")
|
|
95
|
+
.attr("class", this.id + "xaxis")
|
|
96
|
+
.attr("transform", `translate(0,${height - marginBottom})`)
|
|
97
|
+
.call(
|
|
98
|
+
d3
|
|
99
|
+
.axisBottom(x)
|
|
100
|
+
.ticks(width / 80)
|
|
101
|
+
.tickSize(3)
|
|
102
|
+
.tickSizeOuter(0)
|
|
103
|
+
);
|
|
104
|
+
// Add the runs
|
|
105
|
+
this.svg
|
|
106
|
+
.selectAll(".rect")
|
|
107
|
+
.data(this.runs)
|
|
108
|
+
.enter()
|
|
109
|
+
.append("rect")
|
|
110
|
+
.attr("class", (d) => this.id + "run " + `${this.id}${d.taskID}`)
|
|
111
|
+
.attr("style", "cursor: pointer;")
|
|
112
|
+
.attr("z-index", 1)
|
|
113
|
+
.attr("x", (d) => x(moment(d.launchTime).valueOf()))
|
|
114
|
+
.attr("y", marginTop)
|
|
115
|
+
.attr("width", (d) => {
|
|
116
|
+
const runWidth =
|
|
117
|
+
x(moment(d.completeTime).valueOf()) -
|
|
118
|
+
x(moment(d.launchTime).valueOf());
|
|
119
|
+
return runWidth > 3.5 ? runWidth : 3.5;
|
|
120
|
+
})
|
|
121
|
+
.attr("height", (d) => height - marginBottom - marginTop)
|
|
122
|
+
.attr("fill", (d) => {
|
|
123
|
+
const status =
|
|
124
|
+
d.status === "completed"
|
|
125
|
+
? "input"
|
|
126
|
+
: d.status === "aborted"
|
|
127
|
+
? "error"
|
|
128
|
+
: "ignored";
|
|
129
|
+
return platformMetricsLabels[this.theme][status];
|
|
130
|
+
})
|
|
131
|
+
.attr("opacity", 0)
|
|
132
|
+
.on("click", (event, d) => {
|
|
133
|
+
this.$emit("viewRun", d);
|
|
134
|
+
})
|
|
135
|
+
.on("mouseover", mouseover)
|
|
136
|
+
.on("mouseout", mouseout)
|
|
137
|
+
.transition()
|
|
138
|
+
.delay((d, i) => {
|
|
139
|
+
return 1000 - (i / this.runs.length) * 1200;
|
|
140
|
+
})
|
|
141
|
+
.duration(200)
|
|
142
|
+
.attr("opacity", 1);
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
</script>
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :id="id" />
|
|
3
|
+
</template>
|
|
4
|
+
<script>
|
|
5
|
+
import * as d3 from "d3";
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
props: {
|
|
9
|
+
id: {
|
|
10
|
+
type: String,
|
|
11
|
+
required: true,
|
|
12
|
+
},
|
|
13
|
+
width: {
|
|
14
|
+
type: Number,
|
|
15
|
+
default: 350,
|
|
16
|
+
},
|
|
17
|
+
height: {
|
|
18
|
+
type: Number,
|
|
19
|
+
default: 200,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
data() {
|
|
23
|
+
return {
|
|
24
|
+
svg: null,
|
|
25
|
+
};
|
|
26
|
+
},
|
|
27
|
+
mounted() {
|
|
28
|
+
this.initializeChart();
|
|
29
|
+
this.createChart();
|
|
30
|
+
},
|
|
31
|
+
methods: {
|
|
32
|
+
initializeChart() {
|
|
33
|
+
this.svg = d3
|
|
34
|
+
.select("#" + this.id)
|
|
35
|
+
.append("svg")
|
|
36
|
+
.attr("width", this.width > 700 ? this.width + 150 : this.width + 75)
|
|
37
|
+
.attr("height", this.height);
|
|
38
|
+
},
|
|
39
|
+
createChart() {
|
|
40
|
+
// Declare the chart dimensions and margins.
|
|
41
|
+
const width = this.width;
|
|
42
|
+
const height = this.height;
|
|
43
|
+
const marginTop = 20;
|
|
44
|
+
const marginRight = 15;
|
|
45
|
+
const marginBottom = 1;
|
|
46
|
+
const marginLeft = 0.3;
|
|
47
|
+
|
|
48
|
+
const x = d3.scaleUtc([0, 1], [marginLeft, width - marginRight]);
|
|
49
|
+
|
|
50
|
+
// Declare the y (vertical position) scale.
|
|
51
|
+
const y = d3.scaleLinear([0, 1], [height - marginBottom, marginTop]);
|
|
52
|
+
|
|
53
|
+
this.svg
|
|
54
|
+
.append("g")
|
|
55
|
+
.attr("class", this.id + "xaxis")
|
|
56
|
+
.attr("transform", `translate(0,${height - marginBottom})`)
|
|
57
|
+
.call(d3.axisBottom(x));
|
|
58
|
+
|
|
59
|
+
// Add the y-axis, remove the domain line, add grid lines and a label.
|
|
60
|
+
this.svg
|
|
61
|
+
.append("g")
|
|
62
|
+
.attr("class", this.id + "yaxis")
|
|
63
|
+
.attr("transform", `translate(${marginLeft},0)`)
|
|
64
|
+
.call(d3.axisLeft(y));
|
|
65
|
+
|
|
66
|
+
this.svg
|
|
67
|
+
.append("text")
|
|
68
|
+
.attr("x", width / 2)
|
|
69
|
+
.attr("y", height / 2)
|
|
70
|
+
.attr("text-anchor", "middle")
|
|
71
|
+
.attr("fill", "currentColor")
|
|
72
|
+
.text("No data available");
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
</script>
|