From 2570b4e2d0ca8ba55a6c94ac30d6701ce102e56f Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sat, 7 Dec 2019 15:58:37 -0800 Subject: [PATCH] Base code for settings and schedules --- .../Api/Client/ServerTransformer.php | 4 ++ resources/scripts/api/server/getServer.ts | 8 ++++ .../server/schedules/ScheduleContainer.tsx | 3 ++ .../server/settings/SettingsContainer.tsx | 43 +++++++++++++++++++ resources/scripts/routers/ServerRouter.tsx | 6 +++ 5 files changed, 64 insertions(+) create mode 100644 resources/scripts/components/server/schedules/ScheduleContainer.tsx create mode 100644 resources/scripts/components/server/settings/SettingsContainer.tsx diff --git a/app/Transformers/Api/Client/ServerTransformer.php b/app/Transformers/Api/Client/ServerTransformer.php index 7805c4bf4..b43e11346 100644 --- a/app/Transformers/Api/Client/ServerTransformer.php +++ b/app/Transformers/Api/Client/ServerTransformer.php @@ -35,6 +35,10 @@ class ServerTransformer extends BaseClientTransformer 'uuid' => $server->uuid, 'name' => $server->name, 'node' => $server->node->name, + 'sftp_details' => [ + 'ip' => $server->node->fqdn, + 'port' => $server->node->daemonSFTP, + ], 'description' => $server->description, 'allocation' => [ 'ip' => $server->allocation->alias, diff --git a/resources/scripts/api/server/getServer.ts b/resources/scripts/api/server/getServer.ts index 7d1149f34..e6a89fd1a 100644 --- a/resources/scripts/api/server/getServer.ts +++ b/resources/scripts/api/server/getServer.ts @@ -12,6 +12,10 @@ export interface Server { uuid: string; name: string; node: string; + sftpDetails: { + ip: string; + port: number; + }; description: string; allocations: Allocation[]; limits: { @@ -32,6 +36,10 @@ export const rawDataToServerObject = (data: any): Server => ({ uuid: data.uuid, name: data.name, node: data.node, + sftpDetails: { + ip: data.sftp_details.ip, + port: data.sftp_details.port, + }, description: data.description ? ((data.description.length > 0) ? data.description : null) : null, allocations: [{ ip: data.allocation.ip, diff --git a/resources/scripts/components/server/schedules/ScheduleContainer.tsx b/resources/scripts/components/server/schedules/ScheduleContainer.tsx new file mode 100644 index 000000000..1f0240db0 --- /dev/null +++ b/resources/scripts/components/server/schedules/ScheduleContainer.tsx @@ -0,0 +1,3 @@ +import React from 'react'; + +export default () => null; diff --git a/resources/scripts/components/server/settings/SettingsContainer.tsx b/resources/scripts/components/server/settings/SettingsContainer.tsx new file mode 100644 index 000000000..65231ebee --- /dev/null +++ b/resources/scripts/components/server/settings/SettingsContainer.tsx @@ -0,0 +1,43 @@ +import React from 'react'; +import TitledGreyBox from '@/components/elements/TitledGreyBox'; +import { ServerContext } from '@/state/server'; +import { useStoreState } from 'easy-peasy'; +import { ApplicationStore } from '@/state'; +import { UserData } from '@/state/user'; + +export default () => { + const user = useStoreState(state => state.user.data!); + const server = ServerContext.useStoreState(state => state.server.data!); + + return ( +
+ +
+ + +
+
+ + +
+
+
+

+ Your SFTP password is the same as the password you use to access this panel. +

+
+
+
+
+ ); +}; diff --git a/resources/scripts/routers/ServerRouter.tsx b/resources/scripts/routers/ServerRouter.tsx index 38635f9d8..70ebf772d 100644 --- a/resources/scripts/routers/ServerRouter.tsx +++ b/resources/scripts/routers/ServerRouter.tsx @@ -13,6 +13,8 @@ import { CSSTransition } from 'react-transition-group'; import SuspenseSpinner from '@/components/elements/SuspenseSpinner'; import FileEditContainer from '@/components/server/files/FileEditContainer'; import UsersContainer from '@/components/server/users/UsersContainer'; +import ScheduleContainer from '@/components/server/schedules/ScheduleContainer'; +import SettingsContainer from '@/components/server/settings/SettingsContainer'; const ServerRouter = ({ match, location }: RouteComponentProps<{ id: string }>) => { const server = ServerContext.useStoreState(state => state.server.data); @@ -36,6 +38,8 @@ const ServerRouter = ({ match, location }: RouteComponentProps<{ id: string }>) File Manager Databases User Management + Schedules + Settings @@ -64,6 +68,8 @@ const ServerRouter = ({ match, location }: RouteComponentProps<{ id: string }>) /> + + }