-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19652 from dannon/workflow-landing-tweaks
Workflow landing request - collapse activity bar by default.
- Loading branch information
Showing
7 changed files
with
146 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import type { NavigationGuardNext, Route } from "vue-router"; | ||
|
||
import { useUserStore } from "@/stores/userStore"; | ||
|
||
export async function requireAuth(to: Route, from: Route, next: NavigationGuardNext) { | ||
const userStore = useUserStore(); | ||
await userStore.loadUser(false); | ||
|
||
if (userStore.isAnonymous) { | ||
next({ | ||
path: "/login/start", | ||
query: { | ||
redirect: to.fullPath, | ||
}, | ||
}); | ||
return; | ||
} | ||
next(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import { defineStore } from "pinia"; | ||
import { ref } from "vue"; | ||
|
||
import { GalaxyApi } from "@/api"; | ||
import { errorMessageAsString } from "@/utils/simple-error"; | ||
|
||
interface ClaimState { | ||
workflowId: string | null; | ||
instance: boolean; | ||
requestState: Record<string, never> | null; | ||
errorMessage: string | null; | ||
} | ||
|
||
export const useWorkflowLandingStore = defineStore("workflowLanding", () => { | ||
const claimState = ref<ClaimState>({ | ||
workflowId: null, | ||
instance: false, | ||
requestState: null, | ||
errorMessage: null, | ||
}); | ||
|
||
async function claimWorkflow(uuid: string, isPublic: boolean, secret?: string) { | ||
let claim; | ||
let claimError; | ||
|
||
console.debug("Claiming workflow"); | ||
if (isPublic) { | ||
const { data, error } = await GalaxyApi().GET("/api/workflow_landings/{uuid}", { | ||
params: { | ||
path: { uuid }, | ||
}, | ||
}); | ||
claim = data; | ||
claimError = error; | ||
} else { | ||
const { data, error } = await GalaxyApi().POST("/api/workflow_landings/{uuid}/claim", { | ||
params: { | ||
path: { uuid }, | ||
}, | ||
body: { | ||
client_secret: secret, | ||
}, | ||
}); | ||
claim = data; | ||
claimError = error; | ||
} | ||
|
||
if (claim) { | ||
console.debug("CLaim!", claim); | ||
claimState.value = { | ||
workflowId: claim.workflow_id, | ||
instance: claim.workflow_target_type === "workflow", | ||
requestState: claim.request_state, | ||
errorMessage: null, | ||
}; | ||
} else { | ||
console.debug("Claim error", claimError); | ||
claimState.value = { | ||
workflowId: null, | ||
instance: false, | ||
requestState: null, | ||
errorMessage: errorMessageAsString(claimError), | ||
}; | ||
} | ||
} | ||
|
||
return { | ||
claimState, | ||
claimWorkflow, | ||
}; | ||
}); |