-
Notifications
You must be signed in to change notification settings - Fork 239
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Feroze Mohideen
authored
Feb 27, 2024
1 parent
8338655
commit 4a7c824
Showing
7 changed files
with
58 additions
and
16 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ import Icon from "components/porter/Icon"; | |
import Input from "components/porter/Input"; | ||
import Spacer from "components/porter/Spacer"; | ||
import Text from "components/porter/Text"; | ||
import { useDatastoreList } from "lib/hooks/useDatabaseList"; | ||
import { useIntercom } from "lib/hooks/useIntercom"; | ||
|
||
import { Context } from "shared/Context"; | ||
|
@@ -29,6 +30,16 @@ const Settings: React.FC = () => { | |
const [errorMessage, setErrorMessage] = useState(""); | ||
const [status, setStatus] = useState(""); | ||
const { updateClusterButtonProps } = useClusterFormContext(); | ||
const { datastores } = useDatastoreList(); | ||
|
||
const datastoresBelongingToCluster = useMemo(() => { | ||
return datastores.filter( | ||
(d) => | ||
d.cloud_provider === cluster.cloud_provider.name && | ||
d.cloud_provider_credential_identifier === | ||
cluster.cloud_provider_credential_identifier | ||
); | ||
}, [datastores]); | ||
|
||
const renameCluster = useCallback(async (): Promise<void> => { | ||
setStatus("loading"); | ||
|
@@ -129,6 +140,22 @@ const Settings: React.FC = () => { | |
</a> | ||
. Contact [email protected] if you need guidance. | ||
</Text> | ||
{datastoresBelongingToCluster.length > 0 && ( | ||
<> | ||
<Spacer y={0.7} /> | ||
<Text color={"warner"}> | ||
Note that deleting this cluster will delete the following attached | ||
datastores:{" "} | ||
</Text> | ||
<ul style={{ margin: 0 }}> | ||
{datastoresBelongingToCluster.map((d) => ( | ||
<li key={d.name}> | ||
<Text color={"warner"}>{d.name}</Text> | ||
</li> | ||
))} | ||
</ul> | ||
</> | ||
)} | ||
<Spacer y={1} /> | ||
<Button | ||
color="#b91133" | ||
|