Merge branch 'develop' into feature/react-admin
This commit is contained in:
commit
a87fef37ec
77 changed files with 1082 additions and 839 deletions
5
resources/scripts/api/server/backups/index.ts
Normal file
5
resources/scripts/api/server/backups/index.ts
Normal file
|
@ -0,0 +1,5 @@
|
|||
import http from '@/api/http';
|
||||
|
||||
export const restoreServerBackup = async (uuid: string, backup: string): Promise<void> => {
|
||||
await http.post(`/api/client/servers/${uuid}/backups/${backup}/restore`);
|
||||
};
|
|
@ -1,6 +1,6 @@
|
|||
import http, { FractalResponseData, FractalResponseList } from '@/api/http';
|
||||
import { rawDataToServerAllocation, rawDataToServerEggVariable } from '@/api/transformers';
|
||||
import { ServerEggVariable } from '@/api/server/types';
|
||||
import { ServerEggVariable, ServerStatus } from '@/api/server/types';
|
||||
|
||||
export interface Allocation {
|
||||
id: number;
|
||||
|
@ -17,6 +17,7 @@ export interface Server {
|
|||
uuid: string;
|
||||
name: string;
|
||||
node: string;
|
||||
status: ServerStatus;
|
||||
sftpDetails: {
|
||||
ip: string;
|
||||
port: number;
|
||||
|
@ -38,7 +39,6 @@ export interface Server {
|
|||
allocations: number;
|
||||
backups: number;
|
||||
};
|
||||
isSuspended: boolean;
|
||||
isInstalling: boolean;
|
||||
isTransferring: boolean;
|
||||
variables: ServerEggVariable[];
|
||||
|
@ -51,6 +51,7 @@ export const rawDataToServerObject = ({ attributes: data }: FractalResponseData)
|
|||
uuid: data.uuid,
|
||||
name: data.name,
|
||||
node: data.node,
|
||||
status: data.status,
|
||||
invocation: data.invocation,
|
||||
dockerImage: data.docker_image,
|
||||
sftpDetails: {
|
||||
|
@ -61,8 +62,7 @@ export const rawDataToServerObject = ({ attributes: data }: FractalResponseData)
|
|||
limits: { ...data.limits },
|
||||
eggFeatures: data.egg_features || [],
|
||||
featureLimits: { ...data.feature_limits },
|
||||
isSuspended: data.is_suspended,
|
||||
isInstalling: data.is_installing,
|
||||
isInstalling: data.status === 'installing' || data.status === 'install_failed',
|
||||
isTransferring: data.is_transferring,
|
||||
variables: ((data.relationships?.variables as FractalResponseList | undefined)?.data || []).map(rawDataToServerEggVariable),
|
||||
allocations: ((data.relationships?.allocations as FractalResponseList | undefined)?.data || []).map(rawDataToServerAllocation),
|
||||
|
|
2
resources/scripts/api/server/types.d.ts
vendored
2
resources/scripts/api/server/types.d.ts
vendored
|
@ -1,3 +1,5 @@
|
|||
export type ServerStatus = 'installing' | 'install_failed' | 'suspended' | 'restoring_backup' | null;
|
||||
|
||||
export interface ServerBackup {
|
||||
uuid: string;
|
||||
isSuccessful: boolean;
|
||||
|
|
|
@ -32,6 +32,7 @@ export const rawDataToFileObject = (data: FractalResponseData): FileObject => ({
|
|||
'application/x-br', // .tar.br
|
||||
'application/x-bzip2', // .tar.bz2, .bz2
|
||||
'application/gzip', // .tar.gz, .gz
|
||||
'application/x-gzip',
|
||||
'application/x-lzip', // .tar.lz4, .lz4 (not sure if this mime type is correct)
|
||||
'application/x-sz', // .tar.sz, .sz (not sure if this mime type is correct)
|
||||
'application/x-xz', // .tar.xz, .xz
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue