fluency-v8-components 1.3.4 → 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 +31 -31
- package/dist/{index-Dxs_Gn5T.mjs → index-BBxccHNP.mjs} +53 -47
- package/dist/index.css +1 -1
- package/dist/{index.es-YeMpD96e.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,520 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="pt-2 overflow-x-auto">
|
|
3
|
+
<div :id="`decision-chart-${id}`" />
|
|
4
|
+
</div>
|
|
5
|
+
<Slideout
|
|
6
|
+
:open="slideout"
|
|
7
|
+
:title="slideoutTitle"
|
|
8
|
+
@close="closeSlideout"
|
|
9
|
+
@hide="closeSlideout"
|
|
10
|
+
>
|
|
11
|
+
<template #content>
|
|
12
|
+
<FormSection sectionName="Details">
|
|
13
|
+
<div class="px-4">
|
|
14
|
+
<FormCol fieldName="Name">
|
|
15
|
+
<GreyInput readonly :value="slideoutData.name" />
|
|
16
|
+
</FormCol>
|
|
17
|
+
<FormCol fieldName="Type">
|
|
18
|
+
<GreyInput readonly :value="slideoutData.type" />
|
|
19
|
+
</FormCol>
|
|
20
|
+
<FormCol fieldName="Started At">
|
|
21
|
+
<GreyInput readonly :value="slideoutData.started_at" />
|
|
22
|
+
</FormCol>
|
|
23
|
+
<FormCol fieldName="Ended At">
|
|
24
|
+
<GreyInput readonly :value="slideoutData.ended_at" />
|
|
25
|
+
</FormCol>
|
|
26
|
+
<FormCol fieldName="Time Taken (ms)">
|
|
27
|
+
<GreyInput
|
|
28
|
+
readonly
|
|
29
|
+
:value="`${getTimeTaken(
|
|
30
|
+
slideoutData.started_at,
|
|
31
|
+
slideoutData.ended_at
|
|
32
|
+
)}`"
|
|
33
|
+
/>
|
|
34
|
+
</FormCol>
|
|
35
|
+
<FormCol
|
|
36
|
+
v-if="slideoutData.type === 'response'"
|
|
37
|
+
fieldName="Response ID"
|
|
38
|
+
>
|
|
39
|
+
<div class="row">
|
|
40
|
+
<GreyInput readonly :value="slideoutData.span_data.response_id" />
|
|
41
|
+
<LinkIcon
|
|
42
|
+
class="icon-lg cursor-pointer icon-skyblue hover:opacity-75 m-1"
|
|
43
|
+
@click="routeToResponse(slideoutData.span_data.response_id)"
|
|
44
|
+
/>
|
|
45
|
+
</div>
|
|
46
|
+
</FormCol>
|
|
47
|
+
</div>
|
|
48
|
+
</FormSection>
|
|
49
|
+
<FormSection
|
|
50
|
+
v-if="slideoutData?.span_data?.input && slideoutData?.span_data?.output"
|
|
51
|
+
sectionName="Results"
|
|
52
|
+
>
|
|
53
|
+
<div class="px-4">
|
|
54
|
+
<FormCol fieldName="Input">
|
|
55
|
+
<CodeEditor
|
|
56
|
+
class="p-3 !h-60"
|
|
57
|
+
v-model="slideoutData.span_data.input"
|
|
58
|
+
:fontSize="`${fontSize ? fontSize : '12px'}`"
|
|
59
|
+
:isFPL="false"
|
|
60
|
+
/>
|
|
61
|
+
</FormCol>
|
|
62
|
+
<FormCol fieldName="Output">
|
|
63
|
+
<CodeEditor
|
|
64
|
+
class="p-3 !h-60"
|
|
65
|
+
v-model="slideoutData.span_data.output"
|
|
66
|
+
:fontSize="`${fontSize ? fontSize : '12px'}`"
|
|
67
|
+
:isFPL="false"
|
|
68
|
+
/>
|
|
69
|
+
</FormCol>
|
|
70
|
+
</div>
|
|
71
|
+
</FormSection>
|
|
72
|
+
</template>
|
|
73
|
+
</Slideout>
|
|
74
|
+
</template>
|
|
75
|
+
<script>
|
|
76
|
+
import * as d3 from "d3";
|
|
77
|
+
import {
|
|
78
|
+
FormCol,
|
|
79
|
+
FormSection,
|
|
80
|
+
GreyInput,
|
|
81
|
+
Slideout,
|
|
82
|
+
CodeEditor,
|
|
83
|
+
} from "@/components";
|
|
84
|
+
import { agentIcon, bulbIcon, codeIcon } from "@/constants/icon-svg.js";
|
|
85
|
+
import { colors, getAColorByHash } from "@/constants/colors";
|
|
86
|
+
import { LinkIcon } from "@heroicons/vue/20/solid";
|
|
87
|
+
import { adjustText } from "@/constants/font-map";
|
|
88
|
+
import { formatReadableTime } from "@/utils/formatOutput";
|
|
89
|
+
import moment from "moment";
|
|
90
|
+
|
|
91
|
+
const boxWidth = 225;
|
|
92
|
+
const boxHeight = 43;
|
|
93
|
+
const boxSpacing = 10;
|
|
94
|
+
const boxSpacingHorizontal = 60;
|
|
95
|
+
const normalOpacity = 0.8;
|
|
96
|
+
const selectedOpacity = 1;
|
|
97
|
+
const rounding = 10;
|
|
98
|
+
const topPadding = 10;
|
|
99
|
+
const leftPadding = 10;
|
|
100
|
+
const textLeftPadding = 10;
|
|
101
|
+
const textTopPadding = 6;
|
|
102
|
+
const textSize = 14;
|
|
103
|
+
const iconSize = 24;
|
|
104
|
+
// props and emits
|
|
105
|
+
export default {
|
|
106
|
+
components: {
|
|
107
|
+
Slideout,
|
|
108
|
+
FormCol,
|
|
109
|
+
FormSection,
|
|
110
|
+
GreyInput,
|
|
111
|
+
CodeEditor,
|
|
112
|
+
LinkIcon,
|
|
113
|
+
},
|
|
114
|
+
props: {
|
|
115
|
+
data: {
|
|
116
|
+
type: Object,
|
|
117
|
+
required: true,
|
|
118
|
+
},
|
|
119
|
+
fontSize: {
|
|
120
|
+
type: String,
|
|
121
|
+
default: "12px",
|
|
122
|
+
},
|
|
123
|
+
theme: {
|
|
124
|
+
type: String,
|
|
125
|
+
default: "light",
|
|
126
|
+
},
|
|
127
|
+
id: {
|
|
128
|
+
type: String,
|
|
129
|
+
default: "id",
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
data() {
|
|
133
|
+
return {
|
|
134
|
+
svg: null,
|
|
135
|
+
selected: null,
|
|
136
|
+
slideout: false,
|
|
137
|
+
slideoutTitle: "Hello World",
|
|
138
|
+
slideoutData: {},
|
|
139
|
+
depth: 0,
|
|
140
|
+
maxLeaf: 0,
|
|
141
|
+
};
|
|
142
|
+
},
|
|
143
|
+
computed: {
|
|
144
|
+
chartData() {
|
|
145
|
+
// preprocess the data
|
|
146
|
+
return this.data;
|
|
147
|
+
},
|
|
148
|
+
height() {
|
|
149
|
+
if (this.maxLeaf > 0) {
|
|
150
|
+
return (
|
|
151
|
+
topPadding +
|
|
152
|
+
this.maxLeaf * (boxHeight + boxSpacing) +
|
|
153
|
+
boxHeight +
|
|
154
|
+
textTopPadding
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
return 100;
|
|
158
|
+
},
|
|
159
|
+
width() {
|
|
160
|
+
if (this.depth > 0) {
|
|
161
|
+
return (
|
|
162
|
+
leftPadding +
|
|
163
|
+
this.depth * (boxWidth + boxSpacingHorizontal) +
|
|
164
|
+
boxWidth +
|
|
165
|
+
textLeftPadding
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
return 100;
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
watch: {
|
|
172
|
+
id: {
|
|
173
|
+
handler(newVal) {
|
|
174
|
+
this.getMaxDepthAndY(this.chartData);
|
|
175
|
+
this.drawChart();
|
|
176
|
+
},
|
|
177
|
+
deep: true,
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
mounted() {
|
|
181
|
+
this.initializeChart();
|
|
182
|
+
this.getMaxDepthAndY(this.chartData);
|
|
183
|
+
this.drawChart();
|
|
184
|
+
},
|
|
185
|
+
methods: {
|
|
186
|
+
initializeChart() {
|
|
187
|
+
if (this.svg) return;
|
|
188
|
+
this.svg = d3
|
|
189
|
+
.select(`#decision-chart-${this.id}`)
|
|
190
|
+
.append("svg")
|
|
191
|
+
.attr("width", this.width)
|
|
192
|
+
.attr("height", this.height);
|
|
193
|
+
},
|
|
194
|
+
drawChart() {
|
|
195
|
+
const mainFontColor = colors[this.theme].text;
|
|
196
|
+
const backgroundColor = colors[this.theme].canvas;
|
|
197
|
+
|
|
198
|
+
const handle = this;
|
|
199
|
+
// update height and width
|
|
200
|
+
this.svg.attr("width", this.width);
|
|
201
|
+
this.svg.attr("height", this.height);
|
|
202
|
+
this.svg
|
|
203
|
+
.selectAll("g.decisionChart")
|
|
204
|
+
.data(this.chartData, (d) => d.id)
|
|
205
|
+
.join(
|
|
206
|
+
(enter) => enterChart(enter),
|
|
207
|
+
(update) => updateChart(update),
|
|
208
|
+
(exit) => exitChart(exit)
|
|
209
|
+
);
|
|
210
|
+
|
|
211
|
+
function enterChart(enter) {
|
|
212
|
+
const boxes = enter.append("g").attr("class", "decisionChart");
|
|
213
|
+
drawBoxes(boxes, 0);
|
|
214
|
+
}
|
|
215
|
+
function updateChart(update) {
|
|
216
|
+
// do something
|
|
217
|
+
}
|
|
218
|
+
function exitChart(exit) {
|
|
219
|
+
exit.call((g) =>
|
|
220
|
+
g.transition().duration(200).style("opacity", 0).remove()
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
function drawBoxes(handler, columnIndex) {
|
|
225
|
+
// draw the background box
|
|
226
|
+
handler
|
|
227
|
+
.append("rect")
|
|
228
|
+
.attr("class", "dataBox")
|
|
229
|
+
.attr("id", (d) => d.id)
|
|
230
|
+
.attr("width", boxWidth)
|
|
231
|
+
.attr("height", boxHeight)
|
|
232
|
+
.attr(
|
|
233
|
+
"x",
|
|
234
|
+
(d) => leftPadding + columnIndex * (boxWidth + boxSpacingHorizontal)
|
|
235
|
+
)
|
|
236
|
+
.attr("y", (d, i) => topPadding + d.y * (boxHeight + boxSpacing))
|
|
237
|
+
.attr("fill", backgroundColor)
|
|
238
|
+
.attr("stroke", (d) => {
|
|
239
|
+
if (d.type === "agent") return colors[handle.theme].info;
|
|
240
|
+
if (d.type === "function") return colors[handle.theme].active;
|
|
241
|
+
if (d.type === "response") return colors[handle.theme].active2;
|
|
242
|
+
return colors[handle.theme].inactive;
|
|
243
|
+
})
|
|
244
|
+
.attr("stroke-width", 1.5)
|
|
245
|
+
.attr("rx", rounding)
|
|
246
|
+
.attr("ry", rounding)
|
|
247
|
+
.attr("opacity", 0)
|
|
248
|
+
.on("mouseover", (event, d) => {
|
|
249
|
+
const target = event.target;
|
|
250
|
+
d3.select(target)
|
|
251
|
+
.style("cursor", "pointer")
|
|
252
|
+
.attr("stroke-width", 2)
|
|
253
|
+
.attr("opacity", selectedOpacity);
|
|
254
|
+
})
|
|
255
|
+
.on("mouseout", (event, d) => {
|
|
256
|
+
d3.select(event.target)
|
|
257
|
+
.attr("stroke-width", 1.5)
|
|
258
|
+
.attr("opacity", normalOpacity);
|
|
259
|
+
})
|
|
260
|
+
.on("click", (event, d) => {
|
|
261
|
+
handle.slideoutTitle = d.name;
|
|
262
|
+
handle.slideoutData = d;
|
|
263
|
+
handle.slideout = true;
|
|
264
|
+
})
|
|
265
|
+
.transition()
|
|
266
|
+
.duration(500)
|
|
267
|
+
.attr("opacity", normalOpacity);
|
|
268
|
+
|
|
269
|
+
// draw icon
|
|
270
|
+
handler
|
|
271
|
+
.append("path")
|
|
272
|
+
.attr("fill", (d) =>
|
|
273
|
+
d.type === "response" ? colors[handle.theme].active2 : mainFontColor
|
|
274
|
+
)
|
|
275
|
+
.attr("transform", (d, i) => {
|
|
276
|
+
return (
|
|
277
|
+
"translate(" +
|
|
278
|
+
(leftPadding +
|
|
279
|
+
7 +
|
|
280
|
+
columnIndex * (boxWidth + boxSpacingHorizontal)) +
|
|
281
|
+
"," +
|
|
282
|
+
(topPadding + 9 + d.y * (boxHeight + boxSpacing)) +
|
|
283
|
+
")"
|
|
284
|
+
);
|
|
285
|
+
})
|
|
286
|
+
.attr("d", (d, i) => {
|
|
287
|
+
if (d.type === "agent") return agentIcon.path;
|
|
288
|
+
if (d.type === "function") return codeIcon.path;
|
|
289
|
+
if (d.type === "response") return bulbIcon.path;
|
|
290
|
+
return "";
|
|
291
|
+
})
|
|
292
|
+
.attr("opacity", 0)
|
|
293
|
+
.transition()
|
|
294
|
+
.duration(700)
|
|
295
|
+
.attr("opacity", 1);
|
|
296
|
+
|
|
297
|
+
// draw text
|
|
298
|
+
handler
|
|
299
|
+
.append("text")
|
|
300
|
+
.attr(
|
|
301
|
+
"x",
|
|
302
|
+
(d) =>
|
|
303
|
+
leftPadding +
|
|
304
|
+
iconSize +
|
|
305
|
+
textLeftPadding +
|
|
306
|
+
columnIndex * (boxWidth + boxSpacingHorizontal)
|
|
307
|
+
)
|
|
308
|
+
.attr(
|
|
309
|
+
"y",
|
|
310
|
+
(d, i) =>
|
|
311
|
+
topPadding + textTopPadding + d.y * (boxHeight + boxSpacing)
|
|
312
|
+
)
|
|
313
|
+
.attr("text-anchor", "start")
|
|
314
|
+
.attr("dominant-baseline", "hanging")
|
|
315
|
+
.attr("fill", mainFontColor)
|
|
316
|
+
.text((d) => {
|
|
317
|
+
return adjustText(d.name, 1150);
|
|
318
|
+
})
|
|
319
|
+
.attr("font-size", textSize)
|
|
320
|
+
.attr("font-family", "sans-serif")
|
|
321
|
+
.attr("font-weight", "400")
|
|
322
|
+
.attr("pointer-events", "none")
|
|
323
|
+
.attr("user-select", "none")
|
|
324
|
+
.attr("opacity", 0)
|
|
325
|
+
.transition()
|
|
326
|
+
.duration(700)
|
|
327
|
+
.attr("opacity", 1);
|
|
328
|
+
|
|
329
|
+
// draw description text
|
|
330
|
+
handler
|
|
331
|
+
.append("text")
|
|
332
|
+
.attr(
|
|
333
|
+
"x",
|
|
334
|
+
(d) =>
|
|
335
|
+
leftPadding +
|
|
336
|
+
iconSize +
|
|
337
|
+
textLeftPadding +
|
|
338
|
+
columnIndex * (boxWidth + boxSpacingHorizontal)
|
|
339
|
+
)
|
|
340
|
+
.attr(
|
|
341
|
+
"y",
|
|
342
|
+
(d, i) =>
|
|
343
|
+
topPadding + textTopPadding + 17 + d.y * (boxHeight + boxSpacing)
|
|
344
|
+
)
|
|
345
|
+
.attr("text-anchor", "start")
|
|
346
|
+
.attr("dominant-baseline", "hanging")
|
|
347
|
+
.attr("fill", mainFontColor)
|
|
348
|
+
.text((d) => {
|
|
349
|
+
const type = d.type.charAt(0).toUpperCase() + d.type.slice(1);
|
|
350
|
+
const took = formatReadableTime(
|
|
351
|
+
handle.getTimeTaken(d.started_at, d.ended_at)
|
|
352
|
+
);
|
|
353
|
+
return `${type} - [took: ${took}]`;
|
|
354
|
+
})
|
|
355
|
+
.attr("font-size", textSize)
|
|
356
|
+
.attr("font-family", "sans-serif")
|
|
357
|
+
.attr("font-weight", "400")
|
|
358
|
+
.attr("pointer-events", "none")
|
|
359
|
+
.attr("user-select", "none")
|
|
360
|
+
.attr("opacity", 0)
|
|
361
|
+
.transition()
|
|
362
|
+
.duration(700)
|
|
363
|
+
.attr("opacity", 1);
|
|
364
|
+
|
|
365
|
+
handler
|
|
366
|
+
.append("circle")
|
|
367
|
+
.attr("id", (d) => d.id + "_circ_back")
|
|
368
|
+
.attr(
|
|
369
|
+
"cx",
|
|
370
|
+
columnIndex * (boxWidth + boxSpacingHorizontal) +
|
|
371
|
+
boxWidth +
|
|
372
|
+
leftPadding
|
|
373
|
+
)
|
|
374
|
+
.attr(
|
|
375
|
+
"cy",
|
|
376
|
+
(d, i) =>
|
|
377
|
+
topPadding + d.y * (boxHeight + boxSpacing) + boxHeight / 2
|
|
378
|
+
)
|
|
379
|
+
.attr("r", (d) => (d.children.length ? 4 : 0))
|
|
380
|
+
.attr("fill", backgroundColor)
|
|
381
|
+
.attr("stroke", (d) => {
|
|
382
|
+
if (d.type === "agent") return colors[handle.theme].info;
|
|
383
|
+
if (d.type === "function") return colors[handle.theme].active;
|
|
384
|
+
return colors[handle.theme].inactive;
|
|
385
|
+
})
|
|
386
|
+
.attr("stroke-width", 2)
|
|
387
|
+
.attr("opacity", 0)
|
|
388
|
+
.transition()
|
|
389
|
+
.duration(700)
|
|
390
|
+
.attr("opacity", 1);
|
|
391
|
+
|
|
392
|
+
// draw the decision lines
|
|
393
|
+
if (columnIndex) {
|
|
394
|
+
handler
|
|
395
|
+
.append("circle")
|
|
396
|
+
.attr("id", (d) => d.id + "_circ_front")
|
|
397
|
+
.attr(
|
|
398
|
+
"cx",
|
|
399
|
+
columnIndex * (boxWidth + boxSpacingHorizontal) + leftPadding
|
|
400
|
+
)
|
|
401
|
+
.attr(
|
|
402
|
+
"cy",
|
|
403
|
+
(d, i) =>
|
|
404
|
+
topPadding + d.y * (boxHeight + boxSpacing) + boxHeight / 2
|
|
405
|
+
)
|
|
406
|
+
.attr("r", 4)
|
|
407
|
+
.attr("fill", backgroundColor)
|
|
408
|
+
.attr("stroke", (d) => {
|
|
409
|
+
if (d.type === "agent") return colors[handle.theme].info;
|
|
410
|
+
if (d.type === "function") return colors[handle.theme].active;
|
|
411
|
+
if (d.type === "response") return colors[handle.theme].active2;
|
|
412
|
+
return colors[handle.theme].inactive;
|
|
413
|
+
})
|
|
414
|
+
.attr("stroke-width", 2)
|
|
415
|
+
.attr("opacity", 0)
|
|
416
|
+
.transition()
|
|
417
|
+
.duration(700)
|
|
418
|
+
.attr("opacity", 1);
|
|
419
|
+
|
|
420
|
+
connectionLines(
|
|
421
|
+
handler,
|
|
422
|
+
handler.data(),
|
|
423
|
+
handle.svg.selectAll("circle")
|
|
424
|
+
);
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
// draw the children
|
|
428
|
+
handler.each(function (d) {
|
|
429
|
+
const g = d3.select(this);
|
|
430
|
+
|
|
431
|
+
g.selectAll(`g.decisionChartChild${columnIndex + 1}`)
|
|
432
|
+
.data(d.children, (d) => d.id)
|
|
433
|
+
.join(
|
|
434
|
+
(enter) => enterActions(enter, columnIndex + 1),
|
|
435
|
+
(update) => updateActions(update, columnIndex + 1),
|
|
436
|
+
(exit) => exitActions(exit, columnIndex + 1)
|
|
437
|
+
);
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
function enterActions(enter, columnIndex) {
|
|
442
|
+
const boxes = enter
|
|
443
|
+
.append("g")
|
|
444
|
+
.attr("class", `decisionChartChild${columnIndex}`);
|
|
445
|
+
drawBoxes(boxes, columnIndex);
|
|
446
|
+
}
|
|
447
|
+
function updateActions(update, columnIndex) {
|
|
448
|
+
// do something
|
|
449
|
+
}
|
|
450
|
+
function exitActions(exit) {
|
|
451
|
+
exit.call((g) =>
|
|
452
|
+
g.transition().duration(2000).style("opacity", 0).remove()
|
|
453
|
+
);
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
function connectionLines(handle, data, circles) {
|
|
457
|
+
const links = data.map((d) => {
|
|
458
|
+
const source = circles
|
|
459
|
+
.nodes()
|
|
460
|
+
.find((c) => c.id === `${d.parent_id}_circ_back`);
|
|
461
|
+
const target = circles
|
|
462
|
+
.nodes()
|
|
463
|
+
.find((c) => c.id === `${d.id}_circ_front`);
|
|
464
|
+
return d3.linkHorizontal()({
|
|
465
|
+
source: [source.cx.baseVal.value, source.cy.baseVal.value],
|
|
466
|
+
target: [target.cx.baseVal.value, target.cy.baseVal.value],
|
|
467
|
+
});
|
|
468
|
+
});
|
|
469
|
+
|
|
470
|
+
handle
|
|
471
|
+
.append("path")
|
|
472
|
+
.attr("id", (d) => {
|
|
473
|
+
return d.parent_id + "-" + d.id;
|
|
474
|
+
})
|
|
475
|
+
.transition()
|
|
476
|
+
.duration(500)
|
|
477
|
+
.attr("d", (d, i) => links[i])
|
|
478
|
+
.attr("fill", "none")
|
|
479
|
+
.attr("stroke", (d, i) =>
|
|
480
|
+
getAColorByHash("green", d.parent_id + d.id)
|
|
481
|
+
)
|
|
482
|
+
.attr("stroke-width", 2)
|
|
483
|
+
.attr("opacity", 1);
|
|
484
|
+
}
|
|
485
|
+
},
|
|
486
|
+
getMaxDepthAndY(nodes) {
|
|
487
|
+
let maxDepth = 0;
|
|
488
|
+
let maxY = 0;
|
|
489
|
+
|
|
490
|
+
function traverse(node) {
|
|
491
|
+
if (node.depth > maxDepth) {
|
|
492
|
+
maxDepth = node.depth;
|
|
493
|
+
}
|
|
494
|
+
if (node.y > maxY) {
|
|
495
|
+
maxY = node.y;
|
|
496
|
+
}
|
|
497
|
+
node.children.forEach(traverse);
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
nodes.forEach(traverse);
|
|
501
|
+
this.depth = maxDepth;
|
|
502
|
+
this.maxLeaf = maxY;
|
|
503
|
+
},
|
|
504
|
+
getTimeTaken(startedAt, endedAt) {
|
|
505
|
+
const start = moment(startedAt);
|
|
506
|
+
const end = moment(endedAt);
|
|
507
|
+
return end.diff(start, "milliseconds");
|
|
508
|
+
},
|
|
509
|
+
closeSlideout() {
|
|
510
|
+
setTimeout(() => {
|
|
511
|
+
this.slideoutData = {};
|
|
512
|
+
}, 700);
|
|
513
|
+
this.slideout = false;
|
|
514
|
+
},
|
|
515
|
+
routeToResponse(responseID) {
|
|
516
|
+
window.open(`https://platform.openai.com/logs/${responseID}`, "_blank");
|
|
517
|
+
},
|
|
518
|
+
},
|
|
519
|
+
};
|
|
520
|
+
</script>
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="relative">
|
|
3
|
+
<div class="row justify-between items-center pt-2">
|
|
4
|
+
<div class="flex-grow">
|
|
5
|
+
<Combobox v-model="newVal">
|
|
6
|
+
<ComboboxInput
|
|
7
|
+
v-model="newVal"
|
|
8
|
+
placeholder="Search"
|
|
9
|
+
@input="onChange"
|
|
10
|
+
@keyup.enter="emits('search', newVal)"
|
|
11
|
+
class="w-full dark:dark-bg"
|
|
12
|
+
/>
|
|
13
|
+
<transition
|
|
14
|
+
enter-active-class="transition duration-100 ease-out"
|
|
15
|
+
enter-from-class="transform scale-95 opacity-0"
|
|
16
|
+
enter-to-class="transform scale-100 opacity-100"
|
|
17
|
+
leave-active-class="transition duration-75 ease-out"
|
|
18
|
+
leave-from-class="transform scale-100 opacity-100"
|
|
19
|
+
leave-to-class="transform scale-95 opacity-0"
|
|
20
|
+
>
|
|
21
|
+
<ComboboxOptions
|
|
22
|
+
v-if="dict.length"
|
|
23
|
+
class="absolute z-10 max-h-56 w-full overflow-auto bg-slate-100 dark:dark-bg p-1 text-base shadow-lg ring-1 ring-black/5 sm:text-md"
|
|
24
|
+
>
|
|
25
|
+
<ComboboxOption
|
|
26
|
+
v-for="dict in localDict"
|
|
27
|
+
:key="dict"
|
|
28
|
+
:value="`${curr} ${dict}`"
|
|
29
|
+
v-slot="{ active }"
|
|
30
|
+
>
|
|
31
|
+
<li :class="{ 'bg-gray-300 dark:dark-bg-hover': active }">
|
|
32
|
+
{{ dict }}
|
|
33
|
+
</li>
|
|
34
|
+
</ComboboxOption>
|
|
35
|
+
</ComboboxOptions>
|
|
36
|
+
</transition>
|
|
37
|
+
</Combobox>
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
<TextButton class="ml-4" text="Search" @click="emits('search', newVal)">
|
|
41
|
+
<MagnifyingGlassIcon class="w-5 h-5 mr-1" />
|
|
42
|
+
</TextButton>
|
|
43
|
+
|
|
44
|
+
<slot name="right" />
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
</template>
|
|
48
|
+
|
|
49
|
+
<script setup>
|
|
50
|
+
import { computed, ref, watch } from "vue";
|
|
51
|
+
import { TextButton } from "@/components";
|
|
52
|
+
import { MagnifyingGlassIcon } from "@heroicons/vue/20/solid";
|
|
53
|
+
import {
|
|
54
|
+
Combobox,
|
|
55
|
+
ComboboxInput,
|
|
56
|
+
ComboboxOptions,
|
|
57
|
+
ComboboxOption,
|
|
58
|
+
} from "@headlessui/vue";
|
|
59
|
+
|
|
60
|
+
// props and emits
|
|
61
|
+
const props = defineProps({
|
|
62
|
+
str: String,
|
|
63
|
+
dict: {
|
|
64
|
+
type: Array,
|
|
65
|
+
default: () => [],
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
const emits = defineEmits(["search"]);
|
|
69
|
+
// states
|
|
70
|
+
const newVal = ref(props.str);
|
|
71
|
+
const localDict = ref([]);
|
|
72
|
+
// computed
|
|
73
|
+
const curr = computed(() => {
|
|
74
|
+
const lastIndex = newVal.value.lastIndexOf(" ");
|
|
75
|
+
return lastIndex === -1 ? "" : newVal.value.slice(0, lastIndex);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
watch(
|
|
79
|
+
() => props.str,
|
|
80
|
+
(val) => {
|
|
81
|
+
newVal.value = val;
|
|
82
|
+
}
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
function onChange(event) {
|
|
86
|
+
newVal.value = event.target.value;
|
|
87
|
+
filterResults(newVal.value);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function filterResults(val) {
|
|
91
|
+
if (!val) {
|
|
92
|
+
localDict.value = props.dict.slice(0, 100);
|
|
93
|
+
} else {
|
|
94
|
+
const lastWord = val.split(" ").pop();
|
|
95
|
+
localDict.value = props.dict
|
|
96
|
+
.filter((item) => item.toLowerCase().includes(lastWord.toLowerCase()))
|
|
97
|
+
.slice(0, 100);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
</script>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<IconButton
|
|
3
|
+
class="relative"
|
|
4
|
+
color="blue"
|
|
5
|
+
:tooltip="formatTime()"
|
|
6
|
+
@click="refresh"
|
|
7
|
+
>
|
|
8
|
+
<ArrowPathIcon class="icon-lg mx-1" />
|
|
9
|
+
</IconButton>
|
|
10
|
+
</template>
|
|
11
|
+
<script setup>
|
|
12
|
+
import { ArrowPathIcon } from "@heroicons/vue/20/solid";
|
|
13
|
+
import { IconButton } from "@/components";
|
|
14
|
+
import { ref } from "vue";
|
|
15
|
+
// props ane emits
|
|
16
|
+
const props = defineProps({
|
|
17
|
+
interval: {
|
|
18
|
+
type: Number,
|
|
19
|
+
default: 0,
|
|
20
|
+
},
|
|
21
|
+
refreshing: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: false,
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
const emits = defineEmits(["refresh"]);
|
|
27
|
+
// states
|
|
28
|
+
const timer = ref(props.interval);
|
|
29
|
+
// mounted
|
|
30
|
+
tick();
|
|
31
|
+
|
|
32
|
+
// function defs
|
|
33
|
+
function refresh() {
|
|
34
|
+
timer.value = props.interval;
|
|
35
|
+
emits("refresh");
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function formatTime() {
|
|
39
|
+
return `Refresh in ${timer.value}s`;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function tick() {
|
|
43
|
+
timer.value -= 1;
|
|
44
|
+
setTimeout(() => {
|
|
45
|
+
if (timer.value > 0) {
|
|
46
|
+
tick();
|
|
47
|
+
} else {
|
|
48
|
+
refresh();
|
|
49
|
+
tick();
|
|
50
|
+
}
|
|
51
|
+
}, 1000);
|
|
52
|
+
}
|
|
53
|
+
</script>
|