@appscode/design-system 1.0.43-alpha.21 → 1.0.43-alpha.211

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 (132) 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 +313 -67
  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 +7 -5
  22. package/components/_ac-tabs.scss +46 -5
  23. package/components/_ac-terminal.scss +270 -0
  24. package/components/_all.scss +27 -0
  25. package/components/_app-drawer.scss +2 -2
  26. package/components/_breadcumb.scss +2 -0
  27. package/components/_buttons.scss +50 -37
  28. package/components/_card-body-wrapper.scss +2 -2
  29. package/components/_dashboard-header.scss +32 -0
  30. package/components/_direct-deploy.scss +69 -0
  31. package/components/_go-to-top.scss +1 -1
  32. package/components/_graph.scss +45 -0
  33. package/components/_image-upload.scss +5 -3
  34. package/components/_left-sidebar-menu.scss +124 -73
  35. package/components/_monaco-editor.scss +1 -1
  36. package/components/_navbar.scss +170 -10
  37. package/components/_overview-info.scss +3 -3
  38. package/components/_pagination.scss +8 -0
  39. package/components/_payment-card.scss +10 -1
  40. package/components/_preview-modal.scss +18 -5
  41. package/components/_pricing-table.scss +1 -1
  42. package/components/_progress-bar.scss +4 -4
  43. package/components/_subscription-card.scss +11 -4
  44. package/components/_table-of-content.scss +1 -1
  45. package/components/_tfa.scss +69 -0
  46. package/components/_transitions.scss +261 -0
  47. package/components/_wizard.scss +16 -3
  48. package/components/bbum/_all.scss +9 -0
  49. package/components/bbum/_card-team.scss +1 -1
  50. package/components/bbum/_information-center.scss +15 -1
  51. package/components/bbum/_sign-up-notification.scss +1 -1
  52. package/components/bbum/_single-post-preview.scss +2 -2
  53. package/components/bbum/_user-profile.scss +2 -3
  54. package/components/ui-builder/_ui-builder.scss +76 -1
  55. package/components/ui-builder/_vue-open-api.scss +104 -0
  56. package/layouts/_all.scss +2 -0
  57. package/layouts/_code-preview.scss +5 -2
  58. package/main.scss +6 -54
  59. package/package.json +2 -7
  60. package/plugins/theme.js +4 -0
  61. package/plugins/time-convert.js +49 -0
  62. package/plugins/vue-toaster.js +3 -0
  63. package/vue-components/v2/banner/Banner.vue +2 -2
  64. package/vue-components/v2/breadcrumbs/Breadcrumb.vue +97 -0
  65. package/vue-components/v2/button/Button.vue +5 -0
  66. package/vue-components/v2/button/DownloadBtn.vue +45 -0
  67. package/vue-components/v2/card/Card.vue +1 -0
  68. package/vue-components/v2/card/PaymentCards.vue +11 -2
  69. package/vue-components/v2/content/ContentTable.vue +12 -7
  70. package/vue-components/v2/editor/Editor.vue +43 -24
  71. package/vue-components/v2/editor/FilteredFileEditor.vue +189 -0
  72. package/vue-components/v2/editor/MonacoEditor.vue +125 -0
  73. package/vue-components/v2/editor/ResourceKeyValueEditor.vue +209 -0
  74. package/vue-components/v2/form-fields/Input.vue +1 -1
  75. package/vue-components/v2/loaders/ResourceLoader.vue +101 -0
  76. package/vue-components/v2/loaders/SidebarLoader.vue +43 -0
  77. package/vue-components/v2/modal/Modal.vue +38 -4
  78. package/vue-components/v2/modals/DeleteConfirmationModal.vue +79 -0
  79. package/vue-components/v2/modals/JsonShowModal.vue +12 -2
  80. package/vue-components/v2/navbar/Appdrawer.vue +10 -9
  81. package/vue-components/v2/navbar/ThemeMode.vue +50 -44
  82. package/vue-components/v2/navbar/User.vue +229 -17
  83. package/vue-components/v2/notification/Notification.vue +101 -0
  84. package/vue-components/v2/notification/NotificationItem.vue +44 -0
  85. package/vue-components/v2/pagination/Pagination.vue +16 -3
  86. package/vue-components/v2/preloader/Preloader.vue +5 -5
  87. package/vue-components/v2/sidebar/ClusterSwitcher.vue +126 -0
  88. package/vue-components/v2/sidebar/SidebarItem.vue +23 -1
  89. package/vue-components/v2/sidebar/SidebarItemWithDropDown.vue +19 -20
  90. package/vue-components/v2/tab/TabItem.vue +1 -1
  91. package/vue-components/v2/table/Table.vue +44 -8
  92. package/vue-components/v2/table/TableRow.vue +12 -2
  93. package/vue-components/v2/table/table-cell/CellValue.vue +33 -4
  94. package/vue-components/v2/table/table-cell/GenericCell.vue +56 -0
  95. package/vue-components/v2/table/table-cell/ObjectCell.vue +4 -1
  96. package/vue-components/v2/tabs/EditorTabs.vue +1 -1
  97. package/vue-components/v3/button/Button.vue +6 -1
  98. package/vue-components/v3/content/ContentTable.vue +17 -2
  99. package/vue-components/v3/editor/Editor.vue +42 -33
  100. package/vue-components/v3/editor/FilteredFileEditor.vue +186 -0
  101. package/vue-components/v3/editor/MonacoEditor.vue +131 -0
  102. package/vue-components/v3/editor/ResourceKeyValueEditor.vue +125 -0
  103. package/vue-components/v3/form/Form.vue +63 -0
  104. package/vue-components/v3/form-fields/Input.vue +11 -10
  105. package/vue-components/v3/header/HeaderItem.vue +5 -0
  106. package/vue-components/v3/header/HeaderItems.vue +5 -0
  107. package/vue-components/v3/loaders/ResourceLoader.vue +83 -0
  108. package/vue-components/v3/loaders/SidebarLoader.vue +34 -0
  109. package/vue-components/v3/long-running-tasks/LongRunningTaskItem.vue +92 -0
  110. package/vue-components/v3/modal/Modal.vue +38 -6
  111. package/vue-components/v3/modals/DeleteConfirmationModal.vue +85 -0
  112. package/vue-components/v3/modals/JsonShowModal.vue +25 -16
  113. package/vue-components/v3/modals/LongRunningTasksModal.vue +337 -0
  114. package/vue-components/v3/navbar/Appdrawer.vue +12 -7
  115. package/vue-components/v3/navbar/ThemeMode.vue +49 -47
  116. package/vue-components/v3/navbar/User.vue +242 -18
  117. package/vue-components/v3/notification/Notification.vue +98 -0
  118. package/vue-components/v3/notification/NotificationItem.vue +52 -0
  119. package/vue-components/v3/pagination/Pagination.vue +16 -3
  120. package/vue-components/v3/sidebar/ClusterSwitcher.vue +133 -0
  121. package/vue-components/v3/sidebar/SidebarItemWithDropDown.vue +120 -0
  122. package/vue-components/v3/tab/TabItem.vue +1 -1
  123. package/vue-components/v3/table/MultiInfoTable.vue +143 -0
  124. package/vue-components/v3/table/Table.vue +40 -12
  125. package/vue-components/v3/table/TableContainer.vue +34 -0
  126. package/vue-components/v3/table/TableRow.vue +62 -3
  127. package/vue-components/v3/table/table-cell/CellValue.vue +28 -3
  128. package/vue-components/v3/table/table-cell/GenericCell.vue +75 -0
  129. package/vue-components/v3/table/table-cell/ObjectCell.vue +5 -1
  130. package/vue-components/v3/tabs/EditorTabs.vue +1 -1
  131. package/vue-components/v3/tag/Tag.vue +1 -1
  132. package/vue-components/v3/terminal/LongRunningTaskTerminal.vue +148 -0
