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.
Files changed (179) hide show
  1. package/dist/fluency-v8-components.es.js +1 -1
  2. package/dist/fluency-v8-components.umd.js +31 -31
  3. package/dist/{index-Dxs_Gn5T.mjs → index-BBxccHNP.mjs} +53 -47
  4. package/dist/index.css +1 -1
  5. package/dist/{index.es-YeMpD96e.mjs → index.es-D_XhLSeH.mjs} +1 -1
  6. package/package.json +3 -2
  7. package/src/assets/images/ai.svg +1 -0
  8. package/src/assets/images/github-dark.svg +1 -0
  9. package/src/assets/images/github.svg +1 -0
  10. package/src/assets/images/high-priority.svg +1 -0
  11. package/src/assets/images/power-off.svg +1 -0
  12. package/src/assets/images/save.svg +1 -0
  13. package/src/assets/index.ts +15 -0
  14. package/src/assets/main.css +505 -0
  15. package/src/assets/prism-theme.css +290 -0
  16. package/src/components/buttons/ActionButtons.vue +374 -0
  17. package/src/components/buttons/DropdownButton.vue +104 -0
  18. package/src/components/buttons/IconButton.vue +63 -0
  19. package/src/components/buttons/ImageButton.vue +16 -0
  20. package/src/components/buttons/MenuButton.vue +138 -0
  21. package/src/components/buttons/SubmitButtons.vue +51 -0
  22. package/src/components/buttons/TextButton.vue +40 -0
  23. package/src/components/charts/AlertChart.vue +376 -0
  24. package/src/components/charts/BarChart.vue +212 -0
  25. package/src/components/charts/BarChartHorizontal.vue +243 -0
  26. package/src/components/charts/CronChart.vue +146 -0
  27. package/src/components/charts/EmptyChart.vue +76 -0
  28. package/src/components/charts/GradientChart.vue +310 -0
  29. package/src/components/charts/LineChart.test.js +59 -0
  30. package/src/components/charts/LineChart.vue +434 -0
  31. package/src/components/charts/PieChart.vue +293 -0
  32. package/src/components/charts/ProgressChart.vue +106 -0
  33. package/src/components/charts/StackedChart.vue +364 -0
  34. package/src/components/charts/StackedChartClustered.vue +395 -0
  35. package/src/components/charts/TimelineChart.vue +215 -0
  36. package/src/components/charts/WorkflowChart.vue +520 -0
  37. package/src/components/common/AutoCompleteSearchBar.vue +100 -0
  38. package/src/components/common/AutoRefreshButton.vue +53 -0
  39. package/src/components/common/Breadcrumb.vue +45 -0
  40. package/src/components/common/ButtonToggle.vue +24 -0
  41. package/src/components/common/Card.vue +116 -0
  42. package/src/components/common/Carousel.vue +66 -0
  43. package/src/components/common/CategoryCard.vue +28 -0
  44. package/src/components/common/CodeEditor.vue +59 -0
  45. package/src/components/common/DatePicker.vue +21 -0
  46. package/src/components/common/DatePickerInput.vue +109 -0
  47. package/src/components/common/Dialog.vue +103 -0
  48. package/src/components/common/EditorHeading.vue +10 -0
  49. package/src/components/common/EventList.vue +41 -0
  50. package/src/components/common/Facet.vue +206 -0
  51. package/src/components/common/Feed.vue +58 -0
  52. package/src/components/common/Flag.vue +27 -0
  53. package/src/components/common/HomeCard.vue +20 -0
  54. package/src/components/common/ItemBox.vue +49 -0
  55. package/src/components/common/Loading.vue +19 -0
  56. package/src/components/common/LoadingDots.vue +12 -0
  57. package/src/components/common/PageHeading.vue +30 -0
  58. package/src/components/common/Pagination.vue +105 -0
  59. package/src/components/common/Popover.vue +24 -0
  60. package/src/components/common/PowerToggle.vue +130 -0
  61. package/src/components/common/ProgressBar.vue +33 -0
  62. package/src/components/common/RadioButtons.vue +52 -0
  63. package/src/components/common/Schedule.vue +79 -0
  64. package/src/components/common/SearchBar.vue +30 -0
  65. package/src/components/common/Separator.vue +3 -0
  66. package/src/components/common/Slideout.vue +95 -0
  67. package/src/components/common/Sort.vue +83 -0
  68. package/src/components/common/Table.vue +48 -0
  69. package/src/components/common/Tabs.vue +129 -0
  70. package/src/components/common/Tag.vue +53 -0
  71. package/src/components/common/Tooltip.vue +49 -0
  72. package/src/components/common/VerticalTabs.vue +34 -0
  73. package/src/components/common/card/CardItem.vue +27 -0
  74. package/src/components/common/card/CardItemGroup.vue +45 -0
  75. package/src/components/common/facet/Leaf.vue +97 -0
  76. package/src/components/common/facet/TriState.vue +37 -0
  77. package/src/components/common/table/TableData.vue +48 -0
  78. package/src/components/common/table/TableHeader.vue +21 -0
  79. package/src/components/dialogs/ChooseValueDialog.vue +97 -0
  80. package/src/components/dialogs/ConfirmDialog.vue +73 -0
  81. package/src/components/dialogs/CopyDialog.vue +51 -0
  82. package/src/components/dialogs/DownloadDialog.vue +48 -0
  83. package/src/components/dialogs/NameDescDialog.vue +74 -0
  84. package/src/components/dialogs/NameDialog.vue +56 -0
  85. package/src/components/dialogs/PopupEditor.vue +113 -0
  86. package/src/components/dialogs/ProgressDialog.vue +58 -0
  87. package/src/components/dialogs/ResetPasswordDialog.vue +58 -0
  88. package/src/components/dialogs/Wizard.vue +99 -0
  89. package/src/components/dialogs/wizard/Stepper.vue +31 -0
  90. package/src/components/form/CheckBox.vue +26 -0
  91. package/src/components/form/Editor.vue +93 -0
  92. package/src/components/form/FormCol.vue +19 -0
  93. package/src/components/form/FormRow.vue +19 -0
  94. package/src/components/form/FormSection.vue +21 -0
  95. package/src/components/form/GreyForm.vue +7 -0
  96. package/src/components/form/GreyInput.vue +51 -0
  97. package/src/components/form/GreyInputAutocomplete.vue +100 -0
  98. package/src/components/form/GreyInputCopy.vue +66 -0
  99. package/src/components/form/GreyInputGrow.vue +42 -0
  100. package/src/components/form/GreyInputToken.vue +78 -0
  101. package/src/components/form/GreyPassword.vue +36 -0
  102. package/src/components/form/GreySelect.vue +154 -0
  103. package/src/components/form/GreySelectInput.vue +123 -0
  104. package/src/components/form/GreySelectInputMultiple.vue +218 -0
  105. package/src/components/form/GreyTel.vue +58 -0
  106. package/src/components/form/HamburgerItem.vue +95 -0
  107. package/src/components/form/KeyValueEntry.vue +74 -0
  108. package/src/components/form/RadioInput.vue +38 -0
  109. package/src/components/form/UploadFile.vue +99 -0
  110. package/src/components/icons/AiIcon.vue +6 -0
  111. package/src/components/icons/GithubIcon.vue +18 -0
  112. package/src/components/icons/HighPriorityIcon.vue +6 -0
  113. package/src/components/icons/PowerOffIcon.vue +6 -0
  114. package/src/components/icons/SaveIcon.vue +6 -0
  115. package/src/components/index.js +134 -0
  116. package/src/components/menu/DialogMenu.vue +142 -0
  117. package/src/components/menu/GrandChild.vue +39 -0
  118. package/src/components/menu/GridMenu.vue +88 -0
  119. package/src/components/menu/MenuAvatar.vue +66 -0
  120. package/src/components/menu/MenuDesktop.vue +90 -0
  121. package/src/components/notifications/Notify.vue +123 -0
  122. package/src/components/notifications/NotifyList.vue +130 -0
  123. package/src/components/page-structure/FacetPage.vue +77 -0
  124. package/src/components/query/Child.vue +63 -0
  125. package/src/components/query/LVDBQuery.vue +38 -0
  126. package/src/components/status/Active.vue +44 -0
  127. package/src/components/status/ScoreLevel.vue +43 -0
  128. package/src/components/status/Status.vue +51 -0
  129. package/src/components/status/TaskDot.vue +25 -0
  130. package/src/components/status/TaskStatus.vue +26 -0
  131. package/src/components/status/TicketStatus.vue +201 -0
  132. package/src/components/status/Trend.vue +20 -0
  133. package/src/components/tables/ArgumentRunTable.vue +96 -0
  134. package/src/components/tables/ArgumentTable.vue +67 -0
  135. package/src/components/tables/CloudFormationParameters.vue +25 -0
  136. package/src/constants/colors.js +248 -0
  137. package/src/constants/font-map.js +128 -0
  138. package/src/constants/fpl2.js +162 -0
  139. package/src/constants/icon-svg.js +405 -0
  140. package/src/constants/schedule.js +52 -0
  141. package/src/fpl/AddPanel.vue +237 -0
  142. package/src/fpl/Configs/Alert.vue +16 -0
  143. package/src/fpl/Configs/AlertSprite.vue +2 -0
  144. package/src/fpl/Configs/Chart.vue +63 -0
  145. package/src/fpl/Configs/Config.js +154 -0
  146. package/src/fpl/Configs/Counter.vue +35 -0
  147. package/src/fpl/Configs/Histogram.vue +70 -0
  148. package/src/fpl/Configs/IPMap.vue +37 -0
  149. package/src/fpl/Configs/Image.vue +163 -0
  150. package/src/fpl/Configs/MetricChart.vue +20 -0
  151. package/src/fpl/Configs/PieChart.vue +37 -0
  152. package/src/fpl/Configs/SparkChart.vue +41 -0
  153. package/src/fpl/Configs/StackedBarChart.vue +49 -0
  154. package/src/fpl/Configs/Table.vue +211 -0
  155. package/src/fpl/Configs/Text.vue +14 -0
  156. package/src/fpl/Configs/TopNChart.vue +37 -0
  157. package/src/fpl/Outputs/FPLAlert.vue +64 -0
  158. package/src/fpl/Outputs/FPLStream.vue +41 -0
  159. package/src/fpl/Outputs/FPLTable.vue +77 -0
  160. package/src/fpl/Panel.vue +202 -0
  161. package/src/fpl/Panels/Alert.vue +85 -0
  162. package/src/fpl/Panels/AlertSprite.vue +9 -0
  163. package/src/fpl/Panels/Chart.vue +98 -0
  164. package/src/fpl/Panels/Counter.vue +43 -0
  165. package/src/fpl/Panels/Histogram.vue +138 -0
  166. package/src/fpl/Panels/IPMap.vue +48 -0
  167. package/src/fpl/Panels/Image.vue +35 -0
  168. package/src/fpl/Panels/MetricChart.vue +97 -0
  169. package/src/fpl/Panels/PieChart.vue +54 -0
  170. package/src/fpl/Panels/SparkChart.vue +166 -0
  171. package/src/fpl/Panels/StackedBarChart.vue +74 -0
  172. package/src/fpl/Panels/Table.vue +103 -0
  173. package/src/fpl/Panels/Text.vue +24 -0
  174. package/src/fpl/Panels/TopNChart.vue +69 -0
  175. package/src/fpl/index.js +39 -0
  176. package/src/utils/download.js +220 -0
  177. package/src/utils/formatOutput.js +156 -0
  178. package/src/utils/random.js +32 -0
  179. package/src/utils/timeUtils.js +138 -0
