@appscode/design-system 1.0.43-alpha.99 → 1.1.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/utilities/_all.scss +7 -0
- package/base/utilities/_customize-bulma.scss +191 -0
- package/base/utilities/_default.scss +58 -124
- package/base/utilities/_derived-variables.scss +6 -0
- package/base/utilities/_grid.scss +29 -0
- package/base/utilities/_initial-variables.scss +13 -9
- package/base/utilities/_typography.scss +6 -12
- package/base/utilities/dark-theme.scss +1 -0
- package/components/_ac-accordion.scss +14 -5
- package/components/_ac-alert-box.scss +32 -6
- package/components/_ac-card.scss +17 -5
- package/components/_ac-drag.scss +2 -0
- package/components/_ac-input.scss +19 -11
- package/components/_ac-modal.scss +1 -1
- package/components/_ac-multi-select.scss +60 -4
- package/components/_ac-report.scss +53 -0
- package/components/_ac-table.scss +60 -2
- package/components/_ac-tabs.scss +16 -2
- package/components/_ac-tags.scss +85 -0
- package/components/_ac-terminal.scss +1 -3
- package/components/_all.scss +28 -0
- package/components/_buttons.scss +14 -33
- package/components/_dashboard-header.scss +32 -0
- package/components/_left-sidebar-menu.scss +9 -9
- package/components/_navbar.scss +89 -4
- package/components/_preview-modal.scss +14 -1
- package/components/_transitions.scss +261 -0
- package/components/_wizard.scss +1 -0
- package/components/bbum/_all.scss +9 -0
- package/components/bbum/_single-post-preview.scss +1 -1
- package/components/ui-builder/_ui-builder.scss +58 -0
- package/components/ui-builder/_vue-open-api.scss +6 -0
- package/layouts/_all.scss +2 -0
- package/layouts/_code-preview.scss +5 -2
- package/main.scss +5 -56
- package/package.json +4 -2
- package/plugins/caching.ts +243 -0
- package/plugins/time-convert.js +49 -0
- package/plugins/vue-toaster.js +3 -0
- 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 +5 -0
- package/vue-components/v2/button/DownloadBtn.vue +45 -0
- package/vue-components/v2/card/Card.vue +1 -0
- package/vue-components/v2/content/ContentTable.vue +12 -7
- package/vue-components/v2/editor/Editor.vue +37 -24
- 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-fields/Input.vue +1 -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 +30 -5
- package/vue-components/v2/modals/DeleteConfirmationModal.vue +79 -0
- package/vue-components/v2/modals/JsonShowModal.vue +12 -2
- 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 +16 -3
- package/vue-components/v2/preloader/Preloader.vue +1 -1
- package/vue-components/v2/sidebar/SidebarItemWithDropDown.vue +19 -20
- package/vue-components/v2/tab/TabItem.vue +1 -1
- package/vue-components/v2/table/Table.vue +49 -8
- package/vue-components/v2/table/TableRow.vue +12 -2
- package/vue-components/v2/table/table-cell/CellValue.vue +29 -9
- 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/v3/button/Button.vue +6 -1
- package/vue-components/v3/content/ContentHeader.vue +2 -1
- package/vue-components/v3/content/ContentTable.vue +20 -2
- package/vue-components/v3/editor/Editor.vue +36 -33
- 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 +11 -10
- 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 +30 -7
- package/vue-components/v3/modals/DeleteConfirmationModal.vue +85 -0
- package/vue-components/v3/modals/JsonShowModal.vue +25 -16
- package/vue-components/v3/modals/LongRunningTasksModal.vue +400 -0
- package/vue-components/v3/navbar/ThemeMode.vue +41 -49
- package/vue-components/v3/navbar/User.vue +242 -18
- package/vue-components/v3/notification/AlertBox.vue +61 -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 +16 -3
- package/vue-components/v3/sidebar/SidebarItemWithDropDown.vue +120 -0
- package/vue-components/v3/tab/TabItem.vue +1 -1
- package/vue-components/v3/table/MultiInfoTable.vue +143 -0
- package/vue-components/v3/table/Table.vue +52 -13
- package/vue-components/v3/table/TableContainer.vue +34 -0
- package/vue-components/v3/table/TableRow.vue +93 -6
- package/vue-components/v3/table/table-cell/CellValue.vue +23 -7
- package/vue-components/v3/table/table-cell/GenericCell.vue +75 -0
- package/vue-components/v3/table/table-cell/ObjectCell.vue +7 -2
- package/vue-components/v3/terminal/LongRunningTaskTerminal.vue +148 -0
|
@@ -12,20 +12,36 @@
|
|
|
12
12
|
|
|
13
13
|
.ui-builders-wrapper {
|
|
14
14
|
width: 760px;
|
|
15
|
+
|
|
15
16
|
h5 {
|
|
16
17
|
margin-bottom: 10px;
|
|
17
18
|
}
|
|
19
|
+
|
|
18
20
|
p {
|
|
19
21
|
font-size: 13px;
|
|
20
22
|
margin-bottom: 10px;
|
|
21
23
|
color: $ac-color-value;
|
|
22
24
|
}
|
|
23
25
|
}
|
|
26
|
+
|
|
24
27
|
.key-value-save {
|
|
25
28
|
display: grid;
|
|
26
29
|
grid-template-columns: 1fr 1fr auto;
|
|
27
30
|
grid-gap: 15px;
|
|
28
31
|
}
|
|
32
|
+
|
|
33
|
+
.key-value-save-check {
|
|
34
|
+
display: grid;
|
|
35
|
+
grid-template-columns: 1fr 1fr auto auto;
|
|
36
|
+
grid-gap: 15px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.key-save {
|
|
40
|
+
display: grid;
|
|
41
|
+
grid-template-columns: 1fr auto;
|
|
42
|
+
grid-gap: 15px;
|
|
43
|
+
}
|
|
44
|
+
|
|
29
45
|
.value-list-save {
|
|
30
46
|
display: grid;
|
|
31
47
|
grid-template-columns: 1fr auto;
|
|
@@ -38,16 +54,20 @@
|
|
|
38
54
|
padding-left: 20px;
|
|
39
55
|
position: relative;
|
|
40
56
|
z-index: 1;
|
|
57
|
+
|
|
41
58
|
&:first-child {
|
|
42
59
|
margin-left: -20px;
|
|
43
60
|
}
|
|
61
|
+
|
|
44
62
|
&.is-active {
|
|
45
63
|
&::after {
|
|
46
64
|
border: 1px dashed $ac-primary;
|
|
47
65
|
}
|
|
66
|
+
|
|
48
67
|
&::before {
|
|
49
68
|
background-color: $ac-primary;
|
|
50
69
|
}
|
|
70
|
+
|
|
51
71
|
.nested-header {
|
|
52
72
|
h6 {
|
|
53
73
|
.collaps-icon {
|
|
@@ -57,6 +77,7 @@
|
|
|
57
77
|
}
|
|
58
78
|
}
|
|
59
79
|
}
|
|
80
|
+
|
|
60
81
|
&::after {
|
|
61
82
|
position: absolute;
|
|
62
83
|
content: "";
|
|
@@ -79,15 +100,18 @@
|
|
|
79
100
|
border-radius: 50%;
|
|
80
101
|
z-index: -1;
|
|
81
102
|
}
|
|
103
|
+
|
|
82
104
|
.nested-header {
|
|
83
105
|
display: flex;
|
|
84
106
|
align-items: center;
|
|
85
107
|
justify-content: space-between;
|
|
86
108
|
margin-bottom: 5px;
|
|
109
|
+
|
|
87
110
|
h6 {
|
|
88
111
|
display: flex;
|
|
89
112
|
align-items: center;
|
|
90
113
|
cursor: pointer;
|
|
114
|
+
|
|
91
115
|
.collaps-icon {
|
|
92
116
|
width: 16px;
|
|
93
117
|
height: 16px;
|
|
@@ -101,33 +125,46 @@
|
|
|
101
125
|
cursor: pointer;
|
|
102
126
|
background-color: $ac-white;
|
|
103
127
|
color: $ac-color-value;
|
|
128
|
+
|
|
104
129
|
&.is-disabled {
|
|
105
130
|
cursor: not-allowed;
|
|
106
131
|
}
|
|
107
132
|
}
|
|
108
133
|
}
|
|
109
134
|
}
|
|
135
|
+
|
|
110
136
|
.nested-body {
|
|
111
137
|
padding-left: 24px;
|
|
112
138
|
}
|
|
113
139
|
}
|
|
114
140
|
|
|
141
|
+
.is-visibility-hidden {
|
|
142
|
+
visibility: hidden !important;
|
|
143
|
+
height: 0 !important;
|
|
144
|
+
opacity: 0 !important;
|
|
145
|
+
}
|
|
146
|
+
|
|
115
147
|
// nested elements end
|
|
116
148
|
|
|
117
149
|
.table-wrapper {
|
|
118
150
|
overflow-x: auto;
|
|
151
|
+
|
|
119
152
|
.table-inner {
|
|
120
153
|
min-width: 630px;
|
|
154
|
+
|
|
121
155
|
.thead {
|
|
122
156
|
background-color: $ac-white-lighter;
|
|
157
|
+
|
|
123
158
|
.tr {
|
|
124
159
|
.th {
|
|
125
160
|
font-weight: 600;
|
|
126
161
|
}
|
|
162
|
+
|
|
127
163
|
border-top: 1px solid var(--ac-white-light);
|
|
128
164
|
border-bottom: 1px solid var(--ac-white-light);
|
|
129
165
|
}
|
|
130
166
|
}
|
|
167
|
+
|
|
131
168
|
.thead,
|
|
132
169
|
.tbody {
|
|
133
170
|
.tr {
|
|
@@ -152,18 +189,21 @@
|
|
|
152
189
|
}
|
|
153
190
|
}
|
|
154
191
|
}
|
|
192
|
+
|
|
155
193
|
.is-selected {
|
|
156
194
|
border: 1px solid $ac-primary;
|
|
157
195
|
border-bottom: 1px solid $ac-primary !important;
|
|
158
196
|
border-radius: 4px;
|
|
159
197
|
}
|
|
160
198
|
}
|
|
199
|
+
|
|
161
200
|
.is-collapsed {
|
|
162
201
|
&.ac-nested-elements::before,
|
|
163
202
|
&.ac-nested-elements::after {
|
|
164
203
|
display: none;
|
|
165
204
|
}
|
|
166
205
|
}
|
|
206
|
+
|
|
167
207
|
// details with checkradio
|
|
168
208
|
.details-with-checkradio-wrapper {
|
|
169
209
|
display: grid;
|
|
@@ -179,6 +219,24 @@
|
|
|
179
219
|
}
|
|
180
220
|
}
|
|
181
221
|
}
|
|
222
|
+
|
|
223
|
+
//For resource input from
|
|
224
|
+
.resource-input {
|
|
225
|
+
display: grid;
|
|
226
|
+
grid-template-columns: 60px 1fr 1fr;
|
|
227
|
+
grid-gap: 15px;
|
|
228
|
+
align-items: center;
|
|
229
|
+
margin-bottom: 15px;
|
|
230
|
+
|
|
231
|
+
.label-text {
|
|
232
|
+
font-weight: 300;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.ac-single-input {
|
|
236
|
+
margin: 0;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
182
240
|
// dark theme end
|
|
183
241
|
/****************************************
|
|
184
242
|
Responsive Classes
|
|
@@ -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;
|
|
@@ -109,10 +109,13 @@
|
|
|
109
109
|
|
|
110
110
|
// new code preview
|
|
111
111
|
.ac-components {
|
|
112
|
+
margin: 20px;
|
|
112
113
|
.single-component {
|
|
113
|
-
box-shadow: $ac-shadow-1;
|
|
114
|
+
// box-shadow: $ac-shadow-1;
|
|
115
|
+
border: 1px solid $ac-white-light;
|
|
114
116
|
border-radius: 4px;
|
|
115
117
|
margin-bottom: 25px;
|
|
118
|
+
overflow: hidden;
|
|
116
119
|
|
|
117
120
|
.component-header {
|
|
118
121
|
display: flex;
|
package/main.scss
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
|
|
2
|
+
@import "~assets/design-system/base/utilities/customize-bulma";
|
|
1
3
|
// Third party CSS
|
|
2
4
|
@import "~bulma";
|
|
3
5
|
@import "~bulma-checkradio";
|
|
@@ -7,63 +9,10 @@
|
|
|
7
9
|
@import "vue-multiselect/dist/vue-multiselect.min.css";
|
|
8
10
|
|
|
9
11
|
// BASE
|
|
10
|
-
@import "~assets/design-system/base/utilities/
|
|
11
|
-
@import "~assets/design-system/base/utilities/dark-theme";
|
|
12
|
-
@import "~assets/design-system/base/utilities/derived-variables";
|
|
13
|
-
@import "~assets/design-system/base/utilities/typography";
|
|
14
|
-
@import "~assets/design-system/base/utilities/default";
|
|
15
|
-
@import "~assets/design-system/base/utilities/mixin";
|
|
12
|
+
@import "~assets/design-system/base/utilities/all";
|
|
16
13
|
|
|
17
14
|
// LAYOUTS
|
|
18
|
-
@import "~assets/design-system/layouts/
|
|
15
|
+
@import "~assets/design-system/layouts/all";
|
|
19
16
|
|
|
20
17
|
// COMPONENTS
|
|
21
|
-
@import "~assets/design-system/components/
|
|
22
|
-
@import "~assets/design-system/components/ac-select-box";
|
|
23
|
-
@import "~assets/design-system/components/ac-multi-select";
|
|
24
|
-
@import "~assets/design-system/components/ac-code-highlight";
|
|
25
|
-
@import "~assets/design-system/components/navbar";
|
|
26
|
-
@import "~assets/design-system/components/breadcumb";
|
|
27
|
-
@import "~assets/design-system/components/card-body-wrapper";
|
|
28
|
-
@import "~assets/design-system/components/ac-options";
|
|
29
|
-
@import "~assets/design-system/components/left-sidebar-menu";
|
|
30
|
-
@import "~assets/design-system/components/dashboard-header";
|
|
31
|
-
@import "~assets/design-system/components/widget-menu";
|
|
32
|
-
@import "~assets/design-system/components/buttons";
|
|
33
|
-
@import "~assets/design-system/components/ac-input";
|
|
34
|
-
@import "~assets/design-system/components/ac-content-layout";
|
|
35
|
-
@import "~assets/design-system/components/ac-table";
|
|
36
|
-
@import "~assets/design-system/components/progress-bar";
|
|
37
|
-
@import "~assets/design-system/components/go-to-top";
|
|
38
|
-
@import "~assets/design-system/components/image-upload";
|
|
39
|
-
@import "~assets/design-system/components/ac-modal";
|
|
40
|
-
@import "~assets/design-system/components/ac-drag";
|
|
41
|
-
@import "~assets/design-system/components/ac-tabs";
|
|
42
|
-
@import "~assets/design-system/components/payment-card";
|
|
43
|
-
@import "~assets/design-system/components/ac-accordion";
|
|
44
|
-
@import "~assets/design-system/components/ac-card";
|
|
45
|
-
@import "~assets/design-system/components/add-card";
|
|
46
|
-
@import "~assets/design-system/components/subscription-card";
|
|
47
|
-
@import "~assets/design-system/components/ac-calendar";
|
|
48
|
-
@import "~assets/design-system/components/ac-tags";
|
|
49
|
-
@import "~assets/design-system/components/nested-list";
|
|
50
|
-
@import "~assets/design-system/components/overview-info";
|
|
51
|
-
@import "~assets/design-system/components/pricing-table";
|
|
52
|
-
@import "~assets/design-system/components/table-of-content";
|
|
53
|
-
@import "~assets/design-system/components/direct-deploy";
|
|
54
|
-
@import "~assets/design-system/components/preview-modal";
|
|
55
|
-
@import "~assets/design-system/components/wizard";
|
|
56
|
-
@import "~assets/design-system/components/preloader";
|
|
57
|
-
@import "~assets/design-system/components/pagination";
|
|
58
|
-
@import "~assets/design-system/components/graph";
|
|
59
|
-
@import "~assets/design-system/components/ui-builder/ui-builder";
|
|
60
|
-
@import "~assets/design-system/components/ac-toaster/ac-toasted";
|
|
61
|
-
@import "~assets/design-system/components/bbum/post";
|
|
62
|
-
@import "~assets/design-system/components/bbum/single-post-preview";
|
|
63
|
-
@import "~assets/design-system/components/bbum/user-profile";
|
|
64
|
-
@import "~assets/design-system/components/bbum/sign-up-notification";
|
|
65
|
-
@import "~assets/design-system/components/bbum/activities-header";
|
|
66
|
-
@import "~assets/design-system/components/bbum/card-team";
|
|
67
|
-
@import "~assets/design-system/components/bbum/information-center";
|
|
68
|
-
@import "~assets/design-system/components/bbum/left-sidebar";
|
|
69
|
-
@import "~assets/design-system/components/bbum/mobile-desktop";
|
|
18
|
+
@import "~assets/design-system/components/all";
|
package/package.json
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appscode/design-system",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
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"
|
|
10
|
+
"@appscode/design-system-images": "^0.0.13",
|
|
11
|
+
"crypto-js": "^4.1.1",
|
|
12
|
+
"fast-json-stable-stringify": "^2.1.0"
|
|
11
13
|
},
|
|
12
14
|
"repository": {
|
|
13
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
|
+
}
|
|
@@ -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
|
@@ -41,6 +41,7 @@ module.exports = {
|
|
|
41
41
|
},
|
|
42
42
|
options: {
|
|
43
43
|
icon: "fa-warning",
|
|
44
|
+
duration: 20000,
|
|
44
45
|
type: "error",
|
|
45
46
|
className: "ac-toast is-error",
|
|
46
47
|
},
|
|
@@ -56,6 +57,7 @@ module.exports = {
|
|
|
56
57
|
},
|
|
57
58
|
options: {
|
|
58
59
|
icon: "fa-info",
|
|
60
|
+
duration: 20000,
|
|
59
61
|
type: "info",
|
|
60
62
|
className: "ac-toast is-info",
|
|
61
63
|
},
|
|
@@ -73,6 +75,7 @@ module.exports = {
|
|
|
73
75
|
},
|
|
74
76
|
options: {
|
|
75
77
|
icon: "fa-warning",
|
|
78
|
+
duration: 2500,
|
|
76
79
|
type: "error",
|
|
77
80
|
className: "ac-toast is-warning",
|
|
78
81
|
},
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="sign-up-notification mb-20">
|
|
3
3
|
<div class="notification-inner has-text-centered">
|
|
4
|
-
<h3><slot name="banner-title"
|
|
5
|
-
<slot
|
|
4
|
+
<h3><slot name="banner-title">Error!</slot></h3>
|
|
5
|
+
<slot><p>Oops!! There was an error while loading!</p></slot>
|
|
6
6
|
</div>
|
|
7
7
|
</div>
|
|
8
8
|
</template>
|