@@ -0,0 +1,101 @@
1
+ <template>
2
+ <div
3
+ @mouseenter="notificationPanelOpen = true"
4
+ @mouseleave="notificationPanelOpen = false"
5
+ >
6
+ <button class="button ac-nav-button">
7
+ <span v-if="unreadCount">{{ unreadCount }}</span>
8
+ <i
9
+ class="fa fa-bell"
10
+ :class="{ 'ac-shake': unreadCount }"
11
+ aria-hidden="true"
12
+ ></i>
13
+ </button>
14
+ <div class="ac-menu-content is-notification">
15
+ <div class="notification-header">
16
+ <div class="left-content">
17
+ <p>
18
+ Notifications <span>({{ notifications.length }})</span>
19
+ </p>
20
+ </div>
21
+ <div class="right-content"></div>
22
+ </div>
23
+ <div :key="notificationPanelOpen ? 1 : 0" class="notification-body">
24
+ <transition-group v-if="notifications.length" name="slide-right">
25
+ <notification-item
26
+ v-for="notification in notifications"
27
+ :key="`${notification.id}${unreadCount}`"
28
+ :notification="notification"
29
+ />
30
+ </transition-group>
31
+ <span v-else class="single-notification-item"
32
+ >No new notifications</span
33
+ >
34
+ </div>
35
+ </div>
36
+ </div>
37
+ </template>
38
+
39
+ <script>
40
+ import { StringCodec } from "nats.ws/cjs/nats";
41
+ export default {
42
+ components: {
43
+ NotificationItem: () => import("./NotificationItem.vue"),
44
+ },
45
+ data() {
46
+ return {
47
+ notifications: [],
48
+ notificationsRead: 0,
49
+
50
+ notificationPanelOpen: false,
51
+ subscription: null,
52
+ };
53
+ },
54
+ computed: {
55
+ unreadCount() {
56
+ return this.notifications.length - this.notificationsRead;
57
+ },
58
+ },
59
+ watch: {
60
+ notificationPanelOpen(n) {
61
+ if (n) {
62
+ this.notificationsRead = this.notifications.length;
63
+ }
64
+ },
65
+ },
66
+ created() {
67
+ this.subscribeToNotifcations();
68
+ },
69
+ methods: {
70
+ addNewNotification(notification) {
71
+ this.notifications.unshift(notification);
72
+ if (this.notificationPanelOpen) {
73
+ this.notificationsRead = this.notifications.length;
74
+ }
75
+ },
76
+ async subscribeToNotifcations() {
77
+ this.subscription = this.$nc?.subscribe("notifications");
78
+ console.log("Started listening to Notifications");
79
+
80
+ if (this.subscription) {
81
+ // listen to channel events
82
+ for await (const msg of this.subscription) {
83
+ console.log("notifications ===>");
84
+ console.log({ data: StringCodec().decode(msg.data) });
85
+ const log = JSON.parse(StringCodec().decode(msg.data));
86
+ console.log({ log });
87
+ const currentTime = new Date().getTime();
88
+ this.addNewNotification({
89
+ ...log,
90
+ id: currentTime,
91
+ time: currentTime,
92
+ });
93
+ msg.respond();
94
+ }
95
+ console.log("Stopped listening to Notifications");
96
+ console.log("Closed Channel Notifications");
97
+ }
98
+ },
99
+ },
100
+ };
101
+ </script>
@@ -0,0 +1,44 @@
1
+ <template>
2
+ <a class="single-notification-item is-complete">
3
+ <p>
4
+ {{ notification.msg }}
5
+ </p>
6
+ <div class="notification-status">
7
+ <p
8
+ :class="{
9
+ 'is-success': notification.status === 'Success',
10
+ 'is-danger': notification.status === 'Failed',
11
+ 'is-info':
12
+ notification.status === 'Started' ||
13
+ notification.status === 'Running',
14
+ 'is-warning': notification.status === 'Pending',
15
+ }"
16
+ >
17
+ <i
18
+ class="fa mr-5"
19
+ :class="{
20
+ 'fa-check': notification.status === 'Success',
21
+ 'fa-exclamation-triangle': notification.status === 'Failed',
22
+ 'fa-info-circle':
23
+ notification.status === 'Started' ||
24
+ notification.status === 'Pending' ||
25
+ notification.status === 'Running',
26
+ }"
27
+ />
28
+ {{ notification.status }}
29
+ </p>
30
+ <p>{{ notification.time | getDayDifferences }} ago</p>
31
+ </div>
32
+ </a>
33
+ </template>
34
+
35
+ <script>
36
+ export default {
37
+ props: {
38
+ notification: {
39
+ type: Object,
40
+ default: () => ({}),
41
+ },
42
+ },
43
+ };
44
+ </script>
@@ -9,7 +9,11 @@
9
9
  "
