diff --git a/litmus-portal/frontend/src/graphql/mutations/analytics.ts b/litmus-portal/frontend/src/graphql/mutations/analytics.ts index e779cf6da..dc2b7ad85 100644 --- a/litmus-portal/frontend/src/graphql/mutations/analytics.ts +++ b/litmus-portal/frontend/src/graphql/mutations/analytics.ts @@ -40,11 +40,8 @@ export const UPDATE_DATASOURCE = gql` `; export const DELETE_DATASOURCE = gql` - mutation deleteDataSource( - $projectID: String! - $deleteDSInput: deleteDSInput! - ) { - deleteDataSource(projectID: $projectID, input: $deleteDSInput) + mutation deleteDataSource($projectID: String!, $input: DeleteDSInput!) { + deleteDataSource(projectID: $projectID, input: $input) } `; diff --git a/litmus-portal/frontend/src/graphql/mutations/workflows.ts b/litmus-portal/frontend/src/graphql/mutations/workflows.ts index f31947aaf..4e5265990 100644 --- a/litmus-portal/frontend/src/graphql/mutations/workflows.ts +++ b/litmus-portal/frontend/src/graphql/mutations/workflows.ts @@ -32,12 +32,12 @@ export const RERUN_CHAOS_WORKFLOW = gql` `; export const SYNC_WORKFLOW = gql` - mutation syncWorkflow( + mutation syncWorkflowRun( $projectID: String! $workflowID: String! $workflowRunID: String! ) { - syncWorkflow( + syncWorkflowRun( projectID: $projectID workflowID: $workflowID workflowRunID: $workflowRunID diff --git a/litmus-portal/frontend/src/models/graphql/dataSourceDetails.ts b/litmus-portal/frontend/src/models/graphql/dataSourceDetails.ts index cae314538..a16ae580a 100644 --- a/litmus-portal/frontend/src/models/graphql/dataSourceDetails.ts +++ b/litmus-portal/frontend/src/models/graphql/dataSourceDetails.ts @@ -40,7 +40,7 @@ export interface deleteDSInput { export interface DeleteDataSourceInput { projectID: string; - deleteDSInput: deleteDSInput; + input: deleteDSInput; } export interface ListDataSourceVars { projectID: string; diff --git a/litmus-portal/frontend/src/pages/EditSchedule/index.tsx b/litmus-portal/frontend/src/pages/EditSchedule/index.tsx index 7d7884da8..8387a44a6 100644 --- a/litmus-portal/frontend/src/pages/EditSchedule/index.tsx +++ b/litmus-portal/frontend/src/pages/EditSchedule/index.tsx @@ -137,7 +137,7 @@ const EditSchedule: React.FC = () => { const yamlJson = JSON.stringify(yml, null, 2); // Converted to Stringified JSON const chaosWorkFlowInputs = { - workflow_id: wfDetails?.workflowID, + workflowID: wfDetails?.workflowID, workflowManifest: yamlJson, cronSyntax, workflowName: fetchWorkflowNameFromManifest(manifest), diff --git a/litmus-portal/frontend/src/pages/WorkflowInfoStats/WorkflowRunTable/index.tsx b/litmus-portal/frontend/src/pages/WorkflowInfoStats/WorkflowRunTable/index.tsx index 689147cd0..c3d102f50 100644 --- a/litmus-portal/frontend/src/pages/WorkflowInfoStats/WorkflowRunTable/index.tsx +++ b/litmus-portal/frontend/src/pages/WorkflowInfoStats/WorkflowRunTable/index.tsx @@ -168,7 +168,7 @@ const WorkflowRunTable: React.FC = ({ const workflowTestsArray: WorkFlowTests[] = []; if (data?.listWorkflowRuns?.workflowRuns) { const executionData: ExecutionData = JSON.parse( - data.listWorkflowRuns.workflowRuns[0].executionData + data.listWorkflowRuns.workflowRuns[0]?.executionData ); const { nodes } = executionData; let index: number = 1; diff --git a/litmus-portal/frontend/src/utils/yamlUtils.ts b/litmus-portal/frontend/src/utils/yamlUtils.ts index 6da18d716..7e507cf9e 100644 --- a/litmus-portal/frontend/src/utils/yamlUtils.ts +++ b/litmus-portal/frontend/src/utils/yamlUtils.ts @@ -224,10 +224,32 @@ const parsed = (yaml: string) => { } }; +export const extractEngineNames = (manifest: string) => { + const engineNames: string[] = []; + const parsedManifest = YAML.parse(manifest); + if (parsedManifest.spec !== undefined) { + const yamlData = + parsedManifest.kind === constants.workflow + ? parsedManifest.spec + : parsedManifest.spec.workflowSpec; + yamlData.templates?.forEach((template: any) => { + template?.inputs?.artifacts?.forEach((artifact: any) => { + if (artifact?.raw?.data) { + const artifactManifest = YAML.parse(artifact.raw.data); + if (artifactManifest.kind === 'ChaosEngine') { + engineNames.push(artifactManifest.metadata.generateName); + } + } + }); + }); + } + return engineNames; +}; + export const addWeights = (manifest: string) => { const arr: experimentMap[] = []; const hashMap = new Map(); - const tests = parsed(manifest); + const tests = extractEngineNames(manifest); if (tests.length) { tests.forEach((test) => { let value = 10; @@ -446,7 +468,7 @@ export const validateExperimentNames = (manifest: any): boolean => { manifest.kind === constants.workflow ? manifest.spec : manifest.spec.workflowSpec; - yamlData.templates[0].steps.forEach((step: any) => { + yamlData.templates[0]?.steps?.forEach((step: any) => { step.forEach((values: any) => { // if exp name exists append the count if (value[`${values.name}`]) { @@ -472,25 +494,3 @@ export const validateExperimentNames = (manifest: any): boolean => { } return true; }; - -export const extractEngineNames = (manifest: string) => { - const engineNames: string[] = []; - const parsedManifest = YAML.parse(manifest); - if (parsedManifest.spec !== undefined) { - const yamlData = - parsedManifest.kind === constants.workflow - ? parsedManifest.spec - : parsedManifest.spec.workflowSpec; - yamlData.templates.forEach((template: any) => { - template?.inputs?.artifacts.forEach((artifact: any) => { - if (artifact?.raw?.data) { - const artifactManifest = YAML.parse(artifact.raw.data); - if (artifactManifest.kind === 'ChaosEngine') { - engineNames.push(artifactManifest.metadata.generateName); - } - } - }); - }); - } - return engineNames; -}; diff --git a/litmus-portal/frontend/src/views/ChaosWorkflows/Runs/TableData.tsx b/litmus-portal/frontend/src/views/ChaosWorkflows/Runs/TableData.tsx index 16b1f35de..90855a77f 100644 --- a/litmus-portal/frontend/src/views/ChaosWorkflows/Runs/TableData.tsx +++ b/litmus-portal/frontend/src/views/ChaosWorkflows/Runs/TableData.tsx @@ -115,7 +115,7 @@ const TableData: React.FC = ({ data, refetchQuery }) => { */ const [syncWorkflow] = useMutation(SYNC_WORKFLOW, { onCompleted: (data) => { - if (data?.syncWorkflow) { + if (data?.syncWorkflowRun) { handleWarningPopOverClose(); refetchQuery(); } diff --git a/litmus-portal/frontend/src/views/CreateWorkflow/ChooseWorkflow/ChooseWorkflowFromExisting.tsx b/litmus-portal/frontend/src/views/CreateWorkflow/ChooseWorkflow/ChooseWorkflowFromExisting.tsx index 83a900eb2..26286227e 100644 --- a/litmus-portal/frontend/src/views/CreateWorkflow/ChooseWorkflow/ChooseWorkflowFromExisting.tsx +++ b/litmus-portal/frontend/src/views/CreateWorkflow/ChooseWorkflow/ChooseWorkflowFromExisting.tsx @@ -152,7 +152,7 @@ const ChooseWorkflowFromExisting: React.FC = ({ deleteTemplate({ variables: { projectID: getProjectID(), - data: templateData.templateID, + templateID: templateData.templateID, }, }); }} diff --git a/litmus-portal/frontend/src/views/Observability/DataSources/Table/TableData.tsx b/litmus-portal/frontend/src/views/Observability/DataSources/Table/TableData.tsx index e52faa6b9..744bc5c6a 100644 --- a/litmus-portal/frontend/src/views/Observability/DataSources/Table/TableData.tsx +++ b/litmus-portal/frontend/src/views/Observability/DataSources/Table/TableData.tsx @@ -85,7 +85,7 @@ const TableData: React.FC = ({ deleteDataSource({ variables: { projectID: getProjectID(), - deleteDSInput: { + input: { dsID: data.dsID, forceDelete: false, }, diff --git a/litmus-portal/frontend/src/views/Observability/DataSources/Table/index.tsx b/litmus-portal/frontend/src/views/Observability/DataSources/Table/index.tsx index 7120857b4..ee4896791 100644 --- a/litmus-portal/frontend/src/views/Observability/DataSources/Table/index.tsx +++ b/litmus-portal/frontend/src/views/Observability/DataSources/Table/index.tsx @@ -492,7 +492,7 @@ const DataSourceTable: React.FC = () => { deleteDataSource({ variables: { projectID: getProjectID(), - deleteDSInput: { + input: { dsID: forceDeleteVars.dsID, forceDelete: true, }, diff --git a/mkdocs/docs/graphql/v2.9.0/api.html b/mkdocs/docs/graphql/v2.9.0/api.html index a50f613d6..d5cb2d3f3 100644 --- a/mkdocs/docs/graphql/v2.9.0/api.html +++ b/mkdocs/docs/graphql/v2.9.0/api.html @@ -47,19 +47,25 @@ Create Chaos Workflow
  • - List ChaosWorkflow Runs + List Chaos Workflow Runs
  • List Chaos Workflow
  • - Re Run Chaos Workflow + Re-run Chaos Workflow
  • - Update ChaosWorkflow + Update Chaos Workflow
  • - Delete ChaosWorkflow + Delete Chaos Workflow +
  • +
  • + Sync Chaos Workflow +
  • +
  • + Terminate Chaos Workflow
  • Save Template @@ -192,6 +198,13 @@
  • +
    + Authentication +
    Schema Definitions
    ActionPayload AgentStat @@ -331,7 +344,7 @@
    -

    ChaosCenter provides console and UI experience for creating, scheduling, and monitoring chaos workflows.. Chaos workflows consist of a sequence of experiments run together to achieve the objective of introducing some kind of fault into an application.

    +

    ChaosCenter provides console and UI experience for creating, scheduling, and monitoring chaos workflows. Chaos workflows consist of a sequence of experiments run together to achieve the objective of introducing some kind of fault into an application.

    @@ -1314,7 +1327,7 @@ http://localhost:8080/query
    -
    +
    @@ -1324,7 +1337,7 @@ http://localhost:8080/query

    - List ChaosWorkflow Runs + List Chaos Workflow Runs

    @@ -1674,7 +1687,7 @@ http://localhost:8080/query
    -
    +
    @@ -1684,7 +1697,7 @@ http://localhost:8080/query

    - Re Run Chaos Workflow + Re-run Chaos Workflow

    @@ -1818,7 +1831,7 @@ http://localhost:8080/query
    -
    +
    @@ -1828,7 +1841,7 @@ http://localhost:8080/query

    - Update ChaosWorkflow + Update Chaos Workflow

    @@ -2006,7 +2019,7 @@ http://localhost:8080/query
    -
    +
    @@ -2016,7 +2029,7 @@ http://localhost:8080/query

    - Delete ChaosWorkflow + Delete Chaos Workflow

    @@ -2161,6 +2174,328 @@ http://localhost:8080/query "deleteChaosWorkflow": "boolean" } } + + + + +
    +
    +
    +
    + + + + + +

    + Sync Chaos Workflow +

    +
    +
    +
    +

    This API is used to sync a Chaos Workflow with the connected agent.

    + + + + + + + + + + + + + + + + + + + + + +
    FieldPossible valuesMandatory/Optional
    projectID-Mandatory
    workflowID-Mandatory
    workflowRunID-Mandatory
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    projectID: + +
    string
    + +
    +
    +
    +
    +

    (no description)

    +
    +
    +
    +
    +
    workflowID: + +
    string
    + +
    +
    +
    +
    +

    (no description)

    +
    +
    +
    +
    +
    workflowRunID: + +
    string
    + +
    +
    +
    +
    +

    (no description)

    +
    +
    +
    +
    +
    +
    +

    Example

    +
    Request Content-Types: + application/json +
    +
    Query
    + + + +
    mutation syncWorkflowRun($projectID: String!, $workflowID: String!, $workflowRunID: String!){
    +  syncWorkflowRun(projectID: $projectID, workflowID: $workflowID, workflowRunID: $workflowRunID)
    +}
    +
    + + +
    Variables
    + + + +
    {
    +  "projectID": "string",
    +  "workflowID": "string",
    +  "workflowRunID": "string"
    +}
    +
    + + + Try it now +
    +
    +
    +
    +
    +
    +
    +
    +
    200 OK
    +
    +
    +

    Successful operation

    +
    +
    +
    +
    type
    +
    +
    boolean
    + +
    +
    +
    +
    +
    +
    Response Content-Types: + application/json +
    +
    +
    Response Example + (200 OK) +
    + + + +
    {
    +  "data": {
    +    "syncWorkflowRun": "boolean"
    +  }
    +}
    +
    + + +
    +
    +
    +
    +
    + + + + + +

    + Terminate Chaos Workflow +

    +
    +
    +
    +

    This API is used to terminate a running Chaos Workflow.

    + + + + + + + + + + + + + + + + + + + + + +
    FieldPossible valuesMandatory/Optional
    projectID-Mandatory
    workflowID-Mandatory
    workflowRunID-Mandatory
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    projectID: + +
    string
    + +
    +
    +
    +
    +

    (no description)

    +
    +
    +
    +
    +
    workflowID: + +
    string
    + +
    +
    +
    +
    +

    (no description)

    +
    +
    +
    +
    +
    workflowRunID: + +
    string
    + +
    +
    +
    +
    +

    (no description)

    +
    +
    +
    +
    +
    +
    +

    Example

    +
    Request Content-Types: + application/json +
    +
    Query
    + + + +
    mutation terminateChaosWorkflow($projectID: String!, $workflowID: String, $workflowRunID: String){
    +  terminateChaosWorkflow(projectID: $projectID, workflowID: $workflowID, workflowRunID: $workflowRunID)
    +}
    +
    + + +
    Variables
    + + + +
    {
    +  "projectID": "string",
    +  "workflowID": "string",
    +  "workflowRunID": "string"
    +}
    +
    + + + Try it now +
    +
    +
    +
    +
    +
    +
    +
    +
    200 OK
    +
    +
    +

    Successful operation

    +
    +
    +
    +
    type
    +
    +
    boolean
    + +
    +
    +
    +
    +
    +
    Response Content-Types: + application/json +
    +
    +
    Response Example + (200 OK) +
    + + + +
    {
    +  "data": {
    +    "terminateChaosWorkflow": "boolean"
    +  }
    +}
     
    diff --git a/mkdocs/docs/graphql/v2.9.0/config.yml b/mkdocs/docs/graphql/v2.9.0/config.yml index 67dfaf2ff..4ccef64e4 100644 --- a/mkdocs/docs/graphql/v2.9.0/config.yml +++ b/mkdocs/docs/graphql/v2.9.0/config.yml @@ -9,7 +9,7 @@ servers: info: title: ChaosCenter API Documentation description: | - ChaosCenter provides console and UI experience for creating, scheduling, and monitoring chaos workflows.. Chaos workflows consist of a sequence of experiments run together to achieve the objective of introducing some kind of fault into an application. + ChaosCenter provides console and UI experience for creating, scheduling, and monitoring chaos workflows. Chaos workflows consist of a sequence of experiments run together to achieve the objective of introducing some kind of fault into an application. domains: - name: Agents description: | @@ -216,7 +216,7 @@ domains: - - name: List ChaosWorkflow Runs + - name: List Chaos Workflow Runs query: query.listWorkflowRuns description: | This API returns a list of Chaos Workflows and their runs. This API can fetch both cron and non-cron workflow present in the ChaosCenter. false
    @@ -294,7 +294,7 @@ domains: Optional - - name: Re Run Chaos Workflow + - name: Re-run Chaos Workflow query: mutation.reRunChaosWorkFlow description: | This API is used to re-run a particular chaos workflow on the basis of workflowID @@ -315,7 +315,7 @@ domains: Mandatory - - name: Update ChaosWorkflow + - name: Update Chaos Workflow query: mutation.updateChaosWorkflow description: | Update the specified chaos workflow by setting the values of the parameters passed. @@ -361,7 +361,7 @@ domains: Mandatory - - name: Delete ChaosWorkflow + - name: Delete Chaos Workflow query: mutation.deleteChaosWorkflow description: | Delete chaos workflow will permanently delete scheduled workflow from the cluster. It cannot be undone. @@ -388,6 +388,58 @@ domains: Mandatory + - name: Sync Chaos Workflow + query: mutation.syncWorkflowRun + description: | + This API is used to sync a Chaos Workflow with the connected agent. + + + + + + + + + + + + + + + + + + + + + +
    FieldPossible valuesMandatory/Optional
    projectID-Mandatory
    workflowID-Mandatory
    workflowRunID-Mandatory
    + - name: Terminate Chaos Workflow + query: mutation.terminateChaosWorkflow + description: | + This API is used to terminate a running Chaos Workflow. + + + + + + + + + + + + + + + + + + + + + +
    FieldPossible valuesMandatory/Optional
    projectID-Mandatory
    workflowID-Mandatory
    workflowRunID-Mandatory
    - name: Save Template query: mutation.createWorkflowTemplate description: |