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,77 @@
1
+ <template>
2
+ <Table :data="dat">
3
+ <template #header>
4
+ <tr>
5
+ <TableHeader
6
+ v-for="col in data.columns"
7
+ :key="col.name"
8
+ :title="col.name"
9
+ />
10
+ </tr>
11
+ </template>
12
+ <template #rows>
13
+ <tr v-for="item in dat">
14
+ <td
15
+ v-for="col in data.columns"
16
+ :key="col.name"
17
+ class="table-font break-all"
18
+ >
19
+ {{ col.unit ? formatCol(item[col.name], col.unit) : item[col.name] }}
20
+ </td>
21
+ </tr>
22
+ </template>
23
+ <template #pagination>
24
+ <pagination
25
+ v-if="data.rows && data.rows.length"
26
+ :startPos="props.paginationStore.startPos"
27
+ :pageSize="props.paginationStore.pageSize"
28
+ :total="data.rows.length"
29
+ @previous="previousPage()"
30
+ @next="nextPage()"
31
+ @navtopage="skipToPage"
32
+ />
33
+ </template>
34
+ </Table>
35
+ </template>
36
+ <script setup>
37
+ import { ref } from "vue";
38
+ import { Table, TableHeader, Pagination } from "@/components";
39
+ import {
40
+ costCount,
41
+ dataCount,
42
+ humanCount,
43
+ durationCount,
44
+ } from "@/utils/formatOutput";
45
+
46
+ const props = defineProps({
47
+ title: String,
48
+ data: Object,
49
+ paginationStore: Object,
50
+ });
51
+ const dat = ref([]);
52
+ props.paginationStore.$reset;
53
+ if (props.data.rows && props.data.rows.length > 0) {
54
+ dat.value = props.paginationStore.paginate(props.data.rows);
55
+ }
56
+
57
+ function previousPage() {
58
+ dat.value = props.paginationStore.previousPage(props.data.rows);
59
+ }
60
+ function nextPage() {
61
+ dat.value = props.paginationStore.nextPage(props.data.rows);
62
+ }
63
+ function skipToPage(page) {
64
+ dat.value = props.paginationStore.skipToPage(props.data.rows, page);
65
+ }
66
+
67
+ function formatCol(value, unit) {
68
+ if (unit === "B") {
69
+ return dataCount(value) + "B";
70
+ } else if (unit === "$") {
71
+ return costCount(value);
72
+ } else if (unit === "s") {
73
+ return durationCount(value);
74
+ }
75
+ return humanCount(value) + unit;
76
+ }
77
+ </script>
@@ -0,0 +1,202 @@
1
+ <template>
2
+ <div
3
+ :class="[
4
+ 'relative pl-2 w-full',
5
+ panel.panelType === 'image' || panel.panelType === 'text' ? '' : 'py-1',
6
+ ]"
7
+ >
8
+ <div
9
+ v-if="panel.title"
10
+ class="block truncate overflow-hidden text-ellipsis pr-6 w-full pb-1.5"
11
+ >
12
+ <span class="leading-[1] font-semibold text-md">
13
+ {{ panel.title }}
14
+ </span>
15
+ </div>
16
+ <Menu v-if="!viewing" as="div" class="absolute right-1 top-2">
17
+ <MenuButton class="-m-2.5 block p-2.5 text-gray-400 hover:text-gray-500">
18
+ <span class="sr-only">Open options</span>
19
+ <EllipsisHorizontalIcon class="icon-md" aria-hidden="true" />
20
+ </MenuButton>
21
+ <transition
22
+ enter-active-class="transition ease-out duration-100"
23
+ enter-from-class="transform opacity-0 scale-95"
24
+ enter-to-class="transform opacity-100 scale-100"
25
+ leave-active-class="transition ease-in duration-75"
26
+ leave-from-class="transform opacity-100 scale-100"
27
+ leave-to-class="transform opacity-0 scale-95"
28
+ >
29
+ <MenuItems
30
+ class="absolute right-0 z-10 mt-0.5 w-32 origin-top-right rounded-md py-2 shadow-lg ring-1 ring-gray-900/5 focus:outline-hidden bg-white dark:bg-black"
31
+ >
32
+ <MenuItem v-slot="{ active }">
33
+ <div
34
+ :class="[
35
+ active ? 'cursor-pointer bg-gray-50 dark:bg-gray-800' : '',
36
+ 'block px-3 py-1 text-sm leading-6',
37
+ ]"
38
+ @click="emits('edit', panel)"
39
+ >
40
+ Edit
41
+ </div>
42
+ </MenuItem>
43
+ <MenuItem v-if="panel.panelType === 'table'" v-slot="{ active }">
44
+ <div
45
+ :class="[
46
+ active ? 'cursor-pointer bg-gray-50 dark:bg-gray-800' : '',
47
+ 'block px-3 py-1 text-sm leading-6',
48
+ ]"
49
+ @click="downloadTableCSV"
50
+ >
51
+ Download CSV
52
+ </div>
53
+ </MenuItem>
54
+ <MenuItem v-slot="{ active }">
55
+ <div
56
+ :class="[
57
+ active ? 'cursor-pointer bg-gray-50 dark:bg-gray-800' : '',
58
+ 'block px-3 py-1 text-sm leading-6',
59
+ ]"
60
+ @click="emits('delete', panel.key)"
61
+ >
62
+ Delete
63
+ </div>
64
+ </MenuItem>
65
+ </MenuItems>
66
+ </transition>
67
+ </Menu>
68
+ <div
69
+ v-else-if="viewing && panel.panelType === 'table' && mouseover"
70
+ class="absolute right-2 top-2"
71
+ >
72
+ <ActionButtons download hideTooltip @download="downloadTableCSV" />
73
+ </div>
74
+ </div>
75
+ <component
76
+ v-if="!noData"
77
+ :is="getComponent()"
78
+ :config="panel.panelConfig"
79
+ :obj="obj"
80
+ :id="`panel${panel.key}${isMobile ? '-mobile' : ''}`"
81
+ :layout="layout"
82
+ :class="
83
+ panel.panelType === 'image' || panel.panelType === 'text' ? '' : 'p-2'
84
+ "
85
+ :theme="theme"
86
+ :paginationStore="paginationStore"
87
+ :apiKey="apiKey"
88
+ />
89
+ <span v-else class="flex justify-center pt-10 text-lg font-semibold">
90
+ No data available
91
+ </span>
92
+ </template>
93
+ <script setup>
94
+ import { ref, computed } from "vue";
95
+ import { Menu, MenuButton, MenuItem, MenuItems } from "@headlessui/vue";
96
+ import { EllipsisHorizontalIcon } from "@heroicons/vue/20/solid";
97
+ import { panelCSVDownload } from "@/utils/download";
98
+ import { panelComponent } from "./Configs/Config";
99
+ import { ActionButtons } from "@/components";
100
+ import {
101
+ AlertPanel as Alert,
102
+ AlertSpritePanel as AlertSprite,
103
+ ChartPanel as Chart,
104
+ CounterPanel as Counter,
105
+ HistogramPanel as Histogram,
106
+ ImagePanel as Image,
107
+ IPMapPanel as IPMap,
108
+ MetricChartPanel as MetricChart,
109
+ PieChartPanel as PieChart,
110
+ SparkChartPanel as SparkChart,
111
+ StackedBarChartPanel as StackedBarChart,
112
+ TablePanel as Table,
113
+ TextPanel as Text,
114
+ TopNChartPanel as TopNChart,
115
+ } from "../fpl";
116
+
117
+ // constants
118
+ const components = {
119
+ Alert,
120
+ AlertSprite,
121
+ Chart,
122
+ Counter,
123
+ Histogram,
124
+ Image,
125
+ IPMap,
126
+ MetricChart,
127
+ PieChart,
128
+ SparkChart,
129
+ StackedBarChart,
130
+ Table,
131
+ Text,
132
+ TopNChart,
133
+ };
134
+
135
+ // props and emits
136
+ const props = defineProps({
137
+ objects: Array,
138
+ panel: Object,
139
+ layout: Object,
140
+ viewing: {
141
+ type: Boolean,
142
+ default: false,
143
+ },
144
+ mouseover: {
145
+ type: Boolean,
146
+ default: false,
147
+ },
148
+ isMobile: {
149
+ type: Boolean,
150
+ default: false,
151
+ },
152
+ theme: {
153
+ type: String,
154
+ default: "light",
155
+ },
156
+ paginationStore: {
157
+ type: Object,
158
+ default: () => ({}),
159
+ },
160
+ apiKey: {
161
+ type: String,
162
+ default: "",
163
+ },
164
+ });
165
+ const emits = defineEmits(["delete", "edit"]);
166
+ const obj = ref(getPanelObject());
167
+
168
+ const noData = computed(() => {
169
+ if (props.panel.panelType === "text") {
170
+ return false;
171
+ } else if (props.panel.panelType === "image") {
172
+ return false;
173
+ }
174
+ if (obj.value.table && obj.value.table.rows) {
175
+ return false;
176
+ } else if (obj.value.stream) {
177
+ return false;
178
+ } else if (obj.value.alert && obj.value.alert.alerts) {
179
+ return false;
180
+ }
181
+ return true;
182
+ });
183
+
184
+ function getComponent() {
185
+ if (!props.panel || !props.panel.panelType) return "";
186
+ return components[panelComponent[props.panel.panelType]];
187
+ }
188
+
189
+ function getPanelObject() {
190
+ const obj = props.objects.find((o) => o.name === props.panel.dataTable);
191
+ return obj ? obj : {};
192
+ }
193
+
194
+ function downloadTableCSV() {
195
+ // might need more error checking
196
+ panelCSVDownload(
197
+ props.panel.title,
198
+ props.panel.panelConfig.columns,
199
+ obj.value.table.rows
200
+ );
201
+ }
202
+ </script>
@@ -0,0 +1,85 @@
1
+ <template>
2
+ <div
3
+ v-if="!redraw"
4
+ class="overflow-auto"
5
+ :style="`height: ${layout.h * 61 - 10}px`"
6
+ >
7
+ <div v-for="(alert, i) in dat" class="py-2">
8
+ <h3 class="text-lg font-semibold">{{ alert.action }}</h3>
9
+ <Tag
10
+ v-for="(tag, i) in alert.tags"
11
+ :key="i"
12
+ :text="tag.key + ': ' + tag.values.join(', ')"
13
+ color="blue"
14
+ />
15
+ <AlertChart
16
+ :data="alert"
17
+ :id="id + i"
18
+ unit="Value"
19
+ :height="300"
20
+ :width="layout.w * 65 - 150"
21
+ :pannable="false"
22
+ :theme="theme"
23
+ />
24
+ </div>
25
+ </div>
26
+ </template>
27
+ <script setup>
28
+ import { Tag, AlertChart } from "@/components";
29
+ import { ref, watch } from "vue";
30
+
31
+ // stores
32
+
33
+ // props and emits
34
+ const props = defineProps({
35
+ config: Object,
36
+ obj: Object,
37
+ layout: Object,
38
+ id: String,
39
+ theme: {
40
+ type: String,
41
+ default: "light",
42
+ }
43
+ });
44
+ const redraw = ref(false);
45
+ const dat = ref([]);
46
+ // watcher
47
+ watch(
48
+ () => [props.layout.w, props.layout.h],
49
+ () => {
50
+ redraw.value = true;
51
+ setInterval(() => {
52
+ redraw.value = false;
53
+ }, 1);
54
+ }
55
+ );
56
+
57
+ // mounted
58
+ parseData();
59
+
60
+ // function defs
61
+ function parseData() {
62
+ const slots = props.obj.alert.slots.map((slot) => slot * 1000);
63
+ dat.value = props.obj.alert.alerts
64
+ ? props.obj.alert.alerts.map((alert) => {
65
+ const associates = alert.associates || [];
66
+ return {
67
+ tags: alert.dimensionTags ? alert.dimensionTags[0].tags : [],
68
+ slots: slots,
69
+ action: alert.key,
70
+ metric: alert.alertMetric,
71
+ values: alert.values[0].metric.values,
72
+ series: associates
73
+ .filter((associate) => associate.name)
74
+ .map((associate) => {
75
+ return {
76
+ action: associate.name,
77
+ values: associate.metric.values,
78
+ };
79
+ }),
80
+ };
81
+ })
82
+ : [];
83
+ dat.value = dat.value.slice(0, props.config.topID);
84
+ }
85
+ </script>
@@ -0,0 +1,9 @@
1
+ <template>
2
+ <div>AlertSprite</div>
3
+ </template>
4
+ <script setup>
5
+ const props = defineProps({
6
+ config: Object,
7
+ obj: Object,
8
+ });
9
+ </script>
@@ -0,0 +1,98 @@
1
+ <template>
2
+ <div>
3
+ <LineChart
4
+ v-if="config.options.type === 'line' && !redraw"
5
+ :data="data"
6
+ :id="id"
7
+ unit="Value"
8
+ :height="props.layout.h * 60 - 40"
9
+ :width="props.layout.w * 69 - 155"
10
+ :hideZeros="false"
11
+ :isTime="false"
12
+ tooltipOffset="offset"
13
+ :slot-name="config.value.column.name"
14
+ :theme="theme"
15
+ />
16
+ <StackedChart
17
+ v-if="config.options.type === 'bar' && !redraw"
18
+ :data="data"
19
+ :names="data.names"
20
+ :id="id"
21
+ unit="Value"
22
+ :height="props.layout.h * 60 - 50"
23
+ :width="props.layout.w * 69 - 20"
24
+ :isTime="false"
25
+ tooltipOffset="offset"
26
+ :slot-name="config.value.column.name"
27
+ :theme="theme"
28
+ />
29
+ </div>
30
+ </template>
31
+ <script setup>
32
+ import { ref, watch } from "vue";
33
+ import { LineChart, StackedChart } from "@/components";
34
+
35
+ // stores
36
+ // props and emits
37
+ const props = defineProps({
38
+ config: Object,
39
+ obj: Object,
40
+ layout: Object,
41
+ id: String,
42
+ theme: {
43
+ type: String,
44
+ default: "light",
45
+ }
46
+ });
47
+ // states
48
+ const redraw = ref(false);
49
+ const data = ref([]);
50
+ // watcher
51
+ watch(
52
+ () => [props.layout.w, props.layout.h],
53
+ () => {
54
+ redraw.value = true;
55
+ setInterval(() => {
56
+ redraw.value = false;
57
+ }, 1);
58
+ }
59
+ );
60
+ // mounted
61
+ getData();
62
+
63
+ // function defs
64
+ function getData() {
65
+ const slots = props.obj.table.rows.map(
66
+ (row, i) => row[props.config.value.column.name]
67
+ );
68
+ if (props.config.options.type === "line") {
69
+ data.value = props.config.categories.focus.map((cat) => {
70
+ return {
71
+ action: cat.name,
72
+ slots: slots,
73
+ values: props.obj.table.rows.map((row) => row[cat.name]),
74
+ };
75
+ });
76
+ } else if (props.config.options.type === "bar") {
77
+ const nameMap = {};
78
+ const values = [];
79
+ props.config.categories.focus.forEach((cat) => {
80
+ nameMap[cat.name] = cat.name;
81
+ props.obj.table.rows.forEach((row, i) => {
82
+ values.push({
83
+ slot: slots[i],
84
+ name: cat.name,
85
+ value: row[cat.name],
86
+ });
87
+ });
88
+ });
89
+ data.value = {
90
+ slots: slots,
91
+ names: nameMap,
92
+ series: values,
93
+ };
94
+ } else {
95
+ data.value = [];
96
+ }
97
+ }
98
+ </script>
@@ -0,0 +1,43 @@
1
+ <template>
2
+ <div class="w-full" style="height: calc(100% - 40px)">
3
+ <span
4
+ :class="[
5
+ 'flex items-center justify-center content-center h-full overflow-hidden',
6
+ layout.w > 4 ? 'text-7xl' : 'text-5xl',
7
+ ]"
8
+ >
9
+ {{ formatCol(total, config.format) }}
10
+ </span>
11
+ </div>
12
+ </template>
13
+ <script setup>
14
+ import { ref } from "vue";
15
+ import { dataCount, humanCount } from "@/utils/formatOutput";
16
+
17
+ // props
18
+ const props = defineProps({
19
+ config: Object,
20
+ obj: Object,
21
+ layout: Object,
22
+ id: String,
23
+ theme: {
24
+ type: String,
25
+ default: "light",
26
+ }
27
+ });
28
+ // states
29
+ const total = ref(0);
30
+ // mounted
31
+ if (props.obj.table.rows[0]) {
32
+ total.value = props.obj.table.rows[0][props.config.field] || 0;
33
+ }
34
+
35
+ // function defs
36
+ function formatCol(total, format) {
37
+ if (format === "Data") return dataCount(total) + "B";
38
+ if (format === "Readable Numbers") return humanCount(total.toPrecision(3));
39
+ if (format === "comma") return total.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
40
+ if (format === "comma_data") return total.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + "B";
41
+ return total;
42
+ }
43
+ </script>
@@ -0,0 +1,138 @@
1
+ <template>
2
+ <div>
3
+ <LineChart
4
+ v-if="config.options.type === 'line' && !redraw"
5
+ :data="data"
6
+ :id="id"
7
+ unit="Value"
8
+ :height="props.layout.h * 60 - 40"
9
+ :width="props.layout.w * 69 - 155"
10
+ :hideZeros="false"
11
+ tooltipOffset="offset"
12
+ :theme="theme"
13
+ />
14
+ <StackedChart
15
+ v-if="config.options.type === 'bar' && !redraw"
16
+ :data="data"
17
+ :names="data.names"
18
+ :id="id"
19
+ unit="Value"
20
+ :height="props.layout.h * 60 - 50"
21
+ :width="props.layout.w * 69 - 20"
22
+ :is-time="true"
23
+ tooltipOffset="offset"
24
+ :theme="theme"
25
+ />
26
+ </div>
27
+ </template>
28
+ <script setup>
29
+ import { ref, watch } from "vue";
30
+ import { LineChart, StackedChart } from "@/components";
31
+ import { parseTime } from "@/utils/timeUtils";
32
+
33
+ // stores
34
+ // props and emits
35
+ const props = defineProps({
36
+ config: Object,
37
+ obj: Object,
38
+ layout: Object,
39
+ id: String,
40
+ theme: {
41
+ type: String,
42
+ default: "light",
43
+ }
44
+ });
45
+ // states
46
+ const redraw = ref(false);
47
+ const data = ref([]);
48
+ // watcher
49
+ watch(
50
+ () => [props.layout.w, props.layout.h],
51
+ () => {
52
+ redraw.value = true;
53
+ setInterval(() => {
54
+ redraw.value = false;
55
+ }, 1);
56
+ }
57
+ );
58
+ // mounted
59
+ getData();
60
+
61
+ // function defs
62
+ function getData() {
63
+ data.value = [];
64
+ const slots = props.obj.table.rows
65
+ .sort(
66
+ (a, b) =>
67
+ parseTime(a[props.config.value.column.name]) -
68
+ parseTime(b[props.config.value.column.name])
69
+ )
70
+ .map((row) => parseTime(row[props.config.value.column.name]));
71
+ // check if using all columns
72
+ const columns = props.config.allColumns
73
+ ? props.obj.table.columns.map((col) => col.name)
74
+ : props.obj.table.columns
75
+ .map((col) => col.name)
76
+ .filter((row) =>
77
+ props.config.categories.focus.some((col) => col.name === row)
78
+ );
79
+ if (props.config.options.type === "line") {
80
+ columns.forEach((key) => {
81
+ if (key !== props.config.value.column.name) {
82
+ data.value.push({
83
+ action: key,
84
+ slots: slots,
85
+ values: props.obj.table.rows.map((row) => row[key]),
86
+ });
87
+ // flatten the data by combining the slots of same value
88
+ const temp = [];
89
+ data.value.forEach((d) => {
90
+ const flattenSlot = [];
91
+ const falttenValues = [];
92
+ let curr = d.slots[0];
93
+ let val = 0;
94
+ d.slots.forEach((slot, i) => {
95
+ const currVal = d.values[i] || 0;
96
+ if (slot.valueOf() === curr.valueOf()) {
97
+ val += currVal;
98
+ } else {
99
+ flattenSlot.push(curr);
100
+ falttenValues.push(val);
101
+ curr = slot;
102
+ val = currVal;
103
+ }
104
+ });
105
+ flattenSlot.push(curr);
106
+ falttenValues.push(val);
107
+ temp.push({
108
+ action: d.action,
109
+ slots: flattenSlot,
110
+ values: falttenValues,
111
+ });
112
+ });
113
+ data.value = temp;
114
+ }
115
+ });
116
+ } else if (props.config.options.type === "bar") {
117
+ const nameMap = {};
118
+ const values = [];
119
+ columns.forEach((key) => {
120
+ if (key !== props.config.value.column.name) {
121
+ nameMap[key] = key;
122
+ props.obj.table.rows.forEach((row, i) => {
123
+ values.push({
124
+ slot: slots[i],
125
+ name: key,
126
+ value: row[key],
127
+ });
128
+ });
129
+ }
130
+ });
131
+ data.value = {
132
+ slots: slots,
133
+ names: nameMap,
134
+ series: values,
135
+ };
136
+ }
137
+ }
138
+ </script>
@@ -0,0 +1,48 @@
1
+ <template>
2
+ <div>
3
+ <GoogleMap
4
+ :api-key="apiKey"
5
+ :style="`width: 100%; height: ${layout.h * 60 - 40}px`"
6
+ :center="
7
+ markers.length
8
+ ? markers[0].position
9
+ : { lat: 40.689247, lng: -74.044502 }
10
+ "
11
+ :zoom="15"
12
+ >
13
+ <Marker v-for="marker in markers" :options="marker" />
14
+ </GoogleMap>
15
+ </div>
16
+ </template>
17
+ <script setup>
18
+ import { ref } from "vue";
19
+ import { GoogleMap, Marker } from "vue3-google-map";
20
+
21
+ const props = defineProps({
22
+ config: Object,
23
+ obj: Object,
24
+ layout: Object,
25
+ id: String,
26
+ theme: {
27
+ type: String,
28
+ default: "light",
29
+ },
30
+ apiKey: String,
31
+ });
32
+
33
+ const markers = ref([]);
34
+ getMarkers();
35
+
36
+ function getMarkers() {
37
+ markers.value = props.obj.table.rows.map((row) => {
38
+ return {
39
+ title: row[props.config.valueColumn],
40
+ label: row[props.config.ipColumn],
41
+ position: {
42
+ lat: row.latitude,
43
+ lng: row.longitude,
44
+ },
45
+ };
46
+ });
47
+ }
48
+ </script>