10
10
  >
11
11
  <label>Rows per page</label>
12
- <select v-model="selectedItemCountPerPage" name="page">
12
+ <select
13
+ v-model="selectedItemCountPerPage"
14
+ name="page"
15
+ data-testid="rows-per-page-selector"
16
+ >
13
17
  <option :value="5">5</option>
14
18
  <option :value="10" v-show="totalNoOfItems > 5">10</option>
15
19
  <option :value="15" v-show="totalNoOfItems > 10">15</option>
@@ -31,19 +35,28 @@
31
35
 
32
36
  <ul v-if="totalNoOfItems > selectedItemCountPerPage">
33
37
  <li>
34
- <a class="previous" @click.prevent="prevPage()">
38
+ <a
39
+ class="previous"
40
+ @click.prevent="prevPage()"
41
+ data-testid="pagination-previous-page-button"
42
+ >
35
43
  <i class="fa fa-angle-left" aria-hidden="true"></i>
36
44
  </a>
37
45
  </li>
38
46
  <li v-for="page in pages" :key="`page-${page}`">
39
47
  <a
40
48
  @click.prevent="changePage(page)"
49
+ data-testid="pagination-page-switch-button"
41
50
  :class="{ 'is-current': activePageNo === page }"
42
51
  >{{ page }}</a
