Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions x-pack/plugins/snapshot_restore/common/types/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ export interface FSRepository {
settings: {
location: string;
compress?: boolean;
chunk_size?: string | null;
max_restore_bytes_per_sec?: string;
max_snapshot_bytes_per_sec?: string;
chunkSize?: string | null;
maxRestoreBytesPerSec?: string;
maxSnapshotBytesPerSec?: string;
readonly?: boolean;
};
}
Expand All @@ -50,13 +50,13 @@ export interface S3Repository {
settings: {
bucket: string;
client?: string;
base_path?: string;
basePath?: string;
compress?: boolean;
chunk_size?: string | null;
server_side_encryption?: boolean;
buffer_size?: string;
canned_acl?: string;
storage_class?: string;
chunkSize?: string | null;
serverSideEncryption?: boolean;
bufferSize?: string;
cannedAcl?: string;
storageClass?: string;
};
}

Expand All @@ -66,9 +66,9 @@ export interface HDFSRepository {
settings: {
uri: string;
path: string;
load_defaults?: boolean;
loadDefaults?: boolean;
compress?: boolean;
chunk_size?: string | null;
chunkSize?: string | null;
['security.principal']?: string;
[key: string]: any; // For conf.* settings
};
Expand All @@ -80,11 +80,11 @@ export interface AzureRepository {
settings: {
client?: string;
container?: string;
base_path?: string;
basePath?: string;
compress?: boolean;
chunk_size?: string | null;
chunkSize?: string | null;
readonly?: boolean;
location_mode?: string;
locationMode?: string;
};
}

Expand All @@ -94,9 +94,9 @@ export interface GCSRepository {
settings: {
bucket: string;
client?: string;
base_path?: string;
basePath?: string;
compress?: boolean;
chunk_size?: string | null;
chunkSize?: string | null;
};
}

Expand Down Expand Up @@ -125,7 +125,7 @@ export type SourceRepositorySettings<T> = T extends FSRepositoryType
: T extends GCSRepositoryType
? GCSRepository['settings']
: any & {
delegate_type: T;
delegateType: T;
};

export type Repository<T = null> =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
*/

import React, { Fragment, useRef, useState } from 'react';
import { EuiConfirmModal, EuiOverlayMask } from '@elastic/eui';
import { Repository } from '../../../common/types';
import { useAppDependencies } from '../index';
import { deleteRepositories } from '../services/http';

import { EuiConfirmModal, EuiOverlayMask } from '@elastic/eui';

interface Props {
children: (deleteRepository: DeleteRepository) => React.ReactElement;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,6 @@
*/
import React, { Fragment, useEffect, useState } from 'react';

import { PLUGIN_REPOSITORY_TYPES, REPOSITORY_TYPES } from '../../../../common/constants';
import { Repository, RepositoryType } from '../../../../common/types';

import { useAppDependencies } from '../../index';
import { documentationLinksService } from '../../services/documentation';
import { loadRepositoryTypes } from '../../services/http';
import { textService } from '../../services/text';

import { SectionError } from '../section_error';
import { TypeSettings } from './type_settings';

import {
EuiButton,
EuiButtonEmpty,
Expand All @@ -30,6 +19,16 @@ import {
EuiSpacer,
EuiTitle,
} from '@elastic/eui';
import { PLUGIN_REPOSITORY_TYPES, REPOSITORY_TYPES } from '../../../../common/constants';
import { Repository, RepositoryType } from '../../../../common/types';

import { useAppDependencies } from '../../index';
import { documentationLinksService } from '../../services/documentation';
import { loadRepositoryTypes } from '../../services/http';
import { textService } from '../../services/text';

import { SectionError } from '../section_error';
import { TypeSettings } from './type_settings';

interface Props {
repository: Repository;
Expand Down Expand Up @@ -89,10 +88,10 @@ export const RepositoryForm: React.FunctionComponent<Props> = ({
const updateRepository = (updatedFields: Partial<Repository>): void => {
const newRepository: Repository = { ...repository, ...updatedFields };
const { type, settings } = newRepository;
if (type === REPOSITORY_TYPES.source && !settings.delegate_type) {
settings.delegate_type = REPOSITORY_TYPES.fs;
} else if (type !== REPOSITORY_TYPES.source && settings.delegate_type) {
delete settings.delegate_type;
if (type === REPOSITORY_TYPES.source && !settings.delegateType) {
settings.delegateType = REPOSITORY_TYPES.fs;
} else if (type !== REPOSITORY_TYPES.source && settings.delegateType) {
delete settings.delegateType;
}
setRepository(newRepository);
};
Expand Down Expand Up @@ -242,8 +241,8 @@ export const RepositoryForm: React.FunctionComponent<Props> = ({
if (repository.type !== REPOSITORY_TYPES.source) {
return null;
}
const typeValue = availableRepositoryTypes.includes(repository.settings.delegate_type)
? repository.settings.delegate_type
const typeValue = availableRepositoryTypes.includes(repository.settings.delegateType)
? repository.settings.delegateType
: REPOSITORY_TYPES.fs;

return (
Expand Down Expand Up @@ -295,7 +294,7 @@ export const RepositoryForm: React.FunctionComponent<Props> = ({
onChange={e => {
updateRepository({
settings: {
delegate_type: e.target.value,
delegateType: e.target.value,
},
});
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
*/

import React, { Fragment } from 'react';
import { AzureRepository, Repository } from '../../../../../common/types';
import { useAppDependencies } from '../../../index';

import {
EuiCode,
EuiDescribedFormGroup,
Expand All @@ -17,6 +14,8 @@ import {
EuiSwitch,
EuiTitle,
} from '@elastic/eui';
import { AzureRepository, Repository } from '../../../../../common/types';
import { useAppDependencies } from '../../../index';

interface Props {
repository: AzureRepository;
Expand All @@ -36,7 +35,7 @@ export const AzureSettings: React.FunctionComponent<Props> = ({
},
} = useAppDependencies();
const {
settings: { client, container, base_path, compress, chunk_size, readonly, location_mode },
settings: { client, container, basePath, compress, chunkSize, readonly, locationMode },
} = repository;

const locationModeOptions = ['primary_only', 'secondary_only'].map(option => ({
Expand Down Expand Up @@ -164,11 +163,11 @@ export const AzureSettings: React.FunctionComponent<Props> = ({
describedByIds={['azureRepositoryBasePathDescription']}
>
<EuiFieldText
defaultValue={base_path || ''}
defaultValue={basePath || ''}
fullWidth
onChange={e => {
updateRepositorySettings({
base_path: e.target.value,
basePath: e.target.value,
});
}}
/>
Expand Down Expand Up @@ -253,11 +252,11 @@ export const AzureSettings: React.FunctionComponent<Props> = ({
describedByIds={['azureRepositoryChunkSizeDescription']}
>
<EuiFieldText
defaultValue={chunk_size || ''}
defaultValue={chunkSize || ''}
fullWidth
onChange={e => {
updateRepositorySettings({
chunk_size: e.target.value,
chunkSize: e.target.value,
});
}}
/>
Expand Down Expand Up @@ -291,7 +290,7 @@ export const AzureSettings: React.FunctionComponent<Props> = ({
describedByIds={['azureRepositoryReadonlyDescription']}
>
<EuiSwitch
disabled={location_mode === locationModeOptions[1].value}
disabled={locationMode === locationModeOptions[1].value}
label={
<FormattedMessage
id="xpack.snapshotRestore.repositoryForm.typeAzure.readonlyLabel"
Expand All @@ -301,7 +300,7 @@ export const AzureSettings: React.FunctionComponent<Props> = ({
checked={!!readonly}
onChange={e => {
updateRepositorySettings({
readonly: location_mode === locationModeOptions[1].value ? true : e.target.checked,
readonly: locationMode === locationModeOptions[1].value ? true : e.target.checked,
});
}}
/>
Expand Down Expand Up @@ -344,10 +343,10 @@ export const AzureSettings: React.FunctionComponent<Props> = ({
>
<EuiSelect
options={locationModeOptions}
value={location_mode || locationModeOptions[0].value}
value={locationMode || locationModeOptions[0].value}
onChange={e => {
updateRepositorySettings({
location_mode: e.target.value,
locationMode: e.target.value,
readonly: e.target.value === locationModeOptions[1].value ? true : readonly,
});
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
*/

import React, { Fragment } from 'react';
import { FSRepository, Repository } from '../../../../../common/types';
import { useAppDependencies } from '../../../index';

import {
EuiCode,
EuiDescribedFormGroup,
Expand All @@ -17,6 +14,8 @@ import {
EuiSwitch,
EuiTitle,
} from '@elastic/eui';
import { FSRepository, Repository } from '../../../../../common/types';
import { useAppDependencies } from '../../../index';

interface Props {
repository: FSRepository;
Expand All @@ -39,9 +38,9 @@ export const FSSettings: React.FunctionComponent<Props> = ({
settings: {
location,
compress,
chunk_size,
max_restore_bytes_per_sec,
max_snapshot_bytes_per_sec,
chunkSize,
maxRestoreBytesPerSec,
maxSnapshotBytesPerSec,
readonly,
},
} = repository;
Expand Down Expand Up @@ -179,11 +178,11 @@ export const FSSettings: React.FunctionComponent<Props> = ({
describedByIds={['fsRepositoryChunkSizeDescription']}
>
<EuiFieldText
defaultValue={chunk_size || ''}
defaultValue={chunkSize || ''}
fullWidth
onChange={e => {
updateRepositorySettings({
chunk_size: e.target.value,
chunkSize: e.target.value,
});
}}
/>
Expand Down Expand Up @@ -222,11 +221,11 @@ export const FSSettings: React.FunctionComponent<Props> = ({
describedByIds={['fsRepositoryMaxRestoreBytesDescription']}
>
<EuiFieldText
defaultValue={max_restore_bytes_per_sec || ''}
defaultValue={maxRestoreBytesPerSec || ''}
fullWidth
onChange={e => {
updateRepositorySettings({
max_restore_bytes_per_sec: e.target.value,
maxRestoreBytesPerSec: e.target.value,
});
}}
/>
Expand Down Expand Up @@ -265,11 +264,11 @@ export const FSSettings: React.FunctionComponent<Props> = ({
describedByIds={['fsRepositoryMaxSnapshotBytesDescription']}
>
<EuiFieldText
defaultValue={max_snapshot_bytes_per_sec || ''}
defaultValue={maxSnapshotBytesPerSec || ''}
fullWidth
onChange={e => {
updateRepositorySettings({
max_snapshot_bytes_per_sec: e.target.value,
maxSnapshotBytesPerSec: e.target.value,
});
}}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
*/

import React, { Fragment } from 'react';
import { EuiDescribedFormGroup, EuiFieldText, EuiFormRow, EuiSwitch, EuiTitle } from '@elastic/eui';
import { GCSRepository, Repository } from '../../../../../common/types';
import { useAppDependencies } from '../../../index';

import { EuiDescribedFormGroup, EuiFieldText, EuiFormRow, EuiSwitch, EuiTitle } from '@elastic/eui';

interface Props {
repository: GCSRepository;
updateRepositorySettings: (
Expand All @@ -28,7 +27,7 @@ export const GCSSettings: React.FunctionComponent<Props> = ({
},
} = useAppDependencies();
const {
settings: { bucket, client, base_path, compress, chunk_size },
settings: { bucket, client, basePath, compress, chunkSize },
} = repository;

return (
Expand Down Expand Up @@ -151,11 +150,11 @@ export const GCSSettings: React.FunctionComponent<Props> = ({
describedByIds={['gcsRepositoryBasePathDescription']}
>
<EuiFieldText
defaultValue={base_path || ''}
defaultValue={basePath || ''}
fullWidth
onChange={e => {
updateRepositorySettings({
base_path: e.target.value,
basePath: e.target.value,
});
}}
/>
Expand Down Expand Up @@ -240,11 +239,11 @@ export const GCSSettings: React.FunctionComponent<Props> = ({
describedByIds={['gcsRepositoryChunkSizeDescription']}
>
<EuiFieldText
defaultValue={chunk_size || ''}
defaultValue={chunkSize || ''}
fullWidth
onChange={e => {
updateRepositorySettings({
chunk_size: e.target.value,
chunkSize: e.target.value,
});
}}
/>
Expand Down
Loading