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

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": "1.0.43-alpha.221",
3
+ "version": "1.0.43-alpha.223",
4
4
  "description": "A design system for Appscode websites and dashboards made using Bulma",
5
5
  "main": "main.scss",
6
6
  "scripts": {
@@ -20,7 +20,7 @@
20
20
  </div>
21
21
  </div>
22
22
  <div
23
- v-else-if="isNatsConnectionLoading || !activeStep"
23
+ v-else-if="isNatsConnectionLoading || !activeStepId"
24
24
  class="is-justify-content-center"
25
25
  :class="simple ? 'task-simple-wrapper' : 'task-complex-wrapper'"
26
26
  >
@@ -65,12 +65,13 @@
65
65
  <long-running-task-item
66
66
  :title="task.step"
67
67
  :status="task.status"
68
- :class="{ 'is-active': activeStep === task.step }"
68
+ :class="{ 'is-active': activeStepId === task.id }"
69
+ @click="activeStepId = task.id"
69
70
  />
70
71
  </li>
71
72
  </ul>
72
73
  <long-running-task-terminal
73
- :key="activeTask?.step"
74
+ :key="activeTask?.id"
74
75
  :theme="theme"
75
76
  :logs="activeTask?.logs"
76
77
  class="task-log"
@@ -167,9 +168,12 @@ const $nats = currentInstance?.appContext.config.globalProperties.$nc;
167
168
  let subscription: Subscription;
168
169
 
169
170
  const tasks: Ref<Array<Task>> = ref([]);
170
- const activeStep: Ref<string> = ref("");
171
+ const activeStepId: Ref<string> = ref("");
172
+ // to maintain stepId to stepIndex map
173
+ // to find active task faster
174
+ const idToStepIndex: Ref<Record<string, number>> = ref({});
171
175
  const activeTask = computed(() => {
172
- const task = tasks.value.find((task) => task.step === activeStep.value);
176
+ const task = tasks.value.find((task) => task.id === activeStepId.value);
173
177
  return task;
174
178
  });
175
179
 
@@ -181,9 +185,24 @@ function handleTaskLog(log: TaskLog) {
181
185
  ...log,
182
186
  logs: [(log.msg && log.msg) || ""],
183
187
  });
184
- activeStep.value = log.step;
188
+
189
+ // recent pushed task index
190
+ const latestStepIndex = tasks.value.length - 1;
191
+
192
+ // map taskid to stepIndex
193
+ idToStepIndex.value[log.id] = latestStepIndex;
194
+
195
+ // update active step index for first task
196
+ // and if current active step is in latest step
197
+ if (
198
+ latestStepIndex === 0 ||
199
+ latestStepIndex === idToStepIndex.value[activeStepId.value] + 1
200
+ ) {
201
+ activeStepId.value = log.id;
202
+ }
185
203
  } else {
186
- const task = tasks.value.find((task) => task.step === activeStep.value);
204
+ // get active task
205
+ const task = tasks.value[idToStepIndex.value[log.id]];
187
206
  if (task) {
188
207
  task.status = log.status;
189
208
  if (log.status === "Failed") {
@@ -241,12 +260,25 @@ const enableModalFooter = computed(() => {
241
260
  return showReportButton.value || showSuccessButton.value;
242
261
  });
243
262
 
263
+ // generate report issue title with error step title
264
+ const getReportIssueTitle = (): string => {
265
+ const stepTitlesFromErrorTasks: Array<string> = [];
266
+ tasks.value.forEach((task) => {
267
+ // if this taskLog is error task, push it to array
268
+ if (task.error) {
269
+ stepTitlesFromErrorTasks.push(task.step);
270
+ }
271
+ });
272
+ // return final string
273
+ return stepTitlesFromErrorTasks.join(", ");
274
+ };
275
+
244
276
  // report button
245
277
  const showReportButton = computed(() => activeTask.value?.status === "Failed");
246
278
  function onReportIssueClick() {
247
- const url = `https://github.com/bytebuilders/community/issues/new?title=Chart Install: ${
248
- activeStep.value
249
- }&labels[]=bug&body=${window.location.href} %0A%0A %60%60%60 %0A ${
279
+ const url = `https://github.com/bytebuilders/community/issues/new?title=Chart Install: ${getReportIssueTitle()}&labels[]=bug&body=${
280
+ window.location.href
281
+ } %0A%0A %60%60%60 %0A ${
250
282
  activeTask.value?.logs[activeTask.value?.logs.length - 1 || 0]
251
283
  } %0A %60%60%60`;
252
284
  window.open(url, "_blank");