Skip to content
This repository has been archived by the owner on May 26, 2023. It is now read-only.

Commit

Permalink
Show no stack trace available message for complete workflows (#360)
Browse files Browse the repository at this point in the history
  • Loading branch information
feedmeapples authored Jul 10, 2021
1 parent 603a003 commit 5bef5bf
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 20 deletions.
1 change: 1 addition & 0 deletions client/routes/workflow/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
:baseAPIURL="baseAPIURL"
:taskQueueName="taskQueue.name"
:isWorkerRunning="isWorkerRunning"
:isWorkflowRunning="this.summary.isWorkflowRunning"
@onNotification="onNotification"
/>
<router-view
Expand Down
51 changes: 31 additions & 20 deletions client/routes/workflow/stack-trace.vue
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
<template>
<section :class="{ 'stack-trace': true, loading }" data-cy="stack-trace">
<header v-if="stackTraceTimestamp">
<span>Stack trace at {{ stackTraceTimestamp.format('h:mm:ss a') }}</span>
<a href="#" class="refresh" @click="getStackTrace">Refresh</a>
</header>

<prism
v-for="(payload, index) in stackTrace.payloads"
:key="index"
language="json"
class="stack-trace-view"
>
{{ payload }}
</prism>

<span class="error" v-if="stackTrace && stackTrace.error">
<span v-if="!isWorkflowRunning" class="no-queries">
Workflow execution has finished. No stack trace available
</span>
<span v-else-if="stackTrace && stackTrace.error" class="error">
{{ stackTrace.error }}
</span>
<span v-if="!isWorkerRunning" class="no-queries">
<span v-else-if="!isWorkerRunning" class="no-queries">
There are no Workers currently listening to the Task Queue:
<router-link
:to="{
Expand All @@ -29,6 +18,23 @@
>{{ taskQueueName }}
</router-link>
</span>

<div v-else>
<header v-if="stackTraceTimestamp">
<span
>Stack trace at {{ stackTraceTimestamp.format('h:mm:ss a') }}</span
>
<a href="#" class="refresh" @click="getStackTrace">Refresh</a>
</header>
<prism
v-for="(payload, index) in stackTrace.payloads"
:key="index"
language="json"
class="stack-trace-view"
>
{{ payload }}
</prism>
</div>
</section>
</template>

Expand All @@ -50,9 +56,14 @@ export default {
stackTraceTimestamp: undefined,
};
},
props: ['baseAPIURL', 'taskQueueName', 'isWorkerRunning'],
props: [
'baseAPIURL',
'taskQueueName',
'isWorkerRunning',
'isWorkflowRunning',
],
created() {
if (!this.isWorkerRunning) {
if (!this.isWorkerRunning || !this.isWorkflowRunning) {
return;
}
Expand All @@ -66,7 +77,7 @@ export default {
.post(`${this.baseAPIURL}/query/__stack_trace`)
.then(({ queryResult }) => {
queryResult.payloads = queryResult.payloads.map(p =>
p.replaceAll('\n', ' \n ')
p?.replaceAll('\n', ' \n ')
);
this.stackTrace = queryResult;
this.stackTraceTimestamp = moment();
Expand All @@ -85,7 +96,7 @@ export default {
},
watch: {
isWorkerRunning: function(newVal, oldVal) {
if (newVal == false) {
if (newVal == false || !this.isWorkflowRunning) {
this.queries = [];
return;
Expand Down

0 comments on commit 5bef5bf

Please sign in to comment.