Merge pull request #2088 from Sir3lit/changebackup

Backup page edits, Shows client x of x backups when limit > 0. Removes create button if limit is reached or limit is 0
This commit is contained in:
Dane Everitt 2020-06-23 19:26:43 -07:00 committed by GitHub
commit 24852b8982
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -12,7 +12,7 @@ import { ServerContext } from '@/state/server';
import PageContentBlock from '@/components/elements/PageContentBlock'; import PageContentBlock from '@/components/elements/PageContentBlock';
export default () => { export default () => {
const { uuid } = useServer(); const { uuid, featureLimits } = useServer();
const { addError, clearFlashes } = useFlash(); const { addError, clearFlashes } = useFlash();
const [ loading, setLoading ] = useState(true); const [ loading, setLoading ] = useState(true);
@ -37,6 +37,11 @@ export default () => {
return ( return (
<PageContentBlock> <PageContentBlock>
<FlashMessageRender byKey={'backups'} className={'mb-4'}/> <FlashMessageRender byKey={'backups'} className={'mb-4'}/>
{featureLimits.backups !== 0 &&
<p className="text-center text-md text-neutral-400">
You are currently using {backups.length} of {featureLimits.backups} backups.
</p>
}
{!backups.length ? {!backups.length ?
<p className="text-center text-sm text-neutral-400"> <p className="text-center text-sm text-neutral-400">
There are no backups stored for this server. There are no backups stored for this server.
@ -50,10 +55,17 @@ export default () => {
/>)} />)}
</div> </div>
} }
{featureLimits.backups === 0 &&
<p className="text-center text-sm text-neutral-400">
Backups cannot be created for this server.
</p>
}
<Can action={'backup.create'}> <Can action={'backup.create'}>
{featureLimits.backups > 0 && featureLimits.backups !== backups.length &&
<div className={'mt-6 flex justify-end'}> <div className={'mt-6 flex justify-end'}>
<CreateBackupButton/> <CreateBackupButton/>
</div> </div>
}
</Can> </Can>
</PageContentBlock> </PageContentBlock>
); );