@appscode/design-system 2.2.41 → 2.2.43

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appscode/design-system",
3
- "version": "2.2.41",
3
+ "version": "2.2.43",
4
4
  "description": "A design system for Appscode websites and dashboards made using Bulma",
5
5
  "main": "main.scss",
6
6
  "scripts": {
@@ -9,6 +9,8 @@ import HeroiconsTrash from "~icons/heroicons/trash";
9
9
  import HeroiconsChevronDownSolid from "~icons/heroicons/chevron-down-solid";
10
10
  import HeroiconsChevronUpSolid from "~icons/heroicons/chevron-up-solid";
11
11
 
12
+ const JsonModal = defineAsyncComponent(() => import("../modals/JsonShowModal.vue"));
13
+
12
14
  interface Props {
13
15
  disabled?: boolean;
14
16
  isCreateDisabled?: boolean;
@@ -49,6 +51,8 @@ const editFieldIndex = ref(-1);
49
51
  const isFormHidden = ref(true);
50
52
  const isSavingNewElement = ref(false);
51
53
  const dataForTable = defineModel<Array<AcTableRow>>({ required: true });
54
+ const isOpen = ref(false);
55
+ const fullNamespaceList = ref<string[]>([]);
52
56
 
53
57
  function onAddClick() {
54
58
  isSavingNewElement.value = true;
@@ -85,12 +89,33 @@ function onDetailsClick(row: number) {
85
89
  editFieldIndex.value = -1;
86
90
  }
87
91
 
88
- function readableTime(utcTime: string) {
89
- return new Date(utcTime).toLocaleString();
92
+ function readableTime(utcTime: unknown) {
93
+ if (typeof utcTime === "string") return new Date(utcTime).toLocaleString();
94
+ else return utcTime;
95
+ }
96
+ function truncatedNamespaces(namespaces: string[]): string {
97
+ if (namespaces.length <= 1) {
98
+ return namespaces[0];
99
+ }
100
+ return namespaces.slice(0, 1).join(", ") + ` (+${namespaces.length - 1})`;
101
+ }
102
+
103
+ function showFullNamespaceList(namespaces: string[]): void {
104
+ isOpen.value = true;
105
+
106
+ fullNamespaceList.value = namespaces;
90
107
  }
91
108
  </script>
92
109
 
93
110
  <template>
111
+ <json-modal
112
+ v-if="isOpen"
113
+ :open="isOpen"
114
+ :title="'Namespace List'"
115
+ :editor-content="fullNamespaceList"
116
+ @closemodal="isOpen = false"
117
+ ></json-modal>
118
+
94
119
  <div :class="{ 'ac-nested-elements': label }">
95
120
  <!-- Add New Form Start -->
96
121
  <template v-if="isSavingNewElement">
@@ -181,12 +206,23 @@ function readableTime(utcTime: string) {
181
206
  <tbody>
182
207
  <template v-for="(itemRow, idxRow) in dataForTable" :key="idxRow">
183
208
  <tr data-testid="ac-table-row">
184
- <td
185
- v-for="(itemColumn, idx) in itemRow.cells"
186
- :key="itemColumn.data as string || 'namespace' + idx"
187
- >
209
+ <td v-for="(itemColumn, idx) in itemRow.cells" :key="tableHeaders[idx].name + idx">
188
210
  <template v-if="tableHeaders[idx].type === 'date'">
189
- {{ readableTime(itemColumn.data as string) }}
211
+ {{ readableTime(itemColumn.data) }}
212
+ </template>
213
+ <template
214
+ v-else-if="tableHeaders[idx].name.toLowerCase() === 'namespace' && Array.isArray(itemColumn.data)"
215
+ >
216
+ <span
217
+ >{{ truncatedNamespaces(itemColumn.data) }}
218
+ <div
219
+ v-if="itemColumn.data.length > 1"
220
+ class="tag is-secondary is-light"
221
+ @click="showFullNamespaceList(itemColumn.data)"
222
+ >
223
+ <a>More </a>
224
+ </div></span
225
+ >
190
226
  </template>
191
227
  <template v-else>
192
228
  {{ itemColumn.data }}
@@ -15,7 +15,7 @@ interface Props {
15
15
  withDefaults(defineProps<Props>(), {
16
16
  title: "Delete Modal",
17
17
  message: "Do you want to delete",
18
- itemName: "item",
18
+ itemName: "",
19
19
  modifierClasses: "is-normal",
20
20
  isDeleteActive: false,
21
21
  disableModalClose: false,