admin(ui): use new node port columns

This commit is contained in:
Matthew Penner 2021-02-11 10:21:49 -07:00
parent 5f56ff0fed
commit 3c2094890a
7 changed files with 160 additions and 28 deletions

View file

@ -11,6 +11,10 @@ export interface Node {
description: string | null;
locationId: number;
fqdn: string;
listenPortHTTP: number;
publicPortHTTP: number;
listenPortSFTP: number;
publicPortSFTP: number;
scheme: string;
behindProxy: boolean;
maintenanceMode: boolean;
@ -19,8 +23,6 @@ export interface Node {
disk: number;
diskOverallocate: number;
uploadSize: number;
daemonListen: number;
daemonSftp: number;
daemonBase: string;
createdAt: Date;
updatedAt: Date;
@ -38,6 +40,10 @@ export const rawDataToNode = ({ attributes }: FractalResponseData): Node => ({
description: attributes.description,
locationId: attributes.location_id,
fqdn: attributes.fqdn,
listenPortHTTP: attributes.listen_port_http,
publicPortHTTP: attributes.public_port_http,
listenPortSFTP: attributes.listen_port_sftp,
publicPortSFTP: attributes.public_port_sftp,
scheme: attributes.scheme,
behindProxy: attributes.behind_proxy,
maintenanceMode: attributes.maintenance_mode,
@ -46,8 +52,6 @@ export const rawDataToNode = ({ attributes }: FractalResponseData): Node => ({
disk: attributes.disk,
diskOverallocate: attributes.disk_overallocate,
uploadSize: attributes.upload_size,
daemonListen: attributes.daemon_listen,
daemonSftp: attributes.daemon_sftp,
daemonBase: attributes.daemon_base,
createdAt: new Date(attributes.created_at),
updatedAt: new Date(attributes.updated_at),

View file

@ -1,10 +1,10 @@
import http from '@/api/http';
import { Node, rawDataToNode } from '@/api/admin/nodes/getNodes';
export default (id: number, name: string, description: string | null, include: string[] = []): Promise<Node> => {
export default (id: number, node: Partial<Node>, include: string[] = []): Promise<Node> => {
return new Promise((resolve, reject) => {
http.patch(`/api/application/nodes/${id}`, {
name, description,
...node,
}, { params: { include: include.join(',') } })
.then(({ data }) => resolve(rawDataToNode(data)))
.catch(reject);