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
2 changes: 1 addition & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ fi
echo "Done with confd"


ESCAPED_PUBLIC_URL="$(printf '%s' "$PUBLIC_URL_NORMALIZED" | sed 's/[^a-zA-Z0-9.]/\\&/g')"
ESCAPED_PUBLIC_URL="$(printf '%s' "$CONFIGURATION_PUBLIC_URL" | sed 's/[^a-zA-Z0-9.]/\\&/g')"

echo "Running SED command -->" 's/{PUBLIC_URL_PLACEHOLDER}/'"$ESCAPED_PUBLIC_URL"'/g'

Expand Down
44 changes: 23 additions & 21 deletions src/common/models/job-errors-summary.raster.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// #region to be removed
// TODO: should be taken from @map-colonies/types
import { Status } from '../../discrete-layer/models';

export type CallBack<T> = {
Expand All @@ -25,29 +23,33 @@ export type RasterTaskParams = {
};
};

type ErrorsCount = {
geometryValidity: number;
vertices: number;
metadata: number;
resolution: number;
smallGeometries: number;
smallHoles: number;
unknown: number;
};

type Threshold = {
exceeded: boolean;
};

export type RasterErrorsSummary = {
errorsCount: {
geometryValidity: number;
vertices: number;
metadata: number;
resolution: number;
smallGeometries: number;
smallHoles: number;
unknown: number;
};
thresholds: {
smallHoles: {
exceeded: boolean;
count: number;
};
smallGeometries: {
exceeded: boolean;
};
};
errorsCount: ErrorsCount;

thresholds: Partial<{
[K in keyof ErrorsCount]: Threshold;
}>;
};
// #endregion to be removed

export type RasterErrorCount = {
count?: number;
exceeded?: boolean;
};

export type RasterErrorsCountKey = keyof RasterErrorsSummary['errorsCount'];

export const APPROVAL_REQUIRED_ERRORS: readonly RasterErrorsCountKey[] = ['resolution'];
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@ import { DETAILS_ROW_ID_SUFFIX } from '../../../../../common/components/grid';
import { Hyperlink } from '../../../../../common/components/hyperlink/hyperlink';
import { useEnums } from '../../../../../common/hooks/useEnum.hook';
import { Domain } from '../../../../../common/models/domain';
import { RasterErrorsSummary } from '../../../../../common/models/job-errors-summary.raster';
import {
APPROVAL_REQUIRED_ERRORS,
RasterErrorsCountKey,
RasterErrorsSummary,
} from '../../../../../common/models/job-errors-summary.raster';
import { JobModelType, Status, TaskModelType, useStore } from '../../../../models';
import useZoomLevelsTable from '../../../export-layer/hooks/useZoomLevelsTable';
import {
getRasterErrorCount,
JobErrorsSummary,
} from '../../../job-errors-summary/job-errors-summary';
JobErrorsSummaryRasterJobData,
} from './job-errors-summary.raster-job-data';
import { getEnumWithRealValues } from '../../../layer-details/utils';

