Skip to content

Commit

Permalink
fixup! Composer webserver patch
Browse files Browse the repository at this point in the history
Cherry-picked changes from community:
apache/airflow#25950

Change-Id: I52828169824a24995773c8b27ace2003d2534e58
GitOrigin-RevId: 9ded1a989e6613ec5fce485e98b78d057724f5a0
  • Loading branch information
Cloud Composer Team committed Jan 30, 2023
1 parent 8690cfc commit d118609
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions airflow/www/static/js/grid/api/useGridData.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,24 @@ describe('Test areActiveRuns()', () => {
expect(result).toBe(false);
});

[
{ runType: 'manual', state: 'queued', result: true },
{ runType: 'manual', state: 'running', result: true },
{ runType: 'scheduled', state: 'queued', result: true },
{ runType: 'scheduled', state: 'running', result: true },
{ runType: 'backfill', state: 'queued', result: false },
{ runType: 'backfill', state: 'running', result: false },
].forEach((conf) => {
test(`Returns ${conf.result} when filtering runs with runtype ["${conf.runType}"] and state ["${conf.state}"]`, () => {
const runConf = { ...conf };
delete runConf.result;
const runs = [runConf];

const result = areActiveRuns(runs);
expect(result).toBe(conf.result);
});
});

test('Returns false when there are no runs', () => {
const result = areActiveRuns();
expect(result).toBe(false);
Expand Down
2 changes: 1 addition & 1 deletion airflow/www/static/js/grid/api/useGridData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const emptyGridData: GridData = {
},
};

export const areActiveRuns = (runs: DagRun[] = []) => runs.filter((run) => ['manual', 'manual'].includes(run.runType)).filter((run) => ['queued', 'running', 'scheduled'].includes(run.state)).length > 0;
export const areActiveRuns = (runs: DagRun[] = []) => runs.filter((run) => ['manual', 'scheduled'].includes(run.runType)).filter((run) => ['queued', 'running', 'scheduled'].includes(run.state)).length > 0;

const useGridData = () => {
const { isRefreshOn, stopRefresh } = useAutoRefresh();
Expand Down

0 comments on commit d118609

Please sign in to comment.