-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add jobs panel to activity bar #23005
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| <script setup lang="ts"> | ||
| import { faHdd, faWrench } from "@fortawesome/free-solid-svg-icons"; | ||
| import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; | ||
| import { computed } from "vue"; | ||
| import { useRouter } from "vue-router/composables"; | ||
|
|
||
| import type { JobBaseModel } from "@/api/jobs.js"; | ||
| import { useHistoryStore } from "@/stores/historyStore.js"; | ||
| import { useJobStore } from "@/stores/jobStore.js"; | ||
|
|
||
| import GCard from "../Common/GCard.vue"; | ||
| import JobState from "../JobStates/JobState.vue"; | ||
| import ActivityPanel from "@/components/Panels/ActivityPanel.vue"; | ||
|
|
||
| const jobsStore = useJobStore(); | ||
| jobsStore.fetchAllJobs(); | ||
|
|
||
| const filteredJobs = computed(() => { | ||
| return jobsStore.allJobs.filter((job) => job.tool_id != "__DATA_FETCH__") | ||
| }) | ||
|
|
||
| const router = useRouter(); | ||
|
|
||
| function historyName(historyId: string) { | ||
| const historyStore = useHistoryStore(); | ||
| return historyStore.getHistoryNameById(historyId); | ||
| } | ||
|
|
||
| function cardClicked(job: JobBaseModel) { | ||
| // if (props.inPanel) { | ||
| // emit("invocation-clicked"); | ||
| // } | ||
| router.push(`/jobs/${job.id}/view`); | ||
| } | ||
|
|
||
| </script> | ||
|
|
||
| <template> | ||
| <ActivityPanel | ||
| title="Running jobs" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The title "Running Jobs" is a bit misleading, since this is showing all jobs regardless of their status. |
||
| go-to-all-title="Open Jobs List" | ||
| href="/workflows/jobs"> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. During the training we wanted to display the job panel from a workflow invocation. This explains why we ended using this path. |
||
| <GCard | ||
| v-for="job in filteredJobs" | ||
| :key="job.id" | ||
| clickable | ||
| :title="job.tool_id" | ||
| :title-icon="{icon: faWrench}" | ||
| :update-time="job.update_time" | ||
| @click="() => cardClicked(job)" | ||
| > | ||
| <template v-slot:description> | ||
| <Heading class="m-0" size="text"> | ||
| <FontAwesomeIcon :icon="faHdd" fixed-width /> | ||
|
|
||
| <small v-if="job.history_id" class="text-muted truncate-n-lines two-lines"> | ||
| {{ historyName(job.history_id) }} | ||
| </small> | ||
| </Heading> | ||
| </template> | ||
| <template v-slot:badges> | ||
| <JobState :job="job" /> | ||
| </template> | ||
| </GCard> | ||
| </ActivityPanel> | ||
|
|
||
| </template> | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will list every job independent of the state, so it is better to use pagination here; for that, you can use the
limitandoffsetparameters. You can get inspiration, for example, from theInvocationsScrollListcomponent.Another important issue here is that, in the case of an admin user, this will list all users' jobs by default, which is definitely not something you want 😅, so even if it is not necessary for regular users, we should pass the current
user_idto the endpoint to ensure admins only see their own jobs here.