@appscode/design-system 1.0.43-alpha.22 → 1.0.43-alpha.221

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/base/utilities/_all.scss +7 -0
  2. package/base/utilities/_customize-bulma.scss +191 -0
  3. package/base/utilities/_default.scss +286 -126
  4. package/base/utilities/_derived-variables.scss +6 -1
  5. package/base/utilities/_grid.scss +29 -0
  6. package/base/utilities/_initial-variables.scss +27 -17
  7. package/base/utilities/_mixin.scss +1 -17
  8. package/base/utilities/_typography.scss +18 -14
  9. package/base/utilities/dark-theme.scss +9 -145
  10. package/components/_ac-accordion.scss +14 -5
  11. package/components/_ac-alert-box.scss +41 -7
  12. package/components/_ac-card.scss +48 -10
  13. package/components/_ac-code-highlight.scss +5 -1
  14. package/components/_ac-content-layout.scss +2 -2
  15. package/components/_ac-drag.scss +2 -0
  16. package/components/_ac-input.scss +64 -23
  17. package/components/_ac-modal.scss +1 -1
  18. package/components/_ac-multi-select.scss +247 -9
  19. package/components/_ac-options.scss +24 -9
  20. package/components/_ac-select-box.scss +13 -3
  21. package/components/_ac-table.scss +15 -5
  22. package/components/_ac-tabs.scss +46 -5
  23. package/components/_ac-tags.scss +85 -0
  24. package/components/_ac-terminal.scss +270 -0
  25. package/components/_all.scss +28 -0
  26. package/components/_app-drawer.scss +2 -2
  27. package/components/_breadcumb.scss +2 -0
  28. package/components/_buttons.scss +50 -37
  29. package/components/_card-body-wrapper.scss +2 -2
  30. package/components/_dashboard-header.scss +32 -0
  31. package/components/_direct-deploy.scss +69 -0
  32. package/components/_go-to-top.scss +1 -1
  33. package/components/_graph.scss +45 -0
  34. package/components/_image-upload.scss +5 -3
  35. package/components/_left-sidebar-menu.scss +121 -69
  36. package/components/_monaco-editor.scss +1 -1
  37. package/components/_navbar.scss +170 -10
  38. package/components/_overview-info.scss +3 -3
  39. package/components/_pagination.scss +8 -0
  40. package/components/_payment-card.scss +10 -1
  41. package/components/_preview-modal.scss +18 -5
  42. package/components/_pricing-table.scss +1 -1
  43. package/components/_progress-bar.scss +4 -4
  44. package/components/_subscription-card.scss +11 -4
  45. package/components/_table-of-content.scss +1 -1
  46. package/components/_tfa.scss +69 -0
  47. package/components/_transitions.scss +261 -0
  48. package/components/_wizard.scss +16 -3
  49. package/components/bbum/_all.scss +9 -0
  50. package/components/bbum/_card-team.scss +1 -1
  51. package/components/bbum/_information-center.scss +15 -1
  52. package/components/bbum/_sign-up-notification.scss +1 -1
  53. package/components/bbum/_single-post-preview.scss +2 -2
  54. package/components/bbum/_user-profile.scss +2 -3
  55. package/components/ui-builder/_ui-builder.scss +76 -1
  56. package/components/ui-builder/_vue-open-api.scss +104 -0
  57. package/layouts/_all.scss +2 -0
  58. package/layouts/_code-preview.scss +5 -2
  59. package/main.scss +6 -54
  60. package/package.json +4 -7
  61. package/plugins/caching.ts +243 -0
  62. package/plugins/theme.js +4 -0
  63. package/plugins/time-convert.js +49 -0
  64. package/plugins/vue-toaster.js +3 -0
  65. package/vue-components/v2/banner/Banner.vue +2 -2
  66. package/vue-components/v2/breadcrumbs/Breadcrumb.vue +97 -0
  67. package/vue-components/v2/button/Button.vue +5 -0
  68. package/vue-components/v2/button/DownloadBtn.vue +45 -0
  69. package/vue-components/v2/card/Card.vue +1 -0
  70. package/vue-components/v2/card/PaymentCards.vue +11 -2
  71. package/vue-components/v2/content/ContentTable.vue +12 -7
  72. package/vue-components/v2/editor/Editor.vue +43 -24
  73. package/vue-components/v2/editor/FilteredFileEditor.vue +189 -0
  74. package/vue-components/v2/editor/MonacoEditor.vue +125 -0
  75. package/vue-components/v2/editor/ResourceKeyValueEditor.vue +209 -0
  76. package/vue-components/v2/form-fields/Input.vue +1 -1
  77. package/vue-components/v2/loaders/ResourceLoader.vue +101 -0
  78. package/vue-components/v2/loaders/SidebarLoader.vue +43 -0
  79. package/vue-components/v2/modal/Modal.vue +38 -4
  80. package/vue-components/v2/modals/DeleteConfirmationModal.vue +79 -0
  81. package/vue-components/v2/modals/JsonShowModal.vue +12 -2
  82. package/vue-components/v2/navbar/Appdrawer.vue +10 -9
  83. package/vue-components/v2/navbar/ThemeMode.vue +50 -44
  84. package/vue-components/v2/navbar/User.vue +229 -17
  85. package/vue-components/v2/notification/Notification.vue +101 -0
  86. package/vue-components/v2/notification/NotificationItem.vue +44 -0
  87. package/vue-components/v2/pagination/Pagination.vue +16 -3
  88. package/vue-components/v2/preloader/Preloader.vue +5 -5
  89. package/vue-components/v2/sidebar/ClusterSwitcher.vue +126 -0
  90. package/vue-components/v2/sidebar/SidebarItem.vue +23 -1
  91. package/vue-components/v2/sidebar/SidebarItemWithDropDown.vue +19 -20
  92. package/vue-components/v2/tab/TabItem.vue +1 -1
  93. package/vue-components/v2/table/Table.vue +44 -8
  94. package/vue-components/v2/table/TableRow.vue +12 -2
  95. package/vue-components/v2/table/table-cell/CellValue.vue +33 -4
  96. package/vue-components/v2/table/table-cell/GenericCell.vue +56 -0
  97. package/vue-components/v2/table/table-cell/ObjectCell.vue +4 -1
  98. package/vue-components/v2/tabs/EditorTabs.vue +1 -1
  99. package/vue-components/v3/button/Button.vue +6 -1
  100. package/vue-components/v3/content/ContentHeader.vue +2 -1
  101. package/vue-components/v3/content/ContentTable.vue +20 -2
  102. package/vue-components/v3/editor/Editor.vue +42 -33
  103. package/vue-components/v3/editor/FilteredFileEditor.vue +186 -0
  104. package/vue-components/v3/editor/MonacoEditor.vue +131 -0
  105. package/vue-components/v3/editor/ResourceKeyValueEditor.vue +125 -0
  106. package/vue-components/v3/form/Form.vue +63 -0
  107. package/vue-components/v3/form-fields/Input.vue +11 -10
  108. package/vue-components/v3/header/HeaderItem.vue +5 -0
  109. package/vue-components/v3/header/HeaderItems.vue +5 -0
  110. package/vue-components/v3/loaders/ResourceLoader.vue +83 -0
  111. package/vue-components/v3/loaders/SidebarLoader.vue +34 -0
  112. package/vue-components/v3/long-running-tasks/LongRunningTaskItem.vue +92 -0
  113. package/vue-components/v3/modal/Modal.vue +38 -6
  114. package/vue-components/v3/modals/DeleteConfirmationModal.vue +85 -0
  115. package/vue-components/v3/modals/JsonShowModal.vue +25 -16
  116. package/vue-components/v3/modals/LongRunningTasksModal.vue +337 -0
  117. package/vue-components/v3/navbar/Appdrawer.vue +12 -7
  118. package/vue-components/v3/navbar/ThemeMode.vue +49 -47
  119. package/vue-components/v3/navbar/User.vue +242 -18
  120. package/vue-components/v3/notification/Notification.vue +98 -0
  121. package/vue-components/v3/notification/NotificationItem.vue +52 -0
  122. package/vue-components/v3/pagination/Pagination.vue +16 -3
  123. package/vue-components/v3/sidebar/ClusterSwitcher.vue +133 -0
  124. package/vue-components/v3/sidebar/SidebarItemWithDropDown.vue +120 -0
  125. package/vue-components/v3/tab/TabItem.vue +1 -1
  126. package/vue-components/v3/table/MultiInfoTable.vue +143 -0
  127. package/vue-components/v3/table/Table.vue +47 -13
  128. package/vue-components/v3/table/TableContainer.vue +34 -0
  129. package/vue-components/v3/table/TableRow.vue +64 -3
  130. package/vue-components/v3/table/table-cell/CellValue.vue +28 -3
  131. package/vue-components/v3/table/table-cell/GenericCell.vue +75 -0
  132. package/vue-components/v3/table/table-cell/ObjectCell.vue +7 -2
  133. package/vue-components/v3/tabs/EditorTabs.vue +1 -1
  134. 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,11 +77,12 @@
