forked from BLC/sgeUpdated
tab name changes, aypos button, removed area related tabs
This commit is contained in:
@@ -30,7 +30,6 @@ import { default as SweetAlert } from "sweetalert2";
|
||||
import withReactContent from "sweetalert2-react-content";
|
||||
import { getDataCenters, createDataCenter, updateDataCenter, deleteDataCenter } from "../redux/actions/dataCenter";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { getAreas } from "../redux/actions/areas";
|
||||
import { getSectors, getSectorById, getSubSectorById, getConsuptionUnits } from "../redux/actions/datas";
|
||||
import { getAllEmissionSources } from "../redux/actions/emissionSources";
|
||||
import { permissionCheck } from "../components/permission-check";
|
||||
@@ -105,7 +104,6 @@ const DataCenterManagement = () => {
|
||||
name: "",
|
||||
externalId: "",
|
||||
number: "",
|
||||
areaId: null,
|
||||
address: "",
|
||||
latitude: null,
|
||||
longitude: null,
|
||||
@@ -122,10 +120,8 @@ const DataCenterManagement = () => {
|
||||
const [mapPosition, setMapPosition] = useState(null);
|
||||
|
||||
const dataCenterStore = useSelector((state) => state.dataCenter);
|
||||
const areasStore = useSelector((state) => state.areas);
|
||||
const datasStore = useSelector((state) => state.datas);
|
||||
const emissionSourceStore = useSelector((state) => state.emissionSources);
|
||||
const [areasOptions, setAreasOptions] = useState([]);
|
||||
const [sectorsOptions, setSectorsOptions] = useState([]);
|
||||
const [subSectorsOptions, setSubSectorsOptions] = useState([]);
|
||||
const [emissionSourcesOptions, setEmissionSourcesOptions] = useState([]);
|
||||
@@ -154,14 +150,7 @@ const DataCenterManagement = () => {
|
||||
minWidth: "200px",
|
||||
},
|
||||
{
|
||||
name: t("DataCenter.city"),
|
||||
selector: (row) => row.area?.cityNames,
|
||||
sortable: true,
|
||||
minWidth: "150px",
|
||||
cell: (row) => <span>{row.area?.cityNames || "-"}</span>,
|
||||
},
|
||||
{
|
||||
name: "AYPOS",
|
||||
name: "Dashboard",
|
||||
selector: (row) => row.ayposURL,
|
||||
sortable: false,
|
||||
minWidth: "150px",
|
||||
@@ -173,7 +162,7 @@ const DataCenterManagement = () => {
|
||||
size="sm"
|
||||
onClick={() => window.open(row.ayposURL, '_blank')}
|
||||
>
|
||||
AYPOS
|
||||
Dashboard
|
||||
</Button>
|
||||
) : (
|
||||
<span>-</span>
|
||||
@@ -225,19 +214,9 @@ const DataCenterManagement = () => {
|
||||
|
||||
useEffect(() => {
|
||||
dispatch(getDataCenters());
|
||||
dispatch(getAreas());
|
||||
dispatch(getSectors());
|
||||
}, [dispatch]);
|
||||
|
||||
useEffect(() => {
|
||||
setAreasOptions(
|
||||
areasStore?.areas?.map((area) => ({
|
||||
value: area?.id,
|
||||
label: area?.tag,
|
||||
}))
|
||||
);
|
||||
}, [areasStore]);
|
||||
|
||||
useEffect(() => {
|
||||
setSectorsOptions(
|
||||
datasStore?.sectors?.map((sector) => ({
|
||||
@@ -334,7 +313,6 @@ const DataCenterManagement = () => {
|
||||
name: row.dataCenter,
|
||||
externalId: row.externalId,
|
||||
number: row.number,
|
||||
areaId: row.area?.id,
|
||||
address: row.address,
|
||||
latitude: row.latitude,
|
||||
longitude: row.longitude,
|
||||
@@ -432,7 +410,6 @@ const DataCenterManagement = () => {
|
||||
name: "",
|
||||
externalId: "",
|
||||
number: "",
|
||||
areaId: null,
|
||||
address: "",
|
||||
latitude: null,
|
||||
longitude: null,
|
||||
@@ -638,28 +615,6 @@ const DataCenterManagement = () => {
|
||||
/>
|
||||
</FormGroup>
|
||||
</Col>
|
||||
<Col sm="12">
|
||||
<FormGroup>
|
||||
<Label for="area">{t("DataCenter.area")}</Label>
|
||||
<Select
|
||||
id="area"
|
||||
name="area"
|
||||
placeholder={t("DataCenter.selectArea")}
|
||||
options={areasOptions}
|
||||
value={areasOptions?.find(
|
||||
(option) => option.value === selectedDataCenter.areaId
|
||||
)}
|
||||
onChange={(option) =>
|
||||
setSelectedDataCenter({
|
||||
...selectedDataCenter,
|
||||
areaId: option?.value,
|
||||
})
|
||||
}
|
||||
isClearable
|
||||
filterOption={customFilterForSelect}
|
||||
/>
|
||||
</FormGroup>
|
||||
</Col>
|
||||
<Col sm="12">
|
||||
<FormGroup>
|
||||
<Label for="address">{t("DataCenter.address")}</Label>
|
||||
|
||||
Reference in New Issue
Block a user