From 48869d2eda81cc09ce593475f328e0e59a6bfc51 Mon Sep 17 00:00:00 2001 From: Charles Morgan Date: Tue, 2 Jun 2020 23:14:16 -0400 Subject: [PATCH 1/3] Remove create backup button if limit = 0, display message none can be created Removes the create button if the limit is 0, just like it does with the database page Also once limit is reached the create button is removed from view. --- .../components/server/backups/BackupContainer.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/resources/scripts/components/server/backups/BackupContainer.tsx b/resources/scripts/components/server/backups/BackupContainer.tsx index 438c201fb..1d162493c 100644 --- a/resources/scripts/components/server/backups/BackupContainer.tsx +++ b/resources/scripts/components/server/backups/BackupContainer.tsx @@ -12,7 +12,7 @@ import { ServerContext } from '@/state/server'; import PageContentBlock from '@/components/elements/PageContentBlock'; export default () => { - const { uuid } = useServer(); + const { uuid, featureLimits } = useServer(); const { addError, clearFlashes } = useFlash(); const [ loading, setLoading ] = useState(true); @@ -50,10 +50,17 @@ export default () => { />)} } + {featureLimits.backups === 0 && +

+ Backups cannot be created for this server. +

+ } + {featureLimits.backups > 0 && featureLimits.backups !== backups.length &&
+ }
); From e3ac93359189b0cac74e3fc6508cc3f0a02ecb70 Mon Sep 17 00:00:00 2001 From: Charles Morgan Date: Tue, 2 Jun 2020 23:27:10 -0400 Subject: [PATCH 2/3] Add using x of x when limit > 0 Added a using x of x so the end user knows how many they have and are using. --- .../scripts/components/server/backups/BackupContainer.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/resources/scripts/components/server/backups/BackupContainer.tsx b/resources/scripts/components/server/backups/BackupContainer.tsx index 1d162493c..7a4b18d2f 100644 --- a/resources/scripts/components/server/backups/BackupContainer.tsx +++ b/resources/scripts/components/server/backups/BackupContainer.tsx @@ -37,6 +37,11 @@ export default () => { return ( + {featureLimits.backups >= 0 && +

+ You are currently using {backups.length} of {featureLimits.backups} backups. +

+ } {!backups.length ?

There are no backups stored for this server. From 2c326dcbe7c2323a162394badd3bca7594d31a2a Mon Sep 17 00:00:00 2001 From: Charles Morgan Date: Tue, 2 Jun 2020 23:30:43 -0400 Subject: [PATCH 3/3] Fix condition Fix condition for using message --- resources/scripts/components/server/backups/BackupContainer.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/scripts/components/server/backups/BackupContainer.tsx b/resources/scripts/components/server/backups/BackupContainer.tsx index 7a4b18d2f..7e719aab9 100644 --- a/resources/scripts/components/server/backups/BackupContainer.tsx +++ b/resources/scripts/components/server/backups/BackupContainer.tsx @@ -37,7 +37,7 @@ export default () => { return ( - {featureLimits.backups >= 0 && + {featureLimits.backups !== 0 &&

You are currently using {backups.length} of {featureLimits.backups} backups.