diff --git a/src/api/_mock/mockDataTransfer.ts b/src/api/_mock/mockDataTransfer.ts deleted file mode 100644 index 773968d..0000000 --- a/src/api/_mock/mockDataTransfer.ts +++ /dev/null @@ -1,44 +0,0 @@ -// const workflowType = [ -// 'bcl_convert', -// 'wgs_alignment_qc', -// 'wts_alignment_qc', -// 'wts_tumor_only', -// 'wgs_tumor_normal', -// 'umccrise', -// 'rnasum', -// 'star_alignment', -// 'oncoanalyser_wts', -// 'oncoanalyser_wgs', -// 'oncoanalyser_wgts_existing_both', -// 'sash', -// 'tso_ctdna_tumor_only', -// ]; - -// const subjectsList = [ -// 'SBJ05545', -// 'SBJ05551', -// 'SBJ05550', -// 'SBJ05549', -// 'SBJ00006', -// 'SBJ05554', -// 'SBJ05553', -// 'SBJ05552', -// 'SBJ05548', -// 'SBJ05547', -// 'SBJ05546', -// 'SBJ05462', -// 'SBJ05360', -// 'SBJ05359', -// 'SBJ05358', -// 'SBJ05357', -// 'SBJ05356', -// 'SBJ05355', -// 'SBJ05354', -// 'SBJ05353', -// 'SBJ04947', -// 'SBJ04895', -// 'SBJ04404', -// 'SBJ03149', -// 'SBJ00027', -// 'SBJ00005', -// ]; diff --git a/src/api/_mock/mockFastQData.ts b/src/api/_mock/mockFastQData.ts deleted file mode 100644 index a85284e..0000000 --- a/src/api/_mock/mockFastQData.ts +++ /dev/null @@ -1,37 +0,0 @@ -interface GeneratedData { - [key: string]: string; -} - -const generateFastqDataArray = (numRecords: number): GeneratedData[] => { - const dataArray: GeneratedData[] = []; - - for (let i = 0; i < numRecords; i++) { - const record: GeneratedData = { - SubjectID: `SBJ${Math.floor(10000 + Math.random() * 90000).toString()}`, - LibraryID: `L${Math.floor(1000000 + Math.random() * 9000000).toString()}`, - SampleID: `PRJ${Math.floor(1000000 + Math.random() * 9000000).toString()}`, - size_num: (Math.floor(Math.random() * 50) + 20).toString(), - size_chr: `${(Math.floor(Math.random() * 20) + 10).toFixed(1)}G`, - Type: 'WGS', - Phenotype: 'normal', - Workflow: 'qc', - Assay: 'TsqNano', - path: `gds://production/primary_data/0000_A00000_0000_AAAAAA/${Math.random().toString(36).substring(7)}/WGS_TsqNano/Sample_${i}.fastq.gz`, - topup: Math.random() > 0.5 ? 'True' : 'False', - rgid: `${Math.random().toString(36).substring(7)}.${Math.random().toString(36).substring(7)}.4`, - read: (Math.floor(Math.random() * 2) + 1).toString(), - lane: (Math.floor(Math.random() * 8) + 1).toString(), - sbj_url: `SBJ${Math.floor(10000 + Math.random() * 90000).toString()}`, - }; - - dataArray.push(record); - } - - return dataArray; -}; - -export default generateFastqDataArray; - -// Example usage: -// const generatedData = generateDataArray(5); // Generates an array of 5 objects -// console.log(generatedData); diff --git a/src/api/_mock/mockLibraryData.ts b/src/api/_mock/mockLibraryData.ts deleted file mode 100644 index 5db0520..0000000 --- a/src/api/_mock/mockLibraryData.ts +++ /dev/null @@ -1,343 +0,0 @@ -import { v4 as uuidv4 } from 'uuid'; // Assume UUID for generating unique identifiers - -interface LibraryData { - id: number; - library_id: string; - sample_name: string; - sample_id: string; - external_sample_id: string; - subject_id: string; - external_subject_id: string; - phenotype: string; - quality: string; - source: string; - project_name: string; - project_owner: string; - experiment_id: string; - type: string; - assay: string; - override_cycles: string; - workflow: string; - coverage: string; - truseqindex: string; -} - -// Define the enum for different library types -export enum LibraryType { - WGS = 'WGS', - WTS = 'WTS', - ctTSO = 'ctTSO', - ctDNA = 'ctDNA', -} - -// Define the enum for workflow run types -enum WorkflowType { - DRAGEN_WGS_QC = 'DRAGEN_WGS_QC', - TUMOR_NORMAL = 'TUMOR_NORMAL', - UMCCRISE = 'UMCCRISE', - ONCOANALYSER_WGS = 'ONCOANALYSER_WGS', - SASH = 'SASH', - ONCOANALYSER_WGTS_BOTH = 'ONCOANALYSER_WGTS_BOTH', - DRAGEN_WTS_QC = 'DRAGEN_WTS_QC', - DRAGEN_WTS = 'DRAGEN_WTS', - RNASUM = 'RNASUM', - STAR_ALIGNMENT = 'STAR_ALIGNMENT', - ONCOANALYSER_WTS = 'ONCOANALYSER_WTS', - DRAGEN_TSO_CTDNA = 'DRAGEN_TSO_CTDNA', -} - -// Mapping of library types to available workflow types -const WORKFLOW_PIPELINE: Record = { - [LibraryType.WGS]: [ - WorkflowType.DRAGEN_WGS_QC, - WorkflowType.TUMOR_NORMAL, - WorkflowType.UMCCRISE, - WorkflowType.ONCOANALYSER_WGS, - WorkflowType.SASH, - WorkflowType.ONCOANALYSER_WGTS_BOTH, - ], - [LibraryType.WTS]: [ - WorkflowType.DRAGEN_WTS_QC, - WorkflowType.DRAGEN_WTS, - WorkflowType.RNASUM, - WorkflowType.STAR_ALIGNMENT, - WorkflowType.ONCOANALYSER_WTS, - WorkflowType.ONCOANALYSER_WGTS_BOTH, - ], - [LibraryType.ctTSO]: [WorkflowType.DRAGEN_TSO_CTDNA, WorkflowType.UMCCRISE], - [LibraryType.ctDNA]: [WorkflowType.DRAGEN_TSO_CTDNA, WorkflowType.UMCCRISE], -} as Record; - -enum WorkflowStatus { - Requested = 'Requested', - Queued = 'Queued', - Initializing = 'Initializing', - PreparingInputs = 'Preparing Inputs', - InProgress = 'In Progress', - GeneratingOutputs = 'Generating outputs', - Aborting = 'Aborting', - Aborted = 'Aborted', - Failed = 'Failed', - Succeeded = 'Succeeded', -} - -export interface WorkflowRun { - id: number; - portal_run_id: string; - type_name: string; - wfr_id: string; - wfl_id: string; - wfv_id: string; - version: string; - input: string; - start: string; - wfr_name: string; - output: string; - end: string; - end_status: WorkflowStatus; - notified: boolean; - sequence_run: number; - batch_run: number; -} - -interface LibraryRunData { - id: number; - library_id: string; - instrument_run_id: string; - run_id: string; - lane: number; - override_cycles: string; - coverage_yield: null | number; - qc_pass: boolean; - qc_status: null | string; - valid_for_analysis: boolean; - workflows: number[]; -} - -// Mock Library Data Generation -export const generateMockLibraryData = (count: number, libraryType: LibraryType): LibraryData[] => { - return Array.from({ length: count }, (_, i) => ({ - id: 8877 + i, - library_id: `L${new Date().getFullYear()}${Math.floor(1000 + Math.random() * 9000)}`, - sample_name: `Sample${i}`, - sample_id: `SampleID${i}`, - external_sample_id: `External${i}`, - subject_id: `Subject${i}`, - external_subject_id: `ExternalSubject${i}`, - phenotype: 'N/A', - quality: 'High', - source: 'Synthetic', - project_name: 'GenomeProject', - project_owner: 'GenomicsLab', - experiment_id: uuidv4(), - type: libraryType, // All entries will have the specified library type - assay: 'Sequencing', - override_cycles: 'Y151;I8;I8;Y151', - workflow: 'qc', - coverage: `${Math.random() * 100}`, - truseqindex: `Index${i}`, - })); -}; - -// Generating mock workflow run data -// export const generateMockWorkflowRunData = ( -// count: number, -// libraryType: LibraryType -// ): WorkflowRun[] => { -// const finalStatuses = [WorkflowStatus.Aborted, WorkflowStatus.Failed, WorkflowStatus.Succeeded]; -// const possibleWorkflows = WORKFLOW_PIPELINE[libraryType]; - -// return Array.from({ length: count }, (_, i) => { -// const isFinal = Math.random() < 0.3; -// const status = isFinal -// ? finalStatuses[Math.floor(Math.random() * finalStatuses.length)] -// : WorkflowStatus.InProgress; -// const type_name = possibleWorkflows[Math.floor(Math.random() * possibleWorkflows.length)]; - -// return { -// id: 6500 + i, -// portal_run_id: `20230423${Math.floor(Math.random() * 1000000)}`, -// type_name, -// wfr_id: `wfr.${Math.random().toString(36).substring(7)}`, -// wfl_id: `wfl.${Math.random().toString(36).substring(7)}`, -// wfv_id: `wfv.${Math.random().toString(36).substring(7)}`, -// version: `${Math.floor(Math.random() * 5)}.${Math.floor(Math.random() * 10)}.0--${Math.floor(Math.random() * 10)}--${Math.random().toString(36).substring(2, 8)}`, -// input: JSON.stringify({ data: 'Sample input data for the workflow' }), -// start: new Date().toISOString(), -// wfr_name: `workflow_run_${i}`, -// output: JSON.stringify({ data: 'Sample output data for the workflow' }), -// end: new Date().toISOString(), -// end_status: status, -// notified: true, -// sequence_run: Math.floor(Math.random() * 1000), -// batch_run: Math.floor(Math.random() * 100), -// }; -// }); -// }; - -// Define a helper to generate mock workflow run details -// export const generateWorkflowRunDetails = (workflowName: string): WorkflowRun => { -// return { -// id: Math.floor(Math.random() * 10000), -// portal_run_id: uuidv4(), -// type_name: workflowName, -// version: `${Math.random().toFixed(2)}--release`, -// start: new Date().toISOString(), -// end: new Date().toISOString(), -// end_status: [ -// 'Requested', -// 'Queued', -// 'Initializing', -// 'Preparing Inputs', -// 'In Progress', -// 'Generating outputs', -// 'Aborting', -// 'Aborted', -// 'Failed', -// 'Succeeded', -// ][Math.floor(Math.random() * 10)], -// notified: Math.random() > 0.5, -// }; -// }; - -// Mock Library Run Data Generation -// -// Updated Mock Library Run Data Generation -// export const generateMockLibraryRunData = (libraries: LibraryData[]): LibraryRunData[] => { -// return libraries.flatMap((library) => { -// const numberOfRuns = Math.floor(Math.random() * 5) + 1; // Random number of runs per library -// const workflowsForType = WORKFLOW_PIPELINE[library.type]; // Fetch workflows based on library type - -// return Array.from({ length: numberOfRuns }, (_, i) => { -// const workflowDetailsObject = workflowsForType.reduce( -// (details, workflow) => { -// details[workflow] = generateWorkflowRunDetails(workflow); -// return details; -// }, -// {} as { [key: string]: WorkflowRun } -// ); - -// return { -// id: 12500 + i, -// library_id: library.library_id, -// instrument_run_id: `Run${Math.floor(Math.random() * 1000)}`, -// run_id: uuidv4(), -// lane: Math.ceil(Math.random() * 8), // Random lane number -// override_cycles: library.override_cycles, -// coverage_yield: null, -// qc_pass: Math.random() > 0.5, -// qc_status: null, -// valid_for_analysis: Math.random() > 0.5, -// workflows: workflowsForType.map((_, idx) => 6788 + idx), // Generate workflow IDs -// libraryDetails: library, -// workflowsDetails: workflowDetailsObject, // Object of workflow details -// }; -// }); -// }); -// }; - -// // Example usage -// const libraries = generateMockLibraryData(10); -// const workflows = generateMockWorkflowRunData(20); -// const libraryRuns = generateMockLibraryRunData(libraries, workflows, 10); - -// console.log(libraryRuns); -// console.log(libraries); -// console.log(workflows); - -export const generateMockLibraryRunData = ( - count: number, - libraryType: LibraryType -): LibraryRunData[] => { - const libraries = generateMockLibraryData(count, libraryType); // Generate specific library data first - - return libraries.flatMap((library) => { - const numberOfRuns = Math.floor(Math.random() * 5) + 1; // Random number of runs per library - const workflowsForType = WORKFLOW_PIPELINE[library.type]; // Fetch workflows based on library type - - return Array.from({ length: numberOfRuns }, (_, i) => { - const workflowDetailsObject = workflowsForType.reduce( - (details, workflow) => { - details[workflow] = generateWorkflowRunDetails(workflow); - return details; - }, - {} as { [key: string]: WorkflowRunData } - ); - - return { - id: 12500 + i, - library_id: library.library_id, - instrument_run_id: `Run${Math.floor(Math.random() * 1000)}`, - run_id: uuidv4(), - lane: Math.ceil(Math.random() * 8), // Random lane number - override_cycles: library.override_cycles, - coverage_yield: null, - qc_pass: Math.random() > 0.5, - qc_status: null, - valid_for_analysis: Math.random() > 0.5, - workflows: workflowsForType.map((_, idx) => 6788 + idx), // Generate workflow IDs - libraryDetails: library, - workflowsDetails: workflowDetailsObject, // Object of workflow details - }; - }); - }); -}; - -// Generate workflow details for a given workflow type -export const generateWorkflowRunDetails = (workflowType: string): WorkflowRunData => { - return { - id: Math.floor(Math.random() * 1000), - portal_run_id: uuidv4(), - type_name: workflowType, - version: '1.0.0', - start: new Date().toISOString(), - end: new Date().toISOString(), - end_status: [ - 'Requested', - 'Queued', - 'Initializing', - 'Preparing Inputs', - 'In Progress', - 'Generating outputs', - 'Aborting', - 'Aborted', - 'Failed', - 'Succeeded', - ][Math.floor(Math.random() * 10)], - notified: Math.random() > 0.5, - }; -}; - -// LibraryData and WorkflowRunData interfaces need to be defined -// interface LibraryData { -// id: number; -// library_id: string; -// sample_name: string; -// sample_id: string; -// external_sample_id: string; -// subject_id: string; -// external_subject_id: string; -// phenotype: string; -// quality: string; -// source: string; -// project_name: string; -// project_owner: string; -// experiment_id: string; -// type: LibraryType; -// assay: string; -// override_cycles: string; -// workflow: string; -// coverage: string; -// truseqindex: string; -// } - -interface WorkflowRunData { - id: number; - portal_run_id: string; - type_name: string; - version: string; - start: string; - end: string; - end_status: string; - notified: boolean; -} diff --git a/src/api/_mock/mockTestData.ts b/src/api/_mock/mockTestData.ts deleted file mode 100644 index 5ef4a43..0000000 --- a/src/api/_mock/mockTestData.ts +++ /dev/null @@ -1,69 +0,0 @@ -export const generateGanttData = ( - count: number -): { startDate: Date; endDate: Date; taskName: string }[] => { - const tasks = []; - const taskNames = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; - let currentDate = new Date('Sun Dec 09 2012 00:00:00 EST'); - - for (let i = 0; i < count; i++) { - const taskDurationHours = Math.floor(Math.random() * 4) + 1; // Tasks last between 1 and 4 hours - const overlap = Math.floor(Math.random() * 3); // Up to 2 hours overlap - const taskName = `${taskNames.charAt(i % 26)} Job`; // Cycle through 'A Job' to 'Z Job' - - const startDate = new Date(currentDate.getTime() - overlap * 3600000); - const endDate = new Date(startDate.getTime() + taskDurationHours * 3600000); - - tasks.push({ startDate, endDate, taskName }); - - // Update currentDate to the end of the current task for the next task - currentDate = new Date(endDate.getTime()); - } - - return tasks; -}; - -export const generateMockGanttData = ( - tasksData: { name: string; value: number }[] -): { [key: string]: { startDate: Date; endDate: Date; taskName: string }[] } => { - const ganttData: { [key: string]: { startDate: Date; endDate: Date; taskName: string }[] } = {}; - - tasksData.forEach((task) => { - ganttData[task.name] = generateGanttData(task.value); - }); - - return ganttData; -}; - -// we need generate gannt data for the data, like bcl_convert need 1 gannt data, tso_ctdna_tumor_only need 6 gannt data -// const data = [ -// { name: 'bcl_convert', value: 1 }, -// { name: 'tso_ctdna_tumor_only', value: 6 }, -// { name: 'wgs_alignment_qc', value: 22 }, -// { name: 'wts_alignment_qc', value: 16 }, -// { name: 'wts_tumor_only', value: 4 }, -// { name: 'wgs_tumor_normal', value: 4 }, -// { name: 'umccrise', value: 4 }, -// { name: 'rnasum', value: 4 }, -// { name: 'star_alignment', value: 4 }, -// { name: 'oncoanalyser_wts', value: 4 }, -// { name: 'oncoanalyser_wgs', value: 4 }, -// { name: 'oncoanalyser_wgts_existing_both', value: 4 }, -// { name: 'sash', value: 4 }, -// ]; - -// example opuput: -// { -// bcl_convert: [ -// { startDate: '2022-09-09T14:00:00.000Z', endDate: '2022-09-09T15:00:00.000Z', taskName: 'A Job' } -// ], -// tso_ctdna_tumor_only: [ -// { startDate: '2022-09-09T15:00:00.000Z', endDate: '2022-09-09T17:00:00.000Z', taskName: 'B Job' }, -// { startDate: '2022-09-09T14:00:00.000Z', endDate: '2022-09-09T15:00:00.000Z', taskName: 'A Job' }, -// { startDate: '2022-09-09T13:00:00.000Z', endDate: '2022-09-09T14:00:00.000Z', taskName: 'Z Job' }, -// { startDate: '2022-09-09T12:00:00.000Z', endDate: '2022-09-09T13:00:00.000Z', taskName: 'Y Job' }, -// { startDate: '2022-09-09T11:00:00.000Z', endDate: '2022-09-09T12:00:00.000Z', taskName: 'X Job' }, -// { startDate: '2022-09-09T10:00:00.000Z', endDate: '2022-09-09T11:00:00.000Z', taskName: 'W Job' } -// ], -// wgs_alignment_qc: [ -// { startDate: '2022-09-09T17:00:00.000Z', endDate: '2022-09-09T19:00:00.000Z', taskName: 'C Job' }, -// { startDate: '2022-09-09T16:00:00.000Z', endDate: '2022-09-09T17:00:00.000Z', taskName: 'B Job' },... diff --git a/src/api/_mock/mockWorkflowData.ts b/src/api/_mock/mockWorkflowData.ts deleted file mode 100644 index 624859f..0000000 --- a/src/api/_mock/mockWorkflowData.ts +++ /dev/null @@ -1 +0,0 @@ -export const mockWorkflowData = {}; diff --git a/src/api/types/file.d.ts b/src/api/types/file.d.ts index 8ce52f0..93fc8d7 100644 --- a/src/api/types/file.d.ts +++ b/src/api/types/file.d.ts @@ -35,10 +35,8 @@ export interface paths { delete?: never; options?: never; head?: never; - /** - * Update the attributes for a collection of s3_objects using a JSON patch request. - * @description This updates all attributes matching the filter params with the same JSON patch. - */ + /** Update the attributes for a collection of s3_objects using a JSON patch request. + * This updates all attributes matching the filter params with the same JSON patch. */ patch: operations["update_s3_collection_attributes"]; trace?: never; }; @@ -49,14 +47,12 @@ export interface paths { path?: never; cookie?: never; }; - /** - * List all S3 objects according to a set of attribute filter parameters. - * @description This route is a convenience for querying using top-level attributes and accepts arbitrary + /** List all S3 objects according to a set of attribute filter parameters. + * This route is a convenience for querying using top-level attributes and accepts arbitrary * parameters. For example, instead of using `/api/v1/s3?attributes[attributeId]=...`, this route * can express the same query as `/api/v1/s3/attributes?attributeId=...`. Similar to the * `attributes` filter parameter, nested JSON queries are supported using the bracket notation. - * Note that regular filtering parameters, like `key` or `bucket` are not supported on this route. - */ + * Note that regular filtering parameters, like `key` or `bucket` are not supported on this route. */ get: operations["attributes_s3"]; put?: never; post?: never; @@ -90,12 +86,10 @@ export interface paths { path?: never; cookie?: never; }; - /** - * Generate AWS presigned URLs for s3_objects according to the parameters. - * @description This route implies `currentState=true` because only existing objects can be presigned. + /** Generate AWS presigned URLs for s3_objects according to the parameters. + * This route implies `currentState=true` because only existing objects can be presigned. * Less presigned URLs may be returned than the amount of objects in the database because some - * objects may be over the `FILEMANAGER_API_PRESIGN_LIMIT`. - */ + * objects may be over the `FILEMANAGER_API_PRESIGN_LIMIT`. */ get: operations["presign_s3"]; put?: never; post?: never; @@ -112,11 +106,9 @@ export interface paths { path?: never; cookie?: never; }; - /** - * Generate AWS presigned URLs for a single S3 object using its `s3_object_id`. - * @description This route will not return an object if it has been deleted from the database, or its size - * is greater than `FILEMANAGER_API_PRESIGN_LIMIT`. - */ + /** Generate AWS presigned URLs for a single S3 object using its `s3_object_id`. + * This route will not return an object if it has been deleted from the database, or its size + * is greater than `FILEMANAGER_API_PRESIGN_LIMIT`. */ get: operations["presign_s3_by_id"]; put?: never; post?: never; @@ -164,11 +156,56 @@ export interface components { }; /** @enum {string} */ EventType: "Created" | "Deleted" | "Other"; + /** @description Specifies how to join multiple queries with the same key. Either with + * 'or' or 'and' logic. The default is combining using `or` logic for multiple + * keys. For example, use `?key[]=123&key[]=456` to query where `key=123` + * or `key=456`. The same query can be expressed more explicitly as + * `?key[or][]=123&key[or][]=456`. `and` logic can be expressed using the `and` + * keyword. For example, use`?key[and][]=*123*&key[and][]=*345` to query where + * the key contains `123` and ends with `345`. */ + FilterJoin_StorageClass: ("DeepArchive" | "Glacier" | "GlacierIr" | "IntelligentTiering" | "OnezoneIa" | "Outposts" | "ReducedRedundancy" | "Snow" | "Standard" | "StandardIa") | Record[] | { + [key: string]: Record[]; + }; + /** @description Specifies how to join multiple queries with the same key. Either with + * 'or' or 'and' logic. The default is combining using `or` logic for multiple + * keys. For example, use `?key[]=123&key[]=456` to query where `key=123` + * or `key=456`. The same query can be expressed more explicitly as + * `?key[or][]=123&key[or][]=456`. `and` logic can be expressed using the `and` + * keyword. For example, use`?key[and][]=*123*&key[and][]=*345` to query where + * the key contains `123` and ends with `345`. */ + FilterJoin_String: string | Record[] | { + [key: string]: Record[]; + }; + /** @description Specifies how to join multiple queries with the same key. Either with + * 'or' or 'and' logic. The default is combining using `or` logic for multiple + * keys. For example, use `?key[]=123&key[]=456` to query where `key=123` + * or `key=456`. The same query can be expressed more explicitly as + * `?key[or][]=123&key[or][]=456`. `and` logic can be expressed using the `and` + * keyword. For example, use`?key[and][]=*123*&key[and][]=*345` to query where + * the key contains `123` and ends with `345`. */ + FilterJoin_Wildcard: string | Record[] | { + [key: string]: Record[]; + }; + /** @description Specifies how to join multiple queries with the same key. Either with + * 'or' or 'and' logic. The default is combining using `or` logic for multiple + * keys. For example, use `?key[]=123&key[]=456` to query where `key=123` + * or `key=456`. The same query can be expressed more explicitly as + * `?key[or][]=123&key[or][]=456`. `and` logic can be expressed using the `and` + * keyword. For example, use`?key[and][]=*123*&key[and][]=*345` to query where + * the key contains `123` and ends with `345`. */ + FilterJoin_i64: number | Record[] | { + [key: string]: Record[]; + }; /** @description The return value for ingest endpoints indicating how many records were processed. */ IngestCount: { /** @description The number of events processed. This potentially includes duplicate records. */ nRecords: number; }; + /** + * @description The logical query join type. + * @enum {string} + */ + Join: "or" | "and"; /** @description A newtype equivalent to an arbitrary JSON `Value`. */ Json: unknown; /** @description The paginated links to the next and previous page. */ @@ -193,15 +230,48 @@ export interface components { nRecords: number; }; /** @description The response type for list operations. */ - ListResponseS3: { + ListResponse_S3: { + /** @description Links to next and previous page. */ links: components["schemas"]["Links"]; + /** @description The pagination response component. */ pagination: components["schemas"]["PaginatedResponse"]; /** @description The results of the list operation. */ - results: components["schemas"]["S3"][]; + results: { + attributes?: null | components["schemas"]["Value"]; + bucket: string; + /** Format: date-time */ + deletedDate?: string | null; + deletedSequencer?: string | null; + eTag?: string | null; + /** Format: date-time */ + eventTime?: string | null; + eventType: components["schemas"]["EventType"]; + /** Format: uuid */ + ingestId?: string | null; + isCurrentState: boolean; + isDeleteMarker: boolean; + key: string; + /** Format: date-time */ + lastModifiedDate?: string | null; + /** Format: int64 */ + numberDuplicateEvents: number; + /** Format: int64 */ + numberReordered: number; + /** Format: uuid */ + s3ObjectId: string; + sequencer?: string | null; + sha256?: string | null; + /** Format: int64 */ + size?: number | null; + storageClass?: null | components["schemas"]["StorageClass"]; + versionId: string; + }[]; }; /** @description The response type for list operations. */ - ListResponseUrl: { + ListResponse_String: { + /** @description Links to next and previous page. */ links: components["schemas"]["Links"]; + /** @description The pagination response component. */ pagination: components["schemas"]["PaginatedResponse"]; /** @description The results of the list operation. */ results: string[]; @@ -252,22 +322,26 @@ export interface components { * ] */ PatchBody: { + /** @description The JSON patch for a record's attributes. */ attributes: components["schemas"]["Patch"]; } | components["schemas"]["Patch"]; S3: { - attributes?: components["schemas"]["Json"] | null; + attributes?: null | components["schemas"]["Value"]; bucket: string; - deletedDate?: components["schemas"]["DateTimeWithTimeZone"] | null; + /** Format: date-time */ + deletedDate?: string | null; deletedSequencer?: string | null; eTag?: string | null; - eventTime?: components["schemas"]["DateTimeWithTimeZone"] | null; + /** Format: date-time */ + eventTime?: string | null; eventType: components["schemas"]["EventType"]; /** Format: uuid */ ingestId?: string | null; isCurrentState: boolean; isDeleteMarker: boolean; key: string; - lastModifiedDate?: components["schemas"]["DateTimeWithTimeZone"] | null; + /** Format: date-time */ + lastModifiedDate?: string | null; /** Format: int64 */ numberDuplicateEvents: number; /** Format: int64 */ @@ -278,11 +352,12 @@ export interface components { sha256?: string | null; /** Format: int64 */ size?: number | null; - storageClass?: components["schemas"]["StorageClass"] | null; + storageClass?: null | components["schemas"]["StorageClass"]; versionId: string; }; /** @enum {string} */ StorageClass: "DeepArchive" | "Glacier" | "GlacierIr" | "IntelligentTiering" | "OnezoneIa" | "Outposts" | "ReducedRedundancy" | "Snow" | "Standard" | "StandardIa"; + Value: unknown; /** @description A wildcard type represents a filter to match arbitrary characters. Use '%' for multiple characters * and '_' for a single character. Use '\\' to escape these characters. Wildcards are converted to * postgres `like` or `ilike` queries. */ @@ -367,45 +442,55 @@ export interface operations { * `?current_state=true` would return only the last `Created` event. */ currentState?: boolean; /** @description Query by event type. */ - eventType?: components["schemas"]["EventType"] | null; + eventType?: null | components["schemas"]["EventType"]; /** @description Query by bucket. Supports wildcards. - * Repeated parameters are joined with an `or` condition. */ - bucket?: components["schemas"]["Wildcard"][]; + * Repeated parameters with `[]` are joined with an `or` conditions by default. + * Use `[or][]` or `[and][]` to explicitly set the joining logic. */ + bucket?: components["schemas"]["FilterJoin_Wildcard"]; /** @description Query by key. Supports wildcards. - * Repeated parameters are joined with an `or` condition. */ - key?: components["schemas"]["Wildcard"][]; + * Repeated parameters with `[]` are joined with an `or` conditions by default. + * Use `[or][]` or `[and][]` to explicitly set the joining logic. */ + key?: components["schemas"]["FilterJoin_Wildcard"]; /** @description Query by version_id. Supports wildcards. - * Repeated parameters are joined with an `or` condition. */ - versionId?: components["schemas"]["Wildcard"][]; + * Repeated parameters with `[]` are joined with an `or` conditions by default. + * Use `[or][]` or `[and][]` to explicitly set the joining logic. */ + versionId?: components["schemas"]["FilterJoin_Wildcard"]; /** @description Query by event_time. Supports wildcards. - * Repeated parameters are joined with an `or` condition. */ - eventTime?: components["schemas"]["Wildcard"]; + * Repeated parameters with `[]` are joined with an `or` conditions by default. + * Use `[or][]` or `[and][]` to explicitly set the joining logic. */ + eventTime?: components["schemas"]["FilterJoin_Wildcard"]; /** @description Query by size. - * Repeated parameters are joined with an `or` condition. */ - size?: number[]; + * Repeated parameters with `[]` are joined with an `or` conditions by default. + * Use `[or][]` or `[and][]` to explicitly set the joining logic. */ + size?: components["schemas"]["FilterJoin_i64"]; /** @description Query by the sha256 checksum. - * Repeated parameters are joined with an `or` condition. */ - sha256?: string[]; + * Repeated parameters with `[]` are joined with an `or` conditions by default. + * Use `[or][]` or `[and][]` to explicitly set the joining logic. */ + sha256?: components["schemas"]["FilterJoin_Wildcard"]; /** @description Query by the last modified date. Supports wildcards. - * Repeated parameters are joined with an `or` condition. */ - lastModifiedDate?: components["schemas"]["Wildcard"]; + * Repeated parameters with `[]` are joined with an `or` conditions by default. + * Use `[or][]` or `[and][]` to explicitly set the joining logic. */ + lastModifiedDate?: components["schemas"]["FilterJoin_Wildcard"]; /** @description Query by the e_tag. - * Repeated parameters are joined with an `or` condition. */ - eTag?: string[]; + * Repeated parameters with `[]` are joined with an `or` conditions by default. + * Use `[or][]` or `[and][]` to explicitly set the joining logic. */ + eTag?: components["schemas"]["FilterJoin_Wildcard"]; /** @description Query by the storage class. - * Repeated parameters are joined with an `or` condition. */ - storageClass?: components["schemas"]["StorageClass"][]; + * Repeated parameters with `[]` are joined with an `or` conditions by default. + * Use `[or][]` or `[and][]` to explicitly set the joining logic. */ + storageClass?: components["schemas"]["FilterJoin_StorageClass"]; /** @description Query by the object delete marker. */ isDeleteMarker?: boolean | null; /** @description Query by the ingest id that objects get tagged with. - * Repeated parameters are joined with an `or` condition. */ - ingestId?: string[]; + * Repeated parameters with `[]` are joined with an `or` conditions by default. + * Use `[or][]` or `[and][]` to explicitly set the joining logic. */ + ingestId?: components["schemas"]["FilterJoin_String"]; /** @description Query by JSON attributes. Supports nested syntax to access inner * fields, e.g. `attributes[attribute_id]=...`. This only deserializes * into string fields, and does not support other JSON types. E.g. * `attributes[attribute_id]=1` converts to `{ "attribute_id" = "1" }` * rather than `{ "attribute_id" = 1 }`. Supports wildcards. */ - attributes?: components["schemas"]["Json"] | null; + attributes?: null | components["schemas"]["Value"]; }; header?: never; path?: never; @@ -419,7 +504,7 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": components["schemas"]["ListResponseS3"]; + "application/json": components["schemas"]["ListResponse_S3"]; }; }; /** @description the request could not be parsed or the request triggered a constraint error in the database */ @@ -468,45 +553,55 @@ export interface operations { * `?current_state=true` would return only the last `Created` event. */ currentState?: boolean; /** @description Query by event type. */ - eventType?: components["schemas"]["EventType"] | null; + eventType?: null | components["schemas"]["EventType"]; /** @description Query by bucket. Supports wildcards. - * Repeated parameters are joined with an `or` condition. */ - bucket?: components["schemas"]["Wildcard"][]; + * Repeated parameters with `[]` are joined with an `or` conditions by default. + * Use `[or][]` or `[and][]` to explicitly set the joining logic. */ + bucket?: components["schemas"]["FilterJoin_Wildcard"]; /** @description Query by key. Supports wildcards. - * Repeated parameters are joined with an `or` condition. */ - key?: components["schemas"]["Wildcard"][]; + * Repeated parameters with `[]` are joined with an `or` conditions by default. + * Use `[or][]` or `[and][]` to explicitly set the joining logic. */ + key?: components["schemas"]["FilterJoin_Wildcard"]; /** @description Query by version_id. Supports wildcards. - * Repeated parameters are joined with an `or` condition. */ - versionId?: components["schemas"]["Wildcard"][]; + * Repeated parameters with `[]` are joined with an `or` conditions by default. + * Use `[or][]` or `[and][]` to explicitly set the joining logic. */ + versionId?: components["schemas"]["FilterJoin_Wildcard"]; /** @description Query by event_time. Supports wildcards. - * Repeated parameters are joined with an `or` condition. */ - eventTime?: components["schemas"]["Wildcard"]; + * Repeated parameters with `[]` are joined with an `or` conditions by default. + * Use `[or][]` or `[and][]` to explicitly set the joining logic. */ + eventTime?: components["schemas"]["FilterJoin_Wildcard"]; /** @description Query by size. - * Repeated parameters are joined with an `or` condition. */ - size?: number[]; + * Repeated parameters with `[]` are joined with an `or` conditions by default. + * Use `[or][]` or `[and][]` to explicitly set the joining logic. */ + size?: components["schemas"]["FilterJoin_i64"]; /** @description Query by the sha256 checksum. - * Repeated parameters are joined with an `or` condition. */ - sha256?: string[]; + * Repeated parameters with `[]` are joined with an `or` conditions by default. + * Use `[or][]` or `[and][]` to explicitly set the joining logic. */ + sha256?: components["schemas"]["FilterJoin_Wildcard"]; /** @description Query by the last modified date. Supports wildcards. - * Repeated parameters are joined with an `or` condition. */ - lastModifiedDate?: components["schemas"]["Wildcard"]; + * Repeated parameters with `[]` are joined with an `or` conditions by default. + * Use `[or][]` or `[and][]` to explicitly set the joining logic. */ + lastModifiedDate?: components["schemas"]["FilterJoin_Wildcard"]; /** @description Query by the e_tag. - * Repeated parameters are joined with an `or` condition. */ - eTag?: string[]; + * Repeated parameters with `[]` are joined with an `or` conditions by default. + * Use `[or][]` or `[and][]` to explicitly set the joining logic. */ + eTag?: components["schemas"]["FilterJoin_Wildcard"]; /** @description Query by the storage class. - * Repeated parameters are joined with an `or` condition. */ - storageClass?: components["schemas"]["StorageClass"][]; + * Repeated parameters with `[]` are joined with an `or` conditions by default. + * Use `[or][]` or `[and][]` to explicitly set the joining logic. */ + storageClass?: components["schemas"]["FilterJoin_StorageClass"]; /** @description Query by the object delete marker. */ isDeleteMarker?: boolean | null; /** @description Query by the ingest id that objects get tagged with. - * Repeated parameters are joined with an `or` condition. */ - ingestId?: string[]; + * Repeated parameters with `[]` are joined with an `or` conditions by default. + * Use `[or][]` or `[and][]` to explicitly set the joining logic. */ + ingestId?: components["schemas"]["FilterJoin_String"]; /** @description Query by JSON attributes. Supports nested syntax to access inner * fields, e.g. `attributes[attribute_id]=...`. This only deserializes * into string fields, and does not support other JSON types. E.g. * `attributes[attribute_id]=1` converts to `{ "attribute_id" = "1" }` * rather than `{ "attribute_id" = 1 }`. Supports wildcards. */ - attributes?: components["schemas"]["Json"] | null; + attributes?: null | components["schemas"]["Value"]; }; header?: never; path?: never; @@ -580,7 +675,7 @@ export interface operations { * `?current_state=true` would return only the last `Created` event. */ currentState?: boolean; params?: { - [key: string]: components["schemas"]["Json"]; + [key: string]: components["schemas"]["Value"]; }; }; header?: never; @@ -595,7 +690,7 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": components["schemas"]["ListResponseS3"]; + "application/json": components["schemas"]["ListResponse_S3"]; }; }; /** @description the request could not be parsed or the request triggered a constraint error in the database */ @@ -644,45 +739,55 @@ export interface operations { * `?current_state=true` would return only the last `Created` event. */ currentState?: boolean; /** @description Query by event type. */ - eventType?: components["schemas"]["EventType"] | null; + eventType?: null | components["schemas"]["EventType"]; /** @description Query by bucket. Supports wildcards. - * Repeated parameters are joined with an `or` condition. */ - bucket?: components["schemas"]["Wildcard"][]; + * Repeated parameters with `[]` are joined with an `or` conditions by default. + * Use `[or][]` or `[and][]` to explicitly set the joining logic. */ + bucket?: components["schemas"]["FilterJoin_Wildcard"]; /** @description Query by key. Supports wildcards. - * Repeated parameters are joined with an `or` condition. */ - key?: components["schemas"]["Wildcard"][]; + * Repeated parameters with `[]` are joined with an `or` conditions by default. + * Use `[or][]` or `[and][]` to explicitly set the joining logic. */ + key?: components["schemas"]["FilterJoin_Wildcard"]; /** @description Query by version_id. Supports wildcards. - * Repeated parameters are joined with an `or` condition. */ - versionId?: components["schemas"]["Wildcard"][]; + * Repeated parameters with `[]` are joined with an `or` conditions by default. + * Use `[or][]` or `[and][]` to explicitly set the joining logic. */ + versionId?: components["schemas"]["FilterJoin_Wildcard"]; /** @description Query by event_time. Supports wildcards. - * Repeated parameters are joined with an `or` condition. */ - eventTime?: components["schemas"]["Wildcard"]; + * Repeated parameters with `[]` are joined with an `or` conditions by default. + * Use `[or][]` or `[and][]` to explicitly set the joining logic. */ + eventTime?: components["schemas"]["FilterJoin_Wildcard"]; /** @description Query by size. - * Repeated parameters are joined with an `or` condition. */ - size?: number[]; + * Repeated parameters with `[]` are joined with an `or` conditions by default. + * Use `[or][]` or `[and][]` to explicitly set the joining logic. */ + size?: components["schemas"]["FilterJoin_i64"]; /** @description Query by the sha256 checksum. - * Repeated parameters are joined with an `or` condition. */ - sha256?: string[]; + * Repeated parameters with `[]` are joined with an `or` conditions by default. + * Use `[or][]` or `[and][]` to explicitly set the joining logic. */ + sha256?: components["schemas"]["FilterJoin_Wildcard"]; /** @description Query by the last modified date. Supports wildcards. - * Repeated parameters are joined with an `or` condition. */ - lastModifiedDate?: components["schemas"]["Wildcard"]; + * Repeated parameters with `[]` are joined with an `or` conditions by default. + * Use `[or][]` or `[and][]` to explicitly set the joining logic. */ + lastModifiedDate?: components["schemas"]["FilterJoin_Wildcard"]; /** @description Query by the e_tag. - * Repeated parameters are joined with an `or` condition. */ - eTag?: string[]; + * Repeated parameters with `[]` are joined with an `or` conditions by default. + * Use `[or][]` or `[and][]` to explicitly set the joining logic. */ + eTag?: components["schemas"]["FilterJoin_Wildcard"]; /** @description Query by the storage class. - * Repeated parameters are joined with an `or` condition. */ - storageClass?: components["schemas"]["StorageClass"][]; + * Repeated parameters with `[]` are joined with an `or` conditions by default. + * Use `[or][]` or `[and][]` to explicitly set the joining logic. */ + storageClass?: components["schemas"]["FilterJoin_StorageClass"]; /** @description Query by the object delete marker. */ isDeleteMarker?: boolean | null; /** @description Query by the ingest id that objects get tagged with. - * Repeated parameters are joined with an `or` condition. */ - ingestId?: string[]; + * Repeated parameters with `[]` are joined with an `or` conditions by default. + * Use `[or][]` or `[and][]` to explicitly set the joining logic. */ + ingestId?: components["schemas"]["FilterJoin_String"]; /** @description Query by JSON attributes. Supports nested syntax to access inner * fields, e.g. `attributes[attribute_id]=...`. This only deserializes * into string fields, and does not support other JSON types. E.g. * `attributes[attribute_id]=1` converts to `{ "attribute_id" = "1" }` * rather than `{ "attribute_id" = 1 }`. Supports wildcards. */ - attributes?: components["schemas"]["Json"] | null; + attributes?: null | components["schemas"]["Value"]; }; header?: never; path?: never; @@ -746,45 +851,55 @@ export interface operations { * This sets the `response-content-disposition` for the presigned `GetObject` request. */ responseContentDisposition?: components["schemas"]["ContentDisposition"]; /** @description Query by event type. */ - eventType?: components["schemas"]["EventType"] | null; + eventType?: null | components["schemas"]["EventType"]; /** @description Query by bucket. Supports wildcards. - * Repeated parameters are joined with an `or` condition. */ - bucket?: components["schemas"]["Wildcard"][]; + * Repeated parameters with `[]` are joined with an `or` conditions by default. + * Use `[or][]` or `[and][]` to explicitly set the joining logic. */ + bucket?: components["schemas"]["FilterJoin_Wildcard"]; /** @description Query by key. Supports wildcards. - * Repeated parameters are joined with an `or` condition. */ - key?: components["schemas"]["Wildcard"][]; + * Repeated parameters with `[]` are joined with an `or` conditions by default. + * Use `[or][]` or `[and][]` to explicitly set the joining logic. */ + key?: components["schemas"]["FilterJoin_Wildcard"]; /** @description Query by version_id. Supports wildcards. - * Repeated parameters are joined with an `or` condition. */ - versionId?: components["schemas"]["Wildcard"][]; + * Repeated parameters with `[]` are joined with an `or` conditions by default. + * Use `[or][]` or `[and][]` to explicitly set the joining logic. */ + versionId?: components["schemas"]["FilterJoin_Wildcard"]; /** @description Query by event_time. Supports wildcards. - * Repeated parameters are joined with an `or` condition. */ - eventTime?: components["schemas"]["Wildcard"]; + * Repeated parameters with `[]` are joined with an `or` conditions by default. + * Use `[or][]` or `[and][]` to explicitly set the joining logic. */ + eventTime?: components["schemas"]["FilterJoin_Wildcard"]; /** @description Query by size. - * Repeated parameters are joined with an `or` condition. */ - size?: number[]; + * Repeated parameters with `[]` are joined with an `or` conditions by default. + * Use `[or][]` or `[and][]` to explicitly set the joining logic. */ + size?: components["schemas"]["FilterJoin_i64"]; /** @description Query by the sha256 checksum. - * Repeated parameters are joined with an `or` condition. */ - sha256?: string[]; + * Repeated parameters with `[]` are joined with an `or` conditions by default. + * Use `[or][]` or `[and][]` to explicitly set the joining logic. */ + sha256?: components["schemas"]["FilterJoin_Wildcard"]; /** @description Query by the last modified date. Supports wildcards. - * Repeated parameters are joined with an `or` condition. */ - lastModifiedDate?: components["schemas"]["Wildcard"]; + * Repeated parameters with `[]` are joined with an `or` conditions by default. + * Use `[or][]` or `[and][]` to explicitly set the joining logic. */ + lastModifiedDate?: components["schemas"]["FilterJoin_Wildcard"]; /** @description Query by the e_tag. - * Repeated parameters are joined with an `or` condition. */ - eTag?: string[]; + * Repeated parameters with `[]` are joined with an `or` conditions by default. + * Use `[or][]` or `[and][]` to explicitly set the joining logic. */ + eTag?: components["schemas"]["FilterJoin_Wildcard"]; /** @description Query by the storage class. - * Repeated parameters are joined with an `or` condition. */ - storageClass?: components["schemas"]["StorageClass"][]; + * Repeated parameters with `[]` are joined with an `or` conditions by default. + * Use `[or][]` or `[and][]` to explicitly set the joining logic. */ + storageClass?: components["schemas"]["FilterJoin_StorageClass"]; /** @description Query by the object delete marker. */ isDeleteMarker?: boolean | null; /** @description Query by the ingest id that objects get tagged with. - * Repeated parameters are joined with an `or` condition. */ - ingestId?: string[]; + * Repeated parameters with `[]` are joined with an `or` conditions by default. + * Use `[or][]` or `[and][]` to explicitly set the joining logic. */ + ingestId?: components["schemas"]["FilterJoin_String"]; /** @description Query by JSON attributes. Supports nested syntax to access inner * fields, e.g. `attributes[attribute_id]=...`. This only deserializes * into string fields, and does not support other JSON types. E.g. * `attributes[attribute_id]=1` converts to `{ "attribute_id" = "1" }` * rather than `{ "attribute_id" = 1 }`. Supports wildcards. */ - attributes?: components["schemas"]["Json"] | null; + attributes?: null | components["schemas"]["Value"]; }; header?: never; path?: never; @@ -798,7 +913,7 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": components["schemas"]["ListResponseUrl"]; + "application/json": components["schemas"]["ListResponse_String"]; }; }; /** @description the request could not be parsed or the request triggered a constraint error in the database */ diff --git a/src/api/types/workflow.d.ts b/src/api/types/workflow.d.ts index df831c8..5476e9a 100644 --- a/src/api/types/workflow.d.ts +++ b/src/api/types/workflow.d.ts @@ -242,6 +242,8 @@ export interface paths { }; get: operations["workflowrunStateList"]; put?: never; + /** @description Create a customed new state for a workflow run. + * Currently we support "Resolved", "Deprecated" */ post: operations["workflowrunStateCreate"]; delete?: never; options?: never; @@ -265,6 +267,23 @@ export interface paths { patch: operations["workflowrunStatePartialUpdate"]; trace?: never; }; + "/api/v1/workflowrun/{orcabusId}/state/valid_states_map/": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Valid states map for new state creation, update */ + get: operations["workflowrunStateValidStatesMapRetrieve"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; "/api/v1/workflowrun/{orcabusId}/": { parameters: { query?: never; @@ -299,6 +318,23 @@ export interface paths { patch?: never; trace?: never; }; + "/api/v1/workflowrun/{orcabusId}/validate_rerun_workflows/": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Allowed rerun workflows */ + get: operations["workflowrunValidateRerunWorkflowsRetrieve"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; "/api/v1/workflowrun/ongoing/": { parameters: { query?: never; @@ -384,6 +420,11 @@ export interface paths { export type webhooks = Record; export interface components { schemas: { + AllowedRerunWorkflow: { + isValid: boolean; + allowedDatasetChoice: string[]; + validWorkflows: string[]; + }; AnalysisContext: { readonly orcabusId: string; name: string; @@ -668,6 +709,7 @@ export interface components { failed: number; resolved: number; ongoing: number; + deprecated: number; }; WorkflowRunDetail: { readonly orcabusId: string; @@ -973,11 +1015,7 @@ export interface operations { query?: { analysisRun?: string | null; comment?: string | null; - currentState?: { - [key: string]: unknown; - }; executionId?: string | null; - libraries?: string[]; orcabusId?: string; /** @description Which field to use when ordering the results. */ ordering?: string; @@ -1180,6 +1218,29 @@ export interface operations { }; }; }; + workflowrunStateValidStatesMapRetrieve: { + parameters: { + query?: never; + header?: never; + path: { + orcabusId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + [key: string]: unknown; + }; + }; + }; + }; + }; workflowrunRetrieve: { parameters: { query?: never; @@ -1232,6 +1293,28 @@ export interface operations { }; }; }; + workflowrunValidateRerunWorkflowsRetrieve: { + parameters: { + query?: never; + header?: never; + path: { + /** @description A unique value identifying this workflow run. */ + orcabusId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["AllowedRerunWorkflow"]; + }; + }; + }; + }; workflowrunOngoingRetrieve: { parameters: { query?: never; diff --git a/src/api/workflow.ts b/src/api/workflow.ts index 49cec17..8490cb3 100644 --- a/src/api/workflow.ts +++ b/src/api/workflow.ts @@ -155,14 +155,16 @@ export const useWorkflowRunCommentDeleteModel = createWorkflowDeleteMutationHook '/api/v1/workflowrun/{orcabusId}/comment/{id}/soft_delete/' ); -// workflow run state "RESOLVED" -export const useWorkflowRunResolvedStateCreateModel = createWorkflowPostMutationHook( +// workflow run state creation +export const useWorkflowRunStateCreateModel = createWorkflowPostMutationHook( '/api/v1/workflowrun/{orcabusId}/state/' ); - -export const useWorkflowRunResolvedStateUpdateModel = createWorkflowPatchMutationHook( +export const useWorkflowRunStateUpdateModel = createWorkflowPatchMutationHook( '/api/v1/workflowrun/{orcabusId}/state/{id}/' ); +export const useWorkflowRunStateValidMapModel = createWorkflowQueryHook( + '/api/v1/workflowrun/{orcabusId}/state/valid_states_map/' +); // Use suspenseQuery hook for fetching data export const useSuspenseWorkflowRunListModel = createWorkflowFetchingHook('/api/v1/workflowrun/'); @@ -174,3 +176,11 @@ export const useAnalysisRunListModel = createWorkflowQueryHook('/api/v1/analysis export const useAnalysisRunDetailModel = createWorkflowQueryHook( '/api/v1/analysisrun/{orcabusId}/' ); + +// rerun +export const useWorkflowRunRerunModel = createWorkflowPostMutationHook( + '/api/v1/workflowrun/{orcabusId}/rerun/' +); +export const useWorkflowRunRerunValidateModel = createWorkflowQueryHook( + '/api/v1/workflowrun/{orcabusId}/validate_rerun_workflows/' +); diff --git a/src/components/common/buttons/IconButton.tsx b/src/components/common/buttons/IconButton.tsx new file mode 100644 index 0000000..cfb3e9a --- /dev/null +++ b/src/components/common/buttons/IconButton.tsx @@ -0,0 +1,48 @@ +import { FC, ReactNode, MouseEventHandler } from 'react'; +import { Tooltip } from '@/components/common/tooltips'; + +export interface IconButtonProps { + icon: ReactNode; + tooltip?: string; + onClick?: MouseEventHandler; + type?: 'primary' | 'secondary' | 'light' | 'green' | 'red' | 'yellow' | 'gray'; + disabled?: boolean; + className?: string; + tooltipPosition?: 'top' | 'bottom' | 'left' | 'right'; + tooltipBackground?: 'gray' | 'white'; +} + +const IconButton: FC = ({ + icon, + tooltip, + onClick, + disabled = false, + className = '', + tooltipPosition = 'top', + tooltipBackground = 'white', +}) => { + const baseIconButtonStyles = + 'p-1.5 rounded-md text-gray-400 hover:text-gray-600 hover:bg-gray-100'; + + const button = ( + + ); + + if (tooltip) { + return ( + + {button} + + ); + } + + return button; +}; + +export default IconButton; diff --git a/src/components/common/buttons/index.tsx b/src/components/common/buttons/index.tsx index 9080b3e..80a2677 100644 --- a/src/components/common/buttons/index.tsx +++ b/src/components/common/buttons/index.tsx @@ -1,4 +1,5 @@ import Button from './Button'; import ButtonGroup from './ButtonGroup'; +import IconButton from './IconButton'; -export { Button, ButtonGroup }; +export { Button, ButtonGroup, IconButton }; diff --git a/src/components/common/checkbox/Checkbox.tsx b/src/components/common/checkbox/Checkbox.tsx index aae30e3..24d2395 100644 --- a/src/components/common/checkbox/Checkbox.tsx +++ b/src/components/common/checkbox/Checkbox.tsx @@ -3,7 +3,7 @@ import { useState, FC, useEffect } from 'react'; import { classNames } from '@/utils/commonUtils'; interface CheckboxProps { - className?: string; + className: string; checked: boolean; onChange: (checked: boolean) => void; disabled?: boolean; diff --git a/src/components/common/dropdowns/IconDropdown.tsx b/src/components/common/dropdowns/IconDropdown.tsx index c4bb45a..cafcc70 100644 --- a/src/components/common/dropdowns/IconDropdown.tsx +++ b/src/components/common/dropdowns/IconDropdown.tsx @@ -14,19 +14,23 @@ export interface IconDropdownProps { BtnIcon?: FunctionComponent>; className?: string; items: DropdownItemProps[]; + type?: 'rounded' | 'square'; } const IconDropdown: FC = ({ BtnIcon = EllipsisVerticalIcon, className = '', items, + type = 'rounded', }) => { + const roundedClass = type === 'rounded' ? 'rounded-full' : 'rounded-md'; return ( Open options @@ -46,7 +50,7 @@ const IconDropdown: FC = ({ diff --git a/src/components/navigation/tabs/ContentTabs.tsx b/src/components/navigation/tabs/ContentTabs.tsx index c16c1de..2564184 100644 --- a/src/components/navigation/tabs/ContentTabs.tsx +++ b/src/components/navigation/tabs/ContentTabs.tsx @@ -10,7 +10,7 @@ export interface TabsProps { selectedLabel?: string; } -export const Tabs: FC = ({ tabs, selectedLabel = tabs[0].label }) => { +export const Tabs: FC = ({ tabs, selectedLabel = tabs[0]?.label ?? '' }) => { const [selectedTabIndex, setSelectedTabIndex] = useState( tabs.findIndex((tab) => tab.label === selectedLabel) ); diff --git a/src/modules/runs/Pages/WorkflowRunsDetails.tsx b/src/modules/runs/Pages/WorkflowRunsDetails.tsx index c7aded3..a9e22a9 100644 --- a/src/modules/runs/Pages/WorkflowRunsDetails.tsx +++ b/src/modules/runs/Pages/WorkflowRunsDetails.tsx @@ -1,13 +1,16 @@ import WorkflowRunTimeline from '../components/workflowRuns/WorkflowRunTimeline'; import WorkflowRunDetailsTable from '../components/workflowRuns/WorkflowRunDetailsTable'; +import { WorkflowRunProvider } from '../components/workflowRuns/WorkflowRunContext'; const WorkflowRunDetails = () => { return ( -
- + +
+ - -
+ +
+ ); }; diff --git a/src/modules/runs/components/workflowRuns/WorkflowRunContext.tsx b/src/modules/runs/components/workflowRuns/WorkflowRunContext.tsx new file mode 100644 index 0000000..243c287 --- /dev/null +++ b/src/modules/runs/components/workflowRuns/WorkflowRunContext.tsx @@ -0,0 +1,21 @@ +import { createContext, FC, PropsWithChildren, ReactElement, useContext, useState } from 'react'; + +const WorkflowRunContext = createContext({ + refreshWorkflowRuns: false, + // eslint-disable-next-line @typescript-eslint/no-unused-vars + setRefreshWorkflowRuns: (value: boolean) => {}, +}); + +export const WorkflowRunProvider: FC = ({ children }): ReactElement => { + const [refreshWorkflowRuns, setRefreshWorkflowRuns] = useState(false); + + return ( + + {children} + + ); +}; + +export const useWorkflowRunContext = () => { + return useContext(WorkflowRunContext); +}; diff --git a/src/modules/runs/components/workflowRuns/WorkflowRunDetailsTable.tsx b/src/modules/runs/components/workflowRuns/WorkflowRunDetailsTable.tsx index d3c12a5..26aef02 100644 --- a/src/modules/runs/components/workflowRuns/WorkflowRunDetailsTable.tsx +++ b/src/modules/runs/components/workflowRuns/WorkflowRunDetailsTable.tsx @@ -1,16 +1,35 @@ -import { useMemo } from 'react'; +import { useEffect, useMemo, useState } from 'react'; import { Link, useParams } from 'react-router-dom'; -import { useWorkflowRunDetailModel } from '@/api/workflow'; +import { + useWorkflowRunDetailModel, + useWorkflowRunRerunValidateModel, + useWorkflowRunRerunModel, + useWorkflowRunStateCreateModel, +} from '@/api/workflow'; import { JsonToList } from '@/components/common/json-to-table'; import { Table } from '@/components/tables'; import { classNames } from '@/utils/commonUtils'; +import Skeleton from 'react-loading-skeleton'; +import { IconDropdown } from '@/components/common/dropdowns'; +import toaster from '@/components/common/toaster'; +import { Dialog } from '@/components/dialogs'; +import { ArrowPathIcon } from '@heroicons/react/24/outline'; +import { useWorkflowRunContext } from './WorkflowRunContext'; +import { Checkbox } from '@/components/common/checkbox'; +import { useAuthContext } from '@/context/AmplifyAuthContext'; const WorkflowRunDetailsTable = () => { + const { user } = useAuthContext(); const { orcabusId } = useParams(); + const [isOpenRerunWorkflowDialog, setIsOpenRerunWorkflowDialog] = useState(false); + const { setRefreshWorkflowRuns } = useWorkflowRunContext(); + + const [isDeprecated, setIsDeprecated] = useState(false); + const [selectedDataset, setSelectedDataset] = useState(null); const { data: workflowRunDetail, isFetching: isFetchingWorkflowRunDetail } = useWorkflowRunDetailModel({ - params: { path: { orcabusId: orcabusId as string } }, + params: { path: { orcabusId: (orcabusId as string).split('.')[1] } }, reactQuery: { enabled: !!orcabusId, }, @@ -36,6 +55,86 @@ const WorkflowRunDetailsTable = () => { [workflowRunDetail] ); + const { + mutate: rerunWorkflow, + isSuccess: isRerunWorkflowSuccess, + isError: isErrorRerunWorkflow, + reset: resetRerunWorkflow, + } = useWorkflowRunRerunModel({ + params: { path: { orcabusId: orcabusId as string } }, + body: { + dataset: selectedDataset, + }, + reactQuery: { + enabled: !!orcabusId, + }, + }); + + const { + data: workflowRunRerunValidateDetail, + isFetching: isFetchingWorkflowRunRerunAllowedWorkflows, + } = useWorkflowRunRerunValidateModel({ + params: { path: { orcabusId: (orcabusId as string).split('.')[1] } }, + reactQuery: { + enabled: !!orcabusId, + }, + }); + + const handleRerunWorkflow = () => { + rerunWorkflow(); + if (isDeprecated) { + handleMarkAsDeprecated(); + } + setIsOpenRerunWorkflowDialog(false); + }; + + useEffect(() => { + if (isRerunWorkflowSuccess) { + toaster.success({ title: 'Workflow rerun successfully' }); + setIsOpenRerunWorkflowDialog(false); + resetRerunWorkflow(); + setRefreshWorkflowRuns(true); + setSelectedDataset(null); + setIsDeprecated(false); + } + if (isErrorRerunWorkflow) { + toaster.error({ title: 'Error rerunning workflow' }); + setIsOpenRerunWorkflowDialog(false); + resetRerunWorkflow(); + setSelectedDataset(null); + setIsDeprecated(false); + } + }, [isRerunWorkflowSuccess, isErrorRerunWorkflow, resetRerunWorkflow, setRefreshWorkflowRuns]); + + const { + mutate: createWorkflowRunState, + isSuccess: isCreatedWorkflowRunState, + isError: isErrorCreatingWorkflowRunState, + reset: resetCreateWorkflowRunState, + } = useWorkflowRunStateCreateModel({ + params: { path: { orcabusId: orcabusId?.split('.')[1] as string } }, + body: { + status: 'DEPRECATED', + comment: 'Workflow run marked as DEPRECATED as rerun this workflow', + createdBy: user?.email, + }, + }); + + const handleMarkAsDeprecated = () => { + createWorkflowRunState(); + }; + + useEffect(() => { + if (isCreatedWorkflowRunState) { + toaster.success({ title: 'Workflow run marked as DEPRECATED' }); + resetCreateWorkflowRunState(); + } + if (isErrorCreatingWorkflowRunState) { + toaster.error({ title: 'Error marking workflow run as DEPRECATED' }); + resetCreateWorkflowRunState(); + } + }, [isCreatedWorkflowRunState, resetCreateWorkflowRunState, isErrorCreatingWorkflowRunState]); + const librariesTableData = useMemo( () => workflowRunDetail && workflowRunDetail.libraries.length > 0 @@ -75,24 +174,165 @@ const WorkflowRunDetailsTable = () => { [] ); + const handleCloseRerunWorkflowDialog = () => { + setIsOpenRerunWorkflowDialog(false); + resetRerunWorkflow(); + setSelectedDataset(null); + setIsDeprecated(false); + }; + return ( -
-
- +
+ {/* title */} +
+ {isFetchingWorkflowRunDetail ? ( +
+ +
+ ) : ( +
{workflowRunDetail?.workflowRunName}
+ )} +
+ setIsOpenRerunWorkflowDialog(true), + disabled: isFetchingWorkflowRunRerunAllowedWorkflows, + }, + ]} + className='bg-magpie-light-50 hover:text-magpie-light-500' + type='square' + /> +
-
- + + {/* details */} +
+
+ +
+ + {/* libraries */} +
+
+ + + +
{workflowRunDetail?.workflowRunName || ''}
+ + {!workflowRunRerunValidateDetail?.isValid ? ( +
+
+ Warning: + This workflow is not allowed to rerun. +
+
+ Reason: + + Current workflow is not in the allowed workflows:{' '} + {workflowRunRerunValidateDetail?.validWorkflows.join(', ')} + +
+
+ ) : ( + <> +
+
+
+ Please select the dataset to rerun: +
+
+ {workflowRunRerunValidateDetail?.allowedDatasetChoice.map((dataset, idx) => ( + + ))} +
+ {!selectedDataset && ( +
Please select a dataset.
+ )} +
+
+
+ setIsDeprecated(!isDeprecated)} + disabled={ + !selectedDataset || workflowRunDetail?.workflow.workflowName !== 'RNASUM' + } + label="Mark the current run as 'DEPRECATED'." + /> + + {workflowRunDetail?.workflow.workflowName !== 'RNASUM' ? ( +
+ This feature is not available for RNASUM workflow. +
+ ) : ( +
+
+ This action will mark the current run as 'DEPRECATED', and is + irreversible. +
+
+ )} +
+
+
+ Are you sure you want to rerun this workflow? +
+ + )} + + } + onClose={handleCloseRerunWorkflowDialog} + closeBtn={{ + label: 'Close', + onClick: handleCloseRerunWorkflowDialog, + }} + confirmBtn={{ + label: 'Rerun', + onClick: handleRerunWorkflow, + disabled: + isFetchingWorkflowRunRerunAllowedWorkflows || + !workflowRunRerunValidateDetail?.isValid || + !selectedDataset, + }} + /> ); }; diff --git a/src/modules/runs/components/workflowRuns/WorkflowRunFilterHeader.tsx b/src/modules/runs/components/workflowRuns/WorkflowRunFilterHeader.tsx index 0f3dd5e..3cd83ec 100644 --- a/src/modules/runs/components/workflowRuns/WorkflowRunFilterHeader.tsx +++ b/src/modules/runs/components/workflowRuns/WorkflowRunFilterHeader.tsx @@ -126,6 +126,13 @@ const WorkflowRunFilterHeader = () => { setQueryParams({ workflowRunStatus: 'resolved' }); }, }, + { + label: 'Deprecated', + subLabel: '', + onClick: () => { + setQueryParams({ workflowRunStatus: 'deprecated' }); + }, + }, { label: 'Ongoing', subLabel: '', diff --git a/src/modules/runs/components/workflowRuns/WorkflowRunTable.tsx b/src/modules/runs/components/workflowRuns/WorkflowRunTable.tsx index 4af43aa..963ad77 100644 --- a/src/modules/runs/components/workflowRuns/WorkflowRunTable.tsx +++ b/src/modules/runs/components/workflowRuns/WorkflowRunTable.tsx @@ -25,7 +25,7 @@ const WorkflowRunTable = ({ libraryOrcabusId }: { libraryOrcabusId?: string }) = rowsPerPage: getPaginationParams().rowsPerPage || DEFAULT_PAGE_SIZE, search: getQueryParams().search || undefined, workflow__orcabus_id: getQueryParams().workflowTypeId || undefined, - status: ['succeeded', 'failed', 'aborted', 'resolved'].includes( + status: ['succeeded', 'failed', 'aborted', 'resolved', 'deprecated'].includes( getQueryParams().workflowRunStatus ) ? getQueryParams().workflowRunStatus diff --git a/src/modules/runs/components/workflowRuns/WorkflowRunTimeline.tsx b/src/modules/runs/components/workflowRuns/WorkflowRunTimeline.tsx index 8658fa1..5d8c7e6 100644 --- a/src/modules/runs/components/workflowRuns/WorkflowRunTimeline.tsx +++ b/src/modules/runs/components/workflowRuns/WorkflowRunTimeline.tsx @@ -11,16 +11,19 @@ import { useWorkflowRunCommentCreateModel, useWorkflowRunCommentUpdateModel, useWorkflowRunCommentDeleteModel, - useWorkflowRunResolvedStateCreateModel, - useWorkflowRunResolvedStateUpdateModel, + useWorkflowRunStateCreateModel, + useWorkflowRunStateUpdateModel, + useWorkflowRunStateValidMapModel, } from '@/api/workflow'; import { keepPreviousData } from '@tanstack/react-query'; import { - CheckCircleIcon, + PlusCircleIcon, + PlusIcon, ChatBubbleLeftRightIcon, ChatBubbleBottomCenterTextIcon, WrenchIcon, TrashIcon, + ArrowsUpDownIcon, } from '@heroicons/react/24/outline'; import toaster from '@/components/common/toaster'; import { Tooltip } from '@/components/common/tooltips'; @@ -32,11 +35,13 @@ import { getBadgeType, statusBackgroundColor } from '@/components/common/badges' import { dayjs } from '@/utils/dayjs'; import { classNames, getUsername } from '@/utils/commonUtils'; import { BackdropWithText } from '@/components/common/backdrop'; +import { useWorkflowRunContext } from './WorkflowRunContext'; +import { Button } from '@/components/common/buttons'; const WorkflowRunTimeline = () => { const { orcabusId } = useParams(); const { user } = useAuthContext(); - + const { refreshWorkflowRuns, setRefreshWorkflowRuns } = useWorkflowRunContext(); const [currentState, setCurrentState] = useState(null); const [selectedPayloadId, setSelectedPayloadId] = useState(null); const [selectedState, setSelectedState] = useState(null); @@ -46,10 +51,14 @@ const WorkflowRunTimeline = () => { const [isOpenDeleteCommentDialog, setIsOpenDeleteCommentDialog] = useState(false); const [commentId, setCommentId] = useState(null); const [comment, setComment] = useState(''); - const [isOpenAddResolvedDialog, setIsOpenAddResolvedDialog] = useState(false); - const [isOpenUpdateResolvedDialog, setIsOpenUpdateResolvedDialog] = useState(false); - const [resolvedId, setResolvedId] = useState(null); - const [resolvedComment, setResolvedComment] = useState(''); + + const [isReverseOrder, setIsReverseOrder] = useState(false); + + const [isOpenAddStateDialog, setIsOpenAddStateDialog] = useState(false); + const [stateStatus, setStateStatus] = useState(null); + const [isOpenUpdateStateDialog, setIsOpenUpdateStateDialog] = useState(false); + const [stateId, setStateId] = useState(null); + const [stateComment, setStateComment] = useState(''); const { data: workflowStateData, @@ -62,6 +71,13 @@ const WorkflowRunTimeline = () => { }, }); + useEffect(() => { + if (refreshWorkflowRuns) { + refetchWorkflowState(); + setRefreshWorkflowRuns(false); + } + }, [refreshWorkflowRuns, refetchWorkflowState, setRefreshWorkflowRuns]); + const { data: workflowCommentData, isFetching: isFetchingWorkflowComment, @@ -73,49 +89,63 @@ const WorkflowRunTimeline = () => { }, }); + const { data: workflowRunStateValidMapData } = useWorkflowRunStateValidMapModel({ + params: { path: { orcabusId: orcabusId?.split('.')[1] as string } }, + reactQuery: { + enabled: !!orcabusId, + }, + }); + const workflowLastState = workflowStateData?.[workflowStateData.length - 1]?.status; + // check if the last state is valid for state creation + const isValidCreateState = Object.entries(workflowRunStateValidMapData || {}).some(([, value]) => + (value as string[]).includes(workflowLastState || '') + ); + // find all valid state key who has vale of workflowLastState + const validState = Object.entries(workflowRunStateValidMapData || {}) + .filter(([, value]) => (value as string[]).includes(workflowLastState || '')) + .map(([key]) => key); + // format data and disply in the table const workflowStateTimelineData = useMemo( () => workflowStateData - ? workflowStateData - .map((state) => ({ - id: state.orcabusId, - content: ( -
-
Status Updated
- {state.status} - {state.status === 'RESOLVED' && ( -
- - { - setResolvedId(state.orcabusId); - setResolvedComment(state.comment || ''); - setIsOpenUpdateResolvedDialog(true); - }} - /> - -
- )} -
- ), - datetime: dayjs(state.timestamp).format('YYYY-MM-DD HH:mm'), - comment: state.comment || '', - status: state.status, - iconBackground: statusBackgroundColor(getBadgeType(state.status)), - payloadId: state?.payload || '', - eventType: 'stateChange' as const, - })) - .reverse() + ? workflowStateData.map((state) => ({ + id: state.orcabusId, + content: ( +
+
Status Updated
+ {state.status} + {Object.keys(workflowRunStateValidMapData || {}).includes(state.status) && ( +
+ + { + setStateId(state.orcabusId); + setStateComment(state.comment || ''); + setIsOpenUpdateStateDialog(true); + }} + /> + +
+ )} +
+ ), + datetime: dayjs(state.timestamp).format('YYYY-MM-DD HH:mm'), + comment: state.comment || '', + status: state.status, + iconBackground: statusBackgroundColor(getBadgeType(state.status)), + payloadId: state?.payload || '', + eventType: 'stateChange' as const, + })) : [], - [workflowStateData] + [workflowStateData, workflowRunStateValidMapData] ); const workflowCommentTimelineData = useMemo( () => @@ -222,40 +252,40 @@ const WorkflowRunTimeline = () => { ]); const { - mutate: createWorkflowRunResolvedState, - isSuccess: isCreatedWorkflowRunResolvedState, - isError: isErrorCreatingWorkflowRunResolvedState, - reset: resetCreateWorkflowRunResolvedState, - } = useWorkflowRunResolvedStateCreateModel({ + mutate: createWorkflowRunState, + isSuccess: isCreatedWorkflowRunState, + isError: isErrorCreatingWorkflowRunState, + reset: resetCreateWorkflowRunState, + } = useWorkflowRunStateCreateModel({ params: { path: { orcabusId: orcabusId?.split('.')[1] as string } }, body: { - status: 'RESOLVED', - comment: resolvedComment, + status: stateStatus, + comment: stateComment, createdBy: user?.email, }, }); - const handleResolvedEvent = () => { - createWorkflowRunResolvedState(); - setIsOpenAddResolvedDialog(false); + const handleStateCreationEvent = () => { + createWorkflowRunState(); + setIsOpenAddStateDialog(false); }; useEffect(() => { - if (isCreatedWorkflowRunResolvedState) { - toaster.success({ title: 'Resolved Status added' }); + if (isCreatedWorkflowRunState) { + toaster.success({ title: 'State added' }); refetchWorkflowState(); - resetCreateWorkflowRunResolvedState(); - setResolvedComment(''); + resetCreateWorkflowRunState(); + setStateComment(''); } - if (isErrorCreatingWorkflowRunResolvedState) { - toaster.error({ title: 'Error adding resolved status' }); - resetCreateWorkflowRunResolvedState(); + if (isErrorCreatingWorkflowRunState) { + toaster.error({ title: 'Error adding state status' }); + resetCreateWorkflowRunState(); } }, [ - isCreatedWorkflowRunResolvedState, + isCreatedWorkflowRunState, refetchWorkflowState, - resetCreateWorkflowRunResolvedState, - isErrorCreatingWorkflowRunResolvedState, + resetCreateWorkflowRunState, + isErrorCreatingWorkflowRunState, ]); const handleTimelineSelect = (event: TimelineEvent) => { @@ -352,44 +382,44 @@ const WorkflowRunTimeline = () => { ]); const { - mutate: updateWorkflowRunResolvedState, - isSuccess: isUpdatedWorkflowRunResolvedState, - isError: isErrorUpdatingWorkflowRunResolvedState, - reset: resetUpdateWorkflowRunResolvedState, - } = useWorkflowRunResolvedStateUpdateModel({ + mutate: updateWorkflowRunState, + isSuccess: isUpdatedWorkflowRunState, + isError: isErrorUpdatingWorkflowRunState, + reset: resetUpdateWorkflowRunState, + } = useWorkflowRunStateUpdateModel({ params: { path: { orcabusId: orcabusId?.split('.')[1] as string, - id: resolvedId?.split('.')[1] as string, + id: stateId?.split('.')[1] as string, }, }, body: { - comment: resolvedComment, + comment: stateComment, }, }); - const handleUpdateResolved = () => { - updateWorkflowRunResolvedState(); - setIsOpenUpdateResolvedDialog(false); + const handleUpdateState = () => { + updateWorkflowRunState(); + setIsOpenUpdateStateDialog(false); }; useEffect(() => { - if (isUpdatedWorkflowRunResolvedState) { - toaster.success({ title: 'Resolved Event updated successfully' }); + if (isUpdatedWorkflowRunState) { + toaster.success({ title: 'State updated successfully' }); refetchWorkflowState(); - resetUpdateWorkflowRunResolvedState(); - setResolvedComment(''); + resetUpdateWorkflowRunState(); + setStateComment(''); } - if (isErrorUpdatingWorkflowRunResolvedState) { - toaster.error({ title: 'Error updating resolved event' }); - resetUpdateWorkflowRunResolvedState(); + if (isErrorUpdatingWorkflowRunState) { + toaster.error({ title: 'Error updating state' }); + resetUpdateWorkflowRunState(); } }, [ - isUpdatedWorkflowRunResolvedState, + isUpdatedWorkflowRunState, refetchWorkflowState, - resetUpdateWorkflowRunResolvedState, - isErrorUpdatingWorkflowRunResolvedState, + resetUpdateWorkflowRunState, + isErrorUpdatingWorkflowRunState, ]); return ( @@ -399,39 +429,92 @@ const WorkflowRunTimeline = () => { )}
-
-
Timeline
- - +
+

Timeline

+
+ + {workflowRuntimelineData.length} events + + + +
+
+ +
+ + + {isValidCreateState && ( + + )} +
-
Comment
-