Browse Source

set false loading spinner

pull/1/head
wahyun 11 months ago
parent
commit
1198746dd7
  1. 16
      src/views/SimproV2/CreatedProyek/ImportActivity/index.js

16
src/views/SimproV2/CreatedProyek/ImportActivity/index.js

@ -93,6 +93,7 @@ const ImportActivity = ({ params }) => {
// //
const [isMovePage, setIsMovePage] = useState(false); const [isMovePage, setIsMovePage] = useState(false);
const [isPreview, setIsPreview] = useState(false); const [isPreview, setIsPreview] = useState(false);
const [loading, setLoading] = useState(true);
useEffect(() => { useEffect(() => {
getDataAssignHr(); getDataAssignHr();
@ -130,7 +131,9 @@ const ImportActivity = ({ params }) => {
if (result && result.data && result.data.code == 200) { if (result && result.data && result.data.code == 200) {
let dataRes = result.data.data || [] let dataRes = result.data.data || []
setdataUserToProject(dataRes); setdataUserToProject(dataRes);
setLoading(false)
} else { } else {
setLoading(false)
NotificationManager.error('Gagal Mengambil Data!!', 'Failed'); NotificationManager.error('Gagal Mengambil Data!!', 'Failed');
} }
} }
@ -144,6 +147,7 @@ const ImportActivity = ({ params }) => {
setIsMovePage(false); setIsMovePage(false);
}, 5000); }, 5000);
} else { } else {
setLoading(false)
NotificationManager.error('file harus dalam format .xlsx', 'Failed'); NotificationManager.error('file harus dalam format .xlsx', 'Failed');
} }
// else{ // else{
@ -219,8 +223,9 @@ const ImportActivity = ({ params }) => {
} }
dataMapped.push(extractedRow) dataMapped.push(extractedRow)
setLoading(false)
} }
setLoading(false)
setDatatable(dataMapped) setDatatable(dataMapped)
} }
}); });
@ -250,8 +255,11 @@ const ImportActivity = ({ params }) => {
const timestamp = Date.now(); const timestamp = Date.now();
const newTimestamp = timestamp + 60000; const newTimestamp = timestamp + 60000;
window.location = urlSplitted[0] + '//' + urlSplitted[2] + `/#/projects/` + ganttId + '/' + result.data.projectId + '/' + newTimestamp + '/gantt' window.location = urlSplitted[0] + '//' + urlSplitted[2] + `/#/projects/` + ganttId + '/' + result.data.projectId + '/' + newTimestamp + '/gantt'
} setLoading(false)
}else{
setLoading(false)
}
setLoading(false)
setIsMovePage(true); setIsMovePage(true);
setIsPreview(true); setIsPreview(true);
} }
@ -369,7 +377,7 @@ const ImportActivity = ({ params }) => {
<h4 className="capitalize">Data Preview</h4> <h4 className="capitalize">Data Preview</h4>
</CardHeader> </CardHeader>
<CardBody> <CardBody>
<Spin tip="Loading..."> <Spin tip="Loading..." spinning={loading}>
<Table <Table
rowClassName={(record, index) => index % 2 == 0 ? 'table-row-light' : 'table-row-dark'} rowClassName={(record, index) => index % 2 == 0 ? 'table-row-light' : 'table-row-dark'}
dataSource={dataTable} dataSource={dataTable}

Loading…
Cancel
Save