@appscode/design-system 1.1.0 → 2.0.1
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/base/_video-player.scss +65 -0
- package/base/utilities/_all.scss +7 -5
- package/base/utilities/_colors.scss +377 -0
- package/base/utilities/_customize-bulma.scss +23 -27
- package/base/utilities/_extended.scss +39 -0
- package/base/utilities/{_default.scss → _global.scss} +192 -333
- package/base/utilities/_layouts.scss +19 -0
- package/base/utilities/_mixin.scss +11 -11
- package/base/utilities/_spacing.scss +96 -0
- package/base/utilities/_typography.scss +56 -24
- package/components/_ac-alert-box.scss +205 -263
- package/components/_ac-calendar.scss +4 -4
- package/components/_ac-code-highlight.scss +13 -16
- package/components/_ac-content-layout.scss +165 -165
- package/components/_ac-drag.scss +13 -13
- package/components/_ac-modal.scss +212 -212
- package/components/_ac-options.scss +122 -123
- package/components/_ac-select-box.scss +10 -10
- package/components/_ac-table.scss +503 -502
- package/components/_ac-tabs.scss +65 -61
- package/components/_ac-tags.scss +116 -116
- package/components/_accordion.scss +117 -0
- package/components/_add-card.scss +3 -3
- package/components/_all.scss +35 -28
- package/components/_app-drawer.scss +0 -134
- package/components/_breadcumb.scss +0 -71
- package/components/_buttons.scss +779 -779
- package/components/_card-body-wrapper.scss +5 -5
- package/components/_dashboard-header.scss +0 -115
- package/components/_direct-deploy.scss +8 -8
- package/components/_getkeeper.scss +110 -0
- package/components/_go-to-top.scss +1 -1
- package/components/_graph.scss +10 -10
- package/components/_image-upload.scss +9 -9
- package/components/_input-card.scss +232 -0
- package/components/_input.scss +573 -0
- package/components/_left-sidebar-menu.scss +452 -587
- package/components/_monaco-editor.scss +2 -2
- package/components/{_ac-multi-select.scss → _multi-select.scss} +89 -251
- package/components/_navbar.scss +786 -752
- package/components/_nested-list.scss +3 -3
- package/components/_overview-info.scss +10 -10
- package/components/_overview-page.scss +4 -4
- package/components/_pagination.scss +106 -124
- package/components/_payment-card.scss +21 -21
- package/components/_preloader.scss +1 -1
- package/components/_preview-modal.scss +18 -18
- package/components/_pricing-table.scss +14 -14
- package/components/_progress-bar.scss +73 -86
- package/components/_subscription-card.scss +22 -24
- package/components/_table-of-content.scss +8 -8
- package/components/{_ac-terminal.scss → _terminal.scss} +114 -81
- package/components/_tfa.scss +9 -9
- package/components/_transitions.scss +35 -0
- package/components/_widget-menu.scss +252 -257
- package/components/_wizard.scss +518 -793
- package/components/ac-toaster/_ac-toasted.scss +11 -16
- package/components/bbum/_activities-header.scss +1 -1
- package/components/bbum/_card-team.scss +12 -12
- package/components/bbum/_information-center.scss +21 -23
- package/components/bbum/_left-sidebar.scss +8 -8
- package/components/bbum/_mobile-desktop.scss +16 -21
- package/components/bbum/_post.scss +5 -5
- package/components/bbum/_sign-up-notification.scss +10 -10
- package/components/bbum/_single-post-preview.scss +29 -29
- package/components/bbum/_user-profile.scss +10 -10
- package/components/ui-builder/_ui-builder.scss +221 -31
- package/components/ui-builder/_vue-open-api.scss +565 -7
- package/icons/close-icon.svg +3 -0
- package/layouts/_code-preview.scss +17 -18
- package/main.scss +26 -10
- package/package.json +1 -1
- package/plugins/theme.js +11 -9
- package/plugins/vue-toaster.js +1 -1
- package/vue-components/images/icons/cluster-icon.svg +10 -0
- package/vue-components/images/icons/org-icon.svg +10 -0
- package/vue-components/plugins/time-convert.js +49 -0
- package/vue-components/types/cluster.ts +6 -0
- package/vue-components/types/importFlow.ts +16 -0
- package/vue-components/types/notification.ts +6 -0
- package/vue-components/types/previewYaml.ts +8 -0
- package/vue-components/types/table.ts +55 -0
- package/vue-components/types/theme.ts +10 -0
- package/vue-components/types/user.ts +22 -0
- package/vue-components/v2/banner/Banner.vue +1 -1
- package/vue-components/v2/button/Buttons.vue +1 -1
- package/vue-components/v2/card/Card.vue +1 -1
- package/vue-components/v2/card/OverviewCards.vue +17 -2
- package/vue-components/v2/content/ContentTable.vue +14 -9
- package/vue-components/v2/editor/FilteredFileEditor.vue +2 -2
- package/vue-components/v2/editor/ResourceKeyValueEditor.vue +21 -21
- package/vue-components/v2/icons/Ellipsis.vue +2 -1
- package/vue-components/v2/modal/Modal.vue +2 -6
- package/vue-components/v2/navbar/Appdrawer.vue +37 -12
- package/vue-components/v2/navbar/Navbar.vue +3 -3
- package/vue-components/v2/navbar/NavbarItem.vue +3 -1
- package/vue-components/v2/navbar/NavbarItemContent.vue +1 -1
- package/vue-components/v2/navbar/User.vue +5 -22
- package/vue-components/v2/pagination/Pagination.vue +66 -0
- package/vue-components/v2/sidebar/SidebarItem.vue +10 -7
- package/{components/_ac-accordion.scss → vue-components/v3/accordion/Accordion.vue} +40 -6
- package/vue-components/v3/alert/Alert.vue +238 -0
- package/vue-components/v3/alert/Toast.vue +79 -0
- package/vue-components/v3/banner/Banner.vue +10 -0
- package/vue-components/v3/breadcrumbs/Breadcrumb.vue +166 -0
- package/vue-components/v3/button/Button.vue +110 -57
- package/vue-components/v3/button/Buttons.vue +22 -0
- package/vue-components/v3/button/DownloadBtn.vue +31 -0
- package/vue-components/v3/cards/Card.vue +32 -0
- package/vue-components/v3/cards/CardContent.vue +7 -0
- package/vue-components/v3/cards/CardHeader.vue +14 -0
- package/vue-components/v3/cards/Cards.vue +7 -0
- package/vue-components/v3/cards/Cluster.vue +159 -0
- package/vue-components/v3/cards/Counter.vue +39 -0
- package/vue-components/v3/cards/FeatureCard.vue +67 -0
- package/vue-components/v3/cards/FeatureCards.vue +6 -0
- package/vue-components/v3/cards/InfoCard.vue +242 -0
- package/vue-components/v3/cards/Monitoring.vue +90 -0
- package/vue-components/v3/cards/OrgClusterCard.vue +86 -0
- package/vue-components/v3/cards/OverviewCard.vue +28 -0
- package/vue-components/v3/cards/OverviewCards.vue +39 -0
- package/vue-components/v3/cards/Payment.vue +62 -0
- package/vue-components/v3/cards/Vendor.vue +89 -0
- package/vue-components/v3/content/ContentHeader.vue +39 -30
- package/vue-components/v3/content/ContentLayout.vue +20 -0
- package/vue-components/v3/content/ContentTable.vue +44 -58
- package/vue-components/v3/dropdown/DropdownAction.vue +95 -0
- package/vue-components/v3/dropdown/DropdownDivider.vue +2 -0
- package/vue-components/v3/dropdown/DropdownItem.vue +2 -0
- package/vue-components/v3/dropdown/DropdownMenu.vue +85 -91
- package/vue-components/v3/editor/Editor.vue +117 -115
- package/vue-components/v3/editor/FilteredFileEditor.vue +325 -128
- package/vue-components/v3/editor/ResourceKeyValueEditor.vue +73 -94
- package/vue-components/v3/footer/FooterArea.vue +40 -0
- package/vue-components/v3/footer/FooterItem.vue +32 -0
- package/vue-components/v3/footer/FooterItems.vue +15 -0
- package/vue-components/v3/footer/Info.vue +25 -0
- package/vue-components/v3/footer/Status.vue +43 -0
- package/vue-components/v3/footer/Usage.vue +34 -0
- package/vue-components/v3/form/Form.vue +24 -36
- package/vue-components/v3/form/FormFooter.vue +24 -0
- package/vue-components/v3/form/FormFooterControl.vue +7 -0
- package/vue-components/v3/form/FormFooterControls.vue +7 -0
- package/vue-components/v3/form-fields/AcSingleInput.vue +21 -0
- package/vue-components/v3/form-fields/FileUpload.vue +89 -0
- package/vue-components/v3/form-fields/Input.vue +19 -15
- package/vue-components/v3/header/Header.vue +120 -26
- package/vue-components/v3/header/HeaderItem.vue +18 -0
- package/vue-components/v3/header/HeaderItems.vue +4 -0
- package/vue-components/v3/icons/Ellipsis.vue +2 -0
- package/vue-components/v3/loaders/ClusterSwitcherLoader.vue +13 -0
- package/vue-components/v3/loaders/InfoCardLoader.vue +19 -0
- package/vue-components/v3/loaders/ResourceLoader.vue +4 -12
- package/vue-components/v3/loaders/SidebarLoader.vue +4 -12
- package/vue-components/v3/loaders/SingleInfoCardLoader.vue +24 -0
- package/vue-components/v3/modal/Modal.vue +294 -95
- package/vue-components/v3/modals/DeleteConfirmationModal.vue +37 -50
- package/vue-components/v3/modals/JsonShowModal.vue +63 -68
- package/vue-components/v3/navbar/Appdrawer.vue +198 -51
- package/vue-components/v3/navbar/Navbar.vue +139 -0
- package/vue-components/v3/navbar/NavbarItem.vue +103 -0
- package/vue-components/v3/navbar/NavbarItemContent.vue +282 -0
- package/vue-components/v3/navbar/Notification.vue +207 -0
- package/vue-components/v3/navbar/ThemeMode.vue +128 -112
- package/vue-components/v3/navbar/User.vue +431 -268
- package/vue-components/v3/notification/AlertBox.vue +266 -39
- package/vue-components/v3/notification/Notification.vue +50 -44
- package/vue-components/v3/notification/NotificationItem.vue +51 -19
- package/vue-components/v3/option-dots/Options.vue +197 -0
- package/vue-components/v3/pagination/Pagination.vue +216 -102
- package/vue-components/v3/preloader/Preloader.vue +23 -0
- package/vue-components/v3/searchbars/SearchBar.vue +50 -34
- package/vue-components/v3/sidebar/AccentColorPicker.vue +97 -0
- package/vue-components/v3/sidebar/ClusterSwitcher.vue +71 -86
- package/vue-components/v3/sidebar/Sidebar.vue +239 -0
- package/vue-components/v3/sidebar/SidebarBody.vue +14 -0
- package/vue-components/v3/sidebar/SidebarFooter.vue +89 -0
- package/vue-components/v3/sidebar/SidebarHeader.vue +131 -0
- package/vue-components/v3/sidebar/SidebarItem.vue +62 -0
- package/vue-components/v3/sidebar/SidebarItemWithDropDown.vue +101 -104
- package/vue-components/v3/sidebar/SidebarMenuList.vue +9 -0
- package/vue-components/v3/sidebar/Steps.vue +152 -0
- package/vue-components/v3/sidebar/sidebar-tabs/SidebarTabs.vue +204 -0
- package/vue-components/v3/sidebar/sidebar-tabs/SidebarTabsLayout.vue +44 -0
- package/vue-components/v3/sidebar/sidebar-tabs/TabsContent.vue +99 -0
- package/vue-components/v3/tab/TabItem.vue +10 -12
- package/vue-components/v3/tab/Tabs.vue +36 -0
- package/vue-components/v3/tab/TabsBody.vue +7 -0
- package/vue-components/v3/table/EmptyTableInfo.vue +8 -0
- package/vue-components/v3/table/FakeTableCell.vue +22 -31
- package/vue-components/v3/table/InfoTable.vue +89 -61
- package/vue-components/v3/table/MultiInfoTable.vue +72 -95
- package/vue-components/v3/table/Table.vue +596 -157
- package/vue-components/v3/table/TableCell.vue +13 -24
- package/vue-components/v3/table/TableContainer.vue +50 -28
- package/vue-components/v3/table/TableRow.vue +65 -87
- package/vue-components/v3/table/table-cell/ArrayCell.vue +94 -103
- package/vue-components/v3/table/table-cell/CellValue.vue +74 -106
- package/vue-components/v3/table/table-cell/GenericCell.vue +43 -42
- package/vue-components/v3/table/table-cell/ObjectCell.vue +91 -101
- package/vue-components/v3/table/table-cell/ValueWithModal.vue +22 -31
- package/vue-components/v3/tabs/EditorTabs.vue +18 -24
- package/vue-components/v3/tag/Tag.vue +16 -12
- package/vue-components/v3/tag/Tags.vue +7 -0
- package/base/utilities/_derived-variables.scss +0 -25
- package/base/utilities/_initial-variables.scss +0 -215
- package/base/utilities/dark-theme.scss +0 -26
- package/components/_ac-card.scss +0 -597
- package/components/_ac-input.scss +0 -876
- package/mixins/stickyContent.js +0 -141
- package/plugins/caching.ts +0 -243
- package/vue-components/v3/long-running-tasks/LongRunningTaskItem.vue +0 -92
- package/vue-components/v3/modals/LongRunningTasksModal.vue +0 -400
- package/vue-components/v3/terminal/LongRunningTaskTerminal.vue +0 -148
- /package/components/{_ac-report.scss → _report.scss} +0 -0
|
@@ -1,400 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<modal
|
|
3
|
-
:open="open"
|
|
4
|
-
:title="title"
|
|
5
|
-
:is-close-option-disabled="!enableModalClose"
|
|
6
|
-
:ignore-outside-click="true"
|
|
7
|
-
:hide-action-footer="!enableModalFooter"
|
|
8
|
-
@closemodal="$emit('close')"
|
|
9
|
-
>
|
|
10
|
-
<div v-if="connectionError" class="task-simple-wrapper">
|
|
11
|
-
<div class="task-cogs-icon">
|
|
12
|
-
<i class="fa fa-times-circle has-text-danger fa-5x fa-fw"></i>
|
|
13
|
-
</div>
|
|
14
|
-
<div class="task-log">
|
|
15
|
-
<span class="task-title">
|
|
16
|
-
<i class="fa fa-times-circle mr-5 is-failed" />
|
|
17
|
-
<span> Connection error </span>
|
|
18
|
-
</span>
|
|
19
|
-
<span>{{ connectionError }}</span>
|
|
20
|
-
</div>
|
|
21
|
-
</div>
|
|
22
|
-
<div
|
|
23
|
-
v-else-if="isNatsConnectionLoading || !activeStepId"
|
|
24
|
-
class="is-justify-content-center"
|
|
25
|
-
:class="simple ? 'task-simple-wrapper' : 'task-complex-wrapper'"
|
|
26
|
-
>
|
|
27
|
-
<preloader
|
|
28
|
-
:style="{ height: '100%' }"
|
|
29
|
-
class="is-fullheight"
|
|
30
|
-
message="Connecting..."
|
|
31
|
-
/>
|
|
32
|
-
</div>
|
|
33
|
-
<div v-else-if="simple" class="task-simple-wrapper">
|
|
34
|
-
<div class="task-cogs-icon">
|
|
35
|
-
<i class="fa fa-cog fa-spin fa-5x fa-fw"></i>
|
|
36
|
-
<span class="is-flex is-flex-direction-column">
|
|
37
|
-
<i class="fa fa-cog fa-spin fa-3x fa-bw"></i>
|
|
38
|
-
<i class="fa fa-cog fa-spin fa-3x fa-bw"></i>
|
|
39
|
-
</span>
|
|
40
|
-
</div>
|
|
41
|
-
<div class="task-log">
|
|
42
|
-
<span class="task-title">
|
|
43
|
-
<i
|
|
44
|
-
v-if="activeTask?.status === 'Running'"
|
|
45
|
-
class="fa fa-circle-o-notch fa-spin mr-5"
|
|
46
|
-
/>
|
|
47
|
-
<i
|
|
48
|
-
v-else-if="activeTask?.status === 'Success'"
|
|
49
|
-
class="fa fa-check-circle mr-5 is-success"
|
|
50
|
-
/>
|
|
51
|
-
<i
|
|
52
|
-
v-else-if="activeTask?.status === 'Failed'"
|
|
53
|
-
class="fa fa-times-circle mr-5 is-failed"
|
|
54
|
-
/>
|
|
55
|
-
<span>
|
|
56
|
-
{{ activeTask?.step }}
|
|
57
|
-
</span>
|
|
58
|
-
</span>
|
|
59
|
-
<span>{{ activeTask?.logs[activeTask?.logs.length - 1] }}</span>
|
|
60
|
-
</div>
|
|
61
|
-
</div>
|
|
62
|
-
<div v-else class="task-complex-wrapper">
|
|
63
|
-
<ul class="task-list">
|
|
64
|
-
<li v-for="task in tasks" :key="task.step">
|
|
65
|
-
<long-running-task-item
|
|
66
|
-
:title="task.step"
|
|
67
|
-
:status="task.status"
|
|
68
|
-
:class="{ 'is-active': activeStepId === task.id }"
|
|
69
|
-
@click="activeStepId = task.id"
|
|
70
|
-
/>
|
|
71
|
-
</li>
|
|
72
|
-
</ul>
|
|
73
|
-
<long-running-task-terminal
|
|
74
|
-
:key="activeTask?.id"
|
|
75
|
-
:theme="theme"
|
|
76
|
-
:logs="activeTask?.logs"
|
|
77
|
-
class="task-log"
|
|
78
|
-
/>
|
|
79
|
-
</div>
|
|
80
|
-
|
|
81
|
-
<template #modal-footer-controls>
|
|
82
|
-
<ac-button
|
|
83
|
-
title="Close"
|
|
84
|
-
modifier-classes="is-outlined"
|
|
85
|
-
@click.stop="$emit('close')"
|
|
86
|
-
/>
|
|
87
|
-
<ac-button
|
|
88
|
-
v-if="showSuccessButton"
|
|
89
|
-
:title="successCtx?.btnTitle"
|
|
90
|
-
:is-loader-active="successCtx?.isLoaderActive"
|
|
91
|
-
modifier-classes="is-primary"
|
|
92
|
-
icon-class="step-forward"
|
|
93
|
-
@click="successCtx.onSuccessBtnClick"
|
|
94
|
-
/>
|
|
95
|
-
<ac-button
|
|
96
|
-
v-if="showReportButton"
|
|
97
|
-
title="Report Issue"
|
|
98
|
-
modifier-classes="is-danger"
|
|
99
|
-
icon-class="external-link"
|
|
100
|
-
@click="onReportIssueClick"
|
|
101
|
-
/>
|
|
102
|
-
</template>
|
|
103
|
-
</modal>
|
|
104
|
-
</template>
|
|
105
|
-
<script setup lang="ts">
|
|
106
|
-
import {
|
|
107
|
-
computed,
|
|
108
|
-
getCurrentInstance,
|
|
109
|
-
onBeforeUnmount,
|
|
110
|
-
Ref,
|
|
111
|
-
toRefs,
|
|
112
|
-
watch,
|
|
113
|
-
} from "vue";
|
|
114
|
-
import { defineAsyncComponent, ref } from "vue";
|
|
115
|
-
import { Task, TaskLog } from "../../../typings/long-running-tasks.ts";
|
|
116
|
-
import { Subscription, StringCodec } from "nats.ws";
|
|
117
|
-
|
|
118
|
-
const Modal = defineAsyncComponent(() => import("../modal/Modal.vue"));
|
|
119
|
-
const LongRunningTaskItem = defineAsyncComponent(
|
|
120
|
-
() => import("../long-running-tasks/LongRunningTaskItem.vue")
|
|
121
|
-
);
|
|
122
|
-
const LongRunningTaskTerminal = defineAsyncComponent(
|
|
123
|
-
() => import("../terminal/LongRunningTaskTerminal.vue")
|
|
124
|
-
);
|
|
125
|
-
const Preloader = defineAsyncComponent(
|
|
126
|
-
() => import("../../v2/preloader/Preloader.vue")
|
|
127
|
-
);
|
|
128
|
-
const AcButton = defineAsyncComponent(() => import("../button/Button.vue"));
|
|
129
|
-
|
|
130
|
-
defineEmits(["close"]);
|
|
131
|
-
|
|
132
|
-
const props = withDefaults(
|
|
133
|
-
defineProps<{
|
|
134
|
-
open: boolean;
|
|
135
|
-
theme: string;
|
|
136
|
-
title: string;
|
|
137
|
-
simple: boolean;
|
|
138
|
-
natsSubject: string;
|
|
139
|
-
isNatsConnectionLoading: boolean;
|
|
140
|
-
errorCtx?: {
|
|
141
|
-
connectionError: string;
|
|
142
|
-
onError: (msg: string) => void;
|
|
143
|
-
};
|
|
144
|
-
successCtx?: {
|
|
145
|
-
btnTitle?: string;
|
|
146
|
-
isLoaderActive?: boolean;
|
|
147
|
-
onSuccess: () => void;
|
|
148
|
-
onSuccessBtnClick?: () => void;
|
|
149
|
-
};
|
|
150
|
-
}>(),
|
|
151
|
-
{
|
|
152
|
-
open: true,
|
|
153
|
-
theme: "light",
|
|
154
|
-
simple: true,
|
|
155
|
-
title: "Sample title",
|
|
156
|
-
natsSubject: "",
|
|
157
|
-
isNatsConnectionLoading: false,
|
|
158
|
-
errorCtx: undefined,
|
|
159
|
-
successCtx: undefined,
|
|
160
|
-
}
|
|
161
|
-
);
|
|
162
|
-
|
|
163
|
-
const { natsSubject, open, errorCtx, successCtx } = toRefs(props);
|
|
164
|
-
const connectionError = computed(() => errorCtx.value?.connectionError);
|
|
165
|
-
const currentInstance = getCurrentInstance();
|
|
166
|
-
const $nats = currentInstance?.appContext.config.globalProperties.$nc;
|
|
167
|
-
let subscription: Subscription;
|
|
168
|
-
|
|
169
|
-
const tasks: Ref<Array<Task>> = ref([]);
|
|
170
|
-
const activeStepId: Ref<string> = ref("");
|
|
171
|
-
// to maintain stepId to stepIndex map
|
|
172
|
-
// to find active task faster
|
|
173
|
-
const idToStepIndex: Ref<Record<string, number>> = ref({});
|
|
174
|
-
const activeTask = computed(() => {
|
|
175
|
-
const task = tasks.value[idToStepIndex.value[activeStepId.value]];
|
|
176
|
-
return task;
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
function handleTaskLog(log: TaskLog) {
|
|
180
|
-
if (log.step) {
|
|
181
|
-
// log has a step
|
|
182
|
-
// so add new task
|
|
183
|
-
tasks.value.push({
|
|
184
|
-
...log,
|
|
185
|
-
logs: [(log.msg && log.msg) || ""],
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
// recent pushed task index
|
|
189
|
-
const latestStepIndex = tasks.value.length - 1;
|
|
190
|
-
|
|
191
|
-
// map taskid to stepIndex
|
|
192
|
-
idToStepIndex.value[log.id] = latestStepIndex;
|
|
193
|
-
|
|
194
|
-
// update active step index for first task
|
|
195
|
-
// or if current active step is in latest step
|
|
196
|
-
if (
|
|
197
|
-
latestStepIndex === 0 ||
|
|
198
|
-
latestStepIndex === idToStepIndex.value[activeStepId.value] + 1
|
|
199
|
-
) {
|
|
200
|
-
activeStepId.value = log.id;
|
|
201
|
-
}
|
|
202
|
-
} else {
|
|
203
|
-
// get active task
|
|
204
|
-
const task = tasks.value[idToStepIndex.value[log.id]];
|
|
205
|
-
if (task) {
|
|
206
|
-
task.status = log.status;
|
|
207
|
-
if (log.status === "Failed") {
|
|
208
|
-
task.logs.push(log.error || "");
|
|
209
|
-
errorCtx.value?.onError(log.error);
|
|
210
|
-
} else {
|
|
211
|
-
task.logs.push(log.msg || "");
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
async function subscribeToChannel(channelId: string) {
|
|
218
|
-
subscription = $nats?.subscribe(channelId);
|
|
219
|
-
|
|
220
|
-
console.log("Started listening", channelId);
|
|
221
|
-
|
|
222
|
-
if (subscription) {
|
|
223
|
-
// listen to channel events
|
|
224
|
-
for await (const msg of subscription) {
|
|
225
|
-
console.log("Long Running Tasks Modal=>");
|
|
226
|
-
console.log({ data: StringCodec().decode(msg.data) });
|
|
227
|
-
const log: TaskLog = JSON.parse(StringCodec().decode(msg.data));
|
|
228
|
-
console.log({ log });
|
|
229
|
-
handleTaskLog(log);
|
|
230
|
-
}
|
|
231
|
-
console.log("Stopped listening", channelId);
|
|
232
|
-
console.log("Closed Channel", channelId);
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
watch(
|
|
237
|
-
natsSubject,
|
|
238
|
-
(n) => {
|
|
239
|
-
if (n) {
|
|
240
|
-
subscribeToChannel(n);
|
|
241
|
-
}
|
|
242
|
-
},
|
|
243
|
-
{ immediate: true }
|
|
244
|
-
);
|
|
245
|
-
|
|
246
|
-
watch(open, (n) => {
|
|
247
|
-
if (!n) {
|
|
248
|
-
subscription && subscription.unsubscribe();
|
|
249
|
-
}
|
|
250
|
-
});
|
|
251
|
-
onBeforeUnmount(() => {
|
|
252
|
-
subscription && subscription.unsubscribe();
|
|
253
|
-
});
|
|
254
|
-
|
|
255
|
-
const longRunningTaskStatus = computed(() => {
|
|
256
|
-
let successTaskCount = 0;
|
|
257
|
-
let failedTaskCount = 0;
|
|
258
|
-
|
|
259
|
-
// get count of success and failed task
|
|
260
|
-
tasks.value.forEach((task) => {
|
|
261
|
-
if (task?.status === "Success") successTaskCount++;
|
|
262
|
-
else if (task?.status === "Failed") failedTaskCount++;
|
|
263
|
-
});
|
|
264
|
-
|
|
265
|
-
if (tasks.value.length === 0) return "NotStarted";
|
|
266
|
-
// if all the task has been successful
|
|
267
|
-
else if (successTaskCount === tasks.value.length) {
|
|
268
|
-
return "Success";
|
|
269
|
-
}
|
|
270
|
-
// if all the task has been completed and some tasks are failed
|
|
271
|
-
else if (
|
|
272
|
-
failedTaskCount &&
|
|
273
|
-
successTaskCount + failedTaskCount === tasks.value.length
|
|
274
|
-
) {
|
|
275
|
-
return "Failed";
|
|
276
|
-
} else return "Pending";
|
|
277
|
-
});
|
|
278
|
-
|
|
279
|
-
// modal close / footer feature
|
|
280
|
-
const enableModalClose = computed(() => {
|
|
281
|
-
return (
|
|
282
|
-
connectionError.value ||
|
|
283
|
-
longRunningTaskStatus.value === "Failed" ||
|
|
284
|
-
longRunningTaskStatus.value === "Success"
|
|
285
|
-
);
|
|
286
|
-
});
|
|
287
|
-
const enableModalFooter = computed(() => {
|
|
288
|
-
return showReportButton.value || showSuccessButton.value;
|
|
289
|
-
});
|
|
290
|
-
|
|
291
|
-
// generate report issue title with error step title
|
|
292
|
-
const getReportIssueInfo = (): { title: string; body: string } => {
|
|
293
|
-
const stepTitlesFromErrorTasks: Array<string> = [];
|
|
294
|
-
const stepLogsFromErrorTasks: Array<string> = [];
|
|
295
|
-
tasks.value.forEach((task) => {
|
|
296
|
-
// if this taskLog is error task, push it to array
|
|
297
|
-
if (task.error) {
|
|
298
|
-
stepTitlesFromErrorTasks.push(task?.step);
|
|
299
|
-
stepLogsFromErrorTasks.push(task?.logs[task?.logs?.length - 1] || "");
|
|
300
|
-
}
|
|
301
|
-
});
|
|
302
|
-
// return final object
|
|
303
|
-
return {
|
|
304
|
-
title: stepTitlesFromErrorTasks.join(", "),
|
|
305
|
-
body: stepLogsFromErrorTasks.join(", "),
|
|
306
|
-
};
|
|
307
|
-
};
|
|
308
|
-
|
|
309
|
-
// report button
|
|
310
|
-
const showReportButton = computed(
|
|
311
|
-
() => longRunningTaskStatus.value === "Failed"
|
|
312
|
-
);
|
|
313
|
-
function onReportIssueClick() {
|
|
314
|
-
const url = `https://github.com/bytebuilders/community/issues/new?title=Chart Install: ${
|
|
315
|
-
getReportIssueInfo().title
|
|
316
|
-
}&labels[]=bug&body=${window.location.href} %0A%0A %60%60%60 %0A ${
|
|
317
|
-
getReportIssueInfo().body
|
|
318
|
-
} %0A %60%60%60`;
|
|
319
|
-
window.open(url, "_blank");
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
// success button
|
|
323
|
-
const showSuccessButton = computed(
|
|
324
|
-
() =>
|
|
325
|
-
longRunningTaskStatus.value === "Success" && !!successCtx.value?.btnTitle
|
|
326
|
-
);
|
|
327
|
-
|
|
328
|
-
// execute on success and on error functions
|
|
329
|
-
watch(longRunningTaskStatus, (n) => {
|
|
330
|
-
if (n === "Success") {
|
|
331
|
-
successCtx.value.onSuccess();
|
|
332
|
-
} else if (n === "Failed") {
|
|
333
|
-
errorCtx.value?.onError("Operation Failed");
|
|
334
|
-
}
|
|
335
|
-
});
|
|
336
|
-
</script>
|
|
337
|
-
|
|
338
|
-
<style scoped lang="scss">
|
|
339
|
-
.task-simple-wrapper {
|
|
340
|
-
display: flex;
|
|
341
|
-
flex-direction: column;
|
|
342
|
-
justify-content: space-between;
|
|
343
|
-
width: 40vw;
|
|
344
|
-
height: 40vh;
|
|
345
|
-
.task-cogs-icon {
|
|
346
|
-
width: 100%;
|
|
347
|
-
height: 70%;
|
|
348
|
-
display: flex;
|
|
349
|
-
align-items: center;
|
|
350
|
-
justify-content: center;
|
|
351
|
-
font-size: 20px;
|
|
352
|
-
color: var(--ac-primary);
|
|
353
|
-
}
|
|
354
|
-
.task-log {
|
|
355
|
-
width: 100%;
|
|
356
|
-
height: 30%;
|
|
357
|
-
display: flex;
|
|
358
|
-
flex-direction: column;
|
|
359
|
-
align-items: center;
|
|
360
|
-
justify-content: center;
|
|
361
|
-
.task-title {
|
|
362
|
-
span,
|
|
363
|
-
i {
|
|
364
|
-
font-size: 16px;
|
|
365
|
-
}
|
|
366
|
-
i {
|
|
367
|
-
color: var(--ac-primary);
|
|
368
|
-
&.is-success {
|
|
369
|
-
color: #158748;
|
|
370
|
-
}
|
|
371
|
-
&.is-failed {
|
|
372
|
-
color: #ff3729;
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
font-weight: 500;
|
|
376
|
-
}
|
|
377
|
-
span {
|
|
378
|
-
font-size: 14px;
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
.task-complex-wrapper {
|
|
383
|
-
display: flex;
|
|
384
|
-
flex-direction: row;
|
|
385
|
-
justify-content: space-between;
|
|
386
|
-
width: 60vw;
|
|
387
|
-
height: 60vh;
|
|
388
|
-
|
|
389
|
-
.task-list {
|
|
390
|
-
width: 25%;
|
|
391
|
-
height: 100%;
|
|
392
|
-
}
|
|
393
|
-
.task-log {
|
|
394
|
-
width: 70%;
|
|
395
|
-
height: 100%;
|
|
396
|
-
border-radius: 1rem;
|
|
397
|
-
font-size: 13px;
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
</style>
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div ref="terminalRef" class="terminal-body"></div>
|
|
3
|
-
</template>
|
|
4
|
-
|
|
5
|
-
<script setup lang="ts">
|
|
6
|
-
import { computed, nextTick, ref, toRefs, watch, watchPostEffect } from "vue";
|
|
7
|
-
import { Terminal } from "xterm";
|
|
8
|
-
import { FitAddon } from "xterm-addon-fit";
|
|
9
|
-
import { WebglAddon } from "xterm-addon-webgl";
|
|
10
|
-
import { Material, MaterialDark } from "xterm-theme"; //https://github.com/ysk2014/xterm-theme/tree/master/src/iterm
|
|
11
|
-
|
|
12
|
-
const props = withDefaults(
|
|
13
|
-
defineProps<{
|
|
14
|
-
theme: string;
|
|
15
|
-
logs: string[];
|
|
16
|
-
}>(),
|
|
17
|
-
{ theme: "light", logs: () => [] }
|
|
18
|
-
);
|
|
19
|
-
// terminal print logic
|
|
20
|
-
const { logs, theme } = toRefs(props);
|
|
21
|
-
const lastPrintIdx = ref(0);
|
|
22
|
-
watch(
|
|
23
|
-
logs,
|
|
24
|
-
(n) => {
|
|
25
|
-
if (n.length > lastPrintIdx.value) {
|
|
26
|
-
nextTick(() => {
|
|
27
|
-
writeOnTerminal(n.slice(lastPrintIdx.value).join("\n"));
|
|
28
|
-
lastPrintIdx.value = n.length;
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
{ immediate: true, deep: true }
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
//theme
|
|
36
|
-
const bodyBgc = computed(() =>
|
|
37
|
-
theme.value === "light" ? "#eaeaea" : "#232322"
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
// xterm component logic
|
|
41
|
-
const terminalRef = ref<HTMLElement>();
|
|
42
|
-
const terminal = new Terminal({
|
|
43
|
-
windowsMode: false,
|
|
44
|
-
theme: theme.value === "light" ? Material : MaterialDark,
|
|
45
|
-
});
|
|
46
|
-
const fitAddon = new FitAddon();
|
|
47
|
-
terminal.loadAddon(fitAddon);
|
|
48
|
-
const webGlAddon = new WebglAddon();
|
|
49
|
-
webGlAddon.onContextLoss(() => {
|
|
50
|
-
webGlAddon.dispose();
|
|
51
|
-
});
|
|
52
|
-
watchPostEffect(() => {
|
|
53
|
-
if (terminalRef.value) {
|
|
54
|
-
terminal.open(terminalRef.value);
|
|
55
|
-
fitAddon.fit();
|
|
56
|
-
terminal.focus();
|
|
57
|
-
terminal.loadAddon(webGlAddon);
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
function writeOnTerminal(msg: string) {
|
|
61
|
-
const lines = msg.split("\n");
|
|
62
|
-
lines.forEach((line, index) => {
|
|
63
|
-
if (lines.length === 1 || index < lines.length - 1) terminal.writeln(line);
|
|
64
|
-
else terminal.write(line);
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
</script>
|
|
68
|
-
|
|
69
|
-
<style lang="scss">
|
|
70
|
-
.terminal-body {
|
|
71
|
-
width: 100%;
|
|
72
|
-
height: 100%;
|
|
73
|
-
background-color: v-bind(bodyBgc);
|
|
74
|
-
padding: 5px 0px 0px 10px;
|
|
75
|
-
|
|
76
|
-
// for terminal scroll bar style
|
|
77
|
-
.xterm .xterm-viewport {
|
|
78
|
-
&::-webkit-scrollbar {
|
|
79
|
-
border-radius: 50px;
|
|
80
|
-
width: 3px;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
&::-moz-scrollbar {
|
|
84
|
-
border-radius: 50px;
|
|
85
|
-
width: 3px;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
&::-ms-scrollbar {
|
|
89
|
-
border-radius: 50px;
|
|
90
|
-
width: 3px;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
&::-webkit-scrollbar:hover {
|
|
94
|
-
width: 7px;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
&::-moz-scrollbar:hover {
|
|
98
|
-
width: 7px;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
&::-ms-scrollbar:hover {
|
|
102
|
-
width: 7px;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
&::-webkit-scrollbar-thumb {
|
|
106
|
-
background-color: #929292;
|
|
107
|
-
border-radius: 50px;
|
|
108
|
-
height: 2px !important;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
&::-moz-scrollbar-thumb {
|
|
112
|
-
background-color: #929292;
|
|
113
|
-
border-radius: 50px;
|
|
114
|
-
height: 2px !important;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
&::-ms-scrollbar-thumb {
|
|
118
|
-
background-color: #929292;
|
|
119
|
-
border-radius: 50px;
|
|
120
|
-
height: 2px !important;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
&::-webkit-scrollbar-thumb:hover {
|
|
124
|
-
background-color: #929292;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
&::-moz-scrollbar-thumb:hover {
|
|
128
|
-
background-color: #929292;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
&::-ms-scrollbar-thumb:hover {
|
|
132
|
-
background-color: #929292;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
&:hover::-webkit-scrollbar-corner {
|
|
136
|
-
height: 40px;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
&:hover::-moz-scrollbar-corner {
|
|
140
|
-
height: 40px;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
&:hover::-ms-scrollbar-corner {
|
|
144
|
-
height: 40px;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
</style>
|
|
File without changes
|