@appscode/design-system 1.0.43-alpha.222 → 1.0.43-alpha.224
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
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
</div>
|
|
21
21
|
</div>
|
|
22
22
|
<div
|
|
23
|
-
v-else-if="isNatsConnectionLoading || !
|
|
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':
|
|
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?.
|
|
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
|
|
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.
|
|
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
|
-
|
|
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
|
+
// or 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
|
-
|
|
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") {
|
|
@@ -214,11 +233,15 @@ async function subscribeToChannel(channelId: string) {
|
|
|
214
233
|
}
|
|
215
234
|
}
|
|
216
235
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
236
|
+
watch(
|
|
237
|
+
natsSubject,
|
|
238
|
+
(n) => {
|
|
239
|
+
if (n) {
|
|
240
|
+
subscribeToChannel(n);
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
{ immediate: true }
|
|
244
|
+
);
|
|
222
245
|
|
|
223
246
|
watch(open, (n) => {
|
|
224
247
|
if (!n) {
|
|
@@ -241,12 +264,25 @@ const enableModalFooter = computed(() => {
|
|
|
241
264
|
return showReportButton.value || showSuccessButton.value;
|
|
242
265
|
});
|
|
243
266
|
|
|
267
|
+
// generate report issue title with error step title
|
|
268
|
+
const getReportIssueTitle = (): string => {
|
|
269
|
+
const stepTitlesFromErrorTasks: Array<string> = [];
|
|
270
|
+
tasks.value.forEach((task) => {
|
|
271
|
+
// if this taskLog is error task, push it to array
|
|
272
|
+
if (task.error) {
|
|
273
|
+
stepTitlesFromErrorTasks.push(task.step);
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
// return final string
|
|
277
|
+
return stepTitlesFromErrorTasks.join(", ");
|
|
278
|
+
};
|
|
279
|
+
|
|
244
280
|
// report button
|
|
245
281
|
const showReportButton = computed(() => activeTask.value?.status === "Failed");
|
|
246
282
|
function onReportIssueClick() {
|
|
247
|
-
const url = `https://github.com/bytebuilders/community/issues/new?title=Chart Install: ${
|
|
248
|
-
|
|
249
|
-
}
|
|
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 ${
|
|
250
286
|
activeTask.value?.logs[activeTask.value?.logs.length - 1 || 0]
|
|
251
287
|
} %0A %60%60%60`;
|
|
252
288
|
window.open(url, "_blank");
|