@@ -0,0 +1,52 @@
1
+ const intervalOptions = [
2
+ // { label: "Minute", value: "minute" },
3
+ { label: "Hourly", value: "hourly" },
4
+ { label: "Daily", value: "daily" },
5
+ { label: "Weekly", value: "weekly" },
6
+ { label: "Monthly", value: "monthly" },
7
+ ];
8
+
9
+ const weekdayOptions = [
10
+ { label: "Sunday", value: 0 },
11
+ { label: "Monday", value: 1 },
12
+ { label: "Tuesday", value: 2 },
13
+ { label: "Wednesday", value: 3 },
14
+ { label: "Thursday", value: 4 },
15
+ { label: "Friday", value: 5 },
16
+ { label: "Saturday", value: 6 },
17
+ ];
18
+
19
+ const hourOptions = Array.from({ length: 24 }, (_, i) => {
20
+ return { label: i.toString(), value: i };
21
+ });
22
+
23
+ const dayOptions = Array.from({ length: 31 }, (_, i) => {
24
+ return { label: (i + 1).toString(), value: i + 1 };
25
+ });
26
+
27
+ const timezoneOptions = [
28
+ { label: "GMT", value: "GMT" },
29
+ { label: "America/New_York", value: "America/New_York" },
30
+ { label: "America/Chicago", value: "America/Chicago" },
31
+ { label: "America/Los_Angeles", value: "America/Los_Angeles" },
32
+ { label: "America/Denver", value: "America/Denver" },
33
+ { label: "America/Phoenix", value: "America/Phoenix" },
34
+ { label: "Canada/Atlantic", value: "Canada/Atlantic" },
35
+ { label: "Canada/Central", value: "Canada/Central" },
36
+ { label: "Canada/Eastern", value: "Canada/Eastern" },
37
+ { label: "Canada/Mountain", value: "Canada/Mountain" },
38
+ { label: "Canada/Pacific", value: "Canada/Pacific" },
39
+ { label: "Canada/Newfoundland", value: "Canada/Newfoundland" },
40
+ { label: "Europe/London", value: "Europe/London" },
41
+ { label: "Europe/Berlin", value: "Europe/Berlin" },
42
+ { label: "Hongkong", value: "Hongkong" },
43
+ { label: "Asia/Kuala_Lumpur", value: "Asia/Kuala_Lumpur" },
44
+ ];
45
+
46
+ export {
47
+ intervalOptions,
48
+ weekdayOptions,
49
+ timezoneOptions,
50
+ hourOptions,
51
+ dayOptions,
52
+ };
@@ -0,0 +1,237 @@
1
+ <template>
2
+ <Dialog
3
+ :open="open"
4
+ :title="`${isEditing ? 'Edit' : 'Add'}ing Widget`"
5
+ size="xlarge"
6
+ >
7
+ <template #content>
8
+ <div class="flex">
9
+ <div
10
+ v-if="local.panelType !== 'text' && local.panelType !== 'image'"
11
+ class="w-1/3 px-2"
12
+ >
13
+ <FormCol fieldName="Panel Name" required>
14
+ <GreyInput v-model="local.title" :error="errors.title" />
15
+ </FormCol>
16
+ </div>
17
+ <div class="w-1/3 px-2">
18
+ <FormCol fieldName="Panel Type">
19
+ <GreySelect
20
+ v-model="local.panelType"
21
+ :options="availablePanels"
22
+ :error="errors.panelType"
23
+ @update:modelValue="changePanel"
24
+ />
25
+ </FormCol>
26
+ </div>
27
+ <div v-if="objectType" class="w-1/3 px-2">
28
+ <FormCol :fieldName="objectType">
29
+ <GreyInput v-model.trim="selectedObject.name" readonly />
30
+ </FormCol>
31
+ </div>
32
+ </div>
33
+ <FormSection
34
+ v-if="local.panelType"
35
+ sectionName="Widget Configuration"
36
+ class="pt-5"
37
+ >
38
+ <div class="px-10">
39
+ <component
40
+ :is="getComponent(local.panelType)"
41
+ :object="selectedObject"
42
+ :entry="local"
43
+ :errors="errors"
44
+ />
45
+ </div>
46
+ </FormSection>
47
+ <NotifyList ref="notifyList" :is-dialog="open" />
48
+ </template>
49
+ <template #footer>
50
+ <SubmitButtons
51
+ :saveText="isEditing ? 'Update' : 'Add'"
52
+ @save="isEditing ? updatePanel() : addPanel()"
53
+ @close="closeModal"
54
+ />
55
+ </template>
56
+ </Dialog>
57
+ </template>
58
+ <script setup>
59
+ import { ref, computed } from "vue";
60
+ import {
61
+ Dialog,
62
+ SubmitButtons,
63
+ FormCol,
64
+ FormSection,
65
+ GreyInput,
66
+ GreySelect,
67
+ NotifyList,
68
+ } from "@/components";
69
+ import {
70
+ AlertConfig,
71
+ AlertSpriteConfig,
72
+ ChartConfig,
73
+ CounterConfig,
74
+ IPMapConfig,
75
+ HistogramConfig,
76
+ ImageConfig,
77
+ MetricChartConfig,
78
+ PieChartConfig,
79
+ SparkChartConfig,
80
+ StackedBarChartConfig,
81
+ TableConfig,
82
+ TextConfig,
83
+ TopNChartConfig,
84
+ } from "../fpl";
85
+ import {
86
+ panelComponent,
87
+ defaultPanel,
88
+ validatePanelConfig,
89
+ } from "./Configs/Config";
90
+
91
+ const components = {
92
+ AlertConfig,
93
+ AlertSpriteConfig,
94
+ ChartConfig,
95
+ CounterConfig,
96
+ IPMapConfig,
97
+ HistogramConfig,
98
+ ImageConfig,
99
+ MetricChartConfig,
100
+ PieChartConfig,
101
+ SparkChartConfig,
102
+ StackedBarChartConfig,
103
+ TableConfig,
104
+ TextConfig,
105
+ TopNChartConfig,
106
+ };
107
+
108
+ const props = defineProps({
109
+ objects: Array,
110
+ });
111
+ const emits = defineEmits(["add", "update", "notify"]);
112
+
113
+ const open = ref(false);
114
+ const isEditing = ref(false);
115
+ const selectedObject = ref({});
116
+ const local = ref({});
117
+ const errors = ref({});
118
+ const notifyList = ref();
119
+
120
+ const objectType = computed(() => {
121
+ if (selectedObject.value.table) {
122
+ return "Table";
123
+ } else if (selectedObject.value.alert) {
124
+ return "Alert";
125
+ } else if (selectedObject.value.stream) {
126
+ return "Stream";
127
+ }
128
+ return "";
129
+ });
130
+
131
+ const availablePanels = computed(() => {
132
+ if (selectedObject.value.table) {
133
+ return [
134
+ { label: "Table", value: "table" },
135
+ { label: "Chart", value: "chart" },
136
+ { label: "Pie Chart", value: "pie" },
137
+ { label: "Counter", value: "counter" },
138
+ { label: "Stacked Bar Chart", value: "stackChart" },
139
+ { label: "Spark Chart", value: "sparkLine" },
140
+ { label: "Top N Chart", value: "topn" },
141
+ { label: "Geo Map", value: "geoMap" },
142
+ { label: "Histogram", value: "histogram" },
143
+ ];
144
+ } else if (selectedObject.value.alert) {
145
+ return [
146
+ { label: "Alert", value: "alert" },
147
+ { label: "Alert Sprite", value: "alertSprite" },
148
+ ];
149
+ } else if (selectedObject.value.stream) {
150
+ return [
151
+ { label: "Chart", value: "metric" },
152
+ { label: "Spark Chart", value: "sparkLine" },
153
+ ];
154
+ } else if (local.value.panelType === "text") {
155
+ return [{ label: "Text", value: "text" }];
156
+ } else if (local.value.panelType === "image") {
157
+ return [{ label: "Image", value: "image" }];
158
+ }
159
+ return [];
160
+ });
161
+
162
+ function getComponent() {
163
+ return components[panelComponent[local.value.panelType] + "Config"];
164
+ }
165
+
166
+ function changePanel(panelType) {
167
+ // reset the panel to the default values
168
+ local.value.panelType = panelType;
169
+ local.value.panelConfig = JSON.parse(JSON.stringify(defaultPanel[panelType]));
170
+ }
171
+
172
+ function validatePanel() {
173
+ console.log(local.value);
174
+ errors.value = {};
175
+ if (
176
+ local.value.panelType !== "image" &&
177
+ local.value.panelType !== "text" &&
178
+ !local.value.title
179
+ ) {
180
+ errors.value.title = "Panel Name is required";
181
+ }
182
+ if (!local.value.panelType) {
183
+ errors.value.panelType = "Panel Type is required";
184
+ } else {
185
+ try {
186
+ validatePanelConfig(
187
+ errors.value,
188
+ local.value.panelType,
189
+ local.value.panelConfig
190
+ );
191
+ } catch (e) {
192
+ console.log(e);
193
+ emits("notify", "Error", "Panel type is not supported", false);
194
+ return false;
195
+ }
196
+ }
197
+ if (JSON.stringify(errors.value) !== "{}") {
198
+ const errorsArr = Object.keys(errors.value).map((key) => errors.value[key]);
199
+ notifyList.value.openModal("Invalid Configuration", errorsArr, false);
200
+ return false;
201
+ }
202
+ return true;
203
+ }
204
+
205
+ function addPanel() {
206
+ if (validatePanel()) {
207
+ if (selectedObject.value.name)
208
+ local.value.dataTable = selectedObject.value.name;
209
+ emits("add", local.value);
210
+ }
211
+ }
212
+
213
+ function updatePanel() {
214
+ if (validatePanel()) {
215
+ emits("update", local.value);
216
+ }
217
+ }
218
+
219
+ function openModal(obj, panelObj = {}, defaultPanel = "") {
220
+ isEditing.value = false;
221
+ errors.value = {};
222
+ open.value = true;
223
+ selectedObject.value = props.objects.find((o) => o.name === obj) || {};
224
+ local.value = JSON.parse(JSON.stringify(panelObj));
225
+ if (panelObj.panelType) isEditing.value = true;
226
+ if (defaultPanel) changePanel(defaultPanel);
227
+ }
228
+
229
+ function closeModal() {
230
+ open.value = false;
231
+ }
232
+
233
+ defineExpose({
234
+ openModal,
235
+ closeModal,
236
+ });
237
+ </script>
@@ -0,0 +1,16 @@
1
+ <template>
2
+ <FormRow fieldName="Number of Top Alerts">
3
+ <GreyInput v-model.number="local.panelConfig.topID" type="number" min="1" />
4
+ </FormRow>
5
+ </template>
6
+ <script setup>
7
+ import { ref } from "vue";
8
+ import { FormRow, GreyInput } from "@/components";
9
+
10
+ const props = defineProps({
11
+ object: Object,
12
+ entry: Object,
13
+ errors: Object,
14
+ });
15
+ const local = ref(props.entry);
16
+ </script>
@@ -0,0 +1,2 @@
1
+ <template>Not implemented</template>
2
+ <script setup></script>
@@ -0,0 +1,63 @@
1
+ <template>
2
+ <FormRow fieldName="Value Columns (Y-Axis)">
3
+ <GreySelectInputMultiple
4
+ :selected="selected"
5
+ :options="
6
+ object.table.columns.map((col) => ({
7
+ label: col.name,
8
+ value: col.name,
9
+ }))
10
+ "
11
+ :allow-input="false"
12
+ @update="updateColumns($event)"
13
+ />
14
+ </FormRow>
15
+ <FormRow fieldName="Labels (X-Axis)">
16
+ <GreySelect
17
+ v-model="local.panelConfig.value.column.name"
18
+ :options="
19
+ object.table.columns.map((col) => ({
20
+ label: col.name,
21
+ value: col.name,
22
+ }))
23
+ "
24
+ :error="errors.value"
25
+ />
26
+ </FormRow>
27
+ <FormRow fieldName="Chart Type">
28
+ <GreySelect
29
+ v-model="local.panelConfig.options.type"
30
+ :options="chartOptions"
31
+ />
32
+ </FormRow>
33
+ </template>
34
+ <script setup>
35
+ import { ref } from "vue";
36
+ import {
37
+ FormRow,
38
+ GreySelectInputMultiple,
39
+ GreySelect,
40
+ } from "@/components";
41
+
42
+ const props = defineProps({
43
+ object: Object,
44
+ entry: Object,
45
+ errors: Object,
46
+ });
47
+ const local = ref(props.entry);
48
+ const selected = ref(
49
+ props.entry.panelConfig.categories.focus.map((col) => col.name)
50
+ );
51
+ const chartOptions = [
52
+ { label: "Bar Chart", value: "bar" },
53
+ { label: "Line Chart", value: "line" },
54
+ ];
55
+
56
+ function updateColumns(arr) {
57
+ local.value.panelConfig.categories.focus = arr.map((col) => {
58
+ return {
59
+ name: col,
60
+ };
61
+ });
62
+ }
63
+ </script>
@@ -0,0 +1,154 @@
1
+ const panelComponent = {
2
+ alert: "Alert",
3
+ alertSprite: "AlertSprite",
4
+ chart: "Chart",
5
+ counter: "Counter",
6
+ geoMap: "IPMap",
7
+ histogram: "Histogram",
8
+ image: "Image",
9
+ metric: "MetricChart",
10
+ pie: "PieChart",
11
+ severityChart: "StackedBarChart",
12
+ sparkLine: "SparkChart",
13
+ stackChart: "StackedBarChart",
14
+ table: "Table",
15
+ text: "Text",
16
+ topn: "TopNChart",
17
+ };
18
+
19
+ const defaultPanel = {
20
+ alert: {
21
+ topID: 10,
22
+ },
23
+ alertSprite: {},
24
+ chart: {
25
+ categories: {
26
+ focus: [],
27
+ },
28
+ value: {
29
+ column: {},
30
+ },
31
+ options: {
32
+ type: "line",
33
+ },
34
+ },
35
+ counter: {
36
+ field: "",
37
+ format: "default",
38
+ },
39
+ geoMap: {},
40
+ histogram: {
41
+ categories: {
42
+ focus: [],
43
+ },
44
+ value: {
45
+ column: {},
46
+ },
47
+ options: {
48
+ type: "line",
49
+ },
50
+ allColumns: true,
51
+ },
52
+ image: {
53
+ backgroundColor: "transparent",
54
+ positioning: "center-center",
55
+ size: "100%",
56
+ pixels: 100,
57
+ },
58
+ metric: {
59
+ chart: "line",
60
+ },
61
+ pie: {
62
+ categories: {
63
+ focus: {},
64
+ },
65
+ value: {
66
+ column: {},
67
+ },
68
+ },
69
+ sparkLine: {
70
+ metrics: "simple",
71
+ showline: false,
72
+ unit: "count",
73
+ },
74
+ stackChart: {
75
+ categories: {
76
+ focus: {},
77
+ type: {},
78
+ },
79
+ value: {
80
+ column: {},
81
+ },
82
+ },
83
+ table: {
84
+ columns: [],
85
+ },
86
+ text: {},
87
+ topn: {
88
+ categories: {
89
+ focus: {},
90
+ },
91
+ value: {
92
+ column: {},
93
+ },
94
+ },
95
+ };
96
+
97
+ const validationSchema = {
98
+ alert: {},
99
+ chart: {
100
+ categories: (val) => val.focus.length > 0,
101
+ value: (val) => JSON.stringify(val.column) !== "{}",
102
+ },
103
+ counter: {
104
+ field: (val) => val,
105
+ },
106
+ geoMap: {
107
+ ipColumn: (val) => val,
108
+ valueColumn: (val) => val,
109
+ },
110
+ histogram: {
111
+ value: (val) => JSON.stringify(val.column) !== "{}",
112
+ // check either use all columns or choose at least one category
113
+ },
114
+ image: {
115
+ image: (val) => val,
116
+ },
117
+ metric: {},
118
+ pie: {
119
+ categories: (val) => JSON.stringify(val.focus) !== "{}",
120
+ value: (val) => JSON.stringify(val.column) !== "{}",
121
+ },
122
+ sparkLine: {},
123
+ stackChart: {
124
+ categories: (val) =>
125
+ JSON.stringify(val.focus) !== "{}" && JSON.stringify(val.type) !== "{}",
126
+ value: (val) => JSON.stringify(val.column) !== "{}",
127
+ },
128
+ table: {
129
+ columns: (val) => val.length > 0,
130
+ },
131
+ text: {},
132
+ topn: {
133
+ categories: (val) => JSON.stringify(val.focus) !== "{}",
134
+ value: (val) => JSON.stringify(val.column) !== "{}",
135
+ },
136
+ };
137
+
138
+ const validationErrors = {
139
+ columns: "Please select at least a column for the table",
140
+ categories: "Please select a field for value",
141
+ value: "Please select a field for label",
142
+ field: "Please select a field",
143
+ image: "Please upload an image",
144
+ ipColumn: "Please select a field for IP",
145
+ valueColumn: "Please select a field for value",
146
+ };
147
+
148
+ const validatePanelConfig = (errors, panelType, panelConfig) => {
149
+ Object.keys(validationSchema[panelType])
150
+ .filter((key) => !validationSchema[panelType][key](panelConfig[key]))
151
+ .map((key) => (errors[key] = validationErrors[key]));
152
+ };
153
+
154
+ export { panelComponent, defaultPanel, validatePanelConfig };
@@ -0,0 +1,35 @@
1
+ <template>
2
+ <FormRow fieldName="Counter Column">
3
+ <GreySelect
4
+ v-model="local.panelConfig.field"
5
+ :options="
6
+ object.table.columns.map((col) => ({
7
+ label: col.name,
8
+ value: col.name,
9
+ }))
10
+ "
11
+ :error="errors.field"
12
+ />
13
+ </FormRow>
14
+ <FormRow fieldName="Format">
15
+ <GreySelect v-model="local.panelConfig.format" :options="formatOptions" />
16
+ </FormRow>
17
+ </template>
18
+ <script setup>
19
+ import { ref } from "vue";
20
+ import { FormRow, GreySelect } from "@/components";
21
+
22
+ const props = defineProps({
23
+ object: Object,
24
+ entry: Object,
25
+ errors: Object,
26
+ });
27
+ const local = ref(props.entry);
28
+ const formatOptions = [
29
+ { label: "Default", value: "default" },
30
+ { label: "Compact", value: "Readable Numbers" },
31
+ { label: "Thousands Seperated", value: "comma" },
32
+ { label: "Thousands Seperated (Data)", value: "comma_data" },
33
+ { label: "Data", value: "Data" },
34
+ ];
35
+ </script>
@@ -0,0 +1,70 @@
1
+ <template>
2
+ <FormRow fieldName="Timestamp (X-Axis)">
3
+ <GreySelect
4
+ v-model="local.panelConfig.value.column.name"
5
+ :options="
6
+ object.table.columns.map((col) => ({
7
+ label: col.name,
8
+ value: col.name,
9
+ }))
10
+ "
11
+ :error="errors.value"
12
+ />
13
+ </FormRow>
14
+ <FormRow fieldName="Use All Columns (except timestamp column)">
15
+ <CheckBox v-model="local.panelConfig.allColumns" />
16
+ </FormRow>
17
+ <FormRow
18
+ v-if="!local.panelConfig.allColumns"
19
+ fieldName="Value Columns (Y-Axis)"
20
+ >
21
+ <GreySelectInputMultiple
22
+ :selected="selected"
23
+ :options="
24
+ object.table.columns.map((col) => ({
25
+ label: col.name,
26
+ value: col.name,
27
+ }))
28
+ "
29
+ :allow-input="false"
30
+ @update="updateColumns($event)"
31
+ />
32
+ </FormRow>
33
+ <FormRow fieldName="Chart Type">
34
+ <GreySelect
35
+ v-model="local.panelConfig.options.type"
36
+ :options="chartOptions"
37
+ />
38
+ </FormRow>
39
+ </template>
40
+ <script setup>
41
+ import { ref } from "vue";
42
+ import {
43
+ FormRow,
44
+ GreySelect,
45
+ CheckBox,
46
+ GreySelectInputMultiple,
47
+ } from "@/components";
48
+
49
+ const props = defineProps({
50
+ object: Object,
51
+ entry: Object,
52
+ errors: Object,
53
+ });
54
+ const local = ref(props.entry);
55
+ const selected = ref(
56
+ props.entry.panelConfig.categories.focus.map((col) => col.name)
57
+ );
58
+ const chartOptions = [
59
+ { label: "Bar Chart", value: "bar" },
60
+ { label: "Line Chart", value: "line" },
61
+ ];
62
+
63
+ function updateColumns(arr) {
64
+ local.value.panelConfig.categories.focus = arr.map((col) => {
65
+ return {
66
+ name: col,
67
+ };
68
+ });
69
+ }
70
+ </script>
@@ -0,0 +1,37 @@
1
+ <template>
2
+ <FormRow fieldName="IP Column">
3
+ <GreySelect
4
+ v-model="local.panelConfig.ipColumn"
5
+ :options="
6
+ object.table.columns.map((col) => ({
7
+ label: col.name,
8
+ value: col.name,
9
+ }))
10
+ "
11
+ :error="errors.ipColumn"
12
+ />
13
+ </FormRow>
14
+ <FormRow fieldName="Value Column">
15
+ <GreySelect
16
+ v-model="local.panelConfig.valueColumn"
17
+ :options="
18
+ object.table.columns.map((col) => ({
19
+ label: col.name,
20
+ value: col.name,
21
+ }))
22
+ "
23
+ :error="errors.valueColumn"
24
+ />
25
+ </FormRow>
26
+ </template>
27
+ <script setup>
28
+ import { ref } from "vue";
29
+ import { FormRow, GreySelect } from "@/components";
30
+
31
+ const props = defineProps({
32
+ object: Object,
33
+ entry: Object,
34
+ errors: Object,
35
+ });
36
+ const local = ref(props.entry);
37
+ </script>