@appscode/design-system 0.0.21-alpha.2 → 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.
Files changed (165) 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 +319 -110
  4. package/base/utilities/_derived-variables.scss +8 -15
  5. package/base/utilities/_grid.scss +29 -0
  6. package/base/utilities/_initial-variables.scss +111 -72
  7. package/base/utilities/_mixin.scss +90 -10
  8. package/base/utilities/_typography.scss +29 -19
  9. package/base/utilities/dark-theme.scss +26 -0
  10. package/components/_ac-accordion.scss +15 -5
  11. package/components/_ac-alert-box.scss +109 -26
  12. package/components/_ac-card.scss +71 -24
  13. package/components/_ac-code-highlight.scss +7 -1
  14. package/components/_ac-content-layout.scss +5 -5
  15. package/components/_ac-drag.scss +8 -6
  16. package/components/_ac-input.scss +196 -38
  17. package/components/_ac-modal.scss +6 -5
  18. package/components/_ac-multi-select.scss +281 -23
  19. package/components/_ac-options.scss +31 -16
  20. package/components/_ac-report.scss +53 -0
  21. package/components/_ac-select-box.scss +15 -5
  22. package/components/_ac-table.scss +160 -39
  23. package/components/_ac-tabs.scss +86 -23
  24. package/components/_ac-tags.scss +87 -2
  25. package/components/_ac-terminal.scss +270 -0
  26. package/components/_all.scss +28 -0
  27. package/components/_app-drawer.scss +134 -0
  28. package/components/_breadcumb.scss +8 -3
  29. package/components/_buttons.scss +96 -62
  30. package/components/_card-body-wrapper.scss +3 -3
  31. package/components/_dashboard-header.scss +33 -1
  32. package/components/_direct-deploy.scss +69 -0
  33. package/components/_go-to-top.scss +1 -1
  34. package/components/_graph.scss +45 -0
  35. package/components/_image-upload.scss +6 -4
  36. package/components/_left-sidebar-menu.scss +212 -52
  37. package/components/_monaco-editor.scss +1 -1
  38. package/components/_navbar.scss +193 -31
  39. package/components/_overview-info.scss +4 -4
  40. package/components/_overview-page.scss +1 -2
  41. package/components/_pagination.scss +45 -7
  42. package/components/_payment-card.scss +28 -12
  43. package/components/_preloader.scss +1 -1
  44. package/components/_preview-modal.scss +22 -9
  45. package/components/_pricing-table.scss +1 -1
  46. package/components/_progress-bar.scss +5 -5
  47. package/components/_subscription-card.scss +15 -8
  48. package/components/_table-of-content.scss +1 -1
  49. package/components/_tfa.scss +69 -0
  50. package/components/_transitions.scss +261 -0
  51. package/components/_widget-menu.scss +9 -9
  52. package/components/_wizard.scss +33 -20
  53. package/components/ac-toaster/_ac-toasted.scss +40 -8
  54. package/components/bbum/_all.scss +9 -0
  55. package/components/bbum/_card-team.scss +18 -10
  56. package/components/bbum/_information-center.scss +19 -5
  57. package/components/bbum/_mobile-desktop.scss +6 -6
  58. package/components/bbum/_post.scss +5 -4
  59. package/components/bbum/_sign-up-notification.scss +6 -6
  60. package/components/bbum/_single-post-preview.scss +10 -10
  61. package/components/bbum/_user-profile.scss +97 -90
  62. package/components/ui-builder/_ui-builder.scss +98 -21
  63. package/components/ui-builder/_vue-open-api.scss +104 -0
  64. package/layouts/_404.scss +159 -0
  65. package/layouts/_all.scss +2 -0
  66. package/layouts/_code-preview.scss +19 -8
  67. package/main.scss +6 -53
  68. package/package.json +4 -7
  69. package/plugins/caching.ts +243 -0
  70. package/plugins/theme.js +142 -0
  71. package/plugins/time-convert.js +49 -0
  72. package/plugins/vue-toaster.js +10 -6
  73. package/vue-components/v2/banner/Banner.vue +2 -2
  74. package/vue-components/v2/breadcrumbs/Breadcrumb.vue +97 -0
  75. package/vue-components/v2/button/Button.vue +10 -1
  76. package/vue-components/v2/button/DownloadBtn.vue +45 -0
  77. package/vue-components/v2/card/Card.vue +1 -0
  78. package/vue-components/v2/card/CardContent.vue +5 -0
  79. package/vue-components/v2/card/CardHeader.vue +12 -0
  80. package/vue-components/v2/card/OverviewCard.vue +10 -0
  81. package/vue-components/v2/card/OverviewCards.vue +5 -0
  82. package/vue-components/v2/card/PaymentCard.vue +69 -0
  83. package/vue-components/v2/card/PaymentCardOptionButtons.vue +35 -0
  84. package/vue-components/v2/card/PaymentCards.vue +44 -0
  85. package/vue-components/v2/content/ContentHeader.vue +9 -5
  86. package/vue-components/v2/content/ContentTable.vue +12 -7
  87. package/vue-components/v2/editor/Editor.vue +38 -5
  88. package/vue-components/v2/editor/FilteredFileEditor.vue +189 -0
  89. package/vue-components/v2/editor/MonacoEditor.vue +125 -0
  90. package/vue-components/v2/editor/ResourceKeyValueEditor.vue +209 -0
  91. package/vue-components/v2/form/Form.vue +12 -7
  92. package/vue-components/v2/form-fields/Input.vue +1 -1
  93. package/vue-components/v2/header/Header.vue +0 -1
  94. package/vue-components/v2/loaders/ResourceLoader.vue +101 -0
  95. package/vue-components/v2/loaders/SidebarLoader.vue +43 -0
  96. package/vue-components/v2/modal/Modal.vue +40 -7
  97. package/vue-components/v2/modals/DeleteConfirmationModal.vue +79 -0
  98. package/vue-components/v2/modals/JsonShowModal.vue +12 -3
  99. package/vue-components/v2/navbar/Appdrawer.vue +10 -9
  100. package/vue-components/v2/navbar/ThemeMode.vue +120 -0
  101. package/vue-components/v2/navbar/User.vue +229 -17
  102. package/vue-components/v2/notification/Notification.vue +101 -0
  103. package/vue-components/v2/notification/NotificationItem.vue +44 -0
  104. package/vue-components/v2/pagination/Pagination.vue +24 -4
  105. package/vue-components/v2/preloader/Preloader.vue +5 -5
  106. package/vue-components/v2/sidebar/ClusterSwitcher.vue +126 -0
  107. package/vue-components/v2/sidebar/SidebarItem.vue +24 -2
  108. package/vue-components/v2/sidebar/SidebarItemWithDropDown.vue +19 -20
  109. package/vue-components/v2/tab/TabItem.vue +1 -1
  110. package/vue-components/v2/table/FakeTableCell.vue +36 -0
  111. package/vue-components/v2/table/InfoTable.vue +13 -3
  112. package/vue-components/v2/table/NarrowTable.vue +0 -2
  113. package/vue-components/v2/table/Table.vue +170 -10
  114. package/vue-components/v2/table/TableRow.vue +29 -2
  115. package/vue-components/v2/table/table-cell/CellValue.vue +33 -4
  116. package/vue-components/v2/table/table-cell/GenericCell.vue +56 -0
  117. package/vue-components/v2/table/table-cell/ObjectCell.vue +4 -1
  118. package/vue-components/v2/tabs/EditorTabs.vue +1 -1
  119. package/vue-components/v3/button/Button.vue +78 -0
  120. package/vue-components/v3/content/ContentHeader.vue +55 -0
  121. package/vue-components/v3/content/ContentTable.vue +83 -0
  122. package/vue-components/v3/dropdown/DropdownDivider.vue +3 -0
  123. package/vue-components/v3/dropdown/DropdownItem.vue +5 -0
  124. package/vue-components/v3/dropdown/DropdownMenu.vue +111 -0
  125. package/vue-components/v3/editor/Editor.vue +160 -0
  126. package/vue-components/v3/editor/FilteredFileEditor.vue +186 -0
  127. package/vue-components/v3/editor/MonacoEditor.vue +131 -0
  128. package/vue-components/v3/editor/ResourceKeyValueEditor.vue +125 -0
  129. package/vue-components/v3/form/Form.vue +63 -0
  130. package/vue-components/v3/form-fields/Input.vue +22 -0
  131. package/vue-components/v3/header/Header.vue +45 -0
  132. package/vue-components/v3/header/HeaderItem.vue +5 -0
  133. package/vue-components/v3/header/HeaderItems.vue +5 -0
  134. package/vue-components/v3/loaders/ResourceLoader.vue +83 -0
  135. package/vue-components/v3/loaders/SidebarLoader.vue +34 -0
  136. package/vue-components/v3/long-running-tasks/LongRunningTaskItem.vue +92 -0
  137. package/vue-components/v3/modal/Modal.vue +158 -0
  138. package/vue-components/v3/modals/DeleteConfirmationModal.vue +85 -0
  139. package/vue-components/v3/modals/JsonShowModal.vue +96 -0
  140. package/vue-components/v3/modals/LongRunningTasksModal.vue +373 -0
  141. package/vue-components/v3/navbar/Appdrawer.vue +63 -0
  142. package/vue-components/v3/navbar/ThemeMode.vue +120 -0
  143. package/vue-components/v3/navbar/User.vue +288 -0
  144. package/vue-components/v3/notification/Notification.vue +98 -0
  145. package/vue-components/v3/notification/NotificationItem.vue +52 -0
  146. package/vue-components/v3/pagination/Pagination.vue +172 -0
  147. package/vue-components/v3/searchbars/SearchBar.vue +47 -0
  148. package/vue-components/v3/sidebar/ClusterSwitcher.vue +133 -0
  149. package/vue-components/v3/sidebar/SidebarItemWithDropDown.vue +120 -0
  150. package/vue-components/v3/tab/TabItem.vue +17 -0
  151. package/vue-components/v3/table/FakeTableCell.vue +39 -0
  152. package/vue-components/v3/table/InfoTable.vue +105 -0
  153. package/vue-components/v3/table/MultiInfoTable.vue +143 -0
  154. package/vue-components/v3/table/Table.vue +272 -0
  155. package/vue-components/v3/table/TableCell.vue +28 -0
  156. package/vue-components/v3/table/TableContainer.vue +34 -0
  157. package/vue-components/v3/table/TableRow.vue +147 -0
  158. package/vue-components/v3/table/table-cell/ArrayCell.vue +111 -0
  159. package/vue-components/v3/table/table-cell/CellValue.vue +133 -0
  160. package/vue-components/v3/table/table-cell/GenericCell.vue +75 -0
  161. package/vue-components/v3/table/table-cell/ObjectCell.vue +110 -0
  162. package/vue-components/v3/table/table-cell/ValueWithModal.vue +43 -0
  163. package/vue-components/v3/tabs/EditorTabs.vue +36 -0
  164. package/vue-components/v3/tag/Tag.vue +17 -0
  165. package/vue-components/v3/terminal/LongRunningTaskTerminal.vue +148 -0
