mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-22 14:47:56 +01:00
Clean up clode
This commit is contained in:
parent
0e8c75d32c
commit
616396fe6a
@ -20,7 +20,7 @@ export type CreateProps = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const defaultModel: CreateModel = { title: '', description: '' };
|
const defaultModel: CreateModel = { title: '', description: '' };
|
||||||
const CreateDialog = (props: CreateProps) => {
|
const CreateDialog = ({onClose}: CreateProps) => {
|
||||||
const client: Client = useSelector(activeInstance);
|
const client: Client = useSelector(activeInstance);
|
||||||
const [model, setModel] = React.useState<CreateModel>(defaultModel);
|
const [model, setModel] = React.useState<CreateModel>(defaultModel);
|
||||||
const [error, setError] = React.useState<ErrorInfo>();
|
const [error, setError] = React.useState<ErrorInfo>();
|
||||||
@ -40,7 +40,7 @@ const CreateDialog = (props: CreateProps) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const handleOnClose = (): void => {
|
const handleOnClose = (): void => {
|
||||||
props.onClose();
|
onClose();
|
||||||
setModel(defaultModel);
|
setModel(defaultModel);
|
||||||
setError(undefined);
|
setError(undefined);
|
||||||
};
|
};
|
||||||
|
@ -9,12 +9,11 @@ import { SimpleDialogProps, handleOnMutationSuccess } from "..";
|
|||||||
import BaseDialog from "../base-dialog";
|
import BaseDialog from "../base-dialog";
|
||||||
|
|
||||||
|
|
||||||
const DeleteDialog = (props: SimpleDialogProps) => {
|
const DeleteDialog = ({ mapId, onClose } : SimpleDialogProps) => {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const { mapId, onClose } = props;
|
|
||||||
|
|
||||||
const client: Client = useSelector(activeInstance);
|
const client: Client = useSelector(activeInstance);
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
const mutation = useMutation((id: number) => client.deleteMap(id),
|
const mutation = useMutation((id: number) => client.deleteMap(id),
|
||||||
{
|
{
|
||||||
onSuccess: () => handleOnMutationSuccess(onClose, queryClient)
|
onSuccess: () => handleOnMutationSuccess(onClose, queryClient)
|
||||||
|
@ -13,15 +13,14 @@ export type DeleteMultiselectDialogProps = {
|
|||||||
onClose: () => void
|
onClose: () => void
|
||||||
}
|
}
|
||||||
|
|
||||||
const DeleteMultiselectDialog = (props: DeleteMultiselectDialogProps) => {
|
const DeleteMultiselectDialog = ({ onClose, mapsId }: DeleteMultiselectDialogProps) => {
|
||||||
const { onClose, mapsId } = props;
|
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const client: Client = useSelector(activeInstance);
|
const client: Client = useSelector(activeInstance);
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
const mutation = useMutation((ids: number[]) => client.deleteMaps(ids),
|
const mutation = useMutation((ids: number[]) => client.deleteMaps(ids),
|
||||||
{
|
{
|
||||||
onSuccess: () => handleOnMutationSuccess(props.onClose, queryClient)
|
onSuccess: () => handleOnMutationSuccess(onClose, queryClient)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -17,11 +17,10 @@ export type DuplicateModel = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const defaultModel: DuplicateModel = { title: '', description: '', id: -1 };
|
const defaultModel: DuplicateModel = { title: '', description: '', id: -1 };
|
||||||
const DuplicateDialog = (props: SimpleDialogProps) => {
|
const DuplicateDialog = ({ mapId, onClose }: SimpleDialogProps) => {
|
||||||
const service: Client = useSelector(activeInstance);
|
const service: Client = useSelector(activeInstance);
|
||||||
const [model, setModel] = React.useState<DuplicateModel>(defaultModel);
|
const [model, setModel] = React.useState<DuplicateModel>(defaultModel);
|
||||||
const [error, setError] = React.useState<ErrorInfo>();
|
const [error, setError] = React.useState<ErrorInfo>();
|
||||||
const { mapId, onClose } = props;
|
|
||||||
|
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
|
|
||||||
|
@ -16,9 +16,8 @@ type ExportDialogProps = {
|
|||||||
onClose: () => void,
|
onClose: () => void,
|
||||||
}
|
}
|
||||||
|
|
||||||
const ExportDialog = (props: ExportDialogProps) => {
|
const ExportDialog = ({ mapId, onClose, enableImgExport, svgXml }: ExportDialogProps) => {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const { mapId, onClose, enableImgExport, svgXml } = props;
|
|
||||||
const [submit, setSubmit] = React.useState<boolean>(false);
|
const [submit, setSubmit] = React.useState<boolean>(false);
|
||||||
const [formExportRef, setExportFormRef] = React.useState<any>();
|
const [formExportRef, setExportFormRef] = React.useState<any>();
|
||||||
const [formTransformtRef, setTransformFormRef] = React.useState<any>();
|
const [formTransformtRef, setTransformFormRef] = React.useState<any>();
|
||||||
|
@ -10,9 +10,8 @@ import { Link, Paper, Table, TableBody, TableCell, TableContainer, TableHead, Ta
|
|||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
|
|
||||||
|
|
||||||
const HistoryDialog = (props: SimpleDialogProps) => {
|
const HistoryDialog = ({ mapId, onClose }: SimpleDialogProps) => {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const mapId = props.mapId;
|
|
||||||
|
|
||||||
const client: Client = useSelector(activeInstance);
|
const client: Client = useSelector(activeInstance);
|
||||||
const { isLoading, error, data } = useQuery<unknown, ErrorInfo, ChangeHistory[]>('history', () => {
|
const { isLoading, error, data } = useQuery<unknown, ErrorInfo, ChangeHistory[]>('history', () => {
|
||||||
@ -21,7 +20,7 @@ const HistoryDialog = (props: SimpleDialogProps) => {
|
|||||||
const changeHistory: ChangeHistory[] = data ? data : [];
|
const changeHistory: ChangeHistory[] = data ? data : [];
|
||||||
|
|
||||||
const handleOnClose = (): void => {
|
const handleOnClose = (): void => {
|
||||||
props.onClose();
|
onClose();
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleOnClick = (event, vid): void => {
|
const handleOnClick = (event, vid): void => {
|
||||||
|
@ -5,7 +5,7 @@ import { useSelector } from 'react-redux';
|
|||||||
import { Button, FormControl } from '@material-ui/core';
|
import { Button, FormControl } from '@material-ui/core';
|
||||||
|
|
||||||
|
|
||||||
import Client, { BasicMapInfo, ErrorInfo } from '../../../../classes/client';
|
import Client, { ErrorInfo } from '../../../../classes/client';
|
||||||
import { activeInstance } from '../../../../redux/clientSlice';
|
import { activeInstance } from '../../../../redux/clientSlice';
|
||||||
import Input from '../../../form/input';
|
import Input from '../../../form/input';
|
||||||
import BaseDialog from '../base-dialog';
|
import BaseDialog from '../base-dialog';
|
||||||
@ -22,7 +22,7 @@ export type CreateProps = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const defaultModel: ImportModel = { title: '' };
|
const defaultModel: ImportModel = { title: '' };
|
||||||
const ImportDialog = (props: CreateProps) => {
|
const ImportDialog = ({onClose}: CreateProps) => {
|
||||||
const client: Client = useSelector(activeInstance);
|
const client: Client = useSelector(activeInstance);
|
||||||
const [model, setModel] = React.useState<ImportModel>(defaultModel);
|
const [model, setModel] = React.useState<ImportModel>(defaultModel);
|
||||||
const [error, setError] = React.useState<ErrorInfo>();
|
const [error, setError] = React.useState<ErrorInfo>();
|
||||||
@ -42,7 +42,7 @@ const ImportDialog = (props: CreateProps) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const handleOnClose = (): void => {
|
const handleOnClose = (): void => {
|
||||||
props.onClose();
|
onClose();
|
||||||
setModel(defaultModel);
|
setModel(defaultModel);
|
||||||
setError(undefined);
|
setError(undefined);
|
||||||
};
|
};
|
||||||
|
@ -2,11 +2,7 @@ import React from 'react';
|
|||||||
import RenameDialog from './rename-dialog';
|
import RenameDialog from './rename-dialog';
|
||||||
import DeleteDialog from './delete-dialog';
|
import DeleteDialog from './delete-dialog';
|
||||||
import { ActionType } from '../action-chooser';
|
import { ActionType } from '../action-chooser';
|
||||||
import { AccountInfo, ErrorInfo, MapInfo } from '../../../classes/client';
|
import { QueryClient } from 'react-query';
|
||||||
import Client from '../../../classes/client';
|
|
||||||
import { useSelector } from 'react-redux';
|
|
||||||
import { QueryClient, useQuery } from 'react-query';
|
|
||||||
import { activeInstance } from '../../../redux/clientSlice';
|
|
||||||
import DuplicateDialog from './duplicate-dialog';
|
import DuplicateDialog from './duplicate-dialog';
|
||||||
import CreateDialog from './create-dialog';
|
import CreateDialog from './create-dialog';
|
||||||
import HistoryDialog from './history-dialog';
|
import HistoryDialog from './history-dialog';
|
||||||
|
@ -10,8 +10,7 @@ import { useStyles } from './style';
|
|||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import { fetchMapById } from '../../../../redux/clientSlice';
|
import { fetchMapById } from '../../../../redux/clientSlice';
|
||||||
|
|
||||||
const InfoDialog = (props: SimpleDialogProps) => {
|
const InfoDialog = ({ mapId, onClose }: SimpleDialogProps) => {
|
||||||
const { mapId, onClose } = props;
|
|
||||||
const { map } = fetchMapById(mapId);
|
const { map } = fetchMapById(mapId);
|
||||||
const [error, setError] = React.useState<ErrorInfo>();
|
const [error, setError] = React.useState<ErrorInfo>();
|
||||||
const [] = React.useState('1');
|
const [] = React.useState('1');
|
||||||
|
@ -13,8 +13,7 @@ import { handleOnMutationSuccess, SimpleDialogProps } from '..';
|
|||||||
import { useStyles } from './style';
|
import { useStyles } from './style';
|
||||||
|
|
||||||
|
|
||||||
const PublishDialog = (props: SimpleDialogProps) => {
|
const PublishDialog = ({ mapId, onClose }: SimpleDialogProps) => {
|
||||||
const { mapId, onClose } = props;
|
|
||||||
const { map } = fetchMapById(mapId);
|
const { map } = fetchMapById(mapId);
|
||||||
|
|
||||||
const client: Client = useSelector(activeInstance);
|
const client: Client = useSelector(activeInstance);
|
||||||
@ -40,7 +39,7 @@ const PublishDialog = (props: SimpleDialogProps) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const handleOnClose = (): void => {
|
const handleOnClose = (): void => {
|
||||||
props.onClose();
|
onClose();
|
||||||
setError(undefined);
|
setError(undefined);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -16,11 +16,10 @@ export type RenameModel = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const defaultModel: RenameModel = { title: '', description: '', id: -1 };
|
const defaultModel: RenameModel = { title: '', description: '', id: -1 };
|
||||||
const RenameDialog = (props: SimpleDialogProps) => {
|
const RenameDialog = ({ mapId, onClose }: SimpleDialogProps) => {
|
||||||
const service: Client = useSelector(activeInstance);
|
const service: Client = useSelector(activeInstance);
|
||||||
const [model, setModel] = React.useState<RenameModel>(defaultModel);
|
const [model, setModel] = React.useState<RenameModel>(defaultModel);
|
||||||
const [error, setError] = React.useState<ErrorInfo>();
|
const [error, setError] = React.useState<ErrorInfo>();
|
||||||
const { mapId } = props;
|
|
||||||
|
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
@ -31,7 +30,7 @@ const RenameDialog = (props: SimpleDialogProps) => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
handleOnMutationSuccess(props.onClose, queryClient);
|
handleOnMutationSuccess(onClose, queryClient);
|
||||||
},
|
},
|
||||||
onError: (error) => {
|
onError: (error) => {
|
||||||
setError(error);
|
setError(error);
|
||||||
@ -40,7 +39,7 @@ const RenameDialog = (props: SimpleDialogProps) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const handleOnClose = (): void => {
|
const handleOnClose = (): void => {
|
||||||
props.onClose();
|
onClose();
|
||||||
setModel(defaultModel);
|
setModel(defaultModel);
|
||||||
setError(undefined);
|
setError(undefined);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user