@appscode/design-system 1.1.0 → 2.0.0
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 +394 -267
- 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
package/mixins/stickyContent.js
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
data() {
|
|
3
|
-
return {
|
|
4
|
-
stickyByRootRef: true,
|
|
5
|
-
topBoundary_Ref: "",
|
|
6
|
-
topBoundary_Sticky: 0,
|
|
7
|
-
contentsArray_Sticky: [],
|
|
8
|
-
isStickySectionViewed: [],
|
|
9
|
-
mutationObserver: null
|
|
10
|
-
};
|
|
11
|
-
},
|
|
12
|
-
|
|
13
|
-
mounted() {
|
|
14
|
-
if (this.stickyByRootRef) {
|
|
15
|
-
this.topBoundary_Sticky = Math.max(
|
|
16
|
-
this.$refs[this.topBoundary_Ref].getBoundingClientRect().top,
|
|
17
|
-
this.topBoundary_Sticky,
|
|
18
|
-
210
|
|
19
|
-
); // 201 is for min-top-boundary
|
|
20
|
-
}
|
|
21
|
-
this.configSticky();
|
|
22
|
-
window.addEventListener("resize", this.onWindowResize);
|
|
23
|
-
window.addEventListener("scroll", this.configSticky);
|
|
24
|
-
|
|
25
|
-
// first declare the mutation observer handler method
|
|
26
|
-
const handler = mutationList => {
|
|
27
|
-
// loop through the list of mutations
|
|
28
|
-
for (const mutation of mutationList) {
|
|
29
|
-
if (mutation.type === "childList") {
|
|
30
|
-
// react to child nodes added or removed
|
|
31
|
-
this.configSticky();
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
// Create an observer instance linked to the callback function
|
|
36
|
-
this.mutationObserver = new MutationObserver(handler);
|
|
37
|
-
// Start observing the target node for configured mutations
|
|
38
|
-
this.contentsArray_Sticky.forEach(item => {
|
|
39
|
-
this.mutationObserver.observe(this.$refs[item[0]], {
|
|
40
|
-
attributes: false,
|
|
41
|
-
childList: true,
|
|
42
|
-
subtree: true
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
beforeDestroy() {
|
|
48
|
-
window.removeEventListener("resize", this.onWindowResize);
|
|
49
|
-
window.removeEventListener("scroll", this.configSticky);
|
|
50
|
-
// detach the mutation observer
|
|
51
|
-
this.mutationObserver.disconnect();
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
methods: {
|
|
55
|
-
onWindowResize() {
|
|
56
|
-
if (this.stickyByRootRef) {
|
|
57
|
-
this.updateSticky(
|
|
58
|
-
this.topBoundary_Ref,
|
|
59
|
-
this.contentsArray_Sticky,
|
|
60
|
-
true
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
-
// initialize the data of full sticky section
|
|
66
|
-
// called at created hook
|
|
67
|
-
initStickyData(topBoundary, contentsArray, hasTopRef) {
|
|
68
|
-
if (hasTopRef) {
|
|
69
|
-
this.topBoundary_Ref = topBoundary;
|
|
70
|
-
} else {
|
|
71
|
-
this.topBoundary_Sticky = topBoundary;
|
|
72
|
-
}
|
|
73
|
-
this.stickyByRootRef = hasTopRef;
|
|
74
|
-
this.contentsArray_Sticky = contentsArray;
|
|
75
|
-
},
|
|
76
|
-
|
|
77
|
-
// to update top boundary and content array
|
|
78
|
-
updateSticky(topBoundary, contentsArray, hasTopRef) {
|
|
79
|
-
this.initStickyData(topBoundary, contentsArray, hasTopRef);
|
|
80
|
-
if (this.stickyByRootRef) {
|
|
81
|
-
this.topBoundary_Sticky = Math.max(
|
|
82
|
-
this.$refs[this.topBoundary_Ref].getBoundingClientRect().top,
|
|
83
|
-
this.topBoundary_Sticky,
|
|
84
|
-
210
|
|
85
|
-
); // 210 is for min-top-boundary
|
|
86
|
-
}
|
|
87
|
-
this.configSticky();
|
|
88
|
-
},
|
|
89
|
-
|
|
90
|
-
// to check the current sticky section
|
|
91
|
-
configSticky() {
|
|
92
|
-
this.setBottomSectionConfig(
|
|
93
|
-
this.$refs,
|
|
94
|
-
this.contentsArray_Sticky,
|
|
95
|
-
window.innerHeight,
|
|
96
|
-
this.topBoundary_Sticky
|
|
97
|
-
);
|
|
98
|
-
},
|
|
99
|
-
|
|
100
|
-
// Handle Multiple sticky section
|
|
101
|
-
setBottomSectionConfig(refs, refArray, windowHeight, topBoundary) {
|
|
102
|
-
refArray.forEach((item, idx) => {
|
|
103
|
-
const contentRef = refs[item[0]];
|
|
104
|
-
const actionRef = refs[item[1]];
|
|
105
|
-
const bound = contentRef.getBoundingClientRect();
|
|
106
|
-
|
|
107
|
-
if (actionRef.getBoundingClientRect().bottom <= windowHeight) {
|
|
108
|
-
this.isStickySectionViewed[idx] = true;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// Extra 21 for margin-top
|
|
112
|
-
if (
|
|
113
|
-
bound.top < topBoundary + 21 &&
|
|
114
|
-
bound.bottom > windowHeight - actionRef.offsetHeight
|
|
115
|
-
) {
|
|
116
|
-
if (
|
|
117
|
-
!actionRef.classList.contains("is-sticky") &&
|
|
118
|
-
this.isStickySectionViewed[idx]
|
|
119
|
-
) {
|
|
120
|
-
actionRef.classList.add("is-sticky");
|
|
121
|
-
}
|
|
122
|
-
} else {
|
|
123
|
-
if (actionRef.classList.contains("is-sticky")) {
|
|
124
|
-
actionRef.classList.remove("is-sticky");
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
},
|
|
129
|
-
|
|
130
|
-
// to remove is-sticky class
|
|
131
|
-
removeAllSticky() {
|
|
132
|
-
this.isStickySectionViewed = [];
|
|
133
|
-
this.contentsArray_Sticky.forEach((item) => {
|
|
134
|
-
const actionRef = this.$refs[item[1]];
|
|
135
|
-
if (actionRef.classList.contains("is-sticky")) {
|
|
136
|
-
actionRef.classList.remove("is-sticky");
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
};
|
package/plugins/caching.ts
DELETED
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
import { AxiosRequestConfig, AxiosResponse } from "axios";
|
|
2
|
-
import md5 from "crypto-js/md5";
|
|
3
|
-
import stringify from "fast-json-stable-stringify";
|
|
4
|
-
|
|
5
|
-
const resourceListApiRgx =
|
|
6
|
-
/^\/clusters\/([^/]+)\/([^/]+)\/proxy\/([^/]+)\/([^/]+)(\/namespaces\/([^/?]+))?\/([^/?]+)(.*)$/;
|
|
7
|
-
const usermenuUpdateApiRgx =
|
|
8
|
-
/^\/clusters\/([^/]+)\/([^/]+)\/proxy\/meta\.k8s\.appscode\.com\/([^/]+)\/usermenus\/cluster$/;
|
|
9
|
-
|
|
10
|
-
function getRequestInterceptor(config: AxiosRequestConfig) {
|
|
11
|
-
// get call
|
|
12
|
-
const { url, _recurringCall, params } = config;
|
|
13
|
-
const matchListApi = url?.match(resourceListApiRgx);
|
|
14
|
-
if (matchListApi) {
|
|
15
|
-
// url matches list / render api call
|
|
16
|
-
const [, user, cluster, group, version, , namespace, resource] =
|
|
17
|
-
matchListApi;
|
|
18
|
-
|
|
19
|
-
const suffix = `${user}.${cluster}.${group}.${version}.${resource}${
|
|
20
|
-
namespace ? ".ns." + namespace : ""
|
|
21
|
-
}${params ? ".q." + md5(stringify(params)).toString() : ""}`;
|
|
22
|
-
|
|
23
|
-
if (_recurringCall) {
|
|
24
|
-
// always send latest date time as ctag
|
|
25
|
-
return new Date().getTime();
|
|
26
|
-
} else {
|
|
27
|
-
// read ctag from local storage if exists
|
|
28
|
-
const storageKey = `ctag.${suffix}`;
|
|
29
|
-
// read local storage ctag
|
|
30
|
-
return localStorage.getItem(storageKey);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function getResponseInterceptor(resp: AxiosResponse) {
|
|
36
|
-
// get call
|
|
37
|
-
const { config, headers } = resp;
|
|
38
|
-
const { url, _recurringCall, params } = config;
|
|
39
|
-
|
|
40
|
-
// queryParams without ctag
|
|
41
|
-
const queryParamsWithoutCtag = Object.keys(params).reduce((ob, key) => {
|
|
42
|
-
if (key !== "ctag") return { ...ob, [key]: params[key] };
|
|
43
|
-
else return { ...ob };
|
|
44
|
-
}, {});
|
|
45
|
-
|
|
46
|
-
const matchListApi = url?.match(resourceListApiRgx);
|
|
47
|
-
if (matchListApi) {
|
|
48
|
-
// url matches list / render api call
|
|
49
|
-
// window.console.log(matchListApi)
|
|
50
|
-
const [, user, cluster, group, version, , namespace, resource] =
|
|
51
|
-
matchListApi;
|
|
52
|
-
|
|
53
|
-
const suffix = `${user}.${cluster}.${group}.${version}.${resource}${
|
|
54
|
-
namespace ? ".ns." + namespace : ""
|
|
55
|
-
}${
|
|
56
|
-
params ? ".q." + md5(stringify(queryParamsWithoutCtag)).toString() : ""
|
|
57
|
-
}`;
|
|
58
|
-
|
|
59
|
-
const storageKey = `etag.${suffix}`;
|
|
60
|
-
// local storage etag
|
|
61
|
-
const eTag = localStorage.getItem(storageKey);
|
|
62
|
-
// etag in header
|
|
63
|
-
const headerEtag = headers?.["etag"];
|
|
64
|
-
|
|
65
|
-
// window.console.log({ eTag, headerEtag, _recurringCall, url });
|
|
66
|
-
|
|
67
|
-
if (_recurringCall) {
|
|
68
|
-
// for recurring api call
|
|
69
|
-
if (headerEtag && headerEtag !== eTag) {
|
|
70
|
-
// etag missmatch
|
|
71
|
-
if (params.ctag) {
|
|
72
|
-
// save request query parameter ctag into local storage
|
|
73
|
-
localStorage.setItem(`ctag.${suffix}`, params.ctag);
|
|
74
|
-
}
|
|
75
|
-
// update store etag with latest header etag
|
|
76
|
-
localStorage.setItem(`etag.${suffix}`, headerEtag);
|
|
77
|
-
|
|
78
|
-
if (namespace) {
|
|
79
|
-
// for namespaced list calls if etag missmatch happens
|
|
80
|
-
// update the ctag storage for all namespaces
|
|
81
|
-
// this will force the all namespaced list call to ignore disk cache
|
|
82
|
-
localStorage.setItem(
|
|
83
|
-
`etag.${user}.${cluster}.${group}.${version}.${resource}`,
|
|
84
|
-
new Date().getTime().toString()
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
} else {
|
|
89
|
-
// not recurring api call
|
|
90
|
-
if (eTag !== headerEtag && headerEtag) {
|
|
91
|
-
// if the etag missmatches, then the data has changed
|
|
92
|
-
// update local etag
|
|
93
|
-
localStorage.setItem(storageKey, headerEtag);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
function putResponseInterceptor(resp: AxiosResponse) {
|
|
100
|
-
const { config } = resp;
|
|
101
|
-
const { url } = config;
|
|
102
|
-
const matchUsermenuUpdate = url?.match(usermenuUpdateApiRgx);
|
|
103
|
-
if (matchUsermenuUpdate) {
|
|
104
|
-
// user menu update api is called
|
|
105
|
-
const [, user, cluster, version] = matchUsermenuUpdate;
|
|
106
|
-
|
|
107
|
-
// calculate the local storage key
|
|
108
|
-
const renderStorageKey = `ctag.${user}.${cluster}.meta.k8s.appscode.com.${version}.rendermenus.q.${md5(
|
|
109
|
-
stringify({
|
|
110
|
-
apiVersion: `meta.k8s.appscode.com/${version}`,
|
|
111
|
-
kind: "RenderMenu",
|
|
112
|
-
request: {
|
|
113
|
-
menu: "cluster",
|
|
114
|
-
mode: "Accordion",
|
|
115
|
-
},
|
|
116
|
-
})
|
|
117
|
-
).toString()}`;
|
|
118
|
-
const availableMenuStorageKey = `ctag.${user}.${cluster}.meta.k8s.appscode.com.${version}.usermenus`;
|
|
119
|
-
|
|
120
|
-
// set new ctag to that storage key
|
|
121
|
-
// next time render menu is called, cached data won't be used
|
|
122
|
-
localStorage.setItem(renderStorageKey, new Date().getTime().toString());
|
|
123
|
-
// for all available menus api
|
|
124
|
-
localStorage.setItem(
|
|
125
|
-
availableMenuStorageKey,
|
|
126
|
-
new Date().getTime().toString()
|
|
127
|
-
);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
export function handleCacheFromYamls(
|
|
132
|
-
yamls: Array<{
|
|
133
|
-
apiVersion: string;
|
|
134
|
-
kind: string;
|
|
135
|
-
metadata: { name: string; namespace: string };
|
|
136
|
-
}>,
|
|
137
|
-
user: string,
|
|
138
|
-
cluster: string,
|
|
139
|
-
gkToGvrMap: Record<string, string>
|
|
140
|
-
) {
|
|
141
|
-
return function () {
|
|
142
|
-
yamls.forEach((yaml) => {
|
|
143
|
-
const { apiVersion, kind, metadata } = yaml;
|
|
144
|
-
const { namespace } = metadata || {};
|
|
145
|
-
const apiVersionMatch = apiVersion.match(/^(([^/]+)\/)?([^/]+)$/);
|
|
146
|
-
if (apiVersionMatch) {
|
|
147
|
-
// separate the group and version
|
|
148
|
-
const [, , group] = apiVersionMatch;
|
|
149
|
-
const groupKind = `${group || "core"}/${kind}`;
|
|
150
|
-
const gvr = (gkToGvrMap && gkToGvrMap[groupKind]) || "";
|
|
151
|
-
|
|
152
|
-
const storageKeyPrefix = `ctag.${user}.${cluster}.${gvr.replaceAll(
|
|
153
|
-
"/",
|
|
154
|
-
"."
|
|
155
|
-
)}`;
|
|
156
|
-
|
|
157
|
-
// clear list cache for all namespaces
|
|
158
|
-
localStorage.setItem(
|
|
159
|
-
`${storageKeyPrefix}.q.${md5(
|
|
160
|
-
stringify({ convertToTable: true })
|
|
161
|
-
).toString()}`,
|
|
162
|
-
new Date().getTime().toString()
|
|
163
|
-
);
|
|
164
|
-
// clear list cache for specific namespace
|
|
165
|
-
localStorage.setItem(
|
|
166
|
-
`${storageKeyPrefix}.ns.${namespace || "default"}.q.${md5(
|
|
167
|
-
stringify({ convertToTable: true })
|
|
168
|
-
).toString()}`,
|
|
169
|
-
new Date().getTime().toString()
|
|
170
|
-
);
|
|
171
|
-
|
|
172
|
-
// clear for genericresources and resourcesummaries
|
|
173
|
-
localStorage.setItem(
|
|
174
|
-
`ctag.${user}.${cluster}.core.k8s.appscode.com.v1alpha1.resourcesummaries.q.${md5(
|
|
175
|
-
stringify({
|
|
176
|
-
convertToTable: true,
|
|
177
|
-
labelSelector: `k8s.io/group=${group}`,
|
|
178
|
-
})
|
|
179
|
-
).toString()}`,
|
|
180
|
-
new Date().getTime().toString()
|
|
181
|
-
);
|
|
182
|
-
localStorage.setItem(
|
|
183
|
-
`ctag.${user}.${cluster}.core.k8s.appscode.com.v1alpha1.resourcesummaries.q.${md5(
|
|
184
|
-
stringify({
|
|
185
|
-
convertToTable: true,
|
|
186
|
-
labelSelector: `k8s.io/group-kind=${kind}.${group}`,
|
|
187
|
-
})
|
|
188
|
-
).toString()}`,
|
|
189
|
-
new Date().getTime().toString()
|
|
190
|
-
);
|
|
191
|
-
localStorage.setItem(
|
|
192
|
-
`ctag.${user}.${cluster}.core.k8s.appscode.com.v1alpha1.genericresources.q.${md5(
|
|
193
|
-
stringify({
|
|
194
|
-
convertToTable: true,
|
|
195
|
-
labelSelector: `k8s.io/group=${group}`,
|
|
196
|
-
})
|
|
197
|
-
).toString()}`,
|
|
198
|
-
new Date().getTime().toString()
|
|
199
|
-
);
|
|
200
|
-
localStorage.setItem(
|
|
201
|
-
`ctag.${user}.${cluster}.core.k8s.appscode.com.v1alpha1.genericresources.q.${md5(
|
|
202
|
-
stringify({
|
|
203
|
-
convertToTable: true,
|
|
204
|
-
labelSelector: `k8s.io/group-kind=${kind}.${group}`,
|
|
205
|
-
})
|
|
206
|
-
).toString()}`,
|
|
207
|
-
new Date().getTime().toString()
|
|
208
|
-
);
|
|
209
|
-
}
|
|
210
|
-
});
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
export async function requestInterceptor(config: AxiosRequestConfig) {
|
|
215
|
-
// parse the request url
|
|
216
|
-
const { method, params } = config;
|
|
217
|
-
|
|
218
|
-
let ctag;
|
|
219
|
-
|
|
220
|
-
if (method === "get") {
|
|
221
|
-
ctag = getRequestInterceptor(config);
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
return {
|
|
225
|
-
...config,
|
|
226
|
-
params: { ...params, ctag },
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
export function responseInterceptor(resp: AxiosResponse) {
|
|
231
|
-
const { config } = resp;
|
|
232
|
-
// parse the request url
|
|
233
|
-
const { method } = config;
|
|
234
|
-
|
|
235
|
-
if (method === "get") {
|
|
236
|
-
// get call
|
|
237
|
-
getResponseInterceptor(resp);
|
|
238
|
-
} else if (method === "put") {
|
|
239
|
-
putResponseInterceptor(resp);
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
return resp;
|
|
243
|
-
}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<span href="" class="task-item" :class="[statusClass]">
|
|
3
|
-
<i class="fa" :class="`fa-${statusIcon}`" />
|
|
4
|
-
{{ title }}
|
|
5
|
-
</span>
|
|
6
|
-
</template>
|
|
7
|
-
|
|
8
|
-
<script setup lang="ts">
|
|
9
|
-
import { computed, toRefs } from "vue";
|
|
10
|
-
import { TaskStatus } from "../../../typings/long-running-tasks.ts";
|
|
11
|
-
|
|
12
|
-
const props = withDefaults(
|
|
13
|
-
defineProps<{ title: string; status: TaskStatus }>(),
|
|
14
|
-
{
|
|
15
|
-
title: "",
|
|
16
|
-
status: "Pending",
|
|
17
|
-
}
|
|
18
|
-
);
|
|
19
|
-
|
|
20
|
-
const { status } = toRefs(props);
|
|
21
|
-
const statusClass = computed(() => `is-${status.value.toLowerCase()}`);
|
|
22
|
-
const statusIcon = computed(() => {
|
|
23
|
-
if (status.value === "Running" || status.value === "Started")
|
|
24
|
-
return "circle-o-notch";
|
|
25
|
-
else if (status.value === "Success") return "check-circle";
|
|
26
|
-
else if (status.value === "Failed") return "times-circle";
|
|
27
|
-
else return "spinner";
|
|
28
|
-
});
|
|
29
|
-
</script>
|
|
30
|
-
|
|
31
|
-
<style scoped lang="scss">
|
|
32
|
-
.task-item {
|
|
33
|
-
font-size: 14px;
|
|
34
|
-
display: block;
|
|
35
|
-
padding: 5px;
|
|
36
|
-
border-radius: 5px;
|
|
37
|
-
transition: all 0.3s ease-in-out;
|
|
38
|
-
&:hover {
|
|
39
|
-
background-color: var(--ac-white-light);
|
|
40
|
-
cursor: pointer;
|
|
41
|
-
}
|
|
42
|
-
&.is-active {
|
|
43
|
-
background-color: var(--ac-white-light);
|
|
44
|
-
}
|
|
45
|
-
&.is-pending {
|
|
46
|
-
color: var(--ac-gray-light);
|
|
47
|
-
i {
|
|
48
|
-
visibility: hidden;
|
|
49
|
-
}
|
|
50
|
-
&:hover {
|
|
51
|
-
background-color: transparent;
|
|
52
|
-
cursor: not-allowed;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
&.is-aborted {
|
|
56
|
-
color: var(--ac-gray-light);
|
|
57
|
-
&:hover {
|
|
58
|
-
background-color: transparent;
|
|
59
|
-
cursor: not-allowed;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
&.is-running,
|
|
63
|
-
&.is-started {
|
|
64
|
-
i {
|
|
65
|
-
color: var(--ac-primary);
|
|
66
|
-
animation-name: spin;
|
|
67
|
-
animation-duration: 1000ms;
|
|
68
|
-
animation-iteration-count: infinite;
|
|
69
|
-
animation-timing-function: linear;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
@keyframes spin {
|
|
73
|
-
from {
|
|
74
|
-
transform: rotate(0deg);
|
|
75
|
-
}
|
|
76
|
-
to {
|
|
77
|
-
transform: rotate(360deg);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
&.is-success {
|
|
82
|
-
i {
|
|
83
|
-
color: #158748;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
&.is-failed {
|
|
87
|
-
i {
|
|
88
|
-
color: #ff3729;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
</style>
|