Skip to content

Commit

Permalink
Merge pull request #18187 from mvdbeek/fix_on_success_redirect
Browse files Browse the repository at this point in the history
[24.0] Fix on success redirect
  • Loading branch information
mvdbeek authored May 21, 2024
2 parents 37551f5 + 7444544 commit 33ea757
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions client/src/components/Tool/ToolSuccess.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { BAlert } from "bootstrap-vue";
import { computed, onMounted } from "vue";
import { computed } from "vue";
import { useRouter } from "vue-router/composables";
import { useConfig } from "@/composables/config";
Expand All @@ -22,27 +22,24 @@ const responseVal = computed(() => jobStore.getLatestResponse);
const showRecommendation = computed(() => config.value.enable_tool_recommendations);
const toolName = computed(() => responseVal.value.toolName);
/* lifecyle */
onMounted(() => {
// no response means that no tool was run in this session i.e. no data in the store
if (Object.keys(responseVal.value).length === 0) {
router.push(`/`);
}
});
// no data means that no tool was run in this session i.e. no data in the store
if (Object.keys(responseVal.value).length === 0) {
router.push(`/`);
}
</script>

<template>
<section>
<BAlert v-if="!jobResponse" variant="info" show>
<LoadingSpan message="Waiting on a job response" />
<LoadingSpan message="Waiting on data" />
</BAlert>
<div v-else>
<div v-if="jobResponse?.produces_entry_points">
<ToolEntryPoints v-for="job in jobResponse.jobs" :key="job.id" :job-id="job.id" />
</div>
<ToolSuccessMessage :job-response="jobResponse" :tool-name="toolName" />
<Webhook type="tool" :tool-id="jobDef.tool_id" />
<ToolRecommendation v-if="showRecommendation" :tool-id="jobDef.tool_id" />
</div>
<Webhook type="tool" :tool-id="jobDef.tool_id" />
<ToolRecommendation v-if="showRecommendation" :tool-id="jobDef.tool_id" />
</section>
</template>

0 comments on commit 33ea757

Please sign in to comment.