43
52
  >
44
53
  </li>
45
54
  <li>
46
- <a class="next" @click.prevent="nextPage()">
55
+ <a
56
+ class="next"
57
+ @click.prevent="nextPage()"
58
+ data-testid="pagination-next-page-button"
59
+ >
47
60
  <i class="fa fa-angle-right" aria-hidden="true"></i>
48
61
  </a>
49
62
  </li>
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div
3
- class="is-flex is-justify-content-center is-align-items-center is-flex-direction-column"
3
+ class="is-flex is-justify-content-center is-align-items-center is-flex-direction-column ac-preloader"
4
4
  style="height: calc(100vh - 200px);"
5
5
  >
6
6
  <span v-if="showSpinner" class="spinner"></span>
@@ -15,12 +15,12 @@ export default {
15
15
  props: {
16
16
  showSpinner: {
17
17
  type: Boolean,
18
- default: true,
18
+ default: true
19
19
  },
20
20
  message: {
21
21
  type: String,
22
- default: "Fetching! Please wait for sometime...",
23
- },
24
- },
22
+ default: "Loading ..."
23
+ }
24
+ }
25
25
  };
26
26
  </script>
@@ -0,0 +1,126 @@
1
+ <template>
2
+ <div class="is-cluster-logo" v-if="sidebarCollapsed">
3
+ <img
4
+ width="40"
5
+ :src="getProviderIcon(selectedCluster && selectedCluster.provider)"
6
+ onerror="this.onerror=null;this.src='https://cdn.appscode.com/images/cloud-provider-icons/Generic.png';"
7
+ alt="provider-icon"
8
+ />
9
+ </div>
10
+ <multiselect
11
+ v-else
12
+ v-model="selectedCluster"
13
+ placeholder="Selected Cluster"
14
+ label="name"
15
+ track-by="name"
16
+ :options="clusterOptions"
17
+ :allow-empty="false"
18
+ deselectLabel=""
19
+ selectLabel=""
20
+ selectedLabel=""
21
+ >
22
+ <template slot="singleLabel" slot-scope="props">
23
+ <div class="is-flex is-align-items-center">
24
+ <img
25
+ :src="getProviderIcon(props.option.provider)"
26
+ onerror="this.onerror=null;this.src='https://cdn.appscode.com/images/cloud-provider-icons/Generic.png';"
27
+ alt="No cluster selected"
28
+ /><span
29
+ ><span>{{ props.option.displayName }}</span></span
30
+ >
31
+ </div>
32
+ </template>
33
+ <template slot="option" slot-scope="props">
34
+ <div class="is-flex is-align-items-center">
35
+ <img
36
+ class="mr-15"
37
+ :src="getProviderIcon(props.option.provider)"
38
+ onerror="this.onerror=null;this.src='https://cdn.appscode.com/images/cloud-provider-icons/Generic.png';"
39
+ alt="No cluster selected"
40
+ />
41
+ <div>
42
+ <p>{{ props.option.displayName }}</p>
43
+ <p class="location">{{ props.option.location }}</p>
44
+ </div>
45
+ </div>
46
+ </template>
47
+ </multiselect>
48
+ </template>
49
+
50
+ <script>
51
+ export default {
52
+ props: {
53
+ sidebarCollapsed: {
54
+ type: Boolean,
55
+ default: false,
56
+ },
57
+ mouseHover: {
58
+ type: Boolean,
59
+ default: false,
60
+ },
61
+ clusterOptions: {
62
+ type: Array,
63
+ default: [],
64
+ },
65
+ value: {
66
+ type: String,
67
+ default: "",
68
+ }
69
+ },
70
+
71
+ components: {
72
+ Multiselect: () => import("vue-multiselect"),
73
+ },
74
+
75
+ data() {
76
+ return {
77
+ selectedCluster: null,
78
+ selectedClusterName: "",
79
+ };
80
+ },
81
+
82
+ methods: {
83
+ getProviderIcon(provider) {
84
+ return `https://cdn.appscode.com/images/cloud-provider-icons/${provider}.png`;
85
+ },
86
+ },
87
+
88
+ watch: {
89
+ value: {
90
+ immediate: true,
91
+ handler(n) {
92
+ this.selectedClusterName = n;
93
+ },
94
+ },
95
+ selectedCluster: {
96
+ deep: true,
97
+ handler(n) {
98
+ this.selectedClusterName = n.name;
99
+ },
100
+ },
101
+ selectedClusterName(n) {
102
+ if (this.selectedCluster && n !== this.selectedCluster.name) {
103
+ this.clusterOptions.forEach((item) => {
104
+ if (this.selectedClusterName === item.name) {
105
+ this.selectedCluster = item;
106
+ }
107
+ });
108
+ }
109
+ this.$emit("input", n);
110
+ },
111
+ clusterOptions: {
112
+ deep: true,
113
+ immediate: true,
114
+ async handler(list) {
115
+ if (list) {
116
+ list.forEach(async (item) => {
117
+ if(item.name === this.selectedClusterName) {
118
+ this.selectedCluster = item;
119
+ }
120
+ });
121
+ }
122
+ },
123
+ },
124
+ },
125
+ };
126
+ </script>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <li>
2
+ <li ref="sidebarItem">
3
3
  <router-link
