Build out frontend for viewing server backups
This commit is contained in:
parent
44ff99e83d
commit
ad9194a65c
2 changed files with 53 additions and 7 deletions
47
resources/scripts/components/server/backups/BackupRow.tsx
Normal file
47
resources/scripts/components/server/backups/BackupRow.tsx
Normal file
|
@ -0,0 +1,47 @@
|
|||
import React from 'react';
|
||||
import { ServerBackup } from '@/api/server/backups/getServerBackups';
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
import { faArchive } from '@fortawesome/free-solid-svg-icons/faArchive';
|
||||
import format from 'date-fns/format';
|
||||
import distanceInWordsToNow from 'date-fns/distance_in_words_to_now'
|
||||
import Spinner from '@/components/elements/Spinner';
|
||||
import { faCloudDownloadAlt } from '@fortawesome/free-solid-svg-icons/faCloudDownloadAlt';
|
||||
|
||||
interface Props {
|
||||
backup: ServerBackup;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export default ({ backup, className }: Props) => {
|
||||
return (
|
||||
<div className={`grey-row-box flex items-center ${className}`}>
|
||||
<div className={'mr-4'}>
|
||||
<FontAwesomeIcon icon={faArchive} className={'text-neutral-300'}/>
|
||||
</div>
|
||||
<div className={'flex-1'}>
|
||||
<p className={'text-sm mb-1'}>{backup.name}</p>
|
||||
<p className={'text-xs text-neutral-400 font-mono'}>{backup.uuid}</p>
|
||||
</div>
|
||||
<div className={'ml-4 text-center'}>
|
||||
<p
|
||||
title={format(backup.createdAt, 'ddd, MMMM Do, YYYY HH:mm:ss Z')}
|
||||
className={'text-sm'}
|
||||
>
|
||||
{distanceInWordsToNow(backup.createdAt, { includeSeconds: true, addSuffix: true })}
|
||||
</p>
|
||||
<p className={'text-2xs text-neutral-500 uppercase mt-1'}>Created</p>
|
||||
</div>
|
||||
<div className={'ml-6'} style={{ marginRight: '-0.5rem' }}>
|
||||
{!backup.completedAt ?
|
||||
<div title={'Backup is in progress'} className={'p-2'}>
|
||||
<Spinner size={'tiny'}/>
|
||||
</div>
|
||||
:
|
||||
<a href={'#'} className={'text-sm text-neutral-300 p-2 transition-colors duration-250 hover:text-cyan-400'}>
|
||||
<FontAwesomeIcon icon={faCloudDownloadAlt}/>
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
Reference in a new issue