57
77
  }
58
78
  }
59
79
  }
80
+
60
81
  &::after {
61
82
  position: absolute;
62
83
  content: "";
63
84
  left: 27px;
64
- top: 5px;
85
+ top: 10px;
65
86
  width: 1px;
66
87
  height: calc(100% - 20px);
67
88
  border: 1px dashed $ac-white-light;
@@ -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,30 +125,46 @@
101
125
  cursor: pointer;
102
126
  background-color: $ac-white;
103
127
  color: $ac-color-value;
128
+
129
+ &.is-disabled {
130
+ cursor: not-allowed;
131
+ }
104
132
  }
105
133
  }
106
134
  }
135
+
107
136
  .nested-body {
108
137
  padding-left: 24px;
109
138
  }
110
139
  }
111
140
 
141
+ .is-visibility-hidden {
142
+ visibility: hidden !important;
143
+ height: 0 !important;
144
+ opacity: 0 !important;
145
+ }
146
+
112
147
  // nested elements end
113
148
 
114
149
  .table-wrapper {
115
150
  overflow-x: auto;
151
+
116
152
  .table-inner {
117
153
  min-width: 630px;
154
+
118
155
  .thead {
119
156
  background-color: $ac-white-lighter;
157
+
120
158
  .tr {
121
159
  .th {
122
160
  font-weight: 600;
123
161
  }
162
+
124
163
  border-top: 1px solid var(--ac-white-light);
125
164
  border-bottom: 1px solid var(--ac-white-light);
126
165
  }
127
166
  }
167
+
128
168
  .thead,
129
169
  .tbody {
130
170
  .tr {
@@ -149,6 +189,7 @@
149
189
  }
150
190
  }
151
191
  }
192
+
152
193
  .is-selected {
153
194
  border: 1px solid $ac-primary;
154
195
  border-bottom: 1px solid $ac-primary !important;
@@ -156,6 +197,13 @@
156
197
  }
157
198
  }