4
4
  :id="id"
5
5
  :title="title"
@@ -38,5 +38,27 @@ export default {
38
38
  default: "@/assets/images/icons/basic.svg",
39
39
  },
40
40
  },
41
+ watch: {
42
+ isActive: {
43
+ immediate: true,
44
+ handler(n) {
45
+ if (n) {
46
+ this.$nextTick(() => {
47
+ setTimeout(() => {
48
+ const top = (this.$refs.sidebarItem && this.$refs.sidebarItem.getBoundingClientRect().top) || 0;
49
+ // preventing scroll to options that are already visible
50
+ if (top > window.innerHeight - 200) {
51
+ // scroll to selected option item
52
+ this.$refs.sidebarItem.scrollIntoView({
53
+ behavior: 'smooth',
54
+ block: "center"
55
+ });
56
+ }
57
+ }, 500);
58
+ });
59
+ }
60
+ }
61
+ }
62
+ }
41
63
  };
42
64
  </script>
@@ -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>
@@ -23,12 +23,41 @@
23
23
  :key="idx"
24
24
  :class="{
25
25
  sorting: headerSortables[idx] && headerSortables[idx].enabled,
26
- 'sorting-desc': headerSortables[idx] && headerSortables[idx].mode === 'desc',
27
- 'sorting-asc': headerSortables[idx] && headerSortables[idx].mode === 'asc',
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',
28
42
  }"
