Skip to content

Commit

Permalink
fix: also handle sso errors on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
unxsist committed Jun 27, 2024
1 parent 104b242 commit 2fdaa28
Showing 1 changed file with 48 additions and 13 deletions.
61 changes: 48 additions & 13 deletions src/views/Pods.vue
Original file line number Diff line number Diff line change
Expand Up @@ -107,21 +107,56 @@ async function getPods(refresh: boolean = false) {
context.value,
namespace.value === "all" ? "" : namespace.value
),
]).then((results) => {
]).then(async (results) => {
if (results[0].status === "rejected") {
toast({
title: "An error occured",
description: results[0].reason.message,
variant: "destructive",
action: h(
ToastAction,
{ altText: "Retry", onClick: () => startRefreshing() },
{ default: () => "Retry" }
),
});
stopRefreshing();
const authErrorHandler = await Kubernetes.getAuthErrorHandler(
context.value,
results[0].reason.message
);
return;
if (authErrorHandler.canHandle) {
stopRefreshing();
spawnDialog({
title: "SSO Session expired",
message:
"Failed to authenticate as the SSO session has expired. Please login again.",
buttons: [
{
label: "Close",
variant: "ghost",
handler: (dialog) => {
dialog.close();
},
},
{
label: "Login with SSO",
handler: (dialog) => {
dialog.buttons = [];
dialog.title = "Awaiting SSO login";
dialog.message = "Please wait while we redirect you.";
authErrorHandler.callback(() => {
dialog.close();
startRefreshing();
});
},
},
],
});
} else {
toast({
title: "An error occured",
description: results[0].reason.message,
variant: "destructive",
action: h(
ToastAction,
{ altText: "Retry", onClick: () => startRefreshing() },
{ default: () => "Retry" }
),
});
stopRefreshing();
return;
}
}
pods.value = results[0].value.map((pod) => ({
Expand Down

0 comments on commit 2fdaa28

Please sign in to comment.