feature/IO-3291-Tasks-Notifications: Checkpoint
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
// client/src/components/task-center/task-center.component.jsx
|
|
||||||
import { Virtuoso } from "react-virtuoso";
|
import { Virtuoso } from "react-virtuoso";
|
||||||
import { Badge, Button, Space, Spin, Switch, Tooltip, Typography } from "antd";
|
import { Badge, Button, Space, Spin, Switch, Tooltip, Typography } from "antd";
|
||||||
import { CheckCircleFilled, CheckCircleOutlined, EyeFilled, EyeOutlined } from "@ant-design/icons";
|
import { CheckCircleFilled, CheckCircleOutlined, EyeFilled, EyeOutlined } from "@ant-design/icons";
|
||||||
@@ -6,12 +5,12 @@ import { useTranslation } from "react-i18next";
|
|||||||
import { forwardRef, useEffect, useRef } from "react";
|
import { forwardRef, useEffect, useRef } from "react";
|
||||||
import { DateTimeFormat } from "../../utils/DateFormatter.jsx";
|
import { DateTimeFormat } from "../../utils/DateFormatter.jsx";
|
||||||
import day from "../../utils/day.js";
|
import day from "../../utils/day.js";
|
||||||
import "./task-center.styles.scss"; // You can clone this from notification styles for now
|
import "./task-center.styles.scss";
|
||||||
|
|
||||||
const { Text, Title } = Typography;
|
const { Text, Title } = Typography;
|
||||||
|
|
||||||
const TaskCenterComponent = forwardRef(
|
const TaskCenterComponent = forwardRef(
|
||||||
({ visible, onClose, tasks, loading, showIncompleteOnly, toggleIncomplete, markAllComplete, onTaskClick }, ref) => {
|
({ visible, tasks, loading, showIncompleteOnly, toggleIncomplete, markAllComplete, onTaskClick }, ref) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const virtuosoRef = useRef(null);
|
const virtuosoRef = useRef(null);
|
||||||
|
|
||||||
@@ -21,9 +20,12 @@ const TaskCenterComponent = forwardRef(
|
|||||||
}
|
}
|
||||||
}, [showIncompleteOnly]);
|
}, [showIncompleteOnly]);
|
||||||
|
|
||||||
|
// Filter tasks based on showIncompleteOnly
|
||||||
|
const filteredTasks = showIncompleteOnly ? tasks.filter((task) => !task.completed) : tasks;
|
||||||
|
|
||||||
const renderTask = (index, task) => {
|
const renderTask = (index, task) => {
|
||||||
const handleClick = () => {
|
const handleClick = () => {
|
||||||
onTaskClick(task.id);
|
onTaskClick(task.id); // Use the prop handler
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -80,8 +82,8 @@ const TaskCenterComponent = forwardRef(
|
|||||||
<Virtuoso
|
<Virtuoso
|
||||||
ref={virtuosoRef}
|
ref={virtuosoRef}
|
||||||
style={{ height: "400px", width: "100%" }}
|
style={{ height: "400px", width: "100%" }}
|
||||||
data={tasks}
|
data={filteredTasks}
|
||||||
totalCount={tasks.length}
|
totalCount={filteredTasks.length}
|
||||||
itemContent={renderTask}
|
itemContent={renderTask}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// client/src/components/task-center/task-center.container.jsx
|
|
||||||
import { useCallback, useEffect, useMemo, useState } from "react";
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
||||||
import { useMutation, useQuery } from "@apollo/client";
|
import { useMutation, useQuery } from "@apollo/client";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
@@ -10,6 +9,7 @@ import { useNotification } from "../../contexts/Notifications/notificationContex
|
|||||||
import { MUTATION_TOGGLE_TASK_COMPLETED, QUERY_MY_TASKS_PAGINATED } from "../../graphql/tasks.queries";
|
import { MUTATION_TOGGLE_TASK_COMPLETED, QUERY_MY_TASKS_PAGINATED } from "../../graphql/tasks.queries";
|
||||||
import TaskCenterComponent from "./task-center.component";
|
import TaskCenterComponent from "./task-center.component";
|
||||||
import dayjs from "../../utils/day";
|
import dayjs from "../../utils/day";
|
||||||
|
import { setModalContext } from "../../redux/modals/modals.actions"; // Import setModalContext
|
||||||
|
|
||||||
const POLL_INTERVAL = 60; // seconds
|
const POLL_INTERVAL = 60; // seconds
|
||||||
|
|
||||||
@@ -18,7 +18,11 @@ const mapStateToProps = createStructuredSelector({
|
|||||||
currentUser: selectCurrentUser
|
currentUser: selectCurrentUser
|
||||||
});
|
});
|
||||||
|
|
||||||
const TaskCenterContainer = ({ visible, onClose, bodyshop, currentUser }) => {
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
|
setTaskUpsertContext: (context) => dispatch(setModalContext({ context, modal: "taskUpsert" }))
|
||||||
|
});
|
||||||
|
|
||||||
|
const TaskCenterContainer = ({ visible, onClose, bodyshop, currentUser, setTaskUpsertContext }) => {
|
||||||
const [tasks, setTasks] = useState([]);
|
const [tasks, setTasks] = useState([]);
|
||||||
const [showIncompleteOnly, setShowIncompleteOnly] = useState(true);
|
const [showIncompleteOnly, setShowIncompleteOnly] = useState(true);
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
@@ -93,10 +97,15 @@ const TaskCenterContainer = ({ visible, onClose, bodyshop, currentUser }) => {
|
|||||||
(id) => {
|
(id) => {
|
||||||
const task = tasks.find((t) => t.id === id);
|
const task = tasks.find((t) => t.id === id);
|
||||||
if (task) {
|
if (task) {
|
||||||
window.location.href = `/manage/jobs/${task.jobid}`;
|
setTaskUpsertContext({
|
||||||
|
context: {
|
||||||
|
taskId: task.id,
|
||||||
|
view: true
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[tasks]
|
[tasks, setModalContext]
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -108,9 +117,9 @@ const TaskCenterContainer = ({ visible, onClose, bodyshop, currentUser }) => {
|
|||||||
showIncompleteOnly={showIncompleteOnly}
|
showIncompleteOnly={showIncompleteOnly}
|
||||||
toggleIncomplete={handleToggleIncomplete}
|
toggleIncomplete={handleToggleIncomplete}
|
||||||
markAllComplete={handleMarkAllComplete}
|
markAllComplete={handleMarkAllComplete}
|
||||||
onTaskClick={handleTaskClick}
|
onTaskClick={handleTaskClick} // Pass the updated handler
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default connect(mapStateToProps)(TaskCenterContainer);
|
export default connect(mapStateToProps, mapDispatchToProps)(TaskCenterContainer);
|
||||||
|
|||||||
@@ -4,13 +4,12 @@ import {
|
|||||||
DeleteFilled,
|
DeleteFilled,
|
||||||
DeleteOutlined,
|
DeleteOutlined,
|
||||||
EditFilled,
|
EditFilled,
|
||||||
ExclamationCircleFilled,
|
|
||||||
PlusCircleFilled,
|
PlusCircleFilled,
|
||||||
SyncOutlined
|
SyncOutlined
|
||||||
} from "@ant-design/icons";
|
} from "@ant-design/icons";
|
||||||
import { Button, Card, Space, Switch, Table } from "antd";
|
import { Button, Card, Space, Switch, Table } from "antd";
|
||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
import React, { useCallback, useEffect } from "react";
|
import { useCallback, useEffect } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { Link, useLocation, useNavigate } from "react-router-dom";
|
import { Link, useLocation, useNavigate } from "react-router-dom";
|
||||||
@@ -19,6 +18,7 @@ import { pageLimit } from "../../utils/config";
|
|||||||
import { DateFormatter, DateTimeFormatter } from "../../utils/DateFormatter.jsx";
|
import { DateFormatter, DateTimeFormatter } from "../../utils/DateFormatter.jsx";
|
||||||
import dayjs from "../../utils/day";
|
import dayjs from "../../utils/day";
|
||||||
import ShareToTeamsButton from "../share-to-teams/share-to-teams.component.jsx";
|
import ShareToTeamsButton from "../share-to-teams/share-to-teams.component.jsx";
|
||||||
|
import PriorityLabel from "../../utils/tasksPriorityLabel.jsx";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Task List Component
|
* Task List Component
|
||||||
@@ -54,47 +54,12 @@ const RemindAtRecord = ({ remindAt }) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Priority Label Component
|
|
||||||
* @param priority
|
|
||||||
* @returns {Element}
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
const PriorityLabel = ({ priority }) => {
|
|
||||||
switch (priority) {
|
|
||||||
case 1:
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
High <ExclamationCircleFilled style={{ marginLeft: "5px", color: "red" }} />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
case 2:
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
Medium <ExclamationCircleFilled style={{ marginLeft: "5px", color: "yellow" }} />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
case 3:
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
Low <ExclamationCircleFilled style={{ marginLeft: "5px", color: "green" }} />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
default:
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
None <ExclamationCircleFilled style={{ marginLeft: "5px" }} />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
// Existing dispatch props...
|
// Existing dispatch props...
|
||||||
setTaskUpsertContext: (context) => dispatch(setModalContext({ context, modal: "taskUpsert" }))
|
setTaskUpsertContext: (context) => dispatch(setModalContext({ context, modal: "taskUpsert" }))
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapStateToProps = (state) => ({});
|
const mapStateToProps = () => ({});
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(TaskListComponent);
|
export default connect(mapStateToProps, mapDispatchToProps)(TaskListComponent);
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { Col, Form, Input, Row, Select, Switch } from "antd";
|
import { Col, Form, Input, Row, Select, Switch } from "antd";
|
||||||
import React from "react";
|
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { selectBodyshop, selectCurrentUser } from "../../redux/user/user.selectors.js";
|
import { selectBodyshop, selectCurrentUser } from "../../redux/user/user.selectors.js";
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import TasksPageComponent from "./tasks.page.component";
|
import TasksPageComponent from "./tasks.page.component";
|
||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
|
|||||||
38
client/src/utils/tasksPriorityLabel.jsx
Normal file
38
client/src/utils/tasksPriorityLabel.jsx
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
import { ExclamationCircleFilled } from "@ant-design/icons";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Priority Label Component
|
||||||
|
* @param priority
|
||||||
|
* @returns {Element}
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
const PriorityLabel = ({ priority }) => {
|
||||||
|
switch (priority) {
|
||||||
|
case 1:
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
High <ExclamationCircleFilled style={{ marginLeft: "5px", color: "red" }} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
case 2:
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
Medium <ExclamationCircleFilled style={{ marginLeft: "5px", color: "yellow" }} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
case 3:
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
Low <ExclamationCircleFilled style={{ marginLeft: "5px", color: "green" }} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
default:
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
None <ExclamationCircleFilled style={{ marginLeft: "5px" }} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export default PriorityLabel;
|
||||||
Reference in New Issue
Block a user