-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: TmsServiceNew devient PyramidVectorNew
- Loading branch information
Showing
17 changed files
with
242 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { FC } from "react"; | ||
import { StoredDataStatuses } from "../../types/app"; | ||
import { AlertProps } from "@codegouvfr/react-dsfr/Alert"; | ||
import Badge from "@codegouvfr/react-dsfr/Badge"; | ||
import { fr } from "@codegouvfr/react-dsfr"; | ||
|
||
type StoredDataStatusBadgeProps = { | ||
status: string; | ||
}; | ||
|
||
const StoredDataStatusBadge: FC<StoredDataStatusBadgeProps> = ({ status }) => { | ||
let severity: AlertProps.Severity = "info"; | ||
let text = ""; | ||
switch (status) { | ||
case StoredDataStatuses.GENERATED: | ||
severity = "success"; | ||
text = "Prêt"; | ||
break; | ||
|
||
case StoredDataStatuses.CREATED: | ||
case StoredDataStatuses.GENERATING: | ||
severity = "warning"; | ||
text = "En cours de génération"; | ||
break; | ||
|
||
case StoredDataStatuses.MODIFYING: | ||
severity = "warning"; | ||
text = "En cours de modification"; | ||
break; | ||
|
||
case StoredDataStatuses.UNSTABLE: | ||
severity = "error"; | ||
text = "Echoué"; | ||
break; | ||
|
||
case StoredDataStatuses.DELETED: | ||
severity = "info"; | ||
text = "Supprimé"; | ||
break; | ||
|
||
default: | ||
break; | ||
} | ||
|
||
return ( | ||
<Badge noIcon={true} severity={severity} className={fr.cx("fr-mr-2v")}> | ||
{text} | ||
</Badge> | ||
); | ||
}; | ||
|
||
export default StoredDataStatusBadge; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
assets/pages/datasheet/DatasheetView/DatasetListTab/PyramidList.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import { FC } from "react"; | ||
import { Pyramid, StoredDataStatuses } from "../../../../types/app"; | ||
import { fr } from "@codegouvfr/react-dsfr"; | ||
import MenuList from "../../../../components/Utils/MenuList"; | ||
import StoredDataStatusBadge from "../../../../components/Utils/StoredDataStatusBadge"; | ||
import functions from "../../../../functions"; | ||
import Button from "@codegouvfr/react-dsfr/Button"; | ||
import { routes } from "../../../../router/router"; | ||
|
||
type PyramidListProps = { | ||
datastoreId: string; | ||
pyramidList: Pyramid[] | undefined; | ||
}; | ||
|
||
const PyramidList: FC<PyramidListProps> = ({ datastoreId, pyramidList }) => { | ||
return ( | ||
<> | ||
<div className={fr.cx("fr-grid-row")}> | ||
<h5> | ||
<i className={"ri-stack-line"} /> | ||
Pyramides de tuiles vectorielles ({pyramidList?.length}) | ||
</h5> | ||
</div> | ||
{pyramidList?.map((el) => ( | ||
<div key={el._id} className={fr.cx("fr-grid-row", "fr-grid-row--middle", "fr-mt-2v")}> | ||
<div className={fr.cx("fr-col")}> | ||
<div className={fr.cx("fr-grid-row", "fr-grid-row--middle")}>{el.name}</div> | ||
</div> | ||
<div className={fr.cx("fr-col")}> | ||
<div className={fr.cx("fr-grid-row", "fr-grid-row--right", "fr-grid-row--middle")}> | ||
<p className={fr.cx("fr-m-auto", "fr-mr-2v")}>{el?.last_event?.date && functions.date.format(el?.last_event?.date)}</p> | ||
<StoredDataStatusBadge status={el.status} /> | ||
<Button | ||
onClick={() => { | ||
routes.datastore_tms_vector_service_new({ datastoreId, pyramidId: el._id }).push(); | ||
}} | ||
className={fr.cx("fr-mr-2v")} | ||
disabled={el.status !== StoredDataStatuses.GENERATED} | ||
> | ||
Publier le service TMS | ||
</Button> | ||
<MenuList | ||
menuOpenButtonProps={{ | ||
iconId: "fr-icon-menu-2-fill", | ||
title: "Autres actions", | ||
}} | ||
// disabled={el.status !== StoredDataStatuses.GENERATED} | ||
items={[ | ||
{ | ||
text: "Voir les détails", | ||
iconId: "fr-icon-file-text-fill", | ||
onClick: () => console.warn("Action non implémentée"), | ||
}, | ||
{ | ||
text: "Supprimer", | ||
iconId: "fr-icon-delete-line", | ||
onClick: () => console.warn("Action non implémentée"), | ||
}, | ||
]} | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
))} | ||
</> | ||
); | ||
}; | ||
|
||
export default PyramidList; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.