mirror of
https://github.com/status-im/spiff-arena.git
synced 2025-01-16 21:24:19 +00:00
removed the format header method from frontend so we only use the columns that come from the metadata now w/ burnettk
This commit is contained in:
parent
a779fcd97b
commit
4832256fc5
@ -100,7 +100,7 @@ class ProcessInstanceReportService:
|
|||||||
{"Header": "Waiting For", "accessor": "waiting_for", "filterable": False},
|
{"Header": "Waiting For", "accessor": "waiting_for", "filterable": False},
|
||||||
{"Header": "Started", "accessor": "start_in_seconds", "filterable": False},
|
{"Header": "Started", "accessor": "start_in_seconds", "filterable": False},
|
||||||
{"Header": "Last Updated", "accessor": "task_updated_at_in_seconds", "filterable": False},
|
{"Header": "Last Updated", "accessor": "task_updated_at_in_seconds", "filterable": False},
|
||||||
{"Header": "status", "accessor": "status", "filterable": False},
|
{"Header": "Status", "accessor": "status", "filterable": False},
|
||||||
],
|
],
|
||||||
"filter_by": [
|
"filter_by": [
|
||||||
{"field_name": "initiated_by_me", "field_value": True, "operator": "equals"},
|
{"field_name": "initiated_by_me", "field_value": True, "operator": "equals"},
|
||||||
|
@ -138,7 +138,9 @@ export default function ProcessInstanceListTable({
|
|||||||
);
|
);
|
||||||
const canSearchUsers: boolean = ability.can('GET', targetUris.userSearch);
|
const canSearchUsers: boolean = ability.can('GET', targetUris.userSearch);
|
||||||
|
|
||||||
const [processInstances, setProcessInstances] = useState([]);
|
const [processInstances, setProcessInstances] = useState<ProcessInstance[]>(
|
||||||
|
[]
|
||||||
|
);
|
||||||
const [reportMetadata, setReportMetadata] = useState<ReportMetadata | null>();
|
const [reportMetadata, setReportMetadata] = useState<ReportMetadata | null>();
|
||||||
const [pagination, setPagination] = useState<PaginationObject | null>(null);
|
const [pagination, setPagination] = useState<PaginationObject | null>(null);
|
||||||
|
|
||||||
@ -1509,7 +1511,7 @@ export default function ProcessInstanceListTable({
|
|||||||
return value;
|
return value;
|
||||||
};
|
};
|
||||||
|
|
||||||
const formattedColumn = (row: any, column: any) => {
|
const formattedColumn = (row: ProcessInstance, column: ReportColumn) => {
|
||||||
const reportColumnFormatters: Record<string, any> = {
|
const reportColumnFormatters: Record<string, any> = {
|
||||||
id: formatProcessInstanceId,
|
id: formatProcessInstanceId,
|
||||||
process_model_identifier: formatProcessModelIdentifier,
|
process_model_identifier: formatProcessModelIdentifier,
|
||||||
@ -1520,40 +1522,41 @@ export default function ProcessInstanceListTable({
|
|||||||
updated_at_in_seconds: formatSecondsForDisplay,
|
updated_at_in_seconds: formatSecondsForDisplay,
|
||||||
task_updated_at_in_seconds: formatSecondsForDisplay,
|
task_updated_at_in_seconds: formatSecondsForDisplay,
|
||||||
};
|
};
|
||||||
|
const columnAccessor = column.accessor as keyof ProcessInstance;
|
||||||
const formatter =
|
const formatter =
|
||||||
reportColumnFormatters[column.accessor] ?? defaultFormatter;
|
reportColumnFormatters[columnAccessor] ?? defaultFormatter;
|
||||||
const value = row[column.accessor];
|
const value = row[columnAccessor];
|
||||||
|
|
||||||
if (column.accessor === 'status') {
|
if (columnAccessor === 'status') {
|
||||||
return (
|
return (
|
||||||
<td data-qa={`process-instance-status-${value}`}>
|
<td data-qa={`process-instance-status-${value}`}>
|
||||||
{formatter(row, value)}
|
{formatter(row, value)}
|
||||||
</td>
|
</td>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (column.accessor === 'process_model_display_name') {
|
if (columnAccessor === 'process_model_display_name') {
|
||||||
return <td> {formatter(row, value)} </td>;
|
return <td> {formatter(row, value)} </td>;
|
||||||
}
|
}
|
||||||
if (column.accessor === 'waiting_for') {
|
if (columnAccessor === 'waiting_for') {
|
||||||
return <td> {getWaitingForTableCellComponent(row)} </td>;
|
return <td> {getWaitingForTableCellComponent(row)} </td>;
|
||||||
}
|
}
|
||||||
if (column.accessor === 'updated_at_in_seconds') {
|
if (columnAccessor === 'updated_at_in_seconds') {
|
||||||
return (
|
return (
|
||||||
<TableCellWithTimeAgoInWords
|
<TableCellWithTimeAgoInWords
|
||||||
timeInSeconds={row.updated_at_in_seconds}
|
timeInSeconds={row.updated_at_in_seconds}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (column.accessor === 'task_updated_at_in_seconds') {
|
if (columnAccessor === 'task_updated_at_in_seconds') {
|
||||||
return (
|
return (
|
||||||
<TableCellWithTimeAgoInWords
|
<TableCellWithTimeAgoInWords
|
||||||
timeInSeconds={row.task_updated_at_in_seconds}
|
timeInSeconds={row.task_updated_at_in_seconds || 0}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
||||||
<td data-qa={`process-instance-show-link-${column.accessor}`}>
|
<td data-qa={`process-instance-show-link-${columnAccessor}`}>
|
||||||
{formatter(row, value)}
|
{formatter(row, value)}
|
||||||
</td>
|
</td>
|
||||||
);
|
);
|
||||||
@ -1561,27 +1564,15 @@ export default function ProcessInstanceListTable({
|
|||||||
|
|
||||||
// eslint-disable-next-line sonarjs/cognitive-complexity
|
// eslint-disable-next-line sonarjs/cognitive-complexity
|
||||||
const buildTable = () => {
|
const buildTable = () => {
|
||||||
const headerLabels: Record<string, string> = {
|
const headers = reportColumns().map((column: ReportColumn) => {
|
||||||
id: 'Id',
|
return column.Header;
|
||||||
process_model_identifier: 'Process',
|
|
||||||
process_model_display_name: 'Process',
|
|
||||||
start_in_seconds: 'Start Time',
|
|
||||||
end_in_seconds: 'End Time',
|
|
||||||
status: 'Status',
|
|
||||||
process_initiator_username: 'Started By',
|
|
||||||
};
|
|
||||||
const getHeaderLabel = (header: string) => {
|
|
||||||
return headerLabels[header] ?? header;
|
|
||||||
};
|
|
||||||
const headers = reportColumns().map((column: any) => {
|
|
||||||
return getHeaderLabel((column as any).Header);
|
|
||||||
});
|
});
|
||||||
if (showActionsColumn) {
|
if (showActionsColumn) {
|
||||||
headers.push('Action');
|
headers.push('Action');
|
||||||
}
|
}
|
||||||
|
|
||||||
const rows = processInstances.map((row: any) => {
|
const rows = processInstances.map((row: ProcessInstance) => {
|
||||||
const currentRow = reportColumns().map((column: any) => {
|
const currentRow = reportColumns().map((column: ReportColumn) => {
|
||||||
return formattedColumn(row, column);
|
return formattedColumn(row, column);
|
||||||
});
|
});
|
||||||
if (showActionsColumn) {
|
if (showActionsColumn) {
|
||||||
|
@ -143,6 +143,12 @@ export interface ProcessInstance {
|
|||||||
bpmn_version_control_type: string;
|
bpmn_version_control_type: string;
|
||||||
process_metadata?: ProcessInstanceMetadata[];
|
process_metadata?: ProcessInstanceMetadata[];
|
||||||
process_model_with_diagram_identifier?: string;
|
process_model_with_diagram_identifier?: string;
|
||||||
|
|
||||||
|
// from tasks
|
||||||
|
potential_owner_usernames?: string;
|
||||||
|
task_id?: string;
|
||||||
|
task_updated_at_in_seconds?: number;
|
||||||
|
waiting_for?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MessageCorrelationProperties {
|
export interface MessageCorrelationProperties {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user