Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix task status string #1032

Merged
merged 6 commits into from
Dec 7, 2023
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
10 changes: 5 additions & 5 deletions src/frontend/src/components/DialogTaskActions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function Dialog({ taskId, feature, map, view }) {
const token = CoreModules.useAppSelector((state) => state.login.loginToken);
const loading = CoreModules.useAppSelector((state) => state.common.loading);
const [list_of_task_status, set_list_of_task_status] = useState([]);
const [task_status, set_task_status] = useState(task_priority_str['READY']);
const [task_status, set_task_status] = useState('READY');

const geojsonStyles = MapStyles();
const dispatch = CoreModules.useAppDispatch();
Expand All @@ -34,11 +34,11 @@ export default function Dialog({ taskId, feature, map, view }) {
})[0],
};
const findCorrectTaskStatusIndex = environment.tasksStatus.findIndex(
(data) => data.label == task_priority_str[currentStatus.task_status],
(data) => data.label == currentStatus.task_status,
);
const tasksStatus =
feature.id_ != undefined ? environment.tasksStatus[findCorrectTaskStatusIndex]?.['label'] : '';
set_task_status(task_priority_str[tasksStatus]);
set_task_status(tasksStatus);
const tasksStatusList =
feature.id_ != undefined ? environment.tasksStatus[findCorrectTaskStatusIndex]?.['action'] : [];

Expand All @@ -53,7 +53,7 @@ export default function Dialog({ taskId, feature, map, view }) {
const handleOnClick = (event) => {
const status = task_priority_str[event.target.id];
const body = token != null ? { ...token } : {};
const geoStyle = geojsonStyles[status];
const geoStyle = geojsonStyles[event.target.id];
if (event.target.id != undefined) {
if (body.hasOwnProperty('id')) {
dispatch(
Expand Down Expand Up @@ -103,7 +103,7 @@ export default function Dialog({ taskId, feature, map, view }) {
<CoreModules.Stack direction={'row'} pl={1}>
<CoreModules.Typography variant="h3">
{/* {`STATUS : ${task_status?.toString()?.replaceAll('_', ' ')}`} */}
{`STATUS : ${task_priority_str[task_status]}`}
{`STATUS : ${task_status}`}
</CoreModules.Typography>
</CoreModules.Stack>
<CoreModules.Link
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/utilfunctions/getTaskStatusStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const strokeColor = 'rgb(0,0,0,0.5)';

const getTaskStatusStyle = (feature, mapTheme) => {
let id = feature.getId().toString().replace('_', ',');
const status = task_priority_str[id.split(',')[1]];
const status = id.split(',')[1];
const lockedPolygonStyle = createPolygonStyle(mapTheme.palette.mapFeatureColors.locked_for_mapping_rgb, strokeColor);
const lockedValidationStyle = createPolygonStyle(
mapTheme.palette.mapFeatureColors.locked_for_validation_rgb,
Expand Down