forked from galaxyproject/galaxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Render useful Markdown components for mapped over steps.
API functionality to fetch and query ImplicitCollectionJobs' jobs.
- Loading branch information
Showing
16 changed files
with
286 additions
and
39 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
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,44 @@ | ||
<script setup lang="ts"> | ||
import { SelectOption } from "./handlesMappingJobs"; | ||
interface JobSelectionProps { | ||
jobId?: string; | ||
implicitCollectionJobsId?: string; | ||
selectJobOptions: SelectOption[]; | ||
value?: String | undefined; | ||
} | ||
const emit = defineEmits<{ | ||
(e: "input", id: string | undefined): void; | ||
}>(); | ||
function handleInput(value: string | undefined) { | ||
emit("input", value); | ||
} | ||
defineProps<JobSelectionProps>(); | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<slot v-if="jobId"> </slot> | ||
<div v-else> | ||
<b-navbar> | ||
<b-collapse id="nav-text-collapse" is-nav> | ||
<b-navbar-nav> | ||
<b-nav-text>Select Job</b-nav-text> | ||
</b-navbar-nav> | ||
<b-nav-form> | ||
<b-input-group size="sm"> | ||
<b-form-select | ||
:value="value" | ||
class="text-right" | ||
:options="selectJobOptions" | ||
@input="handleInput"></b-form-select> | ||
</b-input-group> | ||
</b-nav-form> | ||
</b-collapse> | ||
</b-navbar> | ||
<slot /> | ||
</div> | ||
</div> | ||
</template> |
51 changes: 51 additions & 0 deletions
51
client/src/components/Markdown/Elements/handlesMappingJobs.ts
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,51 @@ | ||
import { format, parseISO } from "date-fns"; | ||
import { computed, Ref, ref, watch } from "vue"; | ||
|
||
import { fetcher } from "@/api/schema"; | ||
|
||
const jobsFetcher = fetcher.path("/api/jobs").method("get").create(); | ||
|
||
export interface SelectOption { | ||
value: string; | ||
text: string; | ||
} | ||
|
||
interface Job { | ||
id: string; | ||
create_time: string; | ||
} | ||
|
||
export function useMappingJobs( | ||
singleJobId: Ref<string | undefined>, | ||
implicitCollectionJobsId: Ref<string | undefined> | ||
) { | ||
const selectJobOptions = ref<SelectOption[]>([]); | ||
const selectedJob = ref<string | undefined>(undefined); | ||
const targetJobId = computed<string | undefined>(() => { | ||
if (singleJobId.value) { | ||
return singleJobId.value; | ||
} else { | ||
return selectedJob.value; | ||
} | ||
}); | ||
watch( | ||
implicitCollectionJobsId, | ||
async () => { | ||
if (implicitCollectionJobsId.value) { | ||
const response = await jobsFetcher({ implicit_collection_jobs_id: implicitCollectionJobsId.value }); | ||
const jobs: Job[] = response.data as unknown as Job[]; | ||
selectJobOptions.value = jobs.map((value, index) => { | ||
const isoCreateTime = parseISO(`${value.create_time}Z`); | ||
const prettyTime = format(isoCreateTime, "eeee MMM do H:mm:ss yyyy zz"); | ||
return { value: value.id, text: `${index + 1}: ${prettyTime}` }; | ||
}); | ||
if (jobs[0]) { | ||
const job: Job = jobs[0]; | ||
selectedJob.value = job.id; | ||
} | ||
} | ||
}, | ||
{ immediate: true } | ||
); | ||
return { selectJobOptions, selectedJob, targetJobId }; | ||
} |
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
Oops, something went wrong.