Skip to content

Commit

Permalink
[PLAT-10695][PLAT][Restore Tablespace] Restore tablespace option is m…
Browse files Browse the repository at this point in the history
…issing for Incremental Backup

Summary:
This diff contains fixes for multiple tickets

[[ https://yugabyte.atlassian.net/browse/PLAT-10696 | PLAT-10696 ]] - [PLAT] Add verifying loading icon on using back option in restore flow - **Instead of changing the loading state on universe select, now we change the loading state on isFetching**

[[ https://yugabyte.atlassian.net/browse/PLAT-10712 | PLAT-10712 ]] - [PLAT][Restore History] Remove Aborted filter from Restore History - **Removed the abort state**

[[ https://yugabyte.atlassian.net/browse/PLAT-10695 | PLAT-10695 ]] - [PLAT][Restore Tablespace] Restore tablespace option is missing for Incremental Backup - **Added the missing tablespaces attribute to the payload**

[[ https://yugabyte.atlassian.net/browse/PLAT-10673 | PLAT-10673 ]] - [PLAT] Copy Backup location button looks like disabled in Restore History - **Increased the opacity**

[[ https://yugabyte.atlassian.net/browse/PLAT-10672 | PLAT-10672 ]] - [PLAT] Target Universe link is not clickable in Restore History - **Added link to the universe**

[[ https://yugabyte.atlassian.net/browse/PLAT-10634 | PLAT-10634 ]] - [Platform][2.20]Remove hyperlink for Backup source deleted universe in Restore History - **removed the link**

Test Plan:
Tested manually

{F118265}

Reviewers: asathyan, lsangappa, jmak, rmadhavan

Reviewed By: lsangappa

Subscribers: yugaware

Differential Revision: https://phorge.dev.yugabyte.com/D29061
  • Loading branch information
haikarthikssk committed Oct 11, 2023
1 parent 5159eb3 commit bdda250
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 31 deletions.
3 changes: 2 additions & 1 deletion managed/ui/src/components/backupv2/common/BackupAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,8 @@ export const addIncrementalBackup = (backup: IBackup) => {
universeUUID: backup.universeUUID,
baseBackupUUID: backup.commonBackupInfo.baseBackupUUID,
keyspaceTableList: backup.commonBackupInfo.responseList,
tableByTableBackup: backup.commonBackupInfo.tableByTableBackup
tableByTableBackup: backup.commonBackupInfo.tableByTableBackup,
useTablespaces: backup.useTablespaces
};

return axios.post(requestUrl, payload);
Expand Down
1 change: 1 addition & 0 deletions managed/ui/src/components/backupv2/common/IBackup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export interface IBackup {
fullChainSizeInBytes: number;
kmsConfigUUID?: null | string;
scheduleName: string;
useTablespaces: boolean;
}

export interface IBackupEditParams {
Expand Down
4 changes: 0 additions & 4 deletions managed/ui/src/components/backupv2/common/IRestore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,5 @@ export const RESTORE_STATUS_OPTIONS: { value: Restore_States | null; label: stri
{
label: 'Failed',
value: Restore_States.FAILED
},
{
label: 'Aborted',
value: Restore_States.ABORTED
}
];
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,6 @@ export const GeneralSettings = React.forwardRef<PageRef>((_, forwardRef) => {
methods.setValue('forceKeyspaceRename', false);
methods.setValue('renameKeyspace', false);

setDisableSubmit(true);
setisSubmitting(true);
setSubmitLabel(t('newRestoreModal.generalSettings.verifying'));
}, [targetUniverseUUID]);

// send the preflight api request , when the user choses the universe
Expand Down Expand Up @@ -182,6 +179,15 @@ export const GeneralSettings = React.forwardRef<PageRef>((_, forwardRef) => {
methods.setValue('useTablespaces', false);
}, [setDisableSubmit, targetUniverseUUID]);


useEffect(() => {
if (isFetching) {
setDisableSubmit(true);
setisSubmitting(true);
setSubmitLabel(t('newRestoreModal.generalSettings.verifying'));
}
}, [isFetching]);

const renameKeyspace = watch('renameKeyspace');
const tableSelectionType = watch('tableSelectionType');

Expand Down
13 changes: 11 additions & 2 deletions managed/ui/src/components/backupv2/restore/Restore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { Link } from 'react-router';
import { useMethods } from 'react-use';
import { RemoteObjSpec, SortOrder, TableHeaderColumn } from 'react-bootstrap-table';
import { useQuery } from 'react-query';
import { find } from 'lodash';
import Select, { OptionTypeBase } from 'react-select';
import { Badge_Types, StatusBadge } from '../../common/badge/StatusBadge';
import { YBMultiSelectRedesiged } from '../../common/forms/fields';
Expand All @@ -28,6 +29,7 @@ import {
import { TIME_RANGE_STATE } from '../common/IBackup';
import { IRestore, RESTORE_STATUS_OPTIONS } from '../common/IRestore';
import { getRestoreList } from '../common/RestoreAPI';
import { api } from '../../../redesign/helpers/api';
import { DEFAULT_TIME_STATE, TIME_RANGE_OPTIONS } from '../components/BackupList';
import { RestoreEmpty } from './RestoreEmpty';
import { ybFormatDate } from '../../../redesign/helpers/DateUtils';
Expand Down Expand Up @@ -86,6 +88,13 @@ export const Restore: FC<RestoreProps> = ({ universeUUID, type }) => {
initialRestoreDetailsContextState
);

const { data: universesList } = useQuery(['universes'], () => api.fetchUniverseList(),
{
refetchOnMount: false
}

);

const [, { setSelectedRestore }] = restoreDetailsContextData;

const { data: restoreList, isLoading } = useQuery(
Expand Down Expand Up @@ -135,7 +144,7 @@ export const Restore: FC<RestoreProps> = ({ universeUUID, type }) => {

const getUniverseLink = (row: IRestore, type: 'SOURCE' | 'TARGET') => {
if (type === 'SOURCE' && row.sourceUniverseName) {
if (row.isSourceUniversePresent) {
if (find(universesList, { universeUUID: row.sourceUniverseUUID })) {
return (
<Link
target="_blank"
Expand All @@ -151,7 +160,7 @@ export const Restore: FC<RestoreProps> = ({ universeUUID, type }) => {
}
return row.sourceUniverseName;
}
if (type === 'TARGET' && row.targetUniverseName) {
if (type === 'TARGET' && find(universesList, { universeUUID: row.universeUUID })) {
return (
<Link
target="_blank"
Expand Down
85 changes: 64 additions & 21 deletions managed/ui/src/components/backupv2/restore/RestoreDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

import { FC, useContext } from 'react';
import copy from 'copy-to-clipboard';
import { useQuery } from 'react-query';
import { find } from 'lodash';
import { Link } from 'react-router';
import { useTranslation } from 'react-i18next';

Expand All @@ -18,6 +20,7 @@ import { YBButton } from '../../../redesign/components';
import { formatBytes } from '../../xcluster/ReplicationUtils';
import { ENTITY_NOT_AVAILABLE, calculateDuration } from '../common/BackupUtils';
import { Badge_Types, StatusBadge } from '../../common/badge/StatusBadge';
import { api } from '../../../redesign/helpers/api';
import { ybFormatDate } from '../../../redesign/helpers/DateUtils';
import { IRestore } from '../common/IRestore';
import { RestoreContextMethods, RestoreDetailsContext } from './RestoreContext';
Expand Down Expand Up @@ -87,8 +90,6 @@ const useStyles = makeStyles((theme) => ({
cursor: 'pointer'
},
header: {
color: theme.palette.orange[500],
textDecoration: 'underline',
marginTop: theme.spacing(1)
},
divider: {
Expand All @@ -102,6 +103,10 @@ const useStyles = makeStyles((theme) => ({
columnGap: '72px',
flexWrap: 'wrap',
rowGap: '24px'
},
link: {
color: theme.palette.orange[500],
textDecoration: 'underline',
}
}));

Expand All @@ -115,6 +120,13 @@ export const RestoreDetails = () => {
keyPrefix: 'restore.restoreDetails'
});

const { data: universesList } = useQuery(['universes'], () => api.fetchUniverseList(),
{
refetchOnMount: false
}

);

if (!selectedRestore) return null;

return (
Expand All @@ -138,31 +150,62 @@ export const RestoreDetails = () => {
{t('sourceUniverse')}
</Typography>
<CopyUUID uuid={selectedRestore.sourceUniverseUUID} />
<Link
target="_blank"
to={`/universes/${selectedRestore.sourceUniverseUUID}`}
onClick={(e) => {
e.stopPropagation();
}}
>
<div className={classes.header}>
{selectedRestore.sourceUniverseName
? selectedRestore.sourceUniverseName
: ENTITY_NOT_AVAILABLE}
</div>
</Link>
{
find(universesList, { universeUUID: selectedRestore.sourceUniverseUUID }) ? (
<Link
target="_blank"
to={`/universes/${selectedRestore.sourceUniverseUUID}`}
className={classes.link}
onClick={(e) => {
e.stopPropagation();
}}
>
<div className={classes.header}>
{selectedRestore.sourceUniverseName
? selectedRestore.sourceUniverseName
: ENTITY_NOT_AVAILABLE}
</div>
</Link>
) : (
<div className={classes.header}>
{selectedRestore.sourceUniverseName
? selectedRestore.sourceUniverseName
: ENTITY_NOT_AVAILABLE}
</div>
)
}
</div>
<img className={classes.arrowIcon} src={ArrowRight} alt="arrowRight" />
<div>
<Typography variant="body1" component="span">
{t('targetUniverse')}
</Typography>
<CopyUUID uuid={selectedRestore.universeUUID} />
<div className={classes.header}>
{selectedRestore.targetUniverseName
? selectedRestore.targetUniverseName
: ENTITY_NOT_AVAILABLE}
</div>
{
find(universesList, { universeUUID: selectedRestore.universeUUID }) ? (
<Link
target="_blank"
to={`/universes/${selectedRestore.universeUUID}`}
className={classes.link}
onClick={(e) => {
e.stopPropagation();
}}
>
<div className={classes.header}>
{selectedRestore.targetUniverseName
? selectedRestore.targetUniverseName
: ENTITY_NOT_AVAILABLE}
</div>
</Link>
) : (
<div className={classes.header}>
{selectedRestore.targetUniverseName
? selectedRestore.targetUniverseName
: ENTITY_NOT_AVAILABLE}
</div>
)
}

</div>
</div>
<div className={classes.divider} />
Expand Down Expand Up @@ -267,7 +310,7 @@ const RestoreDBDetailsStyles = makeStyles((theme) => ({
},
copyButton: {
padding: '5px 10px',
opacity: 0.5
opacity: 0.9
},
buttonLabel: {
color: theme.palette.ybacolors.ybDarkGray,
Expand Down

0 comments on commit bdda250

Please sign in to comment.