Merged in feature/IO-2884-Add-Alert-Filter-To-Production-Board (pull request #1622)
- Add Alert Filter to visual production board
This commit is contained in:
@@ -21,7 +21,7 @@ import { createBoardData } from "./production-board-kanban.utils.js";
|
|||||||
import ProductionBoardKanbanSettings from "./settings/production-board-kanban.settings.component.jsx";
|
import ProductionBoardKanbanSettings from "./settings/production-board-kanban.settings.component.jsx";
|
||||||
import cloneDeep from "lodash/cloneDeep";
|
import cloneDeep from "lodash/cloneDeep";
|
||||||
import isEqual from "lodash/isEqual";
|
import isEqual from "lodash/isEqual";
|
||||||
import { mergeWithDefaults } from "./settings/defaultKanbanSettings.js";
|
import { defaultFilters, mergeWithDefaults } from "./settings/defaultKanbanSettings.js";
|
||||||
import NoteUpsertModal from "../../components/note-upsert-modal/note-upsert-modal.container";
|
import NoteUpsertModal from "../../components/note-upsert-modal/note-upsert-modal.container";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
@@ -41,7 +41,7 @@ const mapDispatchToProps = (dispatch) => ({
|
|||||||
|
|
||||||
function ProductionBoardKanbanComponent({ data, bodyshop, refetch, insertAuditTrail, associationSettings, statuses }) {
|
function ProductionBoardKanbanComponent({ data, bodyshop, refetch, insertAuditTrail, associationSettings, statuses }) {
|
||||||
const [boardLanes, setBoardLanes] = useState({ lanes: [] });
|
const [boardLanes, setBoardLanes] = useState({ lanes: [] });
|
||||||
const [filter, setFilter] = useState({ search: "", employeeId: null });
|
const [filter, setFilter] = useState(defaultFilters);
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
const [isMoving, setIsMoving] = useState(false);
|
const [isMoving, setIsMoving] = useState(false);
|
||||||
const [orientation, setOrientation] = useState("vertical");
|
const [orientation, setOrientation] = useState("vertical");
|
||||||
@@ -187,11 +187,9 @@ function ProductionBoardKanbanComponent({ data, bodyshop, refetch, insertAuditTr
|
|||||||
return mergeWithDefaults(kanbanSettings);
|
return mergeWithDefaults(kanbanSettings);
|
||||||
}, [associationSettings]);
|
}, [associationSettings]);
|
||||||
|
|
||||||
const handleSettingsChange = useCallback((newSettings) => {
|
const handleSettingsChange = () => {
|
||||||
setLoading(true);
|
setFilter(defaultFilters);
|
||||||
setOrientation(newSettings.orientation ? "vertical" : "horizontal");
|
};
|
||||||
setLoading(false);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
if (loading) {
|
if (loading) {
|
||||||
return <Skeleton active />;
|
return <Skeleton active />;
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ const defaultKanbanSettings = {
|
|||||||
selectedEstimators: []
|
selectedEstimators: []
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const defaultFilters = { search: "", employeeId: null, alert: false };
|
||||||
|
|
||||||
const mergeWithDefaults = (settings) => {
|
const mergeWithDefaults = (settings) => {
|
||||||
// Create a new object that starts with the default settings
|
// Create a new object that starts with the default settings
|
||||||
const mergedSettings = { ...defaultKanbanSettings };
|
const mergedSettings = { ...defaultKanbanSettings };
|
||||||
@@ -64,4 +66,4 @@ const mergeWithDefaults = (settings) => {
|
|||||||
return mergedSettings;
|
return mergedSettings;
|
||||||
};
|
};
|
||||||
|
|
||||||
export { defaultKanbanSettings, statisticsItems, mergeWithDefaults };
|
export { defaultKanbanSettings, statisticsItems, mergeWithDefaults, defaultFilters };
|
||||||
|
|||||||
@@ -9,8 +9,9 @@ import InformationSettings from "./InformationSettings.jsx";
|
|||||||
import StatisticsSettings from "./StatisticsSettings.jsx";
|
import StatisticsSettings from "./StatisticsSettings.jsx";
|
||||||
import FilterSettings from "./FilterSettings.jsx";
|
import FilterSettings from "./FilterSettings.jsx";
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
|
import { isFunction } from "lodash";
|
||||||
|
|
||||||
function ProductionBoardKanbanSettings({ associationSettings, parentLoading, bodyshop, data }) {
|
function ProductionBoardKanbanSettings({ associationSettings, parentLoading, bodyshop, data, onSettingsChange }) {
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
@@ -61,6 +62,11 @@ function ProductionBoardKanbanSettings({ associationSettings, parentLoading, bod
|
|||||||
setOpen(false);
|
setOpen(false);
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
parentLoading(false);
|
parentLoading(false);
|
||||||
|
|
||||||
|
if (onSettingsChange && isFunction(onSettingsChange)) {
|
||||||
|
onSettingsChange(values);
|
||||||
|
}
|
||||||
|
|
||||||
setHasChanges(false);
|
setHasChanges(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -156,6 +162,7 @@ ProductionBoardKanbanSettings.propTypes = {
|
|||||||
associationSettings: PropTypes.object,
|
associationSettings: PropTypes.object,
|
||||||
parentLoading: PropTypes.func.isRequired,
|
parentLoading: PropTypes.func.isRequired,
|
||||||
bodyshop: PropTypes.object.isRequired,
|
bodyshop: PropTypes.object.isRequired,
|
||||||
|
onSettingsChange: PropTypes.func,
|
||||||
data: PropTypes.array
|
data: PropTypes.array
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user