import './info-area.css';
Expand Down Expand Up @@ -56,7 +60,11 @@ export const JobDetailsRasterJobData: React.FC<JobDetailsRasterJobDataProps> = (
let count = 0;
Object.keys(errors.errorsCount).forEach((key) => {
const errorCount = getRasterErrorCount(errors, key);
if (errorCount.exceeded === true || typeof errorCount.exceeded === 'undefined') {
if (
APPROVAL_REQUIRED_ERRORS.includes(key as RasterErrorsCountKey) ||
errorCount.exceeded === true ||
typeof errorCount.exceeded === 'undefined'
) {
count += errorCount.count ?? 0;
}
});
Expand Down Expand Up @@ -156,7 +164,11 @@ export const JobDetailsRasterJobData: React.FC<JobDetailsRasterJobDataProps> = (
<Tooltip
content={
<Box>
{JobErrorsSummary(theme, task?.parameters?.errorsSummary, 'reportItem')}
{JobErrorsSummaryRasterJobData(
theme,
task?.parameters?.errorsSummary,
'reportItem'
)}
</Box>
}
>
Expand Down Expand Up @@ -186,7 +198,7 @@ export const JobDetailsRasterJobData: React.FC<JobDetailsRasterJobDataProps> = (
<Tooltip
content={
<Box>
{JobErrorsSummary(
{JobErrorsSummaryRasterJobData(
theme,
task?.parameters?.errorsSummary,
'reportItem',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Box } from '@material-ui/core';
import {
RasterErrorCount,
RasterErrorsSummary,
} from '../../../common/models/job-errors-summary.raster';
} from '../../../../../common/models/job-errors-summary.raster';

interface ErrorCountProps {
name: string;
Expand Down Expand Up @@ -50,7 +50,7 @@ export const getRasterErrorCount = (
};
};

export const JobErrorsSummary = (
export const JobErrorsSummaryRasterJobData = (
theme: IOptions,
errorsSummary: RasterErrorsSummary | undefined,
className: string,
Expand All @@ -62,13 +62,13 @@ export const JobErrorsSummary = (
}

return Object.entries(errorsSummary.errorsCount).map(([key, value]) => {
const isConflictItem = options?.key === key;
let color = overrideColor;

if (!overrideColor) {
const isResolutionConflict = options?.key === key;
const isResolved = isResolutionConflict
const isResolved = isConflictItem
? options?.isApproved === true
: getRasterErrorCount(errorsSummary, key)?.exceeded === false;

color =
value === 0
? theme.custom?.GC_SUCCESS
Expand All @@ -77,7 +77,7 @@ export const JobErrorsSummary = (
: theme.custom?.GC_ERROR_HIGH;
}

const showResolutionButton = key === options?.key && value > 0;
const showButton = isConflictItem && value > 0;

return (
<ErrorCount
Expand All @@ -87,11 +87,11 @@ export const JobErrorsSummary = (
className={className}
color={color}
action={
showResolutionButton ? (
showButton ? (
<Button
type="button"
outlined
className="resolutionConflictButton"
className="reportButton"
disabled={options?.isEnabled === false}
style={{ color: 'orange', borderColor: 'orange', fontWeight: 'bold' }}
onClick={(e): void => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
display: contents;
}

#layerDetailsFormRaster .resolutionConflictButton {
#layerDetailsFormRaster .reportButton {
min-width: unset;
height: 22px;
padding: 0 6px;
Expand Down
14 changes: 7 additions & 7 deletions src/discrete-layer/components/layer-details/raster/job-info.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Typography, useTheme } from '@map-colonies/react-core';
import { Skeleton } from '../../../../common/components/skeleton/skeleton';
import { AutoDirectionBox } from '../../../../common/components/auto-direction-box/auto-direction-box.component';
import { Status } from '../../../models';
import { JobErrorsSummary } from '../../job-errors-summary/job-errors-summary';
import { JobErrorsSummaryRasterJobData } from '../../job-manager/cell-renderer/job-details/job-errors-summary.raster-job-data';
import { FINAL_STATUSES } from '../../job-manager/job.types';
import { Progress } from './progress';
import { ResolutionConflictDialog } from './resolution-conflict.dialog';
Expand All @@ -21,7 +21,7 @@ interface JobInfoProps {
const JobInfoComponent: React.FC<JobInfoProps> = ({ job }) => {
const theme = useTheme();
const [isResolutionConflictDialogOpen, setIsResolutionConflictDialogOpen] = useState(false);
const [isResolutionConflictApproved, setIsResolutionConflictApproved] = useState(false);
const [isApproved, setIsApproved] = useState(false);
const latestJobRef = useRef<IJob | undefined>(job);

if (job) {
Expand All @@ -35,13 +35,13 @@ const JobInfoComponent: React.FC<JobInfoProps> = ({ job }) => {
}, []);

const approveResolutionConflictDialog = useCallback(() => {
setIsResolutionConflictApproved(true);
setIsApproved(true);
}, []);

const errorsCount = displayJob?.validationReport?.errorsSummary?.errorsCount;
const jobStatus = displayJob?.details?.status as Status | undefined;

const isResolutionConflictViewOnly = useMemo(() => {
const isViewOnly = useMemo(() => {
const isStatusReadOnly = jobStatus != null && FINAL_STATUSES.includes(jobStatus);
if (!errorsCount) {
return isStatusReadOnly;
Expand Down Expand Up @@ -94,7 +94,7 @@ const JobInfoComponent: React.FC<JobInfoProps> = ({ job }) => {
{taskId ? (
errorsCount ? (
<Box className="reportList bold">
{JobErrorsSummary(
{JobErrorsSummaryRasterJobData(
theme,
errorsSummary!,
'countWrapper',
Expand All @@ -103,7 +103,7 @@ const JobInfoComponent: React.FC<JobInfoProps> = ({ job }) => {
key: 'resolution',
action: openResolutionConflictDialog,
isEnabled: taskStatus === Status.Completed,
isApproved: isResolutionConflictApproved || jobStatus === Status.Completed,
isApproved: isApproved || jobStatus === Status.Completed,
}
)}
</Box>
Expand Down Expand Up @@ -133,7 +133,7 @@ const JobInfoComponent: React.FC<JobInfoProps> = ({ job }) => {
isOpen={isResolutionConflictDialogOpen}
onSetIsOpen={setIsResolutionConflictDialogOpen}
onApprove={approveResolutionConflictDialog}
viewOnly={isResolutionConflictViewOnly || isResolutionConflictApproved}
viewOnly={isViewOnly || isApproved}
/>
)}
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,16 +267,7 @@ export const isJobValid = (status: Status | undefined): boolean => {
export const isTaskValid = (job: IJob | undefined): boolean => {
const taskPercentage = job?.taskPercentage;
const validationReport = job?.validationReport;
const errorsSummary = validationReport?.errorsSummary;
return (
taskPercentage === 0 ||
(validationReport?.isValid === true &&
Object.values(errorsSummary?.errorsCount || {}).every(
(value) => typeof value !== 'number' || value === 0
) &&
errorsSummary?.thresholds?.smallHoles?.exceeded === false &&
errorsSummary?.thresholds?.smallGeometries?.exceeded === false)
);
return taskPercentage === 0 || validationReport?.isValid === true;
};

export const isModified = (modDate: Date | string) => {
Expand Down
Loading