Skip to content

Commit

Permalink
feat(toast): add new toast error for downstream service error
Browse files Browse the repository at this point in the history
  • Loading branch information
brucetony committed Sep 5, 2024
1 parent 0718d85 commit 6584689
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
4 changes: 0 additions & 4 deletions components/analysis/AnalysisControlButtons.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,6 @@ const showSuccess = (summary: string, msg: string) => {
});
};
// async function updateHubAnalysisRunStatus(update: string) {
// await updateAnalysis(props.analysisId!, { run_status: update });
// }
async function onStartAnalysis() {
loading.value = true;
setButtonStatuses(AnalysisNodeRunStatus.Starting);
Expand Down
13 changes: 12 additions & 1 deletion composables/connectionErrorToast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,18 @@ export const showKongConnectionErrorToast = () => {
severity: "error",
summary: "Connection error",
detail: "Unable to contact the Kong gateway service.",
life: 3000,
life: 5000,
});
console.warn("Kong service unreachable");
};

export const showDownstreamConnectionErrorToast = () => {
const toast = useToastService();
toast.add({
severity: "error",
summary: "Connection error",
detail: "Unable to contact the downstream service.",
life: 5000,
});
console.warn("A downstream service unreachable");
};
3 changes: 3 additions & 0 deletions plugins/api.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
showKongConnectionErrorToast,
showHubAdapterConnectionErrorToast,
showDownstreamConnectionErrorToast,
} from "~/composables/connectionErrorToast";

export default defineNuxtPlugin(() => {
Expand Down Expand Up @@ -33,6 +34,8 @@ export default defineNuxtPlugin(() => {
} else {
showHubAdapterConnectionErrorToast();
}
} else if (response.status === 503) {
showDownstreamConnectionErrorToast();
}
},
});
Expand Down

0 comments on commit 6584689

Please sign in to comment.