Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/common/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -629,8 +629,9 @@
"system-status.job-details.header.producerName": "Producer Name",

"system-status.export-details.link.label": "Link to files",
"system-status.export-details.description.text": "Job Description: {desc}",
"system-status.export-details.description.label": "Description: ",
"system-status.export-details.no-description.text": "None",
"system-status.export-details.expirationDate": "Expiration Date",

"system-status.job-priority-lowest": "Lowest",
"system-status.job-priority-low": "Low",
Expand Down
1 change: 1 addition & 0 deletions src/common/i18n/he.json
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,7 @@
"system-status.export-details.link.label": "לינק לקבצים",
"system-status.export-details.description.label": "תיאור משימה: ",
"system-status.export-details.no-description.text": "ללא",
"system-status.export-details.expirationDate": "תאריך תפוגה",

"system-status.task.fields.type.label": "מטלה",
"system-status.task.fields.status.label": "סטטוס",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import { DateCellRenderer } from '../../system-status/cell-renderer/date.cell-renderer';
import { TooltippedCellRenderer } from '../../system-status/cell-renderer/tool-tipped.cell-renderer';
import PlaceholderCellRenderer from '../../system-status/cell-renderer/placeholder.cell-renderer';
import moment from 'moment';

Check warning on line 24 in src/discrete-layer/components/job-manager/grids/job-manager-grid.common.tsx

View workflow job for this annotation

GitHub Actions / build_and_test (ubuntu-latest, 16.13.x)

'moment' is defined but never used
import { Loading } from '../../../../common/components/tree/statuses/loading';

