ui(admin): add allocation table, implement allocation creator

This commit is contained in:
Matthew Penner 2021-09-12 19:40:10 -06:00
parent 6b746440fc
commit 3c01dbbcc5
No known key found for this signature in database
GPG key ID: 030E4AB751DC756F
14 changed files with 397 additions and 87 deletions

View file

@ -0,0 +1,16 @@
import http from '@/api/http';
import { Allocation, rawDataToAllocation } from '@/api/admin/nodes/allocations/getAllocations';
export interface Values {
ip: string;
ports: number[];
alias?: string;
}
export default (id: string | number, values: Values, include: string[] = []): Promise<Allocation[]> => {
return new Promise((resolve, reject) => {
http.post(`/api/application/nodes/${id}/allocations`, values, { params: { include: include.join(',') } })
.then(({ data }) => resolve((data || []).map(rawDataToAllocation)))
.catch(reject);
});
};