Add nest endpoints and pages
This commit is contained in:
parent
359769244f
commit
6c85be72fa
12 changed files with 473 additions and 10 deletions
12
resources/scripts/api/admin/nests/createNest.ts
Normal file
12
resources/scripts/api/admin/nests/createNest.ts
Normal file
|
@ -0,0 +1,12 @@
|
|||
import http from '@/api/http';
|
||||
import { Nest } from '@/api/admin/nests/getNests';
|
||||
|
||||
export default (name: string, description?: string): Promise<Nest> => {
|
||||
return new Promise((resolve, reject) => {
|
||||
http.post('/api/application/nests', {
|
||||
name, description,
|
||||
})
|
||||
.then(({ data }) => resolve(data.attributes))
|
||||
.catch(reject);
|
||||
});
|
||||
};
|
34
resources/scripts/api/admin/nests/eggs/getEggs.ts
Normal file
34
resources/scripts/api/admin/nests/eggs/getEggs.ts
Normal file
|
@ -0,0 +1,34 @@
|
|||
import http from '@/api/http';
|
||||
import { rawDataToEgg } from '@/api/transformers';
|
||||
|
||||
export interface Egg {
|
||||
id: number;
|
||||
uuid: string;
|
||||
nest_id: number;
|
||||
author: string;
|
||||
name: string;
|
||||
description: string | null;
|
||||
features: string[] | null;
|
||||
dockerImages: string[];
|
||||
configFiles: string | null;
|
||||
configStartup: string | null;
|
||||
configLogs: string | null;
|
||||
configStop: string | null;
|
||||
configFrom: number | null;
|
||||
startup: string;
|
||||
scriptContainer: string;
|
||||
copyScriptFrom: number | null;
|
||||
scriptEntry: string;
|
||||
scriptIsPrivileged: boolean;
|
||||
scriptInstall: string | null;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
}
|
||||
|
||||
export default (id: number): Promise<Egg[]> => {
|
||||
return new Promise((resolve, reject) => {
|
||||
http.get(`/api/application/nests/${id}`)
|
||||
.then(({ data }) => resolve((data.data || []).map(rawDataToEgg)))
|
||||
.catch(reject);
|
||||
});
|
||||
};
|
20
resources/scripts/api/admin/nests/getNests.ts
Normal file
20
resources/scripts/api/admin/nests/getNests.ts
Normal file
|
@ -0,0 +1,20 @@
|
|||
import http from '@/api/http';
|
||||
import { rawDataToNest } from '@/api/transformers';
|
||||
|
||||
export interface Nest {
|
||||
id: number;
|
||||
uuid: string;
|
||||
author: string;
|
||||
name: string;
|
||||
description: string | null;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
}
|
||||
|
||||
export default (): Promise<Nest[]> => {
|
||||
return new Promise((resolve, reject) => {
|
||||
http.get('/api/application/nests')
|
||||
.then(({ data }) => resolve((data.data || []).map(rawDataToNest)))
|
||||
.catch(reject);
|
||||
});
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue