Skip to content

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

localization && validation

Stanimir Marinove48464c56b15
diff --git a/app/components/dialogs/CreateLocationDialog.js b/app/components/dialogs/CreateLocationDialog.js
index 8c7942425..cd0df9608 100644
--- a/app/components/dialogs/CreateLocationDialog.js
+++ b/app/components/dialogs/CreateLocationDialog.js
@@ -154,6 +154,8 @@ class CreateLocationDialog extends React.Component<Props, State> {
let cloudErrorTextPath = false;
let cloudErrorAccessKey = false;
let cloudErrorSecretAccessKey = false;
+ let cloudErrorBucketName = false;
+ let cloudErrorRegion = false;
let disableConfirmButton = false;
if (!this.state.storeName || this.state.storeName.length === 0) {
cloudErrorTextName = true;
@@ -175,7 +177,17 @@ class CreateLocationDialog extends React.Component<Props, State> {
disableConfirmButton = true;
}
- this.setState({ cloudErrorTextName, cloudErrorTextPath, cloudErrorAccessKey, cloudErrorSecretAccessKey, disableConfirmButton });
+ if (!this.state.bucketName || this.state.bucketName.length === 0) {
+ cloudErrorBucketName = true;
+ disableConfirmButton = true;
+ }
+
+ if (!this.state.region) {
+ cloudErrorRegion = true;
+ disableConfirmButton = true;
+ }
+
+ this.setState({ cloudErrorTextName, cloudErrorTextPath, cloudErrorAccessKey, cloudErrorSecretAccessKey, cloudErrorBucketName, disableConfirmButton, cloudErrorRegion });
}
}
diff --git a/app/components/dialogs/EditLocationDialog.js b/app/components/dialogs/EditLocationDialog.js
index 68314ed8d..be7a3b68c 100644
--- a/app/components/dialogs/EditLocationDialog.js
+++ b/app/components/dialogs/EditLocationDialog.js
@@ -154,6 +154,8 @@ class EditLocationDialog extends React.Component<Props, State> {
let cloudErrorTextPath = false;
let cloudErrorAccessKey = false;
let cloudErrorSecretAccessKey = false;
+ let cloudErrorBucketName = false;
+ let cloudErrorRegion = false;
let disableConfirmButton = false;
if (!this.state.storeName || this.state.storeName.length === 0) {
cloudErrorTextName = true;
@@ -175,7 +177,17 @@ class EditLocationDialog extends React.Component<Props, State> {
disableConfirmButton = true;
}
- this.setState({ cloudErrorTextName, cloudErrorTextPath, cloudErrorAccessKey, cloudErrorSecretAccessKey, disableConfirmButton });
+ if (!this.state.bucketName || this.state.bucketName.length === 0) {
+ cloudErrorBucketName = true;
+ disableConfirmButton = true;
+ }
+
+ if (!this.state.region) {
+ cloudErrorRegion = true;
+ disableConfirmButton = true;
+ }
+
+ this.setState({ cloudErrorTextName, cloudErrorTextPath, cloudErrorAccessKey, cloudErrorSecretAccessKey, cloudErrorBucketName, disableConfirmButton, cloudErrorRegion });
}
}
diff --git a/app/components/dialogs/ObjectStoreForm.js b/app/components/dialogs/ObjectStoreForm.js
index 0a34bb498..be0e1ea04 100644
--- a/app/components/dialogs/ObjectStoreForm.js
+++ b/app/components/dialogs/ObjectStoreForm.js
@@ -315,7 +315,7 @@ class ObjectStoreForm extends React.Component<Props> {
</FormControl>
</Grid>
<Grid item xs={5}>
- <FormControl>
+ <FormControl error={state.cloudErrorBucketName}>
<InputLabel htmlFor="bucketName">{i18n.t('core:bucketName')}</InputLabel>
<Input
required
@@ -327,23 +327,27 @@ class ObjectStoreForm extends React.Component<Props> {
onChange={handleInputChange}
value={state.bucketName}
/>
+ {state.cloudErrorBucketName && <FormHelperText>{i18n.t('core:invalidBucketName')}</FormHelperText>}
</FormControl>
</Grid>
<Grid item xs={7}>
- <NoSsr>
- <CreatableSelect
- isClearable
- classes={classes}
- options={suggestions}
- styles={selectStyles}
- fullWidth={true}
- components={components}
- value={state.region}
- onChange={this.handleChange('region')}
- onInputChange={this.handleInputSelectChange}
- placeholder="Search a region"
- />
- </NoSsr>
+ <FormControl fullWidth={true} error={state.cloudErrorRegion}>
+ <NoSsr>
+ <CreatableSelect
+ isClearable
+ classes={classes}
+ options={suggestions}
+ styles={selectStyles}
+ fullWidth={true}
+ components={components}
+ value={state.region}
+ onChange={this.handleChange('region')}
+ onInputChange={this.handleInputSelectChange}
+ placeholder={i18n.t('core:regionSearch')}
+ />
+ </NoSsr>
+ {state.cloudErrorRegion && <FormHelperText>{i18n.t('core:invalidRegion')}</FormHelperText>}
+ </FormControl>
</Grid>
</Grid>
);
diff --git a/app/locales/en/core.json b/app/locales/en/core.json
index 332af05c1..863d7d06b 100644
--- a/app/locales/en/core.json
+++ b/app/locales/en/core.json
@@ -335,5 +335,14 @@
"quitTagSpaces": "Quit TagSpaces",
"switchTheme": "Switch theme",
"tagSearchType": "Tag search type",
+ "bucketName": "Bucket Name",
+ "regionSearch": "Search a region",
+ "secretAccessKey": "Secret Access Key",
+ "accessKeyId": "Access Key",
+ "invalidName": "Name is empty",
+ "invalidSecretAccessKey": "Secret Access Key is empty",
+ "invalidAccessKey": "Access Key is empty",
+ "invalidBucketName": "Bucket Name is empty",
+ "invalidRegion": "Region is empty",
"-": "-"
}