Skip to content

TagSpaces is an offline, open source, document manager with tagging support

fix: refactoring location management

Ilian Sapundshiev9a291e273ca4
diff --git a/app/components/dialogs/CreateLocationDialog.tsx b/app/components/dialogs/CreateLocationDialog.tsx
index a6ca58279..0b15603e6 100644
--- a/app/components/dialogs/CreateLocationDialog.tsx
+++ b/app/components/dialogs/CreateLocationDialog.tsx
@@ -63,11 +63,14 @@ interface Props {
}
interface State {
+ showAdvancedMode: boolean;
+ showSecretAccessKey: boolean;
errorTextPath: boolean;
errorTextName: boolean;
disableConfirmButton: boolean;
name: string;
path: string;
+ newuuid: string;
endpointURL: string;
perspective: string;
isDefault: boolean;
@@ -91,9 +94,12 @@ interface State {
class CreateLocationDialog extends React.Component<Props, State> {
state = {
+ showAdvancedMode: false,
+ showSecretAccessKey: false,
errorTextPath: false,
errorTextName: false,
disableConfirmButton: true,
+ newuuid: uuidv1(),
name: '',
path: '',
endpointURL: '',
@@ -142,6 +148,18 @@ class CreateLocationDialog extends React.Component<Props, State> {
);
};
+ switchAdvancedMode = () => {
+ this.setState(prevState => ({
+ showAdvancedMode: !prevState.showAdvancedMode
+ }));
+ };
+
+ switchSecretAccessKeyVisibility = () => {
+ this.setState(prevState => ({
+ showSecretAccessKey: !prevState.showSecretAccessKey
+ }));
+ };
+
handleValidation() {
// const pathRegex = this.state.path.match('^((\.\./|[a-zA-Z0-9_/\-\\])*\.[a-zA-Z0-9]+)$');
// const nameRegex = this.state.name.match('^[A-Z][-a-zA-Z]+$');
@@ -195,7 +213,7 @@ class CreateLocationDialog extends React.Component<Props, State> {
if (!this.state.disableConfirmButton) {
if (this.state.type === locationType.TYPE_LOCAL) {
this.props.addLocation({
- uuid: uuidv1(),
+ uuid: this.state.newuuid,
type: locationType.TYPE_LOCAL,
name: this.state.name,
path: this.state.path,
@@ -207,7 +225,7 @@ class CreateLocationDialog extends React.Component<Props, State> {
});
} else if (this.state.type === locationType.TYPE_CLOUD) {
this.props.addLocation({
- uuid: uuidv1(),
+ uuid: this.state.newuuid,
type: locationType.TYPE_CLOUD,
name: this.state.storeName,
path: this.state.storePath,
@@ -241,6 +259,7 @@ class CreateLocationDialog extends React.Component<Props, State> {
if (this.state.type === locationType.TYPE_CLOUD) {
content = (
<ObjectStoreForm
+ switchSecretAccessKeyVisibility={this.switchSecretAccessKeyVisibility}
handleInputChange={this.handleInputChange}
handleChange={this.handleChange}
state={this.state}
@@ -322,21 +341,23 @@ class CreateLocationDialog extends React.Component<Props, State> {
}
label={i18n.t('core:startupLocation')}
/>
- <FormControlLabel
- control={
- <Switch
- disabled={!Pro}
- data-tid="changeReadOnlyMode"
- name="isReadOnly"
- checked={this.state.isReadOnly}
- onChange={this.handleInputChange}
- />
- }
- label={
- i18n.t('core:readonlyModeSwitch') +
- (Pro ? '' : ' - ' + i18n.t('core:proFeature'))
- }
- />
+ {this.state.showAdvancedMode && (
+ <FormControlLabel
+ control={
+ <Switch
+ disabled={!Pro}
+ data-tid="changeReadOnlyMode"
+ name="isReadOnly"
+ checked={this.state.isReadOnly}
+ onChange={this.handleInputChange}
+ />
+ }
+ label={
+ i18n.t('core:readonlyModeSwitch') +
+ (Pro ? '' : ' - ' + i18n.t('core:proFeature'))
+ }
+ />
+ )}
<FormControlLabel
control={
<Switch
@@ -352,21 +373,23 @@ class CreateLocationDialog extends React.Component<Props, State> {
(Pro ? '' : ' - ' + i18n.t('core:proFeature'))
}
/>
- <FormControlLabel
- control={
- <Switch
- disabled={!Pro}
- data-tid="changePersistIndex"
- name="persistIndex"
- checked={this.state.persistIndex}
- onChange={this.handleInputChange}
- />
- }
- label={
- i18n.t('core:persistIndexSwitch') +
- (Pro ? '' : ' - ' + i18n.t('core:proFeature'))
- }
- />
+ {this.state.showAdvancedMode && (
+ <FormControlLabel
+ control={
+ <Switch
+ disabled={!Pro}
+ data-tid="changePersistIndex"
+ name="persistIndex"
+ checked={this.state.persistIndex}
+ onChange={this.handleInputChange}
+ />
+ }
+ label={
+ i18n.t('core:persistIndexSwitch') +
+ (Pro ? '' : ' - ' + i18n.t('core:proFeature'))
+ }
+ />
+ )}
<FormControlLabel
control={
<Switch
@@ -385,6 +408,11 @@ class CreateLocationDialog extends React.Component<Props, State> {
</FormGroup>
</DialogContent>
<DialogActions>
+ <Button onClick={this.switchAdvancedMode}>
+ {this.state.showAdvancedMode
+ ? i18n.t('core:switchSimpleMode')
+ : i18n.t('core:switchAdvancedMode')}
+ </Button>
<Button onClick={this.onCancel} color="primary">
{i18n.t('core:cancel')}
</Button>
diff --git a/app/components/dialogs/EditLocationDialog.tsx b/app/components/dialogs/EditLocationDialog.tsx
index b6200a529..f58f2d4a9 100644
--- a/app/components/dialogs/EditLocationDialog.tsx
+++ b/app/components/dialogs/EditLocationDialog.tsx
@@ -52,6 +52,8 @@ interface Props {
}
interface State {
+ showAdvancedMode: boolean;
+ showSecretAccessKey: boolean;
errorTextPath: boolean;
errorTextName: boolean;
errorTextId: boolean;
@@ -106,6 +108,8 @@ class EditLocationDialog extends React.Component<Props, State> {
}
this.state = {
...properties,
+ showAdvancedMode: false,
+ showSecretAccessKey: false,
uuid: props.location.uuid,
newuuid: props.location.uuid,
isDefault: props.location.isDefault,
@@ -122,6 +126,8 @@ class EditLocationDialog extends React.Component<Props, State> {
};
} else {
this.state = {
+ showAdvancedMode: false,
+ showSecretAccessKey: false,
errorTextPath: false,
errorTextName: false,
errorTextId: false,
@@ -153,6 +159,18 @@ class EditLocationDialog extends React.Component<Props, State> {
}
}
+ switchAdvancedMode = () => {
+ this.setState(prevState => ({
+ showAdvancedMode: !prevState.showAdvancedMode
+ }));
+ };
+
+ switchSecretAccessKeyVisibility = () => {
+ this.setState(prevState => ({
+ showSecretAccessKey: !prevState.showSecretAccessKey
+ }));
+ };
+
handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {
const { target } = event;
const value = target.type === 'checkbox' ? target.checked : target.value;
@@ -318,6 +336,7 @@ class EditLocationDialog extends React.Component<Props, State> {
if (this.state.type === locationType.TYPE_CLOUD) {
content = (
<ObjectStoreForm
+ switchSecretAccessKeyVisibility={this.switchSecretAccessKeyVisibility}
handleInputChange={this.handleInputChange}
handleChange={this.handleChange}
state={this.state}
@@ -380,21 +399,23 @@ class EditLocationDialog extends React.Component<Props, State> {
}
label={i18n.t('core:startupLocation')}
/>
- <FormControlLabel
- control={
- <Switch
- disabled={!Pro}
- data-tid="changeReadOnlyMode"
- name="isReadOnly"
- checked={this.state.isReadOnly}
- onChange={this.handleInputChange}
- />
- }
- label={
- i18n.t('core:readonlyModeSwitch') +
- (Pro ? '' : ' - ' + i18n.t('core:proFeature'))
- }
- />
+ {this.state.showAdvancedMode && (
+ <FormControlLabel
+ control={
+ <Switch
+ disabled={!Pro}
+ data-tid="changeReadOnlyMode"
+ name="isReadOnly"
+ checked={this.state.isReadOnly}
+ onChange={this.handleInputChange}
+ />
+ }
+ label={
+ i18n.t('core:readonlyModeSwitch') +
+ (Pro ? '' : ' - ' + i18n.t('core:proFeature'))
+ }
+ />
+ )}
<FormControlLabel
control={
<Switch
@@ -410,21 +431,23 @@ class EditLocationDialog extends React.Component<Props, State> {
(Pro ? '' : ' - ' + i18n.t('core:proFeature'))
}
/>
- <FormControlLabel
- control={
- <Switch
- disabled={!Pro}
- data-tid="changePersistIndex"
- name="persistIndex"
- checked={this.state.persistIndex}
- onChange={this.handleInputChange}
- />
- }
- label={
- i18n.t('core:persistIndexSwitch') +
- (Pro ? '' : ' - ' + i18n.t('core:proFeature'))
- }
- />
+ {this.state.showAdvancedMode && (
+ <FormControlLabel
+ control={
+ <Switch
+ disabled={!Pro}
+ data-tid="changePersistIndex"
+ name="persistIndex"
+ checked={this.state.persistIndex}
+ onChange={this.handleInputChange}
+ />
+ }
+ label={
+ i18n.t('core:persistIndexSwitch') +
+ (Pro ? '' : ' - ' + i18n.t('core:proFeature'))
+ }
+ />
+ )}
<FormControlLabel
control={
<Switch
@@ -448,6 +471,11 @@ class EditLocationDialog extends React.Component<Props, State> {
renderActions = () => (
<DialogActions>
+ <Button onClick={this.switchAdvancedMode}>
+ {this.state.showAdvancedMode
+ ? i18n.t('core:switchSimpleMode')
+ : i18n.t('core:switchAdvancedMode')}
+ </Button>
<Button
data-tid="closeEditLocationDialog"
color="primary"
diff --git a/app/components/dialogs/LocalForm.tsx b/app/components/dialogs/LocalForm.tsx
index 49a4bf53e..834d86bdb 100644
--- a/app/components/dialogs/LocalForm.tsx
+++ b/app/components/dialogs/LocalForm.tsx
@@ -19,13 +19,13 @@
import React from 'react';
import InputAdornment from '@material-ui/core/InputAdornment';
-import TextField from '@material-ui/core/TextField';
import FormControl from '@material-ui/core/FormControl';
-import FormHelperText from '@material-ui/core/FormHelperText';
+// import FormHelperText from '@material-ui/core/FormHelperText';
import Input from '@material-ui/core/Input';
import InputLabel from '@material-ui/core/InputLabel';
import IconButton from '@material-ui/core/IconButton';
import FolderIcon from '@material-ui/icons/Folder';
+import Grid from '@material-ui/core/Grid';
import i18n from '-/services/i18n';
import AppConfig from '-/config';
import { extractDirectoryName } from '-/utils/paths';
@@ -38,19 +38,21 @@ interface Props {
showSelectDirectoryDialog: () => void;
}
-class LocalForm extends React.Component<Props> {
- openDirectory = () => {
+const LocalForm = (props: Props) => {
+ function openDirectory() {
if (AppConfig.isElectron) {
PlatformIO.selectDirectoryDialog()
.then(selectedPaths => {
- this.props.handleChange('path', selectedPaths[0]);
- if (this.props.state.name.length < 1) {
- this.props.handleChange(
+ const selectedPath = selectedPaths[0];
+ props.handleChange('path', selectedPath);
+ if (props.state.name.length < 1 && selectedPath.length > 0) {
+ const dirName = extractDirectoryName(
+ selectedPath,
+ PlatformIO.getDirSeparator()
+ );
+ props.handleChange(
'name',
- extractDirectoryName(
- selectedPaths[0],
- PlatformIO.getDirSeparator()
- )
+ dirName.charAt(0).toUpperCase() + dirName.slice(1)
);
}
return true;
@@ -59,58 +61,63 @@ class LocalForm extends React.Component<Props> {
console.log('selectDirectoryDialog failed with: ' + err);
});
} else {
- this.props.showSelectDirectoryDialog();
+ props.showSelectDirectoryDialog();
}
- };
-
- render() {
- const { handleInputChange, state } = this.props;
+ }
- return (
- <div>
- <FormControl fullWidth={true} error={state.errorTextName}>
- <TextField
- error={state.errorTextName}
- required
- autoFocus
- margin="dense"
- name="name"
- label={i18n.t('core:createLocationName')}
- onChange={handleInputChange}
- value={state.name}
- data-tid="locationName"
- fullWidth={true}
- />
- {state.errorTextName && (
- <FormHelperText>{i18n.t('core:invalidName')}</FormHelperText>
- )}
- </FormControl>
+ const { handleInputChange, state } = props;
+ return (
+ <Grid container spacing={2}>
+ <Grid item xs={12}>
<FormControl fullWidth={true} error={state.errorTextPath}>
<InputLabel htmlFor="path">
{i18n.t('core:createLocationPath')}
</InputLabel>
<Input
required
+ autoFocus
margin="dense"
name="path"
fullWidth={true}
data-tid="locationPath"
onChange={handleInputChange}
value={state.path}
+ placeholder="Enter a folder path or select it with the button on the right"
endAdornment={
<InputAdornment position="end" style={{ height: 32 }}>
- <IconButton onClick={this.openDirectory}>
+ <IconButton onClick={openDirectory}>
<FolderIcon />
</IconButton>
</InputAdornment>
}
/>
- {state.errorTextPath && (
+ {/* {state.errorTextPath && (
<FormHelperText>{i18n.t('core:invalidPath')}</FormHelperText>
- )}
+ )} */}
</FormControl>
- {state.newuuid && (
- <FormControl fullWidth={true}>
+ </Grid>
+ <Grid item xs={12}>
+ <FormControl fullWidth={true} error={state.errorTextName}>
+ <InputLabel htmlFor="path">
+ {i18n.t('core:createLocationName')}
+ </InputLabel>
+ <Input
+ required
+ margin="dense"
+ name="name"
+ onChange={handleInputChange}
+ value={state.name}
+ data-tid="locationName"
+ fullWidth={true}
+ />
+ {/* {state.errorTextName && (
+ <FormHelperText>{i18n.t('core:invalidName')}</FormHelperText>
+ )} */}
+ </FormControl>
+ </Grid>
+ {state.showAdvancedMode && (
+ <Grid item xs={12}>
+ <FormControl fullWidth={true} error={state.errorTextId}>
<InputLabel htmlFor="newuuid">
{i18n.t('core:locationId')}
</InputLabel>
@@ -120,18 +127,18 @@ class LocalForm extends React.Component<Props> {
name="newuuid"
fullWidth={true}
data-tid="newuuid"
- placeholder="Location ID"
+ placeholder="Unique location identifier"
onChange={handleInputChange}
value={state.newuuid}
/>
- {state.errorTextId && (
- <FormHelperText>{i18n.t('core:invalidId')}</FormHelperText>
- )}
+ {/* {state.errorTextId && (
+ <FormHelperText>{i18n.t('core:invalidId')}</FormHelperText>
+ )} */}
</FormControl>
- )}
- </div>
- );
- }
-}
+ </Grid>
+ )}
+ </Grid>
+ );
+};
export default LocalForm;
diff --git a/app/components/dialogs/ObjectStoreForm.tsx b/app/components/dialogs/ObjectStoreForm.tsx
index c53ffc78f..ec021042a 100644
--- a/app/components/dialogs/ObjectStoreForm.tsx
+++ b/app/components/dialogs/ObjectStoreForm.tsx
@@ -123,212 +123,202 @@ const styles: any = (theme: any) => ({
interface Props {
state: any;
- handleChange: (name: string, value: any, action: string) => void;
+ handleChange: (name: string, value: any, action?: string) => void;
handleInputChange: (event: any) => void;
+ switchSecretAccessKeyVisibility: () => void;
classes: any;
theme: any;
}
-
-interface State {
- showPassword: boolean;
-}
-
-class ObjectStoreForm extends React.Component<Props, State> {
- state = { showPassword: false };
-
- handleRegionChange = (inputValue: any, region: string, reason: string) => {
+const ObjectStoreForm = (props: Props) => {
+ function handleRegionChange(inputValue: any, region: string, reason: string) {
if (reason === 'input') {
- this.props.handleChange('region', region, reason);
+ props.handleChange('region', region, reason);
} else if (reason === 'select-option') {
- this.props.handleChange('region', region, reason);
+ props.handleChange('region', region, reason);
}
if (reason === 'clear') {
- this.props.handleChange('region', '', reason);
+ props.handleChange('region', '', reason);
}
- };
-
- handleClickShowPassword = () => {
- this.setState(prevState => ({ showPassword: !prevState.showPassword }));
- };
+ }
- render() {
- const { handleInputChange, state } = this.props;
+ const { handleInputChange, switchSecretAccessKeyVisibility, state } = props;
- return (
- <Grid container spacing={2}>
- <Grid item xs={12}>
- <FormControl fullWidth={true} error={state.cloudErrorTextName}>
- <InputLabel htmlFor="storeName">
- {i18n.t('core:createLocationName')}
- </InputLabel>
- <Input
- required
- autoFocus
- margin="dense"
- name="storeName"
- fullWidth={true}
- data-tid="locationName"
- onChange={handleInputChange}
- value={state.storeName}
- />
- {state.cloudErrorTextName && (
- <FormHelperText>{i18n.t('core:invalidName')}</FormHelperText>
- )}
- </FormControl>
- </Grid>
- <Grid item xs={12}>
- <FormControl fullWidth={true} error={state.cloudErrorTextPath}>
- <InputLabel htmlFor="path">
- {i18n.t('core:createLocationPath')}
- </InputLabel>
- <Input
- margin="dense"
- name="storePath"
- fullWidth={true}
- data-tid="locationPath"
- onChange={handleInputChange}
- value={state.storePath}
- />
- {state.cloudErrorTextPath && (
- <FormHelperText>{i18n.t('core:invalidPath')}</FormHelperText>
- )}
- </FormControl>
- </Grid>
- <Grid item xs={12}>
- <FormControl fullWidth={true} error={state.cloudErrorAccessKey}>
- <InputLabel htmlFor="accessKeyId">
- {i18n.t('core:accessKeyId')}
- </InputLabel>
- <Input
- margin="dense"
- name="accessKeyId"
- fullWidth={true}
- data-tid="accessKeyId"
- onChange={handleInputChange}
- value={state.accessKeyId}
- />
- {state.cloudErrorAccessKey && (
- <FormHelperText>{i18n.t('core:invalidAccessKey')}</FormHelperText>
- )}
- </FormControl>
- </Grid>
- <Grid item xs={12}>
- <FormControl fullWidth={true} error={state.cloudErrorSecretAccessKey}>
- <InputLabel htmlFor="secretAccessKey">
- {i18n.t('core:secretAccessKey')}
- </InputLabel>
- <Input
- margin="dense"
- name="secretAccessKey"
- type={this.state.showPassword ? 'text' : 'password'}
- fullWidth={true}
- data-tid="secretAccessKey"
- onChange={handleInputChange}
- value={state.secretAccessKey}
- endAdornment={
- <InputAdornment position="end">
- <IconButton
- aria-label="toggle password visibility"
- onClick={this.handleClickShowPassword}
- >
- {this.state.showPassword ? (
- <Visibility />
- ) : (
- <VisibilityOff />
- )}
- </IconButton>
- </InputAdornment>
- }
- />
- {state.cloudErrorSecretAccessKey && (
- <FormHelperText>
- {i18n.t('core:invalidSecretAccessKey')}
- </FormHelperText>
+ return (
+ <Grid container spacing={2}>
+ <Grid item xs={12}>
+ <FormControl fullWidth={true} error={state.cloudErrorTextName}>
+ <InputLabel htmlFor="storeName">
+ {i18n.t('core:createLocationName')}
+ </InputLabel>
+ <Input
+ required
+ autoFocus
+ margin="dense"
+ name="storeName"
+ fullWidth={true}
+ data-tid="locationName"
+ onChange={handleInputChange}
+ value={state.storeName}
+ />
+ {/* {state.cloudErrorTextName && (
+ <FormHelperText>{i18n.t('core:invalidName')}</FormHelperText>
+ )} */}
+ </FormControl>
+ </Grid>
+ <Grid item xs={12}>
+ <FormControl fullWidth={true} error={state.cloudErrorTextPath}>
+ <InputLabel htmlFor="path">
+ {i18n.t('core:createLocationPath')}
+ </InputLabel>
+ <Input
+ margin="dense"
+ name="storePath"
+ fullWidth={true}
+ data-tid="locationPath"
+ onChange={handleInputChange}
+ value={state.storePath}
+ />
+ {/* {state.cloudErrorTextPath && (
+ <FormHelperText>{i18n.t('core:invalidPath')}</FormHelperText>
+ )} */}
+ </FormControl>
+ </Grid>
+ <Grid item xs={12}>
+ <FormControl fullWidth={true} error={state.cloudErrorAccessKey}>
+ <InputLabel htmlFor="accessKeyId">
+ {i18n.t('core:accessKeyId')}
+ </InputLabel>
+ <Input
+ margin="dense"
+ name="accessKeyId"
+ fullWidth={true}
+ data-tid="accessKeyId"
+ onChange={handleInputChange}
+ value={state.accessKeyId}
+ />
+ {/* {state.cloudErrorAccessKey && (
+ <FormHelperText>{i18n.t('core:invalidAccessKey')}</FormHelperText>
+ )} */}
+ </FormControl>
+ </Grid>
+ <Grid item xs={12}>
+ <FormControl fullWidth={true} error={state.cloudErrorSecretAccessKey}>
+ <InputLabel htmlFor="secretAccessKey">
+ {i18n.t('core:secretAccessKey')}
+ </InputLabel>
+ <Input
+ margin="dense"
+ name="secretAccessKey"
+ type={state.showSecretAccessKey ? 'text' : 'password'}
+ fullWidth={true}
+ data-tid="secretAccessKey"
+ onChange={handleInputChange}
+ value={state.secretAccessKey}
+ endAdornment={
+ <InputAdornment position="end">
+ <IconButton
+ aria-label="toggle password visibility"
+ onClick={switchSecretAccessKeyVisibility}
+ >
+ {state.showSecretAccessKey ? (
+ <Visibility />
+ ) : (
+ <VisibilityOff />
+ )}
+ </IconButton>
+ </InputAdornment>
+ }
+ />
+ {/* {state.cloudErrorSecretAccessKey && (
+ <FormHelperText>
+ {i18n.t('core:invalidSecretAccessKey')}
+ </FormHelperText>
+ )} */}
+ </FormControl>
+ </Grid>
+ <Grid item xs={12}>
+ <FormControl fullWidth={true} error={state.cloudErrorBucketName}>
+ <InputLabel htmlFor="bucketName">
+ {i18n.t('core:bucketName')}
+ </InputLabel>
+ <Input
+ margin="dense"
+ name="bucketName"
+ fullWidth={true}
+ data-tid="bucketName"
+ onChange={handleInputChange}
+ value={state.bucketName}
+ />
+ {/* {state.cloudErrorBucketName && (
+ <FormHelperText>
+ {i18n.t('core:invalidBucketName')}
+ </FormHelperText>
+ )} */}
+ </FormControl>
+ </Grid>
+ <Grid item xs={12}>
+ <FormControl fullWidth={true} error={state.cloudErrorRegion}>
+ <Autocomplete
+ options={regions}
+ value={state.region}
+ freeSolo
+ onChange={handleRegionChange}
+ onInputChange={handleRegionChange}
+ placeholder={i18n.t('core:regionSearch')}
+ renderInput={params => (
+ <TextField
+ {...params}
+ label={i18n.t('core:regionSearch')}
+ margin="normal"
+ />
)}
- </FormControl>
- </Grid>
+ />
+ {/* {state.cloudErrorRegion && (
+ <FormHelperText>{i18n.t('core:invalidRegion')}</FormHelperText>
+ )} */}
+ </FormControl>
+ </Grid>
+ {state.showAdvancedMode && (
<Grid item xs={12}>
- <FormControl fullWidth={true} error={state.cloudErrorBucketName}>
- <InputLabel htmlFor="bucketName">
- {i18n.t('core:bucketName')}
+ <FormControl fullWidth={true}>
+ <InputLabel htmlFor="endpointURL">
+ {i18n.t('core:endpointURL')}
</InputLabel>
<Input
margin="dense"
- name="bucketName"
+ name="endpointURL"
fullWidth={true}
- data-tid="bucketName"
+ data-tid="endpointURL"
+ placeholder="Advanced setting, could be left empty"
onChange={handleInputChange}
- value={state.bucketName}
- />
- {state.cloudErrorBucketName && (
- <FormHelperText>
- {i18n.t('core:invalidBucketName')}
- </FormHelperText>
- )}
- </FormControl>
- </Grid>
- <Grid item xs={12}>
- <FormControl fullWidth={true} error={state.cloudErrorRegion}>
- <Autocomplete
- options={regions}
- value={state.region}
- freeSolo
- onChange={this.handleRegionChange}
- onInputChange={this.handleRegionChange}
- placeholder={i18n.t('core:regionSearch')}
- renderInput={params => (
- <TextField
- {...params}
- label={i18n.t('core:regionSearch')}
- margin="normal"
- />
- )}
+ value={state.endpointURL}
/>
- {state.cloudErrorRegion && (
- <FormHelperText>{i18n.t('core:invalidRegion')}</FormHelperText>
- )}
+ {/* {state.cloudErrorId && (
+ <FormHelperText>{i18n.t('core:missingId')}</FormHelperText>
+ )} */}
</FormControl>
</Grid>
+ )}
+ {state.showAdvancedMode && (
<Grid item xs={12}>
<FormControl fullWidth={true}>
- <InputLabel htmlFor="endpointURL">
- {i18n.t('core:endpointURL')}
+ <InputLabel htmlFor="newuuid">
+ {i18n.t('core:locationId')}
</InputLabel>
<Input
margin="dense"
- name="endpointURL"
+ name="newuuid"
fullWidth={true}
- data-tid="endpointURL"
- placeholder="Advanced setting, could be left empty"
+ data-tid="newuuid"
+ placeholder="Advanced setting"
onChange={handleInputChange}
- value={state.endpointURL}
+ value={state.newuuid}
/>
- {state.cloudErrorId && (
- <FormHelperText>{i18n.t('core:missingId')}</FormHelperText>
- )}
</FormControl>
</Grid>
- {state.newuuid && (
- <Grid item xs={12}>
- <FormControl fullWidth={true}>
- <InputLabel htmlFor="newuuid">
- {i18n.t('core:locationId')}
- </InputLabel>
- <Input
- margin="dense"
- name="newuuid"
- fullWidth={true}
- data-tid="newuuid"
- placeholder="Advanced setting"
- onChange={handleInputChange}
- value={state.newuuid}
- />
- </FormControl>
- </Grid>
- )}
- </Grid>
- );
- }
-}
+ )}
+ </Grid>
+ );
+};
export default withStyles(styles, { withTheme: true })(ObjectStoreForm);
diff --git a/app/locales/en/core.json b/app/locales/en/core.json
index 74cf85d91..355ab81e8 100644
--- a/app/locales/en/core.json
+++ b/app/locales/en/core.json
@@ -487,5 +487,7 @@
"filesLimit": "Max. files to be displayed in a folder",
"goback": "Go Back",
"goforward": "Go Forward",
+ "switchSimpleMode": "Simpe Mode",
+ "switchAdvancedMode": "Advanced Mode",
"-": "-"
}