158
199
 
200
+ .is-collapsed {
201
+ &.ac-nested-elements::before,
202
+ &.ac-nested-elements::after {
203
+ display: none;
204
+ }
205
+ }
206
+
159
207
  // details with checkradio
160
208
  .details-with-checkradio-wrapper {
161
209
  display: grid;
@@ -163,6 +211,33 @@
163
211
  grid-gap: 15px;
164
212
  }
165
213
 
214
+ // dark theme start
215
+ .is-dark-theme {
216
+ .nested-body {
217
+ code {
218
+ background-color: var(--dark-bg-light);
219
+ }
220
+ }
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
+
240
+ // dark theme end
166
241
  /****************************************
167
242
  Responsive Classes
168
243
  *****************************************/
@@ -0,0 +1,104 @@
1
+ .vue-schema-form-array {
2
+ .nested-body {
3
+ // margin-bottom: 15px;
4
+ display: flex;
5
+
6
+ .form-left-item {
7
+ margin-right: 10px;
8
+ width: calc(100% - 92px);
9
+ }
10
+ }
11
+ }
12
+
13
+ .nested-header {
14
+ .tabs.ac-tabs {
15
+ margin-bottom: 0;
16
+ opacity: 0;
17
+ visibility: hidden;
18
+ transition: 0.3s ease-in-out;
19
+ }
20
+
21
+ &:hover {
22
+ .tabs.ac-tabs {
23
+ opacity: 1;
24
+ visibility: visible;
25
+ }
26
+ }
27
+ }
28
+
29
+ .vue-openapi-form {
30
+ margin-left: -20px;
31
+ .is-warning {
32
+ font-size: 12px;
33
+ color: #ea3d2f;
34
+ padding-left: 10px;
35
+ }
36
+
37
+ .ac-nested-elements {
38
+ &:first-child {
39
+ margin-left: 0;
40
+ }
41
+
42
+ .nested-body {
43
+ padding-left: 0px;
44
+ }
45
+
46
+ .nested-header {
47
+ width: 100%;
48
+ }
49
+ }
50
+
51
+ .ac-single-switch {
52
+ margin-left: -15px;
53
+ }
54
+
55
+ .ac-single-input {
56
+ margin-left: 25px;
57
+
58
+ &:last-child {
59
+ margin-bottom: 15px;
60
+ }
61
+ }
62
+ }
63
+
64
+ .vue-form-scema-body {
65
+ .left-content {
66
+ width: 650px;
67
+ background-color: $ac-white-lighter;
68
+ padding: 30px;
69
+ }
70
+
71
+ .right-content {
72
+ width: 100%;
73
+ margin-top: 30px;
74
+ }
75
+ }
76
+
77
+ .v-tooltip-open {
78
+ background-color: $ac-white;
79
+ }
80
+
81
+ .ac-nested-elements::after {
82
+ top: 25px;
83
+ width: 1px;
84
+ height: calc(100% - 50px);
85
+ }
86
+
87
+ .ac-nested-elements::before {
88
+ bottom: 12px;
89
+ }
90
+
91
+ .is-collapsed {
92
+ &.ac-nested-elements::before,
93
+ &.ac-nested-elements::after {
94
+ display: none;
95
+ }
96
+ }
97
+
98
+ .ui-builders-wrapper {
99
+ .ac-nested-elements::before {
100
+ bottom: 6px !important;
101
+ }
102
+ }
103
+
104
+ // for vue-tooltip
@@ -0,0 +1,2 @@
1
+ // @import "404";
2
+ @import "code-preview";
@@ -1,6 +1,6 @@
1
1
  .component-wrapper {
2
2
  .component-inner {
3
- margin-bottom: 20px;
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,66 +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/initial-variables";
10
- @import "~assets/design-system/base/utilities/dark-theme";
11
- @import "~assets/design-system/base/utilities/derived-variables";
12
- @import "~assets/design-system/base/utilities/typography";
13
- @import "~assets/design-system/base/utilities/default";
14
- @import "~assets/design-system/base/utilities/mixin";
12
+ @import "~assets/design-system/base/utilities/all";
15
13
 
16
14
  // LAYOUTS
17
- @import "~assets/design-system/layouts/code-preview";
15
+ @import "~assets/design-system/layouts/all";
18
16
 
19
17
  // COMPONENTS
20
- @import "~assets/design-system/components/ac-alert-box";
21
- @import "~assets/design-system/components/ac-select-box";
22
- @import "~assets/design-system/components/ac-multi-select";
23
- @import "~assets/design-system/components/ac-code-highlight";
24
- @import "~assets/design-system/components/navbar";
25
- @import "~assets/design-system/components/breadcumb";
26
- @import "~assets/design-system/components/card-body-wrapper";
27
- @import "~assets/design-system/components/ac-options";
28
- @import "~assets/design-system/components/left-sidebar-menu";
29
- @import "~assets/design-system/components/dashboard-header";
30
- @import "~assets/design-system/components/widget-menu";
31
- @import "~assets/design-system/components/buttons";
32
- @import "~assets/design-system/components/ac-input";
33
- @import "~assets/design-system/components/ac-content-layout";
34
- @import "~assets/design-system/components/ac-table";
35
- @import "~assets/design-system/components/progress-bar";
36
- @import "~assets/design-system/components/go-to-top";
37
- @import "~assets/design-system/components/image-upload";
38
- @import "~assets/design-system/components/ac-modal";
39
- @import "~assets/design-system/components/ac-drag";
40
- @import "~assets/design-system/components/ac-tabs";
41
- @import "~assets/design-system/components/payment-card";
42
- @import "~assets/design-system/components/ac-accordion";
43
- @import "~assets/design-system/components/ac-card";
44
- @import "~assets/design-system/components/add-card";
45
- @import "~assets/design-system/components/subscription-card";
46
- @import "~assets/design-system/components/ac-calendar";
47
- @import "~assets/design-system/components/ac-tags";
48
- @import "~assets/design-system/components/nested-list";
49
- @import "~assets/design-system/components/overview-info";
50
- @import "~assets/design-system/components/pricing-table";
51
- @import "~assets/design-system/components/table-of-content";
52
- @import "~assets/design-system/components/preview-modal";
53
- @import "~assets/design-system/components/wizard";
54
- @import "~assets/design-system/components/preloader";
55
- @import "~assets/design-system/components/pagination";
56
- @import "~assets/design-system/components/ui-builder/ui-builder";
57
- @import "~assets/design-system/components/ac-toaster/ac-toasted";
58
- @import "~assets/design-system/components/bbum/post";
59
- @import "~assets/design-system/components/bbum/single-post-preview";
60
- @import "~assets/design-system/components/bbum/user-profile";
61
- @import "~assets/design-system/components/bbum/sign-up-notification";
62
- @import "~assets/design-system/components/bbum/activities-header";
63
- @import "~assets/design-system/components/bbum/card-team";
64
- @import "~assets/design-system/components/bbum/information-center";
65
- @import "~assets/design-system/components/bbum/left-sidebar";
66
- @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": "1.0.43-alpha.22",
3
+ "version": "1.0.43-alpha.221",
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
- "bulma-checkradio": "^1.1.1",
12
- "bulma-switch": "^2.0.0",
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 CHANGED
@@ -136,3 +136,7 @@ export function getFontHSL() {
136
136
  lightness,
137
137
  };
138
138
  }
139
+ export const loaderLightThemePrimaryColor = "#f5f7f9";
140
+ export const loaderDarkThemePrimaryColor = "#2e323c";
141
+ export const loaderLightThemeSecondaryColor = "#ecebeb";
142
+ export const loaderDarkThemeSecondaryColor = "#21272e";