diff --git a/src/modals/create-dashboard/create-dashboard.modal.tsx b/src/modals/create-dashboard/create-dashboard.modal.tsx
index aee613d87..32a0b0d23 100644
--- a/src/modals/create-dashboard/create-dashboard.modal.tsx
+++ b/src/modals/create-dashboard/create-dashboard.modal.tsx
@@ -8,7 +8,7 @@ import { createDashboardSchemaValidation } from '~/validations/dashboards';
export const CreateDashboardModal = ({ context, id, innerProps }: ContextModalProps<{}>) => {
const apiContext = api.useContext();
- const { isLoading, mutateAsync } = api.config.save.useMutation({
+ const { isLoading, mutate } = api.config.save.useMutation({
onSuccess: async () => {
await apiContext.config.all.invalidate();
modals.close(id);
@@ -24,37 +24,43 @@ export const CreateDashboardModal = ({ context, id, innerProps }: ContextModalPr
validate: i18nZodResolver(createDashboardSchemaValidation),
});
+ const handleSubmit = () => {
+ const fallbackConfig = getStaticFallbackConfig(form.values.name);
+ mutate({
+ name: form.values.name,
+ config: fallbackConfig,
+ });
+ };
+
return (
-
- A name cannot be changed after a dashboard has been created.
+
+
);
};
diff --git a/src/modals/delete-board/delete-board.modal.tsx b/src/modals/delete-board/delete-board.modal.tsx
new file mode 100644
index 000000000..785bf4890
--- /dev/null
+++ b/src/modals/delete-board/delete-board.modal.tsx
@@ -0,0 +1,52 @@
+import { Button, Group, Stack, Text } from '@mantine/core';
+import { ContextModalProps, modals } from '@mantine/modals';
+import { api } from '~/utils/api';
+
+export const DeleteBoardModal = ({
+ context,
+ id,
+ innerProps,
+}: ContextModalProps<{ boardName: string; onConfirm: () => Promise }>) => {
+ const apiContext = api.useContext();
+ const { isLoading, mutateAsync } = api.config.delete.useMutation({
+ onSuccess: async () => {
+ await apiContext.config.all.invalidate();
+ modals.close(id);
+ },
+ });
+
+ return (
+
+
+ Are you sure, that you want to delete this board? This action cannot be undone and your data
+ will be lost permanently.
+
+
+
+
+
+
+
+ );
+};
diff --git a/src/modals/modals.ts b/src/modals/modals.ts
index 3d2bbfaff..2f2cb8aa3 100644
--- a/src/modals/modals.ts
+++ b/src/modals/modals.ts
@@ -11,6 +11,7 @@ import { CreateRegistrationTokenModal } from './create-registration-token/create
import { DeleteRegistrationTokenModal } from './delete-registration-token/delete-registration-token.modal';
import { CreateDashboardModal } from './create-dashboard/create-dashboard.modal';
import { CopyRegistrationToken } from './copy-regristration-token/copy-registration-token.modal';
+import { DeleteBoardModal } from './delete-board/delete-board.modal';
export const modals = {
editApp: EditAppModal,
@@ -25,6 +26,7 @@ export const modals = {
deleteRegistrationTokenModal: DeleteRegistrationTokenModal,
createDashboardModal: CreateDashboardModal,
copyRegistrationTokenModal: CopyRegistrationToken,
+ deleteBoardModal: DeleteBoardModal
};
declare module '@mantine/modals' {
diff --git a/src/pages/manage/boards/index.tsx b/src/pages/manage/boards/index.tsx
index 337196175..1b80a0cee 100644
--- a/src/pages/manage/boards/index.tsx
+++ b/src/pages/manage/boards/index.tsx
@@ -14,7 +14,13 @@ import {
} from '@mantine/core';
import { useListState } from '@mantine/hooks';
import { modals } from '@mantine/modals';
-import { IconDotsVertical, IconPlus, IconTrash } from '@tabler/icons-react';
+import {
+ IconDotsVertical,
+ IconFile,
+ IconFolderFilled,
+ IconPlus,
+ IconTrash,
+} from '@tabler/icons-react';
import Link from 'next/link';
import { MainLayout } from '~/components/layout/admin/main-admin.layout';
import { CommonHeader } from '~/components/layout/common-header';
@@ -45,14 +51,14 @@ const BoardsPage = () => {
onClick={() => {
modals.openContextModal({
modal: 'createDashboardModal',
- title: Create new dashboard,
+ title: Create new board,
innerProps: {},
});
}}
leftIcon={}
variant="default"
>
- Create new dashboard
+ Create new board
@@ -68,9 +74,13 @@ const BoardsPage = () => {
{data.map((board, index) => (
-
- {board}
-
+
+
+ {board}
+
+
+
+ } color="pink" variant="light">
Filesystem
@@ -100,14 +110,18 @@ const BoardsPage = () => {
{
- append(board);
- // give user feedback, that it's being deleted
- await sleep(500);
- deletionMutationAsync({
- name: board,
- }).finally(async () => {
- await sleep(500);
- filter((item, _) => item !== board);
+ modals.openContextModal({
+ modal: 'deleteBoardModal',
+ title: Delete board,
+ innerProps: {
+ boardName: board,
+ onConfirm: async () => {
+ append(board);
+ // give user feedback, that it's being deleted
+ await sleep(500);
+ filter((item, _) => item !== board);
+ },
+ },
});
}}
icon={}