Skip to content

Commit

Permalink
fix batch operation query bug (#1840)
Browse files Browse the repository at this point in the history
* fix batch operation query bug

* add integration test

* remove uncecessary step
  • Loading branch information
rossedfort committed Jan 31, 2024
1 parent 563937c commit 0c30139
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 11 deletions.
13 changes: 2 additions & 11 deletions src/lib/pages/workflows-with-new-search.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,13 @@
import { toListWorkflowFilters } from '$lib/utilities/query/to-list-workflow-filters';
$: query = $page.url.searchParams.get('query');
$: query && ($workflowsQuery = query);
$: query, ($workflowsQuery = query);
$: batchOperationQuery = $workflowsQuery ?? 'ExecutionStatus="Running"';
// For returning to page from 'Back to Workflows' with previous search
$: searchParams = $page.url.searchParams.toString();
$: searchParams, ($workflowsSearchParams = searchParams);
$: {
if (!$workflowFilters.length) {
$workflowsQuery = '';
}
}
onMount(() => {
$lastUsedNamespace = $page.params.namespace;
if (query) {
Expand Down Expand Up @@ -158,10 +153,6 @@
}
};
$: batchOperationQuery = !$workflowsQuery
? 'ExecutionStatus="Running"'
: $workflowsQuery;
$: {
if ($updating) {
resetSelection();
Expand Down
34 changes: 34 additions & 0 deletions tests/integration/workflow-bulk-actions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,39 @@ test.describe('Batch and Bulk Workflow Actions', () => {
.click();
await expect(page.locator('#batch-cancel-success-toast')).toBeVisible();
});

test('works when visiting a URL directly that has an existing query in it', async ({
page,
}) => {
await page.goto(
'/namespaces/default/workflows?query=WorkflowId%3D"test"',
);

await waitForWorkflowsApis(page);

await page.getByTestId('batch-actions-checkbox').click();
await page.getByTestId('select-all-workflows').click();
await page.getByTestId('bulk-cancel-button').click();

const cancelQueryValue = await page
.getByTestId('batch-Cancel-confirmation')
.getByTestId('batch-action-workflows-query')
.innerText();

expect(cancelQueryValue).toBe('WorkflowId="test"');

await page
.getByTestId('batch-Cancel-confirmation')
.getByLabel('Cancel')
.click();
await page.getByTestId('bulk-terminate-button').click();

const terminateQueryValue = await page
.getByTestId('batch-Terminate-confirmation')
.getByTestId('batch-action-workflows-query')
.innerText();

expect(terminateQueryValue).toBe('WorkflowId="test"');
});
});
});

0 comments on commit 0c30139

Please sign in to comment.