Basic backend support to at least store a backup model in the DB
This commit is contained in:
parent
6d426e45d9
commit
d27f0c6f2a
10 changed files with 138 additions and 18 deletions
|
@ -6,7 +6,7 @@ export default (uuid: string, name?: string, ignore?: string): Promise<ServerBac
|
|||
http.post(`/api/client/servers/${uuid}/backups`, {
|
||||
name, ignore,
|
||||
})
|
||||
.then(({ data }) => resolve(rawDataToServerBackup(data.attributes)))
|
||||
.then(({ data }) => resolve(rawDataToServerBackup(data)))
|
||||
.catch(reject);
|
||||
});
|
||||
};
|
||||
|
|
|
@ -3,7 +3,7 @@ import http, { FractalResponseData, getPaginationSet, PaginatedResult } from '@/
|
|||
export interface ServerBackup {
|
||||
uuid: string;
|
||||
name: string;
|
||||
contents: string;
|
||||
ignoredFiles: string;
|
||||
sha256Hash: string;
|
||||
bytes: number;
|
||||
createdAt: Date;
|
||||
|
@ -13,7 +13,7 @@ export interface ServerBackup {
|
|||
export const rawDataToServerBackup = ({ attributes }: FractalResponseData): ServerBackup => ({
|
||||
uuid: attributes.uuid,
|
||||
name: attributes.name,
|
||||
contents: attributes.contents,
|
||||
ignoredFiles: attributes.ignored_files,
|
||||
sha256Hash: attributes.sha256_hash,
|
||||
bytes: attributes.bytes,
|
||||
createdAt: new Date(attributes.created_at),
|
||||
|
|
|
@ -96,7 +96,9 @@ export default ({ onBackupGenerated }: Props) => {
|
|||
onSubmit={submit}
|
||||
initialValues={{ name: '', ignored: '' }}
|
||||
validationSchema={object().shape({
|
||||
name: string().max(255),
|
||||
name: string().required()
|
||||
.matches(/^[w\][\w\s_.-]*[\w]$/, 'Backup name must only contain alpha-numeric characters, spaces, underscores, dashes, and periods. The name must start and end with an alpha-numeric character.')
|
||||
.max(255),
|
||||
ignored: string(),
|
||||
})}
|
||||
>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue