chore: run prettier
This commit is contained in:
parent
9cdbbc3a00
commit
155d7bb876
76 changed files with 788 additions and 550 deletions
|
@ -1,11 +1,28 @@
|
|||
import http from '@/api/http';
|
||||
import { Mount, rawDataToMount } from '@/api/admin/mounts/getMounts';
|
||||
|
||||
export default (name: string, description: string, source: string, target: string, readOnly: boolean, userMountable: boolean, include: string[] = []): Promise<Mount> => {
|
||||
export default (
|
||||
name: string,
|
||||
description: string,
|
||||
source: string,
|
||||
target: string,
|
||||
readOnly: boolean,
|
||||
userMountable: boolean,
|
||||
include: string[] = [],
|
||||
): Promise<Mount> => {
|
||||
return new Promise((resolve, reject) => {
|
||||
http.post('/api/application/mounts', {
|
||||
name, description, source, target, read_only: readOnly, user_mountable: userMountable,
|
||||
}, { params: { include: include.join(',') } })
|
||||
http.post(
|
||||
'/api/application/mounts',
|
||||
{
|
||||
name,
|
||||
description,
|
||||
source,
|
||||
target,
|
||||
read_only: readOnly,
|
||||
user_mountable: userMountable,
|
||||
},
|
||||
{ params: { include: include.join(',') } },
|
||||
)
|
||||
.then(({ data }) => resolve(rawDataToMount(data)))
|
||||
.catch(reject);
|
||||
});
|
||||
|
|
|
@ -40,7 +40,9 @@ export const rawDataToMount = ({ attributes }: FractalResponseData): Mount => ({
|
|||
relations: {
|
||||
eggs: ((attributes.relationships?.eggs as FractalResponseList | undefined)?.data || []).map(rawDataToEgg),
|
||||
nodes: ((attributes.relationships?.nodes as FractalResponseList | undefined)?.data || []).map(rawDataToNode),
|
||||
servers: ((attributes.relationships?.servers as FractalResponseList | undefined)?.data || []).map(rawDataToServer),
|
||||
servers: ((attributes.relationships?.servers as FractalResponseList | undefined)?.data || []).map(
|
||||
rawDataToServer,
|
||||
),
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -69,12 +71,14 @@ export default (include: string[] = []) => {
|
|||
params.sort = (sortDirection ? '-' : '') + sort;
|
||||
}
|
||||
|
||||
return useSWR<PaginatedResult<Mount>>([ 'mounts', page, filters, sort, sortDirection ], async () => {
|
||||
const { data } = await http.get('/api/application/mounts', { params: { include: include.join(','), page, ...params } });
|
||||
return useSWR<PaginatedResult<Mount>>(['mounts', page, filters, sort, sortDirection], async () => {
|
||||
const { data } = await http.get('/api/application/mounts', {
|
||||
params: { include: include.join(','), page, ...params },
|
||||
});
|
||||
|
||||
return ({
|
||||
return {
|
||||
items: (data.data || []).map(rawDataToMount),
|
||||
pagination: getPaginationSet(data.meta.pagination),
|
||||
});
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
@ -1,11 +1,29 @@
|
|||
import http from '@/api/http';
|
||||
import { Mount, rawDataToMount } from '@/api/admin/mounts/getMounts';
|
||||
|
||||
export default (id: number, name: string, description: string | null, source: string, target: string, readOnly: boolean, userMountable: boolean, include: string[] = []): Promise<Mount> => {
|
||||
export default (
|
||||
id: number,
|
||||
name: string,
|
||||
description: string | null,
|
||||
source: string,
|
||||
target: string,
|
||||
readOnly: boolean,
|
||||
userMountable: boolean,
|
||||
include: string[] = [],
|
||||
): Promise<Mount> => {
|
||||
return new Promise((resolve, reject) => {
|
||||
http.patch(`/api/application/mounts/${id}`, {
|
||||
name, description, source, target, read_only: readOnly, user_mountable: userMountable,
|
||||
}, { params: { include: include.join(',') } })
|
||||
http.patch(
|
||||
`/api/application/mounts/${id}`,
|
||||
{
|
||||
name,
|
||||
description,
|
||||
source,
|
||||
target,
|
||||
read_only: readOnly,
|
||||
user_mountable: userMountable,
|
||||
},
|
||||
{ params: { include: include.join(',') } },
|
||||
)
|
||||
.then(({ data }) => resolve(rawDataToMount(data)))
|
||||
.catch(reject);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue