@appscode/design-system 1.1.0-alpha.1 → 1.1.0-alpha.2

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.
@@ -151,6 +151,41 @@
151
151
  position: absolute;
152
152
  }
153
153
 
154
+ .zoom-list-move, /* apply transition to moving elements */
155
+ .zoom-list-enter-active,
156
+ .zoom-list-leave-active {
157
+ transition: all 0.5s ease;
158
+ }
159
+
160
+ .zoom-list-enter-from,
161
+ .zoom-list-leave-to {
162
+ opacity: 0;
163
+ transform: scale(0.5);
164
+ }
165
+
166
+ .zoom-list-leave-active {
167
+ position: absolute;
168
+ }
169
+
170
+ .slide-left-list-move,
171
+ .slide-left-list-enter-active,
172
+ .slide-left-list-leave-active {
173
+ transition: all 0.3s ease-in-out;
174
+ }
175
+ .slide-left-list-enter-from,
176
+ .slide-left-list-leave-to {
177
+ transform: translateX(20px);
178
+ opacity: 0;
179
+ }
180
+ .slide-left-list-enter-to,
181
+ .slide-left-list-leave-from {
182
+ transform: translateX(0px);
183
+ opacity: 1;
184
+ }
185
+ .slide-left-list-leave-active {
186
+ position: absolute;
187
+ }
188
+
154
189
  .overview-card-enter-active {
155
190
  transition: all 0.2s ease-in-out;
156
191
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appscode/design-system",
3
- "version": "1.1.0-alpha.1",
3
+ "version": "1.1.0-alpha.2",
4
4
  "description": "A design system for Appscode websites and dashboards made using Bulma",
5
5
  "main": "main.scss",
6
6
  "scripts": {
@@ -110,11 +110,6 @@
110
110
  </tbody>
111
111
  </template>
112
112
  </table>
113
-
114
- <!-- table footer info start -->
115
- <slot name="table-footer-info" />
116
- <!-- table footer info end -->
117
-
118
113
  <!-- pagination start -->
119
114
  <slot name="table-pagination" />
120
115
  <!-- pagination end -->
@@ -110,6 +110,7 @@ import {
110
110
  Ref,
111
111
  toRefs,
112
112
  watch,
113
+ watchEffect,
113
114
  } from "vue";
114
115
  import { defineAsyncComponent, ref } from "vue";
115
116
  import { Task, TaskLog } from "../../../typings/long-running-tasks.ts";
@@ -172,7 +173,7 @@ const activeStepId: Ref<string> = ref("");
172
173
  // to find active task faster
173
174
  const idToStepIndex: Ref<Record<string, number>> = ref({});
174
175
  const activeTask = computed(() => {
175
- const task = tasks.value[idToStepIndex.value[activeStepId.value]];
176
+ const task = tasks.value.find((task) => task.id === activeStepId.value);
176
177
  return task;
177
178
  });
178
179
 
@@ -206,7 +207,6 @@ function handleTaskLog(log: TaskLog) {
206
207
  task.status = log.status;
207
208
  if (log.status === "Failed") {
208
209
  task.logs.push(log.error || "");
209
- errorCtx.value?.onError(log.error);
210
210
  } else {
211
211
  task.logs.push(log.msg || "");
212
212
  }
@@ -252,36 +252,12 @@ onBeforeUnmount(() => {
252
252
  subscription && subscription.unsubscribe();
253
253
  });
254
254
 
255
- const longRunningTaskStatus = computed(() => {
256
- let successTaskCount = 0;
257
- let failedTaskCount = 0;
258
-
259
- // get count of success and failed task
260
- tasks.value.forEach((task) => {
261
- if (task?.status === "Success") successTaskCount++;
262
- else if (task?.status === "Failed") failedTaskCount++;
263
- });
264
-
265
- if (tasks.value.length === 0) return "NotStarted";
266
- // if all the task has been successful
267
- else if (successTaskCount === tasks.value.length) {
268
- return "Success";
269
- }
270
- // if all the task has been completed and some tasks are failed
271
- else if (
272
- failedTaskCount &&
273
- successTaskCount + failedTaskCount === tasks.value.length
274
- ) {
275
- return "Failed";
276
- } else return "Pending";
277
- });
278
-
279
255
  // modal close / footer feature
280
256
  const enableModalClose = computed(() => {
281
257
  return (
282
258
  connectionError.value ||
283
- longRunningTaskStatus.value === "Failed" ||
284
- longRunningTaskStatus.value === "Success"
259
+ activeTask.value?.status === "Failed" ||
260
+ activeTask.value?.status === "Success"
285
261
  );
286
262
  });
287
263
  const enableModalFooter = computed(() => {
@@ -289,50 +265,47 @@ const enableModalFooter = computed(() => {
289
265
  });
290
266
 
291
267
  // generate report issue title with error step title
292
- const getReportIssueInfo = (): { title: string; body: string } => {
268
+ const getReportIssueTitle = (): string => {
293
269
  const stepTitlesFromErrorTasks: Array<string> = [];
294
- const stepLogsFromErrorTasks: Array<string> = [];
295
270
  tasks.value.forEach((task) => {
296
271
  // if this taskLog is error task, push it to array
297
272
  if (task.error) {
298
- stepTitlesFromErrorTasks.push(task?.step);
299
- stepLogsFromErrorTasks.push(task?.logs[task?.logs?.length - 1] || "");
273
+ stepTitlesFromErrorTasks.push(task.step);
300
274
  }
301
275
  });
302
- // return final object
303
- return {
304
- title: stepTitlesFromErrorTasks.join(", "),
305
- body: stepLogsFromErrorTasks.join(", "),
306
- };
276
+ // return final string
277
+ return stepTitlesFromErrorTasks.join(", ");
307
278
  };
308
279
 
309
280
  // report button
310
- const showReportButton = computed(
311
- () => longRunningTaskStatus.value === "Failed"
312
- );
281
+ const showReportButton = computed(() => activeTask.value?.status === "Failed");
313
282
  function onReportIssueClick() {
314
- const url = `https://github.com/bytebuilders/community/issues/new?title=Chart Install: ${
315
- getReportIssueInfo().title
316
- }&labels[]=bug&body=${window.location.href} %0A%0A %60%60%60 %0A ${
317
- getReportIssueInfo().body
283
+ const url = `https://github.com/bytebuilders/community/issues/new?title=Chart Install: ${getReportIssueTitle()}&labels[]=bug&body=${
284
+ window.location.href
285
+ } %0A%0A %60%60%60 %0A ${
286
+ activeTask.value?.logs[activeTask.value?.logs.length - 1 || 0]
318
287
  } %0A %60%60%60`;
319
288
  window.open(url, "_blank");
320
289
  }
321
290
 
322
291
  // success button
323
292
  const showSuccessButton = computed(
324
- () =>
325
- longRunningTaskStatus.value === "Success" && !!successCtx.value?.btnTitle
293
+ () => activeTask.value?.status === "Success" && successCtx.value?.btnTitle
326
294
  );
327
295
 
328
296
  // execute on success and on error functions
329
- watch(longRunningTaskStatus, (n) => {
330
- if (n === "Success") {
331
- successCtx.value.onSuccess();
332
- } else if (n === "Failed") {
333
- errorCtx.value?.onError("Operation Failed");
297
+ watch(
298
+ () => activeTask.value?.status,
299
+ (n) => {
300
+ if (n === "Success") {
301
+ successCtx.value.onSuccess();
302
+ } else if (n === "Failed") {
303
+ errorCtx.value.onError(
304
+ activeTask.value?.logs[activeTask.value?.logs.length - 1 || 0] || ""
305
+ );
306
+ }
334
307
  }
335
- });
308
+ );
336
309
  </script>
337
310
 
338
311
  <style scoped lang="scss">
@@ -97,7 +97,9 @@
97
97
  <table-row class="is-hoverless">
98
98
  <table-cell
99
99
  :colspan="
100
- actionable ? tableHeaders.length + 1 : tableHeaders.length
100
+ tableHeaders.length +
101
+ (actionable ? 1 : 0) +
102
+ (collapsible ? 1 : 0)
101
103
  "
102
104
  class="no-data-available has-text-centered"
103
105
  >
@@ -107,11 +109,6 @@
107
109
  </tbody>
108
110
  </template>
109
111
  </table>
110
-
111
- <!-- table footer info start -->
112
- <slot name="table-footer-info" />
113
- <!-- table footer info end -->
114
-
115
112
  <!-- pagination start -->
116
113
  <slot name="table-pagination" />
117
114
  <!-- pagination end -->
@@ -1,61 +0,0 @@
1
- <template>
2
- <!-- alert-message area start -->
3
- <!-- plsease, use this class name ('.is-info' 'is-success', 'is-error', 'is-warning') -->
4
- <div :class="`ac-notification is-${notificationType} mb-15`">
5
- <p>
6
- <i v-if="!hideIcon" :class="`fa ${iconClass} mr-5`"></i
7
- ><span v-html="getSanitizedHtml(content)"></span>
8
- <ac-button
9
- v-if="actionButton?.show"
10
- :title="actionButton?.title"
11
- :icon-class="actionButton?.iconClass"
12
- data-testid="notification-action-button"
13
- @click.prevent="actionButton?.action()"
14
- >
15
- </ac-button>
16
- </p>
17
- </div>
18
- <!-- alert-message area end -->
19
- </template>
20
-
21
- <script setup lang="ts">
22
- import { toRefs, computed, defineAsyncComponent } from "vue";
23
- import DOMPurify from "dompurify";
24
-
25
- const AcButton = defineAsyncComponent(
26
- () => import("@appscode/design-system/vue-components/v3/button/Button.vue")
27
- );
28
-
29
- const props = withDefaults(
30
- defineProps<{
31
- notificationType: string;
32
- content: string;
33
- hideIcon: boolean;
34
- actionButton?: {
35
- show: boolean;
36
- title: string;
37
- iconClass: string;
38
- action: (...args: any) => void | undefined;
39
- };
40
- }>(),
41
- {
42
- notificationType: "",
43
- content: "",
44
- hideIcon: false,
45
- actionButton: undefined,
46
- }
47
- );
48
-
49
- const { notificationType, content, hideIcon, actionButton } = toRefs(props);
50
-
51
- const iconClass = computed(() => {
52
- if (notificationType.value === "success") return "fa-check-circle";
53
- else if (notificationType.value === "info") return "fa-info-circle";
54
- else if (notificationType.value === "error") return "fa-times-circle";
55
- else return "fa-info-circle";
56
- });
57
-
58
- const getSanitizedHtml = (content: string) => {
59
- return DOMPurify.sanitize(content || "");
60
- };
61
- </script>