Re-enable debugbar, add table to ServersContainer.tsx

This commit is contained in:
Matthew Penner 2021-01-05 09:17:44 -07:00
parent ed73f6a020
commit 8f1a5bf0ab
15 changed files with 446 additions and 82 deletions

View file

@ -1,5 +1,4 @@
import http from '@/api/http';
import { rawDataToEgg } from '@/api/transformers';
import http, { FractalResponseData } from '@/api/http';
export interface Egg {
id: number;
@ -25,6 +24,30 @@ export interface Egg {
updatedAt: Date;
}
export const rawDataToEgg = ({ attributes }: FractalResponseData): Egg => ({
id: attributes.id,
uuid: attributes.uuid,
nest_id: attributes.nest_id,
author: attributes.author,
name: attributes.name,
description: attributes.description,
features: attributes.features,
dockerImages: attributes.docker_images,
configFiles: attributes.config_files,
configStartup: attributes.config_startup,
configLogs: attributes.config_logs,
configStop: attributes.config_stop,
configFrom: attributes.config_from,
startup: attributes.startup,
scriptContainer: attributes.script_container,
copyScriptFrom: attributes.copy_script_from,
scriptEntry: attributes.script_entry,
scriptIsPrivileged: attributes.script_is_privileged,
scriptInstall: attributes.script_install,
createdAt: new Date(attributes.created_at),
updatedAt: new Date(attributes.updated_at),
});
export default (id: number): Promise<Egg[]> => {
return new Promise((resolve, reject) => {
http.get(`/api/application/nests/${id}`)

View file

@ -1,5 +1,4 @@
import http, { getPaginationSet, PaginatedResult } from '@/api/http';
import { rawDataToNest } from '@/api/transformers';
import http, { FractalResponseData, getPaginationSet, PaginatedResult } from '@/api/http';
import { createContext, useContext } from 'react';
import useSWR from 'swr';
@ -13,6 +12,16 @@ export interface Nest {
updatedAt: Date;
}
export const rawDataToNest = ({ attributes }: FractalResponseData): Nest => ({
id: attributes.id,
uuid: attributes.uuid,
author: attributes.author,
name: attributes.name,
description: attributes.description,
createdAt: new Date(attributes.created_at),
updatedAt: new Date(attributes.updated_at),
});
interface ctx {
page: number;
setPage: (value: number | ((s: number) => number)) => void;