29
- @click.prevent="headerSortables[idx] && headerSortables[idx].enabled && emitSortEvent(idx)"
43
+ @click.prevent="
44
+ headerSortables[idx] &&
45
+ headerSortables[idx].enabled &&
46
+ emitSortEvent(idx)
47
+ "
30
48
  >
31
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>
32
61
  </th>
33
62
  <th
34
63
  ref="action-section"
@@ -146,7 +175,7 @@ export default {
146
175
  },
147
176
  headerLabels() {
148
177
  return this.tableHeaders.map((th) =>
149
- typeof th === "string" ? th : th.label || "Label"
178
+ typeof th === "string" ? th : th.name || "Label"
150
179
  );
151
180
  },
152
181
  },
@@ -157,8 +186,15 @@ export default {
157
186
  handler(n) {
158
187
  if (this.headerSortables.length === n.length) {
159
188
  n.forEach((th, idx) => {
160
- if (this.headerSortables[idx].enabled !== !!th.sortable) {
161
- this.headerSortables[idx].enabled = !!th.sortable;
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
+ );
162
198
  this.headerSortables[idx].mode = "";
163
199
  }
164
200
  });
@@ -171,7 +207,7 @@ export default {
171
207
  };
172
208
  } else {
173
209
  return {
174
- enabled: !!th.sortable,
210
+ enabled: !!(th && th.sort && th.sort.enable),
175
211
  mode: "",
176
212
  };
177
213
  }
@@ -198,7 +234,7 @@ export default {
198
234
  emitSortEvent(index) {
199
235
  const emitValue = {
200
236
  index,
201
- label: this.tableHeaders[index].label,
237
+ label: this.tableHeaders[index].name,
202
238
  mode: "",
203
239
  };
204
240
 
@@ -6,7 +6,7 @@
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
11
  <fake-table-cell
12
12
  v-if="fakeCellWidth > 0"
@@ -14,9 +14,15 @@
14
14
  />
15
15
  </tr>
16
16
  </router-link>
17
+
17
18
  <tr
18
19
  v-else
19
- :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"
20
26
  @click.prevent="$emit('rowselect', true)"
21
27
  >
22
28
  <slot />
@@ -38,6 +44,10 @@ export default {
38
44
  type: Boolean,
39
45
  default: false,
40
46
  },
47
+ isDisabled: {
48
+ type: Boolean,
49
+ default: false,
50
+ },
41
51
  fakeCellWidth: {
42
52
  type: Number,
43
53
  default: 0,
@@ -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() {