@@ -10,7 +10,7 @@
10
10
  </span>
11
11
  </a>
12
12
 
13
- <ul :ref="title" :style="{ maxHeight: dropDownSectionHeight }">
13
+ <ul ref="sectionItems" :style="{ maxHeight: dropDownSectionHeight }">
14
14
  <slot />
15
15
  </ul>
16
16
  </li>
@@ -23,10 +23,6 @@ export default {
23
23
  type: Boolean,
24
24
  default: false,
25
25
  },
26
- isLoaderActive: {
27
- type: Boolean,
28
- default: false,
29
- },
30
26
  title: {
31
27
  type: String,
32
28
  default: "Sidebar Item",
@@ -41,27 +37,32 @@ export default {
41
37
  return {
42
38
  dropDownStatus: "close",
43
39
  dropDownSectionHeight: null,
40
+ isCompMounted: false,
44
41
  };
45
42
  },
46
43
 
47
- watch: {
48
- isLoaderActive(n) {
49
- if (!n) {
50
- this.$nextTick(() => {
51
- // for expanding dropdown
52
- this.setDropdownMaxHeight("open");
53
- });
44
+ mounted() {
45
+ this.isCompMounted = true;
46
+ setTimeout(() => {
47
+ // for expanding dropdown
48
+ if (this.isDropDownOpen) {
49
+ this.setDropdownMaxHeight("open");
50
+ } else {
51
+ this.setDropdownMaxHeight("close");
54
52
  }
55
- },
53
+ }, 700);
54
+ },
55
+
56
+ watch: {
56
57
  title(n, o) {
57
- if (n && !this.isLoaderActive) {
58
+ if (n && this.isCompMounted) {
58
59
  this.$nextTick(() => {
59
60
  // for expanding dropdown
60
61
  this.setDropdownMaxHeight("open");
61
62
  });
62
63
  }
63
64
 
64
- if (o && !this.isLoaderActive) {
65
+ if (o && this.isCompMounted) {
65
66
  this.$nextTick(() => {
66
67
  // for expanding dropdown
67
68
  this.setDropdownMaxHeight("close");
@@ -84,7 +85,7 @@ export default {
84
85
  this.$emit("dropDownItemChange");
85
86
 
86
87
  this.$nextTick(() => {
87
- const dropDownUl = this.$refs[this.title];
88
+ const dropDownUl = this.$refs["sectionItems"];
88
89
  if (dropDownUl)
89
90
  this.dropDownSectionHeight = `${dropDownUl.scrollHeight}px`;
90
91
  });
@@ -99,11 +100,9 @@ export default {
99
100
  methods: {
100
101
  setDropdownMaxHeight(mode) {
101
102
  if (mode === "open") {
102
- this.$refs[this.title][0].style.maxHeight = `${
103
- this.$refs[this.title][0].scrollHeight
104
- }px`;
103
+ this.dropDownSectionHeight = `${this.$refs["sectionItems"]?.scrollHeight}px`;
105
104
  } else {
106
- this.$refs[this.title][0].style.maxHeight = null;
105
+ this.dropDownSectionHeight = null;
107
106
  }
108
107
  },
109
108
  toggleDropDownStatus() {
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <li :class="{ 'is-active': isActive }">
2
+ <li :class="{ 'is-active': isActive }" data-testid="tab-item">
3
3
  <slot />
4
4
  </li>
5
5
  </template>
@@ -0,0 +1,36 @@
1
+ <template>
2
+ <th v-if="isHeaderCell" class="increase-width">
3
+ <div class="increase-innner" :style="dynamicColumnStyle" />
4
+ </th>
5
+ <table-cell v-else class="increase-width">
6
+ <div class="increase-innner" :style="dynamicColumnStyle" />
7
+ </table-cell>
8
+ </template>
9
+
10
+ <script>
11
+ export default {
12
+ props: {
13
+ isHeaderCell: {
14
+ type: Boolean,
15
+ default: false,
16
+ },
17
+ fakeCellWidth: {
18
+ type: Number,
19
+ default: 0,
20
+ },
21
+ },
22
+
23
+ components: {
24
+ TableCell: () =>
25
+ import("@appscode/design-system/vue-components/v2/table/TableCell.vue"),
26
+ },
27
+
28
+ computed: {
29
+ dynamicColumnStyle() {
30
+ return {
31
+ right: `-${this.fakeCellWidth}px`,
32
+ };
33
+ },
34
+ },
35
+ };
36
+ </script>
@@ -1,6 +1,9 @@
1
1
  <template>
2
2
  <table-container>
3
- <table class="table ac-info-table is-fullwidth">
3
+ <table
4
+ class="table ac-info-table is-fullwidth"
5
+ :class="{ 'pl-0 pr-0': removeContentPadding }"
6
+ >
4
7
  <tbody v-if="isFullTableLoaderActive">
5
8
  <!-- table loader -->
6
9
  <table-row v-for="i in loaderCols" :key="i">
@@ -15,7 +18,10 @@
15
18
  </tbody>
16
19
  <tbody
17
20
  v-else
18
- :class="isTableEmpty ? 'no-data-available has-text-centered p-10' : ''"
21
+ :class="{
22
+ 'no-data-available has-text-centered p-10': isTableEmpty,
23
+ 'pl-0 pr-0': removeContentPadding
24
+ }"
19
25
  >
20
26
  <template v-if="!isTableEmpty">
21
27
  <!-- table rows -->
@@ -60,7 +66,11 @@ export default {
60
66
  },
61
67
  tableHeaders: {
62
68
  type: Array,
63
- default: () => [],
69
+ default: () => []
70
+ },
71
+ removeContentPadding: {
72
+ type: Boolean,
73
+ default: false,
64
74
  },
65
75
  },
66
76
 
@@ -15,5 +15,3 @@ export default {
15
15
  },
16
16
  };
17
17
  </script>
18
-
19
- TableContainer
@@ -1,6 +1,16 @@
1
1
  <template>
2
2
  <table-container>
3
- <table class="table ac-table ac-striped is-fullwidth">
3
+ <table
4
+ ref="ac-table"
5
+ class="table ac-table ac-striped"
6
+ :class="{
7
+ 'is-fullwidth':
8
+ !isDynamicWidthTable ||
9
+ isFullTableLoaderActive ||
10
+ isTableEmpty ||
11
+ isLoaderActive,
12
+ }"
13
+ >
4
14
  <thead>
5
15
  <table-row v-if="isFullTableLoaderActive">
6
16
  <th v-for="i in loaderCols" :key="i">
@@ -8,10 +18,57 @@
8
18
  </th>
9
19
  </table-row>
10
20
  <table-row v-else>
11
- <th v-for="tableHeader in tableHeaders" :key="tableHeader">
12
- {{ tableHeader }}
21
+ <th
22
+ v-for="(tableHeader, idx) in tableHeaders"
23
+ :key="idx"
24
+ :class="{
25
+ sorting: headerSortables[idx] && headerSortables[idx].enabled,
26
+ 'sorting-desc':
27
+ headerSortables[idx] && headerSortables[idx].mode === 'desc',
28
+ 'sorting-asc':
29
+ headerSortables[idx] && headerSortables[idx].mode === 'asc',
30
+ 'has-text-centered':
31
+ typeof tableHeader === 'string'
32
+ ? false
33
+ : tableHeader.textAlign === 'center',
34
+ 'has-text-left':
35
+ typeof tableHeader === 'string'
36
+ ? false
37
+ : tableHeader.textAlign === 'left',
38
+ 'has-text-right':
39
+ typeof tableHeader === 'string'
40
+ ? false
41
+ : tableHeader.textAlign === 'right',
42
+ }"
43
+ @click.prevent="
44
+ headerSortables[idx] &&
45
+ headerSortables[idx].enabled &&
46
+ emitSortEvent(idx)
47
+ "
48
+ >
49
+ {{ headerLabels[idx] }}
50
+ <span
51
+ v-if="
52
+ tableHeader.dashboard &&
53
+ tableHeader.dashboard.status &&
54
+ tableHeader.dashboard.status !== 'Success'
55
+ "
56
+ class="icon has-text-danger"
57
+ :title="tableHeader.dashboard && tableHeader.dashboard.message"
58
+ >
59
+ <i class="fa fa-exclamation-triangle" />
60
+ </span>
13
61
  </th>
14
- <th v-if="actionable" style="min-width: 100px;"></th>
62
+ <th
63
+ ref="action-section"
64
+ v-if="actionable"
65
+ style="min-width: 100px"
66
+ ></th>
67
+ <fake-table-cell
68
+ v-if="fakeCellWidth > 0"
69
+ :is-header-cell="true"
70
+ :fake-cell-width="fakeCellWidth"
71
+ />
15
72
  </table-row>
16
73
  </thead>
17
74
  <!-- table row loaders -->
@@ -22,8 +79,14 @@
22
79
  </th>
23
80
  </table-row>
24
81
  <table-row v-else>
25
- <table-cell v-for="tableHeader in tableHeaders" :key="tableHeader">
26
- <cell-value :is-loader-active="true" :cell-title="tableHeader" />
82
+ <table-cell
83
+ v-for="(tableHeader, idx) in tableHeaders"
84
+ :key="headerLabels[idx]"
85
+ >
86
+ <cell-value
87
+ :is-loader-active="true"
88
+ :cell-title="headerLabels[idx]"
89
+ />
27
90
  </table-cell>
28
91
  </table-row>
29
92
  </tbody>
@@ -31,13 +94,14 @@
31
94
  <template v-else>
32
95
  <tbody v-if="!isTableEmpty">
33
96
  <!-- table rows -->
34
- <slot />
35
- <!-- table rows -->
97
+ <slot :fake-cell-width="fakeCellWidth" />
36
98
  </tbody>
37
99
  <tbody v-else>
38
100
  <table-row class="is-hoverless">
39
101
  <table-cell
40
- :colspan="tableHeaders.length"
102
+ :colspan="
103
+ actionable ? tableHeaders.length + 1 : tableHeaders.length
104
+ "
41
105
  class="no-data-available has-text-centered"
42
106
  >
43
107
  <empty-table-info />
@@ -71,6 +135,14 @@ export default {
71
135
  type: Boolean,
72
136
  default: false,
73
137
  },
138
+ isDynamicWidthTable: {
139
+ type: Boolean,
140
+ default: false,
141
+ },
142
+ fullWidth: {
143
+ type: Number,
144
+ default: 1920,
145
+ },
74
146
  },
75
147
  components: {
76
148
  TableContainer: () => import("./TableContainer.vue"),
@@ -78,18 +150,106 @@ export default {
78
150
  TableCell: () => import("./TableCell.vue"),
79
151
  CellValue: () => import("./table-cell/CellValue.vue"),
80
152
  EmptyTableInfo: () => import("./EmptyTableInfo.vue"),
153
+ FakeTableCell: () => import("./FakeTableCell.vue"),
81
154
  },
82
155
 
83
156
  data() {
84
157
  return {
85
- loaderCols: 5,
158
+ fakeCellWidth: 0,
159
+ headerSortables: [],
86
160
  };
87
161
  },
88
162
 
89
163
  computed: {
164
+ loaderCols() {
165
+ if (this.isFullTableLoaderActive) {
166
+ return 5;
167
+ } else if (this.isLoaderActive) {
168
+ return Math.max(this.tableHeaders.length + 1, 5);
169
+ } else {
170
+ return this.tableHeaders.length || 5;
171
+ }
172
+ },
90
173
  isFullTableLoaderActive() {
91
174
  return !this.tableHeaders.length;
92
175
  },
176
+ headerLabels() {
177
+ return this.tableHeaders.map((th) =>
178
+ typeof th === "string" ? th : th.name || "Label"
179
+ );
180
+ },
181
+ },
182
+
183
+ watch: {
184
+ tableHeaders: {
185
+ immediate: true,
186
+ handler(n) {
187
+ if (this.headerSortables.length === n.length) {
188
+ n.forEach((th, idx) => {
189
+ if (
190
+ this.headerSortables[idx].enabled !==
191
+ !!(th && th.sort && th.sort.enable)
192
+ ) {
193
+ this.headerSortables[idx].enabled = !!(
194
+ th &&
195
+ th.sort &&
196
+ th.sort.enable
197
+ );
198
+ this.headerSortables[idx].mode = "";
199
+ }
200
+ });
201
+ } else {
202
+ this.headerSortables = n.map((th) => {
203
+ if (typeof th === "string") {
204
+ return {
205
+ enabled: false,
206
+ mode: "",
207
+ };
208
+ } else {
209
+ return {
210
+ enabled: !!(th && th.sort && th.sort.enable),
211
+ mode: "",
212
+ };
213
+ }
214
+ });
215
+ }
216
+ },
217
+ },
218
+ },
219
+
220
+ updated() {
221
+ this.$nextTick(() => {
222
+ this.onWindowResize();
223
+ });
224
+ },
225
+
226
+ methods: {
227
+ onWindowResize() {
228
+ if (this.$refs["ac-table"] && this.isDynamicWidthTable) {
229
+ const tableWidth = this.$refs["ac-table"].clientWidth;
230
+ const d = this.fullWidth - tableWidth;
231
+ this.fakeCellWidth = d;
232
+ }
233
+ },
234
+ emitSortEvent(index) {
235
+ const emitValue = {
236
+ index,
237
+ label: this.tableHeaders[index].name,
238
+ mode: "",
239
+ };
240
+
241
+ this.headerSortables.forEach((hs, idx) => {
242
+ if (idx !== index) hs.mode = "";
243
+ else {
244
+ if (hs.mode === "asc") hs.mode = "desc";
245
+ else hs.mode = "asc";
246
+
247
+ emitValue.mode = hs.mode;
248
+ }
249
+ });
250
+
251
+ this.$emit("sort", emitValue);
252
+ },
93
253
  },
94
254
  };
95
255
  </script>
@@ -6,16 +6,30 @@
6
6
  custom
7
7
  v-slot="{ navigate }"
8
8
  >
9
- <tr @click="navigate">
9
+ <tr class="is-link" @click="navigate" data-testid="ac-table-row">
10
10
  <slot />
11
+ <fake-table-cell
12
+ v-if="fakeCellWidth > 0"
13
+ :fake-cell-width="fakeCellWidth"
14
+ />
11
15
  </tr>
12
16
  </router-link>
17
+
13
18
  <tr
14
19
  v-else
15
- :class="{ 'is-selected': isSelected, 'is-hoverless': !isSelected }"
20
+ :class="{
21
+ 'is-selected': isSelected,
22
+ 'is-hoverless': !isSelected,
23
+ 'is-disabled': isDisabled,
24
+ }"
25
+ data-testid="ac-table-row"
16
26
  @click.prevent="$emit('rowselect', true)"
17
27
  >
18
28
  <slot />
29
+ <fake-table-cell
30
+ v-if="fakeCellWidth > 0"
31
+ :fake-cell-width="fakeCellWidth"
32
+ />
19
33
  </tr>
20
34
  </template>
21
35
 
@@ -30,6 +44,19 @@ export default {
30
44
  type: Boolean,
31
45
  default: false,
32
46
  },
47
+ isDisabled: {
48
+ type: Boolean,
49
+ default: false,
50
+ },
51
+ fakeCellWidth: {
52
+ type: Number,
53
+ default: 0,
54
+ },
55
+ },
56
+
57
+ components: {
58
+ TableCell: () => import("./TableCell.vue"),
59
+ FakeTableCell: () => import("./FakeTableCell.vue"),
33
60
  },
34
61
  };
35
62
  </script>
@@ -1,22 +1,29 @@
1
1
  <template>
2
2
  <div v-if="isLoaderActive" ref="cellLoaderDiv" :style="{ maxWidth: '300px' }">
3
- <content-loader :height="10" :width="computedCellWidth || 300" />
3
+ <content-loader
4
+ :height="10"
5
+ :width="computedCellWidth || 300"
6
+ :primaryColor="primaryColor"
7
+ :secondaryColor="secondaryColor"
8
+ />
4
9
  </div>
5
- <div v-else class="haha" ref="cellDiv">
10
+ <div v-else ref="cellDiv">
6
11
  <object-cell
7
12
  v-if="valueType === 'object'"
8
13
  :obj="value"
9
14
  :cell-title="cellTitle"
10
15
  :max-character-length="maxCharacterLength"
16
+ data-testid="object-cell-value"
11
17
  />
12
18
  <array-cell
13
19
  v-else-if="valueType === 'array'"
14
20
  :items="value"
15
21
  :cell-title="cellTitle"
16
22
  :max-character-length="maxCharacterLength"
23
+ data-testid="array-cell-value"
17
24
  />
18
25
  <template v-else>
19
- <span class="is-ellipsis-1" :title="value">{{
26
+ <span class="is-ellipsis-1" :title="tooltip" data-testid="cell-value">{{
20
27
  value || (value === 0 ? 0 : "-")
21
28
  }}</span>
22
29
  </template>
@@ -24,6 +31,13 @@
24
31
  </template>
25
32
 
26
33
  <script>
34
+ import {
35
+ loaderLightThemePrimaryColor,
36
+ loaderDarkThemePrimaryColor,
37
+ loaderLightThemeSecondaryColor,
38
+ loaderDarkThemeSecondaryColor,
39
+ } from "@appscode/design-system/plugins/theme";
40
+
27
41
  export default {
28
42
  props: {
29
43
  isLoaderActive: {
@@ -38,6 +52,10 @@ export default {
38
52
  type: null,
39
53
  default: "",
40
54
  },
55
+ tooltip: {
56
+ type: String,
57
+ defualt: "",
58
+ },
41
59
  },
42
60
  components: {
43
61
  ContentLoader: () =>
@@ -49,13 +67,24 @@ export default {
49
67
  computed: {
50
68
  valueType() {
51
69
  if (typeof this.value === "object") {
52
- if (Array.isArray(this.value)) return "array";
70
+ if (this.value === null) return "null";
71
+ else if (Array.isArray(this.value)) return "array";
53
72
  else return "object";
54
73
  } else return typeof this.value;
55
74
  },
56
75
  maxCharacterLength() {
57
76
  return Math.ceil(this.computedCellWidth / 8);
58
77
  },
78
+ primaryColor() {
79
+ return document.documentElement.classList.contains("is-dark-theme")
80
+ ? loaderDarkThemePrimaryColor
81
+ : loaderLightThemePrimaryColor;
82
+ },
83
+ secondaryColor() {
84
+ return document.documentElement.classList.contains("is-dark-theme")
85
+ ? loaderDarkThemeSecondaryColor
86
+ : loaderLightThemeSecondaryColor;
87
+ },
59
88
  },
60
89
 
61
90
  data() {
@@ -0,0 +1,56 @@
1
+ <template>
2
+ <span
3
+ :class="{
4
+ 'is-flex': cellDescriptor.type !== 'object',
5
+ 'is-align-items-center': cellValue.icon,
6
+ 'is-justify-content-center': cellDescriptor.textAlign === 'center',
7
+ 'is-justify-content-left': cellDescriptor.textAlign === 'left',
8
+ 'is-justify-content-right': cellDescriptor.textAlign === 'right'
9
+ }"
10
+ >
11
+ <span v-if="cellValue.icon" class="icon p-0 mr-10">
12
+ <img width="15" :src="cellValue.icon" />
13
+ </span>
14
+ <router-link v-if="cellValue.link" :to="getCellLink(cellValue)">
15
+ {{ cellValue.data }}
16
+ </router-link>
17
+ <tag v-else-if="cellValue.color" :class="`is-${cellValue.color}`">
18
+ {{ cellValue.data }}
19
+ </tag>
20
+ <cell-value
21
+ v-else
22
+ :cell-title="cellDescriptor.name"
23
+ :value="cellValue.data || '-'"
24
+ :tooltip="cellValue.tooltip || JSON.stringify(cellValue.data)"
25
+ />
26
+ </span>
27
+ </template>
28
+ <script>
29
+ export default {
30
+ components: {
31
+ Tag: () => import("../../tag/Tag.vue"),
32
+ CellValue: () => import("../table-cell/CellValue.vue")
33
+ },
34
+ props: {
35
+ cellDescriptor: {
36
+ type: Object,
37
+ default: () => ({})
38
+ },
39
+ cellValue: {
40
+ type: Object,
41
+ default: () => ({})
42
+ }
43
+ },
44
+ methods: {
45
+ getCellLink(cell) {
46
+ const inject = (str, obj) => str.replace(/\${(.*?)}/g, (x, g) => obj[g]);
47
+ const { user, cluster } = this.$route.params;
48
+ const link = inject(cell.link || "", {
49
+ username: user,
50
+ clustername: cluster
51
+ });
52
+ return link;
53
+ }
54
+ }
55
+ };
56
+ </script>
@@ -68,7 +68,10 @@ export default {
68
68
  },
69
69
  printableStringObjs() {
70
70
  return this.objKeys.map((key) => {
71
- const value = this.obj[key];
71
+ let value = this.obj[key];
72
+ if (typeof value === "object" && value !== null) {
73
+ value = JSON.stringify(value);
74
+ }
72
75
  const keyValue = `${key}: ${value}`;
73
76
  const exceededLength = keyValue.length > 30;
74
77
  const print = exceededLength ? key : keyValue;
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <tabs-body class="mt-20">
2
+ <tabs-body>
3
3
  <tabs class="is-line">
4
4
  <tab-item :is-active="activeTab === 'edit'">
5
5
  <a @click.prevent="$emit('tabchange', 'edit')">Edit</a>
@@ -0,0 +1,78 @@
1
+ <template>
2
+ <button
3
+ class="button ac-button is-extra-small"
4
+ :class="`${modifierClasses}${isLoaderActive ? ' is-loading' : ''}`"
5
+ :disabled="disabled ? true : null"
6
+ @click="handleClick"
7
+ :title="tooltip"
8
+ >
9
+ <span v-if="iconClass || iconImage" class="icon is-small">
10
+ <img
11
+ v-if="iconImage"
12
+ :src="iconImage"
13
+ alt="icon"
14
+ :width="iconImageWidth"
15
+ />
16
+ <i v-else :class="`fa fa-${iconClass}`" aria-hidden="true" />
17
+ </span>
18
+ <span v-if="title" :class="titleModifierClass">{{ title }}</span>
19
+ <slot />
20
+ </button>
21
+ </template>
22
+
23
+ <script>
24
+ import { defineComponent } from "vue";
25
+ export default defineComponent({
26
+ props: {
27
+ // button title
28
+ title: {
29
+ type: String,
30
+ default: "",
31
+ },
32
+ tooltip: {
33
+ type: String,
34
+ defualt: undefined
35
+ },
36
+ // for loader
37
+ isLoaderActive: {
38
+ type: Boolean,
39
+ default: false,
40
+ },
41
+ // for disability
42
+ disabled: {
43
+ type: Boolean,
44
+ default: false,
45
+ },
46
+ // for icon
47
+ iconClass: {
48
+ type: String,
49
+ default: "",
50
+ },
51
+ iconImage: {
52
+ type: String,
53
+ default: "",
54
+ },
55
+ iconImageWidth: {
56
+ type: Number,
57
+ default: undefined,
58
+ },
59
+ // modifier class
60
+ modifierClasses: {
61
+ type: String,
62
+ default: "is-primary",
63
+ },
64
+ titleModifierClass: {
65
+ type: String,
66
+ default: "",
67
+ },
68
+ },
69
+
70
+ emits: ["click"],
71
+
72
+ methods: {
73
+ handleClick(e) {
74
+ if (!this.disabled) this.$emit("click", e);
75
+ },
76
+ },
77
+ });
78
+ </script>