From 61018b5e672ce00ed088541fb111092f031f0520 Mon Sep 17 00:00:00 2001 From: DaneEveritt Date: Mon, 20 Jun 2022 15:28:27 -0400 Subject: [PATCH] Update more of the UI to use new design elements --- .../scripts/components/elements/Code.tsx | 5 +- .../elements/button/style.module.css | 2 +- .../server/network/AllocationRow.tsx | 49 +++++++++---------- .../server/network/DeleteAllocationButton.tsx | 36 ++++++++------ .../server/network/NetworkContainer.tsx | 12 ++--- .../server/schedules/DeleteScheduleButton.tsx | 31 ++++++------ .../server/schedules/EditScheduleModal.tsx | 4 +- .../server/schedules/NewTaskButton.tsx | 5 +- .../server/schedules/RunScheduleButton.tsx | 8 ++- .../server/schedules/ScheduleContainer.tsx | 2 +- .../server/schedules/ScheduleCronRow.tsx | 34 ++++++------- .../schedules/ScheduleEditContainer.tsx | 12 ++--- .../server/schedules/TaskDetailsModal.tsx | 2 +- .../server/users/AddSubuserButton.tsx | 7 +-- 14 files changed, 100 insertions(+), 109 deletions(-) diff --git a/resources/scripts/components/elements/Code.tsx b/resources/scripts/components/elements/Code.tsx index 047ddecf0..30eac0d86 100644 --- a/resources/scripts/components/elements/Code.tsx +++ b/resources/scripts/components/elements/Code.tsx @@ -3,12 +3,13 @@ import classNames from 'classnames'; interface CodeProps { dark?: boolean | undefined; + className?: string; children: React.ReactChild | React.ReactFragment | React.ReactPortal; } -export default ({ dark, children }: CodeProps) => ( +export default ({ dark, className, children }: CodeProps) => ( { const [ loading, setLoading ] = useState(false); - const { clearFlashes, clearAndAddHttpError } = useFlash(); + const { clearFlashes, clearAndAddHttpError } = useFlashKey('server:network'); const uuid = ServerContext.useStoreState(state => state.server.data!.uuid); const { mutate } = getServerAllocations(); @@ -39,69 +39,64 @@ const AllocationRow = ({ allocation }: Props) => { const setAllocationNotes = debounce((notes: string) => { setLoading(true); - clearFlashes('server:network'); + clearFlashes(); setServerAllocationNotes(uuid, allocation.id, notes) .then(() => onNotesChanged(allocation.id, notes)) - .catch(error => clearAndAddHttpError({ key: 'server:network', error })) + .catch(error => clearAndAddHttpError(error)) .then(() => setLoading(false)); }, 750); const setPrimaryAllocation = () => { - clearFlashes('server:network'); + clearFlashes(); mutate(data => data?.map(a => ({ ...a, isDefault: a.id === allocation.id })), false); setPrimaryServerAllocation(uuid, allocation.id) .catch(error => { - clearAndAddHttpError({ key: 'server:network', error }); + clearAndAddHttpError(error); mutate(); }); }; return ( - -
-
+ +
+
-
+
{allocation.alias ? - {allocation.alias} : - {formatIp(allocation.ip)}} + {allocation.alias} : + {formatIp(allocation.ip)}}
-
- {allocation.port} +
+ {allocation.port}
-
+