-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(orchestrator): set default workflow runs table size to 20 (#1127)
fix(orchestrator): increase default workflow runs table size from 5 to 10
- Loading branch information
Showing
4 changed files
with
86 additions
and
9 deletions.
There are no files selected for viewing
65 changes: 65 additions & 0 deletions
65
plugins/orchestrator/src/__fixtures__/fakeLongProcessInstanceList.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { | ||
ProcessInstance, | ||
ProcessInstanceState, | ||
WorkflowCategory, | ||
} from '@janus-idp/backstage-plugin-orchestrator-common'; | ||
|
||
import { fakeWorkflowOverviewList } from './fakeWorkflowOverviewList'; | ||
|
||
const createValuesGenerator = (counter: number, size: number) => { | ||
const baseDate = new Date('2024-02-01'); | ||
const DAY = 24 * 60 * 60 * 1000; // 24 hours in milliseconds | ||
const startDate = new Date(baseDate.getTime() - 30 * DAY); // 30 days ago | ||
const endDate = new Date(); | ||
|
||
const getNextEnumValue = (enumerator: object) => { | ||
const values = Object.values(enumerator); | ||
const index = counter % values.length; | ||
return values[index]; | ||
}; | ||
|
||
const getNextDate = (): Date => { | ||
const startMillis = startDate.getTime(); | ||
const endMillis = endDate.getTime(); | ||
const millis = | ||
startMillis + ((endMillis - startMillis) / size) * (counter % size); // Assuming 5 states | ||
return new Date(millis); | ||
}; | ||
|
||
return { | ||
getNextEnumValue, | ||
getNextDate, | ||
}; | ||
}; | ||
|
||
export const generateFakeProcessInstances = ( | ||
listSize: number, | ||
): ProcessInstance[] => { | ||
const instances: ProcessInstance[] = []; | ||
|
||
for (let i = 0; i < listSize; i++) { | ||
const valuesGenerator = createValuesGenerator(i, listSize); | ||
|
||
const randomState = valuesGenerator.getNextEnumValue(ProcessInstanceState); | ||
const randomCategory = valuesGenerator.getNextEnumValue(WorkflowCategory); | ||
|
||
instances.push({ | ||
id: `12f767c1-9002-43af-9515-62a72d0eaf${i}`, | ||
processId: | ||
fakeWorkflowOverviewList[i % fakeWorkflowOverviewList.length] | ||
.workflowId, | ||
state: randomState, | ||
endpoint: 'enpoint/foo', | ||
start: valuesGenerator.getNextDate(), | ||
lastUpdate: valuesGenerator.getNextDate(), | ||
nodes: [], | ||
variables: {}, | ||
isOpen: false, | ||
isSelected: false, | ||
category: randomCategory, | ||
description: `test description ${i}`, | ||
}); | ||
} | ||
|
||
return instances; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export const VALUE_UNAVAILABLE = '---' as const; | ||
export const SHORT_REFRESH_INTERVAL = 5000; | ||
export const LONG_REFRESH_INTERVAL = 15000; | ||
export const DEFAULT_TABLE_PAGE_SIZE = 20; |