Skip to content
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

Implement a page object accessibility dialog #17225

Merged
merged 2 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions client/src/api/datasetCollections.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -11,7 +11,16 @@ const getCollectionDetails = fetcher.path("/api/dataset_collections/{id}").metho
*/
export async function fetchCollectionDetails(params: { id: string }): Promise<HDCADetailed> {
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.
jmchilton marked this conversation as resolved.
Show resolved Hide resolved
*/
export async function fetchCollectionSummary(params: { id: string }): Promise<HDCASummary> {
const { data } = await getCollectionDetails({ id: params.id, view: "collection" });
return data as HDCASummary;
}

const getCollectionContents = fetcher
Expand Down
2 changes: 2 additions & 0 deletions client/src/api/histories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
2 changes: 2 additions & 0 deletions client/src/api/jobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
4 changes: 3 additions & 1 deletion client/src/api/schema/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13337,8 +13337,10 @@ export interface operations {
/** Returns detailed information about the given collection. */
parameters: {
/** @description The type of collection instance. Either `history` (default) or `library`. */
/** @description The view of collection instance to return. */
query?: {
instance_type?: "history" | "library";
view?: string;
};
/** @description The user ID that will be used to effectively make this API call. Only admins and designated users can make API calls on behalf of other users. */
header?: {
Expand All @@ -13353,7 +13355,7 @@ export interface operations {
/** @description Successful Response */
200: {
content: {
"application/json": components["schemas"]["HDCADetailed"];
"application/json": components["schemas"]["HDCADetailed"] | components["schemas"]["HDCASummary"];
};
};
/** @description Validation Error */
Expand Down
3 changes: 3 additions & 0 deletions client/src/api/workflows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
45 changes: 45 additions & 0 deletions client/src/components/Markdown/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,48 @@ function namedArgumentRegex(argument: string): RegExp {
function escapeRegExpReplacement(value: string): string {
return value.replace(/\$/g, "$$$$");
}

class ReferencedObjects {
jobs: Set<string> = new Set();
historyDatasets: Set<string> = new Set();
historyDatasetCollections: Set<string> = new Set();
workflows: Set<string> = new Set();
invocations: Set<string> = 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<string>): void {
if (value) {
toSet.add(value);
}
}
Loading
Loading