diff --git a/client/src/api/datasetCollections.ts b/client/src/api/datasetCollections.ts index 3cf02c98f55a..cc45c5811cf7 100644 --- a/client/src/api/datasetCollections.ts +++ b/client/src/api/datasetCollections.ts @@ -1,4 +1,4 @@ -import { CollectionEntry, DCESummary, HDCADetailed, isHDCA } from "@/api"; +import { CollectionEntry, DCESummary, HDCADetailed, HDCASummary, isHDCA } from "@/api"; import { fetcher } from "@/api/schema"; const DEFAULT_LIMIT = 50; @@ -11,7 +11,16 @@ const getCollectionDetails = fetcher.path("/api/dataset_collections/{id}").metho */ export async function fetchCollectionDetails(params: { id: string }): Promise { const { data } = await getCollectionDetails({ id: params.id }); - return data; + return data as HDCADetailed; +} + +/** + * Fetches the details of a collection. + * @param params.id The ID of the collection (HDCA) to fetch. + */ +export async function fetchCollectionSummary(params: { id: string }): Promise { + const { data } = await getCollectionDetails({ id: params.id, view: "collection" }); + return data as HDCASummary; } const getCollectionContents = fetcher diff --git a/client/src/api/histories.ts b/client/src/api/histories.ts index fcd1d0c1c1f7..ef0aeaa5df0b 100644 --- a/client/src/api/histories.ts +++ b/client/src/api/histories.ts @@ -12,3 +12,5 @@ export const updateHistoryItemsInBulk = fetcher .path("/api/histories/{history_id}/contents/bulk") .method("put") .create(); +export const sharing = fetcher.path("/api/histories/{history_id}/sharing").method("get").create(); +export const enableLink = fetcher.path("/api/histories/{history_id}/enable_link_access").method("put").create(); diff --git a/client/src/api/jobs.ts b/client/src/api/jobs.ts index 65399c0beb96..fb744aca65b8 100644 --- a/client/src/api/jobs.ts +++ b/client/src/api/jobs.ts @@ -2,6 +2,8 @@ import { components, fetcher } from "@/api/schema"; export type JobDestinationParams = components["schemas"]["JobDestinationParams"]; +export const getJobDetails = fetcher.path("/api/jobs/{job_id}").method("get").create(); + export const jobLockStatus = fetcher.path("/api/job_lock").method("get").create(); export const jobLockUpdate = fetcher.path("/api/job_lock").method("put").create(); diff --git a/client/src/api/workflows.ts b/client/src/api/workflows.ts index 0febc403426d..0082f1db63f9 100644 --- a/client/src/api/workflows.ts +++ b/client/src/api/workflows.ts @@ -3,3 +3,6 @@ import { fetcher } from "@/api/schema"; export const workflowsFetcher = fetcher.path("/api/workflows").method("get").create(); export const invocationCountsFetcher = fetcher.path("/api/workflows/{workflow_id}/counts").method("get").create(); + +export const sharing = fetcher.path("/api/workflows/{workflow_id}/sharing").method("get").create(); +export const enableLink = fetcher.path("/api/workflows/{workflow_id}/enable_link_access").method("put").create(); diff --git a/client/src/components/Markdown/parse.ts b/client/src/components/Markdown/parse.ts index f7d5b17cd562..c97fb159a182 100644 --- a/client/src/components/Markdown/parse.ts +++ b/client/src/components/Markdown/parse.ts @@ -160,6 +160,7 @@ export function getArgs(content: string): GalaxyDirectiveSection { }; } + function namedArgumentRegex(argument: string): RegExp { return new RegExp(`(\\s*${argument}\\s*=)` + FUNCTION_ARGUMENT_VALUE_REGEX); } @@ -168,3 +169,48 @@ function namedArgumentRegex(argument: string): RegExp { function escapeRegExpReplacement(value: string): string { return value.replace(/\$/g, "$$$$"); } + +class ReferencedObjects { + jobs: Set = new Set(); + historyDatasets: Set = new Set(); + historyDatasetCollections: Set = new Set(); + workflows: Set = new Set(); + invocations: Set = new Set(); +} + +export function referencedObjects(markdown: string) { + const { sections } = splitMarkdown(markdown); + const objects = new ReferencedObjects(); + for (const section of sections) { + if (!("args" in section)) { + continue; + } + const args = section.args; + if (!args) { + continue; + } + if ("job_id" in args) { + addToSetIfHasValue(args.job_id, objects.jobs); + } + if ("history_dataset_id" in args) { + addToSetIfHasValue(args.history_dataset_id, objects.historyDatasets); + } + if ("history_dataset_collection_id" in args) { + addToSetIfHasValue(args.history_dataset_collection_id, objects.historyDatasetCollections); + } + if ("invocation_id" in args) { + addToSetIfHasValue(args.invocation_id, objects.invocations); + } + if ("workflow_id" in args) { + addToSetIfHasValue(args.workflow_id, objects.workflows); + } + // TODO: implicit collect job ids + } + return objects; +} + +function addToSetIfHasValue(value: string | undefined, toSet: Set): void { + if (value) { + toSet.add(value); + } +} diff --git a/client/src/components/PageEditor/ObjectPermissions.vue b/client/src/components/PageEditor/ObjectPermissions.vue new file mode 100644 index 000000000000..f5ab4da9f3db --- /dev/null +++ b/client/src/components/PageEditor/ObjectPermissions.vue @@ -0,0 +1,305 @@ + + + diff --git a/client/src/components/PageEditor/ObjectPermissionsModal.vue b/client/src/components/PageEditor/ObjectPermissionsModal.vue new file mode 100644 index 000000000000..cb250f1884e6 --- /dev/null +++ b/client/src/components/PageEditor/ObjectPermissionsModal.vue @@ -0,0 +1,15 @@ + + + diff --git a/client/src/components/PageEditor/PageEditorMarkdown.vue b/client/src/components/PageEditor/PageEditorMarkdown.vue index 84c061f2cd20..6e1cb5bcc76a 100644 --- a/client/src/components/PageEditor/PageEditorMarkdown.vue +++ b/client/src/components/PageEditor/PageEditorMarkdown.vue @@ -6,6 +6,20 @@ mode="page" @onUpdate="onUpdate">