From 1490c9014c512de64b06943ac68229227e4d48bf Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Mon, 7 Aug 2023 13:50:12 +0700 Subject: [PATCH 1/2] Remove unnecessary request --- src/views/SimproV2/CreatedProyek/DialogGantt.js | 7 ++----- src/views/SimproV2/CreatedProyek/DialogHierarchy.js | 1 + 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/views/SimproV2/CreatedProyek/DialogGantt.js b/src/views/SimproV2/CreatedProyek/DialogGantt.js index 7fb98d7..3fc9550 100644 --- a/src/views/SimproV2/CreatedProyek/DialogGantt.js +++ b/src/views/SimproV2/CreatedProyek/DialogGantt.js @@ -13,7 +13,7 @@ import DialogUserGantt from './DialogUserGantt'; import { Link } from 'react-router-dom'; -const DialogGantt = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName, hierarchyId, hierarchyName }) => { +const DialogGantt = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName, hierarchyId, hierarchyName, openDialogHierarchy }) => { const token = localStorage.getItem("token") const HEADER = { headers: { @@ -31,10 +31,7 @@ const DialogGantt = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName const [humanResource, setHumanResource] = useState([]) useEffect(() => { - if (idTask > 0) { - getdataGantt(); - } - if (hierarchyId > 0) { + if (hierarchyId > 0 || idTask > 0 && !openDialogHierarchy) { getdataGantt(); } }, [hierarchyId, idTask, openDialog]) diff --git a/src/views/SimproV2/CreatedProyek/DialogHierarchy.js b/src/views/SimproV2/CreatedProyek/DialogHierarchy.js index d62ce53..7c1f99a 100644 --- a/src/views/SimproV2/CreatedProyek/DialogHierarchy.js +++ b/src/views/SimproV2/CreatedProyek/DialogHierarchy.js @@ -311,6 +311,7 @@ const DialogHierarchy = ({ openDialog, closeDialog, toggleDialog, idTask, proyek hierarchyId={parentId} hierarchyName={parentName} idTask={idTask} + openDialogHierarchy={openDialog} /> Date: Tue, 8 Aug 2023 16:55:33 +0700 Subject: [PATCH 2/2] Extracting gantt iframe --- src/views/SimproV2/Gantt/GanttFrame.js | 23 +++++++++++++++++++++++ src/views/SimproV2/Gantt/index.js | 25 ++++++++++--------------- 2 files changed, 33 insertions(+), 15 deletions(-) create mode 100644 src/views/SimproV2/Gantt/GanttFrame.js diff --git a/src/views/SimproV2/Gantt/GanttFrame.js b/src/views/SimproV2/Gantt/GanttFrame.js new file mode 100644 index 0000000..0ddb2b9 --- /dev/null +++ b/src/views/SimproV2/Gantt/GanttFrame.js @@ -0,0 +1,23 @@ +import React from 'react'; +import { BASE_SIMPRO_LUMEN } from '../../../const/ApiConst'; + +const GanttFrame = React.memo((props) => { + const { versionGanttId, idProject, token, ro, timestamp } = props; + const iframeSrc = `https://adw-gantt.ospro.id/edit-mode/index.html?base_url=${BASE_SIMPRO_LUMEN}&gantt_id=${versionGanttId}&proyek_id=${idProject}&token=${token}&ro=${ro}×tamp=${timestamp}`; + + return ( + + ); +}); + +export default GanttFrame; diff --git a/src/views/SimproV2/Gantt/index.js b/src/views/SimproV2/Gantt/index.js index 466bb6d..c491af4 100644 --- a/src/views/SimproV2/Gantt/index.js +++ b/src/views/SimproV2/Gantt/index.js @@ -6,7 +6,7 @@ import axios from "../../../const/interceptorApi" import { Fab, Action } from 'react-tiny-fab'; import 'react-tiny-fab/dist/styles.css'; import { useHistory } from "react-router-dom"; - +import GanttFrame from './GanttFrame'; const token = localStorage.getItem("token") const userId = parseInt(localStorage.getItem("user_id")); const HEADER = { @@ -82,24 +82,19 @@ const Gantt = (props) => { } roCount = roCount + 1; } - const RenderGantt = () => ( - - ) return ( <>
- {ready && } + {ready && ( + + )}
);