diff --git a/managed/ui/src/components/tables/CreateBackup/CreateBackup.js b/managed/ui/src/components/tables/CreateBackup/CreateBackup.js index 324368030cdd..ad655ba801e6 100644 --- a/managed/ui/src/components/tables/CreateBackup/CreateBackup.js +++ b/managed/ui/src/components/tables/CreateBackup/CreateBackup.js @@ -52,7 +52,7 @@ export default class CreateBackup extends Component { createUniverseBackup, universeTables } = this.props; - + if (isDefinedNotNull(values.storageConfigUUID)) { const payload = { "storageConfigUUID": values.storageConfigUUID, @@ -61,7 +61,12 @@ export default class CreateBackup extends Component { "schedulingFrequency": isEmptyString(values.schedulingFrequency) ? null : values.schedulingFrequency, "cronExpression": isNonEmptyString(values.cronExpression) ? values.cronExpression : null, }; - if (isDefinedNotNull(values.backupTableUUID) && values.backupTableUUID.length) { + if (isDefinedNotNull(values.tableKeyspace) && values.tableKeyspace.value === "allkeyspaces") { + // Backup all tables in all keyspaces + // AC: v2.1.8 No transactional backup for universe + payload.transactionalBackup = false; + createUniverseBackup(universeUUID, payload); + } else if (isDefinedNotNull(values.backupTableUUID) && values.backupTableUUID.length) { values.backupTableUUID = Array.isArray(values.backupTableUUID) ? values.backupTableUUID.map(x => x.value) : [values.backupTableUUID.value]; if (values.backupTableUUID[0] === "alltables") { @@ -176,23 +181,25 @@ export default class CreateBackup extends Component { const isKeyspaceSelected = tableKeyspace && tableKeyspace.value; const universeBackupSelected = isKeyspaceSelected && tableKeyspace.value === 'allkeyspaces'; const s3StorageSelected = storageConfigUUID && storageConfigUUID.label === 'S3 Storage'; - - const showTransactionalToggle = isKeyspaceSelected && + const showTransactionalToggle = isKeyspaceSelected && !universeBackupSelected && (!!isTableSelected && (backupTableUUID.length > 1 || backupTableUUID[0].value === 'alltables')); const displayedTables = [ { label: All Tables in Keyspace, value: "alltables", - }, - !universeBackupSelected && { + } + ]; + + if (!universeBackupSelected) { + displayedTables.push({ label: "Tables", value: 'tables', options: isKeyspaceSelected ? tableOptions.filter(option => option.keyspace === tableKeyspace.value) : tableOptions - } - ]; + }); + } keyspaceOptions = [{ label: All Keyspaces, value: "allkeyspaces", diff --git a/managed/ui/src/components/tables/RestoreBackup/RestoreBackup.js b/managed/ui/src/components/tables/RestoreBackup/RestoreBackup.js index a096f3df6a58..4aebbec7899d 100644 --- a/managed/ui/src/components/tables/RestoreBackup/RestoreBackup.js +++ b/managed/ui/src/components/tables/RestoreBackup/RestoreBackup.js @@ -28,13 +28,15 @@ export default class RestoreBackup extends Component { const payload = { storageConfigUUID: values.storageConfigUUID, storageLocation: values.storageLocation, - actionType: 'RESTORE', - // tableName: values.restoreToTableName, + actionType: 'RESTORE', }; - // TODO: Allow renaming of individual tables - if (values.keyspace !== initialValues.keyspace) { + if (values.restoreToTableName !== initialValues.restoreToTableName) { + payload.keyspace = values.restoreToKeyspace; + payload.tableName = values.restoreToTableName; + } else if (values.restoreToKeyspace !== initialValues.restoreToKeyspace) { payload.keyspace = values.restoreToKeyspace; } + onHide(); restoreTableBackup(restoreToUniverseUUID, payload); browserHistory.push('/universes/' + restoreToUniverseUUID + "/backups"); @@ -45,7 +47,7 @@ export default class RestoreBackup extends Component { } render() { - const { visible, onHide, universeList, storageConfigs, currentUniverse } = this.props; + const { visible, onHide, universeList, storageConfigs, currentUniverse, backupInfo } = this.props; // If the backup information is not provided, most likely we are trying to load the backup // from pre-existing location (specified by the user) into the current universe in context. @@ -84,6 +86,12 @@ export default class RestoreBackup extends Component { ...this.props.initialValues, storageConfigUUID: hasBackupInfo ? storageOptions.find((element) => { return element.value === this.props.initialValues.storageConfigUUID;}) : "" }; + // Disable table field if multi-table backup + // Second line checks whether `tableNameList` is empty array + const isMultiTableBackup = hasBackupInfo && ( + (backupInfo.tableNameList && backupInfo.tableNameList.length > 1) || + (backupInfo.keyspace && (!backupInfo.tableNameList || !backupInfo.tableNameList.length) && !backupInfo.tableUUID) + ); return (
e.stopPropagation()}> @@ -123,7 +131,7 @@ export default class RestoreBackup extends Component { label={"Keyspace"} />