@appscode/design-system 0.0.21-alpha.3 → 0.4.27
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/utilities/_all.scss +7 -0
- package/base/utilities/_customize-bulma.scss +191 -0
- package/base/utilities/_default.scss +319 -110
- package/base/utilities/_derived-variables.scss +8 -15
- package/base/utilities/_grid.scss +29 -0
- package/base/utilities/_initial-variables.scss +111 -72
- package/base/utilities/_mixin.scss +90 -10
- package/base/utilities/_typography.scss +29 -19
- package/base/utilities/dark-theme.scss +26 -0
- package/components/_ac-accordion.scss +15 -5
- package/components/_ac-alert-box.scss +109 -26
- package/components/_ac-card.scss +71 -24
- package/components/_ac-code-highlight.scss +7 -1
- package/components/_ac-content-layout.scss +5 -5
- package/components/_ac-drag.scss +8 -6
- package/components/_ac-input.scss +191 -37
- package/components/_ac-modal.scss +6 -5
- package/components/_ac-multi-select.scss +281 -23
- package/components/_ac-options.scss +31 -16
- package/components/_ac-report.scss +53 -0
- package/components/_ac-select-box.scss +15 -5
- package/components/_ac-table.scss +160 -39
- package/components/_ac-tabs.scss +86 -23
- package/components/_ac-tags.scss +87 -2
- package/components/_ac-terminal.scss +270 -0
- package/components/_all.scss +28 -0
- package/components/_app-drawer.scss +134 -0
- package/components/_breadcumb.scss +8 -3
- package/components/_buttons.scss +96 -62
- package/components/_card-body-wrapper.scss +3 -3
- package/components/_dashboard-header.scss +33 -1
- package/components/_direct-deploy.scss +69 -0
- package/components/_go-to-top.scss +1 -1
- package/components/_graph.scss +45 -0
- package/components/_image-upload.scss +6 -4
- package/components/_left-sidebar-menu.scss +212 -52
- package/components/_monaco-editor.scss +1 -1
- package/components/_navbar.scss +193 -31
- package/components/_overview-info.scss +4 -4
- package/components/_overview-page.scss +1 -2
- package/components/_pagination.scss +45 -7
- package/components/_payment-card.scss +28 -12
- package/components/_preloader.scss +1 -1
- package/components/_preview-modal.scss +22 -9
- package/components/_pricing-table.scss +1 -1
- package/components/_progress-bar.scss +5 -5
- package/components/_subscription-card.scss +15 -8
- package/components/_table-of-content.scss +1 -1
- package/components/_tfa.scss +69 -0
- package/components/_transitions.scss +261 -0
- package/components/_widget-menu.scss +9 -9
- package/components/_wizard.scss +33 -20
- package/components/ac-toaster/_ac-toasted.scss +40 -8
- package/components/bbum/_all.scss +9 -0
- package/components/bbum/_card-team.scss +18 -10
- package/components/bbum/_information-center.scss +19 -5
- package/components/bbum/_mobile-desktop.scss +6 -6
- package/components/bbum/_post.scss +5 -4
- package/components/bbum/_sign-up-notification.scss +6 -6
- package/components/bbum/_single-post-preview.scss +10 -10
- package/components/bbum/_user-profile.scss +97 -90
- package/components/ui-builder/_ui-builder.scss +98 -21
- package/components/ui-builder/_vue-open-api.scss +104 -0
- package/layouts/_404.scss +159 -0
- package/layouts/_all.scss +2 -0
- package/layouts/_code-preview.scss +19 -8
- package/main.scss +6 -53
- package/package.json +4 -7
- package/plugins/caching.ts +243 -0
- package/plugins/theme.js +142 -0
- package/plugins/time-convert.js +49 -0
- package/plugins/vue-toaster.js +10 -6
- package/vue-components/v2/banner/Banner.vue +2 -2
- package/vue-components/v2/breadcrumbs/Breadcrumb.vue +97 -0
- package/vue-components/v2/button/Button.vue +10 -1
- package/vue-components/v2/button/DownloadBtn.vue +45 -0
- package/vue-components/v2/card/Card.vue +1 -0
- package/vue-components/v2/card/CardContent.vue +5 -0
- package/vue-components/v2/card/CardHeader.vue +12 -0
- package/vue-components/v2/card/OverviewCard.vue +10 -0
- package/vue-components/v2/card/OverviewCards.vue +5 -0
- package/vue-components/v2/card/PaymentCard.vue +69 -0
- package/vue-components/v2/card/PaymentCardOptionButtons.vue +35 -0
- package/vue-components/v2/card/PaymentCards.vue +44 -0
- package/vue-components/v2/content/ContentHeader.vue +9 -5
- package/vue-components/v2/content/ContentTable.vue +12 -7
- package/vue-components/v2/editor/Editor.vue +38 -5
- package/vue-components/v2/editor/FilteredFileEditor.vue +189 -0
- package/vue-components/v2/editor/MonacoEditor.vue +125 -0
- package/vue-components/v2/editor/ResourceKeyValueEditor.vue +209 -0
- package/vue-components/v2/form/Form.vue +12 -7
- package/vue-components/v2/form-fields/Input.vue +1 -1
- package/vue-components/v2/header/Header.vue +0 -1
- package/vue-components/v2/loaders/ResourceLoader.vue +101 -0
- package/vue-components/v2/loaders/SidebarLoader.vue +43 -0
- package/vue-components/v2/modal/Modal.vue +40 -7
- package/vue-components/v2/modals/DeleteConfirmationModal.vue +79 -0
- package/vue-components/v2/modals/JsonShowModal.vue +12 -3
- package/vue-components/v2/navbar/Appdrawer.vue +10 -9
- package/vue-components/v2/navbar/ThemeMode.vue +120 -0
- package/vue-components/v2/navbar/User.vue +229 -17
- package/vue-components/v2/notification/Notification.vue +101 -0
- package/vue-components/v2/notification/NotificationItem.vue +44 -0
- package/vue-components/v2/pagination/Pagination.vue +24 -4
- package/vue-components/v2/preloader/Preloader.vue +5 -5
- package/vue-components/v2/sidebar/ClusterSwitcher.vue +126 -0
- package/vue-components/v2/sidebar/SidebarItem.vue +24 -2
- package/vue-components/v2/sidebar/SidebarItemWithDropDown.vue +19 -20
- package/vue-components/v2/tab/TabItem.vue +1 -1
- package/vue-components/v2/table/FakeTableCell.vue +36 -0
- package/vue-components/v2/table/InfoTable.vue +13 -3
- package/vue-components/v2/table/NarrowTable.vue +0 -2
- package/vue-components/v2/table/Table.vue +170 -10
- package/vue-components/v2/table/TableRow.vue +29 -2
- package/vue-components/v2/table/table-cell/CellValue.vue +33 -4
- package/vue-components/v2/table/table-cell/GenericCell.vue +56 -0
- package/vue-components/v2/table/table-cell/ObjectCell.vue +4 -1
- package/vue-components/v2/tabs/EditorTabs.vue +1 -1
- package/vue-components/v3/button/Button.vue +78 -0
- package/vue-components/v3/content/ContentHeader.vue +55 -0
- package/vue-components/v3/content/ContentTable.vue +83 -0
- package/vue-components/v3/dropdown/DropdownDivider.vue +3 -0
- package/vue-components/v3/dropdown/DropdownItem.vue +5 -0
- package/vue-components/v3/dropdown/DropdownMenu.vue +111 -0
- package/vue-components/v3/editor/Editor.vue +160 -0
- package/vue-components/v3/editor/FilteredFileEditor.vue +186 -0
- package/vue-components/v3/editor/MonacoEditor.vue +131 -0
- package/vue-components/v3/editor/ResourceKeyValueEditor.vue +125 -0
- package/vue-components/v3/form/Form.vue +63 -0
- package/vue-components/v3/form-fields/Input.vue +22 -0
- package/vue-components/v3/header/Header.vue +45 -0
- package/vue-components/v3/header/HeaderItem.vue +5 -0
- package/vue-components/v3/header/HeaderItems.vue +5 -0
- package/vue-components/v3/loaders/ResourceLoader.vue +83 -0
- package/vue-components/v3/loaders/SidebarLoader.vue +34 -0
- package/vue-components/v3/long-running-tasks/LongRunningTaskItem.vue +92 -0
- package/vue-components/v3/modal/Modal.vue +158 -0
- package/vue-components/v3/modals/DeleteConfirmationModal.vue +85 -0
- package/vue-components/v3/modals/JsonShowModal.vue +96 -0
- package/vue-components/v3/modals/LongRunningTasksModal.vue +373 -0
- package/vue-components/v3/navbar/Appdrawer.vue +63 -0
- package/vue-components/v3/navbar/ThemeMode.vue +120 -0
- package/vue-components/v3/navbar/User.vue +288 -0
- package/vue-components/v3/notification/Notification.vue +98 -0
- package/vue-components/v3/notification/NotificationItem.vue +52 -0
- package/vue-components/v3/pagination/Pagination.vue +172 -0
- package/vue-components/v3/searchbars/SearchBar.vue +47 -0
- package/vue-components/v3/sidebar/ClusterSwitcher.vue +133 -0
- package/vue-components/v3/sidebar/SidebarItemWithDropDown.vue +120 -0
- package/vue-components/v3/tab/TabItem.vue +17 -0
- package/vue-components/v3/table/FakeTableCell.vue +39 -0
- package/vue-components/v3/table/InfoTable.vue +105 -0
- package/vue-components/v3/table/MultiInfoTable.vue +143 -0
- package/vue-components/v3/table/Table.vue +272 -0
- package/vue-components/v3/table/TableCell.vue +28 -0
- package/vue-components/v3/table/TableContainer.vue +34 -0
- package/vue-components/v3/table/TableRow.vue +147 -0
- package/vue-components/v3/table/table-cell/ArrayCell.vue +111 -0
- package/vue-components/v3/table/table-cell/CellValue.vue +133 -0
- package/vue-components/v3/table/table-cell/GenericCell.vue +75 -0
- package/vue-components/v3/table/table-cell/ObjectCell.vue +110 -0
- package/vue-components/v3/table/table-cell/ValueWithModal.vue +43 -0
- package/vue-components/v3/tabs/EditorTabs.vue +36 -0
- package/vue-components/v3/tag/Tag.vue +17 -0
- package/vue-components/v3/terminal/LongRunningTaskTerminal.vue +148 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
.component-wrapper {
|
|
2
2
|
.component-inner {
|
|
3
|
-
margin
|
|
3
|
+
margin: 20px;
|
|
4
4
|
border: 1px solid $ac-white-light;
|
|
5
5
|
border-radius: 4px;
|
|
6
6
|
display: flex;
|
|
@@ -18,6 +18,10 @@
|
|
|
18
18
|
.ac-html-preview {
|
|
19
19
|
width: 100%;
|
|
20
20
|
|
|
21
|
+
i.is-block {
|
|
22
|
+
color: $ac-color-value;
|
|
23
|
+
}
|
|
24
|
+
|
|
21
25
|
.ac-navbar-area {
|
|
22
26
|
position: inherit;
|
|
23
27
|
}
|
|
@@ -29,7 +33,7 @@
|
|
|
29
33
|
}
|
|
30
34
|
|
|
31
35
|
&.ac-bg-dark {
|
|
32
|
-
background-color: $ac-
|
|
36
|
+
background-color: $ac-color-heading;
|
|
33
37
|
}
|
|
34
38
|
|
|
35
39
|
.ac-html-preview {
|
|
@@ -54,13 +58,13 @@
|
|
|
54
58
|
|
|
55
59
|
/* Handle */
|
|
56
60
|
&::-webkit-scrollbar-thumb {
|
|
57
|
-
background:
|
|
61
|
+
background-color: $ac-gray-light;
|
|
58
62
|
border-radius: 10px;
|
|
59
63
|
}
|
|
60
64
|
|
|
61
65
|
/* Handle on hover */
|
|
62
66
|
&::-webkit-scrollbar-thumb:hover {
|
|
63
|
-
background:
|
|
67
|
+
background-color: $ac-gray-light;
|
|
64
68
|
}
|
|
65
69
|
|
|
66
70
|
.number {
|
|
@@ -91,7 +95,7 @@
|
|
|
91
95
|
}
|
|
92
96
|
|
|
93
97
|
.ac-code-preview-wrapper {
|
|
94
|
-
border: 1px solid
|
|
98
|
+
border: 1px solid $ac-white-light;
|
|
95
99
|
border-radius: 4px;
|
|
96
100
|
|
|
97
101
|
.ac-code-header {
|
|
@@ -105,15 +109,18 @@
|
|
|
105
109
|
|
|
106
110
|
// new code preview
|
|
107
111
|
.ac-components {
|
|
112
|
+
margin: 20px;
|
|
108
113
|
.single-component {
|
|
109
|
-
box-shadow: $ac-shadow-1;
|
|
114
|
+
// box-shadow: $ac-shadow-1;
|
|
115
|
+
border: 1px solid $ac-white-light;
|
|
110
116
|
border-radius: 4px;
|
|
111
117
|
margin-bottom: 25px;
|
|
118
|
+
overflow: hidden;
|
|
112
119
|
|
|
113
120
|
.component-header {
|
|
114
121
|
display: flex;
|
|
115
122
|
justify-content: space-between;
|
|
116
|
-
border-bottom: 1px solid
|
|
123
|
+
border-bottom: 1px solid $ac-white-light;
|
|
117
124
|
background-color: $ac-white;
|
|
118
125
|
|
|
119
126
|
h3 {
|
|
@@ -121,7 +128,7 @@
|
|
|
121
128
|
font-size: 16px;
|
|
122
129
|
font-weight: 500;
|
|
123
130
|
font-family: $ac-family-paragraph;
|
|
124
|
-
color:
|
|
131
|
+
color: $ac-color-value;
|
|
125
132
|
}
|
|
126
133
|
|
|
127
134
|
.component-switch {
|
|
@@ -145,17 +152,21 @@
|
|
|
145
152
|
z-index: 1;
|
|
146
153
|
max-height: 500px;
|
|
147
154
|
overflow-y: auto;
|
|
155
|
+
|
|
148
156
|
.copy-button {
|
|
149
157
|
position: absolute;
|
|
150
158
|
right: 5px;
|
|
151
159
|
top: 5px;
|
|
160
|
+
|
|
152
161
|
&:hover {
|
|
153
162
|
box-shadow: none;
|
|
154
163
|
}
|
|
155
164
|
}
|
|
165
|
+
|
|
156
166
|
pre {
|
|
157
167
|
margin: 0;
|
|
158
168
|
border-radius: 4px;
|
|
169
|
+
font-size: 14px;
|
|
159
170
|
|
|
160
171
|
.token {
|
|
161
172
|
&.tag {
|
package/main.scss
CHANGED
|
@@ -1,65 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
@import "~assets/design-system/base/utilities/customize-bulma";
|
|
1
3
|
// Third party CSS
|
|
2
4
|
@import "~bulma";
|
|
3
5
|
@import "~bulma-checkradio";
|
|
4
6
|
@import "~bulma-switch";
|
|
5
7
|
@import "~bulma-tooltip";
|
|
8
|
+
@import url("https://fonts.googleapis.com/css2?family=Material+Icons&display=swap");
|
|
6
9
|
@import "vue-multiselect/dist/vue-multiselect.min.css";
|
|
7
10
|
|
|
8
11
|
// BASE
|
|
9
|
-
@import "~assets/design-system/base/utilities/
|
|
10
|
-
@import "~assets/design-system/base/utilities/derived-variables";
|
|
11
|
-
@import "~assets/design-system/base/utilities/typography";
|
|
12
|
-
@import "~assets/design-system/base/utilities/default";
|
|
13
|
-
@import "~assets/design-system/base/utilities/mixin";
|
|
12
|
+
@import "~assets/design-system/base/utilities/all";
|
|
14
13
|
|
|
15
14
|
// LAYOUTS
|
|
16
|
-
@import "~assets/design-system/layouts/
|
|
15
|
+
@import "~assets/design-system/layouts/all";
|
|
17
16
|
|
|
18
17
|
// COMPONENTS
|
|
19
|
-
@import "~assets/design-system/components/
|
|
20
|
-
@import "~assets/design-system/components/ac-select-box";
|
|
21
|
-
@import "~assets/design-system/components/ac-multi-select";
|
|
22
|
-
@import "~assets/design-system/components/ac-code-highlight";
|
|
23
|
-
@import "~assets/design-system/components/navbar";
|
|
24
|
-
@import "~assets/design-system/components/breadcumb";
|
|
25
|
-
@import "~assets/design-system/components/card-body-wrapper";
|
|
26
|
-
@import "~assets/design-system/components/ac-options";
|
|
27
|
-
@import "~assets/design-system/components/left-sidebar-menu";
|
|
28
|
-
@import "~assets/design-system/components/dashboard-header";
|
|
29
|
-
@import "~assets/design-system/components/widget-menu";
|
|
30
|
-
@import "~assets/design-system/components/buttons";
|
|
31
|
-
@import "~assets/design-system/components/ac-input";
|
|
32
|
-
@import "~assets/design-system/components/ac-content-layout";
|
|
33
|
-
@import "~assets/design-system/components/ac-table";
|
|
34
|
-
@import "~assets/design-system/components/progress-bar";
|
|
35
|
-
@import "~assets/design-system/components/go-to-top";
|
|
36
|
-
@import "~assets/design-system/components/image-upload";
|
|
37
|
-
@import "~assets/design-system/components/ac-modal";
|
|
38
|
-
@import "~assets/design-system/components/ac-drag";
|
|
39
|
-
@import "~assets/design-system/components/ac-tabs";
|
|
40
|
-
@import "~assets/design-system/components/payment-card";
|
|
41
|
-
@import "~assets/design-system/components/ac-accordion";
|
|
42
|
-
@import "~assets/design-system/components/ac-card";
|
|
43
|
-
@import "~assets/design-system/components/add-card";
|
|
44
|
-
@import "~assets/design-system/components/subscription-card";
|
|
45
|
-
@import "~assets/design-system/components/ac-calendar";
|
|
46
|
-
@import "~assets/design-system/components/ac-tags";
|
|
47
|
-
@import "~assets/design-system/components/nested-list";
|
|
48
|
-
@import "~assets/design-system/components/overview-info";
|
|
49
|
-
@import "~assets/design-system/components/pricing-table";
|
|
50
|
-
@import "~assets/design-system/components/table-of-content";
|
|
51
|
-
@import "~assets/design-system/components/preview-modal";
|
|
52
|
-
@import "~assets/design-system/components/wizard";
|
|
53
|
-
@import "~assets/design-system/components/preloader";
|
|
54
|
-
@import "~assets/design-system/components/pagination";
|
|
55
|
-
@import "~assets/design-system/components/ui-builder/ui-builder";
|
|
56
|
-
@import "~assets/design-system/components/ac-toaster/ac-toasted";
|
|
57
|
-
@import "~assets/design-system/components/bbum/post";
|
|
58
|
-
@import "~assets/design-system/components/bbum/single-post-preview";
|
|
59
|
-
@import "~assets/design-system/components/bbum/user-profile";
|
|
60
|
-
@import "~assets/design-system/components/bbum/sign-up-notification";
|
|
61
|
-
@import "~assets/design-system/components/bbum/activities-header";
|
|
62
|
-
@import "~assets/design-system/components/bbum/card-team";
|
|
63
|
-
@import "~assets/design-system/components/bbum/information-center";
|
|
64
|
-
@import "~assets/design-system/components/bbum/left-sidebar";
|
|
65
|
-
@import "~assets/design-system/components/bbum/mobile-desktop";
|
|
18
|
+
@import "~assets/design-system/components/all";
|
package/package.json
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appscode/design-system",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.27",
|
|
4
4
|
"description": "A design system for Appscode websites and dashboards made using Bulma",
|
|
5
5
|
"main": "main.scss",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@appscode/design-system-images": "0.0.13",
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"bulma-tooltip": "^3.0.2",
|
|
14
|
-
"v-calendar": "^1.0.6",
|
|
15
|
-
"vue-multiselect": "^2.1.6"
|
|
10
|
+
"@appscode/design-system-images": "^0.0.13",
|
|
11
|
+
"crypto-js": "^4.1.1",
|
|
12
|
+
"fast-json-stable-stringify": "^2.1.0"
|
|
16
13
|
},
|
|
17
14
|
"repository": {
|
|
18
15
|
"type": "git",
|
|
@@ -0,0 +1,243 @@
|
|
|
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
|
+
}
|
package/plugins/theme.js
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
export function HSLToHex(h, s, l) {
|
|
2
|
+
s /= 100;
|
|
3
|
+
l /= 100;
|
|
4
|
+
|
|
5
|
+
const c = (1 - Math.abs(2 * l - 1)) * s,
|
|
6
|
+
x = c * (1 - Math.abs(((h / 60) % 2) - 1)),
|
|
7
|
+
m = l - c / 2;
|
|
8
|
+
|
|
9
|
+
let r = 0,
|
|
10
|
+
g = 0,
|
|
11
|
+
b = 0;
|
|
12
|
+
|
|
13
|
+
if (0 <= h && h < 60) {
|
|
14
|
+
r = c;
|
|
15
|
+
g = x;
|
|
16
|
+
b = 0;
|
|
17
|
+
} else if (60 <= h && h < 120) {
|
|
18
|
+
r = x;
|
|
19
|
+
g = c;
|
|
20
|
+
b = 0;
|
|
21
|
+
} else if (120 <= h && h < 180) {
|
|
22
|
+
r = 0;
|
|
23
|
+
g = c;
|
|
24
|
+
b = x;
|
|
25
|
+
} else if (180 <= h && h < 240) {
|
|
26
|
+
r = 0;
|
|
27
|
+
g = x;
|
|
28
|
+
b = c;
|
|
29
|
+
} else if (240 <= h && h < 300) {
|
|
30
|
+
r = x;
|
|
31
|
+
g = 0;
|
|
32
|
+
b = c;
|
|
33
|
+
} else if (300 <= h && h < 360) {
|
|
34
|
+
r = c;
|
|
35
|
+
g = 0;
|
|
36
|
+
b = x;
|
|
37
|
+
}
|
|
38
|
+
// Having obtained RGB, convert channels to hex
|
|
39
|
+
r = Math.round((r + m) * 255).toString(16);
|
|
40
|
+
g = Math.round((g + m) * 255).toString(16);
|
|
41
|
+
b = Math.round((b + m) * 255).toString(16);
|
|
42
|
+
|
|
43
|
+
// Prepend 0s, if necessary
|
|
44
|
+
if (r.length == 1) r = "0" + r;
|
|
45
|
+
if (g.length == 1) g = "0" + g;
|
|
46
|
+
if (b.length == 1) b = "0" + b;
|
|
47
|
+
|
|
48
|
+
return "#" + r + g + b;
|
|
49
|
+
}
|
|
50
|
+
export function HexToHSL(H) {
|
|
51
|
+
// Convert hex to RGB first
|
|
52
|
+
let r = 0,
|
|
53
|
+
g = 0,
|
|
54
|
+
b = 0;
|
|
55
|
+
if (H.length == 4) {
|
|
56
|
+
r = parseInt("0x" + H[1] + H[1]);
|
|
57
|
+
g = parseInt("0x" + H[2] + H[2]);
|
|
58
|
+
b = parseInt("0x" + H[3] + H[3]);
|
|
59
|
+
} else if (H.length == 7) {
|
|
60
|
+
r = parseInt("0x" + H[1] + H[2]);
|
|
61
|
+
g = parseInt("0x" + H[3] + H[4]);
|
|
62
|
+
b = parseInt("0x" + H[5] + H[6]);
|
|
63
|
+
}
|
|
64
|
+
// Then to HSL
|
|
65
|
+
r /= 255;
|
|
66
|
+
g /= 255;
|
|
67
|
+
b /= 255;
|
|
68
|
+
const cmin = Math.min(r, g, b),
|
|
69
|
+
cmax = Math.max(r, g, b),
|
|
70
|
+
delta = cmax - cmin;
|
|
71
|
+
let h = 0,
|
|
72
|
+
s = 0,
|
|
73
|
+
l = 0;
|
|
74
|
+
|
|
75
|
+
if (delta == 0) h = 0;
|
|
76
|
+
else if (cmax == r) h = ((g - b) / delta) % 6;
|
|
77
|
+
else if (cmax == g) h = (b - r) / delta + 2;
|
|
78
|
+
else h = (r - g) / delta + 4;
|
|
79
|
+
|
|
80
|
+
h = Math.round(h * 60);
|
|
81
|
+
|
|
82
|
+
if (h < 0) h += 360;
|
|
83
|
+
|
|
84
|
+
l = (cmax + cmin) / 2;
|
|
85
|
+
s = delta == 0 ? 0 : delta / (1 - Math.abs(2 * l - 1));
|
|
86
|
+
s = +(s * 100).toFixed(1);
|
|
87
|
+
l = +(l * 100).toFixed(1);
|
|
88
|
+
|
|
89
|
+
return {
|
|
90
|
+
hue: `${h}`,
|
|
91
|
+
saturation: `${s}%`,
|
|
92
|
+
lightness: `${l}%`,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
export function getThemeHSL() {
|
|
96
|
+
const hue = getComputedStyle(document.documentElement).getPropertyValue(
|
|
97
|
+
"--hsl-hue"
|
|
98
|
+
);
|
|
99
|
+
const saturation = getComputedStyle(
|
|
100
|
+
document.documentElement
|
|
101
|
+
).getPropertyValue("--hsl-saturation");
|
|
102
|
+
const lightness = getComputedStyle(
|
|
103
|
+
document.documentElement
|
|
104
|
+
).getPropertyValue("--hsl-lightness");
|
|
105
|
+
|
|
106
|
+
return {
|
|
107
|
+
hue,
|
|
108
|
+
saturation,
|
|
109
|
+
lightness,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
export function setThemeHSL(h, s, l) {
|
|
113
|
+
document.documentElement.style.setProperty("--hsl-hue", h);
|
|
114
|
+
document.documentElement.style.setProperty("--hsl-saturation", s);
|
|
115
|
+
document.documentElement.style.setProperty("--hsl-lightness", l);
|
|
116
|
+
}
|
|
117
|
+
export function setFontHSL(h, s, l) {
|
|
118
|
+
document.documentElement.style.setProperty("--font-hsl-hue", h);
|
|
119
|
+
document.documentElement.style.setProperty("--font-hsl-saturation", s);
|
|
120
|
+
document.documentElement.style.setProperty("--font-hsl-lightness", l);
|
|
121
|
+
}
|
|
122
|
+
export function getFontHSL() {
|
|
123
|
+
const hue = getComputedStyle(document.documentElement).getPropertyValue(
|
|
124
|
+
"--font-hsl-hue"
|
|
125
|
+
);
|
|
126
|
+
const saturation = getComputedStyle(
|
|
127
|
+
document.documentElement
|
|
128
|
+
).getPropertyValue("--font-hsl-saturation");
|
|
129
|
+
const lightness = getComputedStyle(
|
|
130
|
+
document.documentElement
|
|
131
|
+
).getPropertyValue("--font-hsl-lightness");
|
|
132
|
+
|
|
133
|
+
return {
|
|
134
|
+
hue,
|
|
135
|
+
saturation,
|
|
136
|
+
lightness,
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
export const loaderLightThemePrimaryColor = "#f5f7f9";
|
|
140
|
+
export const loaderDarkThemePrimaryColor = "#2e323c";
|
|
141
|
+
export const loaderLightThemeSecondaryColor = "#ecebeb";
|
|
142
|
+
export const loaderDarkThemeSecondaryColor = "#21272e";
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import moment from "moment";
|
|
2
|
+
import { useNow, useThrottleFn } from "@vueuse/core";
|
|
3
|
+
|
|
4
|
+
const getTime = option => {
|
|
5
|
+
if (parseInt(option.time, 10) < 0 || !option.time) {
|
|
6
|
+
return undefined;
|
|
7
|
+
}
|
|
8
|
+
let time = option.time;
|
|
9
|
+
|
|
10
|
+
// moment(option.time).valueOf('x') needs to convert pharmer's api date to epoch time
|
|
11
|
+
time = moment(option.time).valueOf("x")
|
|
12
|
+
? moment(option.time).valueOf("x")
|
|
13
|
+
: time * 1000;
|
|
14
|
+
|
|
15
|
+
return moment(time).format("MMM DD YYYY, h:mm A");
|
|
16
|
+
};
|
|
17
|
+
const getDayDifferences = options => {
|
|
18
|
+
const past = moment(options.past).isValid()
|
|
19
|
+
? moment(options.past).valueOf("x") / 1000
|
|
20
|
+
: options.past;
|
|
21
|
+
const now = Date.now() / 1000;
|
|
22
|
+
const diff = now - past;
|
|
23
|
+
if (parseInt(options.past, 10) > 10) {
|
|
24
|
+
let ret = Math.floor(diff / 86400);
|
|
25
|
+
let unit = "";
|
|
26
|
+
if (diff < 60) {
|
|
27
|
+
ret = parseInt(diff, 10);
|
|
28
|
+
unit = " Second";
|
|
29
|
+
} else if (diff < 3600) {
|
|
30
|
+
ret = parseInt(diff / 60, 10);
|
|
31
|
+
unit = " Minute";
|
|
32
|
+
} else if (diff < 86400) {
|
|
33
|
+
ret = parseInt(diff / 3600, 10);
|
|
34
|
+
unit = " Hour";
|
|
35
|
+
} else {
|
|
36
|
+
ret = parseInt(diff / 86400, 10);
|
|
37
|
+
unit = " Day";
|
|
38
|
+
}
|
|
39
|
+
unit += ret > 1 ? "s" : "";
|
|
40
|
+
return ret + unit;
|
|
41
|
+
}
|
|
42
|
+
return undefined;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export default {
|
|
46
|
+
getTime,
|
|
47
|
+
// formatMoment,
|
|
48
|
+
getDayDifferences
|
|
49
|
+
};
|
package/plugins/vue-toaster.js
CHANGED
|
@@ -2,9 +2,9 @@ module.exports = {
|
|
|
2
2
|
position: "top-center",
|
|
3
3
|
theme: "toasted-primary",
|
|
4
4
|
iconPack: "fontawesome",
|
|
5
|
-
className: "ac-
|
|
5
|
+
className: "ac-toast",
|
|
6
6
|
action: {
|
|
7
|
-
|
|
7
|
+
icon: "close",
|
|
8
8
|
class: "ac-toast-action",
|
|
9
9
|
onClick: (e, toastObject) => {
|
|
10
10
|
toastObject.goAway(0);
|
|
@@ -26,7 +26,7 @@ module.exports = {
|
|
|
26
26
|
icon: "fa-check",
|
|
27
27
|
duration: 2500,
|
|
28
28
|
type: "success",
|
|
29
|
-
className: "ac-
|
|
29
|
+
className: "ac-toast is-success",
|
|
30
30
|
},
|
|
31
31
|
},
|
|
32
32
|
{
|
|
@@ -34,14 +34,16 @@ module.exports = {
|
|
|
34
34
|
message: (payload) => {
|
|
35
35
|
if (payload) {
|
|
36
36
|
if (typeof payload === "string") return payload;
|
|
37
|
+
else if (payload.response && payload.response.data && payload.response.data.message) return payload.response.data.message;
|
|
37
38
|
else if (payload.message) return payload.message;
|
|
38
39
|
else return "Something Went Wrong";
|
|
39
40
|
} else return "Something Went Wrong";
|
|
40
41
|
},
|
|
41
42
|
options: {
|
|
42
43
|
icon: "fa-warning",
|
|
44
|
+
duration: 20000,
|
|
43
45
|
type: "error",
|
|
44
|
-
className: "ac-
|
|
46
|
+
className: "ac-toast is-error",
|
|
45
47
|
},
|
|
46
48
|
},
|
|
47
49
|
{
|
|
@@ -55,8 +57,9 @@ module.exports = {
|
|
|
55
57
|
},
|
|
56
58
|
options: {
|
|
57
59
|
icon: "fa-info",
|
|
60
|
+
duration: 20000,
|
|
58
61
|
type: "info",
|
|
59
|
-
className: "ac-
|
|
62
|
+
className: "ac-toast is-info",
|
|
60
63
|
},
|
|
61
64
|
},
|
|
62
65
|
{
|
|
@@ -72,8 +75,9 @@ module.exports = {
|
|
|
72
75
|
},
|
|
73
76
|
options: {
|
|
74
77
|
icon: "fa-warning",
|
|
78
|
+
duration: 2500,
|
|
75
79
|
type: "error",
|
|
76
|
-
className: "ac-
|
|
80
|
+
className: "ac-toast is-warning",
|
|
77
81
|
},
|
|
78
82
|
},
|
|
79
83
|
],
|