export interface ICommonJobManagerGridProps {
Expand Down Expand Up @@ -195,52 +195,52 @@
comparator: (valueA, valueB, nodeA, nodeB, isInverted): number =>
valueA - valueB,
},
{
headerName: intl.formatMessage({
id: 'system-status.job.fields.expirationDate.label',
}),
width: 160,
field: 'parameters.cleanupData.cleanupExpirationTime',
sortable: true,
cellRenderer: 'dateCellRenderer',
cellRendererParams: {
field: 'parameters.cleanupData.cleanupExpirationTime',
comingSoonDaysIndication: 10,
shouldShowPredicate: (data: JobModelType): boolean => {
return (data.type as string).toLowerCase().includes('export');
},
onChange: (
updatedExpirationDate: Date,
jobData: JobModelType
): void => {
const { id, productType } = jobData;
const updateTaskDomain = getProductDomain(
productType as ProductType,
enumsMap ?? undefined
);
// {
// headerName: intl.formatMessage({
// id: 'system-status.job.fields.expirationDate.label',
// }),
// width: 160,
// field: 'expirationDate',
// sortable: true,
// cellRenderer: 'dateCellRenderer',
// cellRendererParams: {
// field: 'expirationDate',
// comingSoonDaysIndication: 10,
// shouldShowPredicate: (data: JobModelType): boolean => {
// return (data.type as string).toLowerCase().includes('export');
// },
// onChange: (
// updatedExpirationDate: Date,
// jobData: JobModelType
// ): void => {
// const { id, productType } = jobData;
// const updateTaskDomain = getProductDomain(
// productType as ProductType,
// enumsMap ?? undefined
// );

updateJobCB({
id,
domain: updateTaskDomain,
data: {
parameters: {
cleanupData: {
cleanupExpirationTime: updatedExpirationDate
}
},
},
});
},
datePickerProps: {
disablePast: true,
disableFuture: false,
minDate: moment().add(1,'day').toDate(),
}
},
// @ts-ignore
comparator: (valueA, valueB, nodeA, nodeB, isInverted): number =>
valueA - valueB,
},
// updateJobCB({
// id,
// domain: updateTaskDomain,
// data: {
// parameters: {
// cleanupData: {
// cleanupExpirationTime: updatedExpirationDate
// }
// },
// },
// });
// },
// datePickerProps: {
// disablePast: true,
// disableFuture: false,
// minDate: moment().add(1,'day').toDate(),
// }
// },
// // @ts-ignore
// comparator: (valueA, valueB, nodeA, nodeB, isInverted): number =>
// valueA - valueB,
// },
{
headerName: intl.formatMessage({
id: 'system-status.job.fields.status.label',
Expand Down
1 change: 1 addition & 0 deletions src/discrete-layer/components/job-manager/jobs.dialog.css
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ body[dir='rtl'] #jobsDialog .closeIcon {
}

#jobsDialog .refreshContainer .refreshSecs {
cursor: pointer;
position: relative;
text-align: center;
font-size: 8px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,15 +171,36 @@ const TasksRenderer: React.FC<TasksRendererParams> = observer(({ jobId, productT
);
});

export const JobDetailsRenderer: React.FC<ICellRendererParams> = (props) => {
const jobId = (props.data as JobModelType).id;
export const JobDetailsRenderer: React.FC<ICellRendererParams> = observer((props) => {
const [propsWithJobParams, setPropsWithJobParams] = useState(props);

const jobId = (props.data as JobModelType).id.replace(DETAILS_ROW_ID_SUFFIX, '');

const { data } = useQuery(
(store) =>
store.queryJob({
id: jobId,
})
);

useEffect(() => {
if (!data?.job) return;

setPropsWithJobParams(prev => ({
...prev,
data: {
...props.data,
parameters: data.job?.parameters
},
}));
}, [data]);

const keyPrefix = `${(props.data as JobModelType).resourceId as string}`;

return (
<Box className="jobDetailsContainer">
<JobDetailsHeader job={props.data as JobModelType} />
<JobDetailsExportJobData {...props} />
<JobDetailsHeader job={props.data as JobModelType} />
<JobDetailsExportJobData key={jobId} {...propsWithJobParams} />
<Box className="gridContainer">
{taskFields.map((field) => (
<Typography
Expand All @@ -191,8 +212,8 @@ export const JobDetailsRenderer: React.FC<ICellRendererParams> = (props) => {
<FormattedMessage id={field.label} />
</Typography>
))}
<TasksRenderer productType={(props.data as JobModelType).productType as ProductType} jobId={jobId.replace(DETAILS_ROW_ID_SUFFIX, '')} />
<TasksRenderer productType={(props.data as JobModelType).productType as ProductType} jobId={jobId} />
</Box>
</Box>
);
};
});
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const JobDetailsHeader: React.FC<JobDetailsHeaderProps> = ({
inProgressTasks,
completedTasks,
pendingTasks,
expiredTasks,
},
}) => {
const intl = useIntl();
Expand Down Expand Up @@ -77,9 +78,10 @@ export const JobDetailsHeader: React.FC<JobDetailsHeaderProps> = ({
label: getStatusTranslation(Status.Pending),
value: (pendingTasks as unknown) as string,
},
suspended: {
// suspended: {
expired: {
label: getStatusTranslation(Status.Suspended),
value: (completedTasks as unknown) as string,
value: (expiredTasks as unknown) as string,
},
},
failReason: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,12 @@

.exportJobDataContainer .exportJobLinkContainer > a:hover {
filter: brightness(150%);
}

.exportJobDataContainer .jobDescriptionContainer .expired {
color: var(--mdc-theme-gc-error-medium);
}

.exportJobDataContainer .jobDescriptionContainer .valid {
color: var(--mdc-theme-gc-priority-normal);
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { get } from 'lodash';
import React from 'react';
import { useIntl } from 'react-intl';
import { Hyperlink } from '../../../../common/components/hyperlink/hyperlink';
import { dateFormatter } from '../../../../common/helpers/formatters';
import { JobModelType, Status } from '../../../models';
import { CopyButton } from '../../job-manager/job-details.copy-button';

Expand All @@ -23,6 +24,17 @@ const JobDetailsExportJobData: React.FC<JobDetailsExportJobDataProps> = ({ data
const jobDescription = jobData.description as string | undefined ?? '';
const exportLinks = get(jobData, `parameters.callbackParams.links`) as Record<string, string> | undefined;

const expirationTimeUTC: string = get(jobData, `parameters.cleanupData.cleanupExpirationTimeUTC`);
let formattedExpirationTime = '';
let hasExpired: boolean = false;

if (expirationTimeUTC) {
const expirationTime = new Date(expirationTimeUTC);
formattedExpirationTime = dateFormatter(expirationTime);
const today = new Date();
hasExpired = expirationTime < today;
}

const jobStatus = jobData.status;

// const exportLinkLabel = intl.formatMessage({id: 'system-status.export-details.link.label'});
Expand All @@ -35,6 +47,14 @@ const JobDetailsExportJobData: React.FC<JobDetailsExportJobDataProps> = ({ data
return (
<Box className="exportJobDataContainer">
<Box className="jobDescriptionContainer">
{ exportLinks && expirationTimeUTC &&
<>
<span className={`${hasExpired ? 'expired' : 'valid'}`}>
{ intl.formatMessage({id: 'system-status.export-details.expirationDate'}) + ': ' + formattedExpirationTime}
</span>
{ " | " }
</>
}
<Typography tag="bdi" className="jobDescriptionLabel">
{jobDescriptionText}
</Typography>
Expand Down