Skip to content

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

chore: optimizing ui of the location properties

Ilian Sapundshieva27410a5a2ca
diff --git a/src/renderer/components/dialogs/CreateEditLocationDialog.tsx b/src/renderer/components/dialogs/CreateEditLocationDialog.tsx
index f035a4959..58bd9714b 100644
--- a/src/renderer/components/dialogs/CreateEditLocationDialog.tsx
+++ b/src/renderer/components/dialogs/CreateEditLocationDialog.tsx
@@ -707,6 +707,22 @@ function CreateEditLocationDialog(props: Props) {
</FormControl>
)}
{content}
+ <WorkSpacesDropdown
+ disabled={!Pro}
+ dataTid="locationWorkspaceTID"
+ workSpaceId={workSpaceId}
+ setWorkSpaceId={setWorkSpaceId}
+ workSpaces={workSpaces}
+ label={
+ <>
+ {t('core:workspace')}
+ <ProLabel />
+ </>
+ }
+ onOpenNewWorkspace={() =>
+ workSpacesContext.openNewWorkspaceDialog()
+ }
+ />
<FormControlLabel
labelPlacement="start"
style={{ justifyContent: 'space-between', marginLeft: 0 }}
@@ -783,27 +799,28 @@ function CreateEditLocationDialog(props: Props) {
/>
)}
<FormControlLabel
- disabled={
- !Pro ||
- type === locationType.TYPE_CLOUD ||
- AppConfig.isCordova
- }
labelPlacement="start"
style={{ justifyContent: 'space-between', marginLeft: 0 }}
control={
<Switch
- data-tid="changeWatchForChanges"
- name="watchForChanges"
- checked={watchForChanges}
+ disabled={!Pro}
+ data-tid="reloadOnFocusTID"
+ name="reloadOnFocus"
+ checked={reloadOnFocus}
onChange={(event: ChangeEvent<HTMLInputElement>) =>
- setWatchForChanges(event.target.checked)
+ setReloadOnFocus(event.target.checked)
}
/>
}
label={
<>
- {t('core:watchForChangesInLocation')}
- {!Pro && <ProLabel />}
+ {t('core:reloadOnFocus')}
+ <InfoIcon
+ tooltip={t(
+ 'Reloads the current folder, when the app regains focus in order to show changes which may have happened in the background.',
+ )}
+ />
+ <ProLabel />
</>
}
/>
@@ -821,22 +838,6 @@ function CreateEditLocationDialog(props: Props) {
</AccordionSummary>
<AccordionDetails>
<FormGroup>
- <WorkSpacesDropdown
- disabled={!Pro}
- dataTid="locationWorkspaceTID"
- workSpaceId={workSpaceId}
- setWorkSpaceId={setWorkSpaceId}
- workSpaces={workSpaces}
- label={
- <>
- {t('core:workspace')}
- <ProLabel />
- </>
- }
- onOpenNewWorkspace={() =>
- workSpacesContext.openNewWorkspaceDialog()
- }
- />
<FormControlLabel
labelPlacement="start"
style={{ justifyContent: 'space-between', marginLeft: 0 }}
@@ -859,40 +860,44 @@ function CreateEditLocationDialog(props: Props) {
}
/>
<FormControlLabel
+ disabled={
+ !Pro ||
+ type === locationType.TYPE_CLOUD ||
+ AppConfig.isCordova
+ }
labelPlacement="start"
style={{ justifyContent: 'space-between', marginLeft: 0 }}
control={
<Switch
- data-tid="locationSettingsGenThumbsTID"
- name="locationSettingsGenThumbs"
- checked={disableThumbnailGeneration}
+ data-tid="changeWatchForChanges"
+ name="watchForChanges"
+ checked={watchForChanges}
onChange={(event: ChangeEvent<HTMLInputElement>) =>
- setDisableThumbnailGeneration(event.target.checked)
+ setWatchForChanges(event.target.checked)
}
/>
}
- label={<>{t('core:disableThumbnailGeneration')}</>}
+ label={
+ <>
+ {t('core:watchForChangesInLocation')}
+ {!Pro && <ProLabel />}
+ </>
+ }
/>
<FormControlLabel
labelPlacement="start"
style={{ justifyContent: 'space-between', marginLeft: 0 }}
control={
<Switch
- disabled={!Pro}
- data-tid="disableIndexingTID"
- name="disableIndexing"
- checked={disableIndexing}
+ data-tid="locationSettingsGenThumbsTID"
+ name="locationSettingsGenThumbs"
+ checked={disableThumbnailGeneration}
onChange={(event: ChangeEvent<HTMLInputElement>) =>
- setIndexDisable(event.target.checked)
+ setDisableThumbnailGeneration(event.target.checked)
}
/>
}
- label={
- <>
- {t('core:disableIndexing')}
- <ProLabel />
- </>
- }
+ label={<>{t('core:disableThumbnailGeneration')}</>}
/>
<FormControlLabel
labelPlacement="start"
@@ -900,22 +905,17 @@ function CreateEditLocationDialog(props: Props) {
control={
<Switch
disabled={!Pro}
- data-tid="reloadOnFocusTID"
- name="reloadOnFocus"
- checked={reloadOnFocus}
+ data-tid="disableIndexingTID"
+ name="disableIndexing"
+ checked={disableIndexing}
onChange={(event: ChangeEvent<HTMLInputElement>) =>
- setReloadOnFocus(event.target.checked)
+ setIndexDisable(event.target.checked)
}
/>
}
label={
<>
- {t('core:reloadOnFocus')}
- <InfoIcon
- tooltip={t(
- 'Reloads the current folder, when the app regains focus in order to show changes which may have happened in the background.',
- )}
- />
+ {t('core:disableIndexing')}
<ProLabel />
</>
}
@@ -1184,7 +1184,7 @@ function CreateEditLocationDialog(props: Props) {
</FormGroup>
</AccordionDetails>
</Accordion>
- {type === locationType.TYPE_CLOUD && (
+ {devMode && type === locationType.TYPE_CLOUD && (
<Accordion>
<AccordionSummary
data-tid="switchEncryptionTID"
diff --git a/src/renderer/components/dialogs/components/ObjectStoreForm.tsx b/src/renderer/components/dialogs/components/ObjectStoreForm.tsx
index 4fc890ec2..bcfed374a 100644
--- a/src/renderer/components/dialogs/components/ObjectStoreForm.tsx
+++ b/src/renderer/components/dialogs/components/ObjectStoreForm.tsx
@@ -16,8 +16,10 @@
*
*/
+import InfoIcon from '-/components/InfoIcon';
import TsIconButton from '-/components/TsIconButton';
import TsTextField from '-/components/TsTextField';
+import { isDevMode } from '-/reducers/settings';
import Visibility from '@mui/icons-material/Visibility';
import VisibilityOff from '@mui/icons-material/VisibilityOff';
import Autocomplete from '@mui/material/Autocomplete';
@@ -26,31 +28,8 @@ import FormHelperText from '@mui/material/FormHelperText';
import Grid from '@mui/material/Grid';
import InputAdornment from '@mui/material/InputAdornment';
import { useTranslation } from 'react-i18next';
+import { useSelector } from 'react-redux';
-/**
- * https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html
- us-east-2 US East (Ohio) Not required Not available
-us-east-1 US East (N. Virginia) Not required Not available
-us-west-1 US West (N. California) Not required Not available
-us-west-2 US West (Oregon) Not required us-west-2-lax-1a us-west-2-lax-1b
-af-south-1 Africa (Cape Town) Required Not available
-ap-east-1 Asia Pacific (Hong Kong) Required Not available
-ap-south-1 Asia Pacific (Mumbai) Not required Not available
-ap-northeast-3 Asia Pacific (Osaka-Local) Not required Not available
-ap-northeast-2 Asia Pacific (Seoul) Not required Not available
-ap-southeast-1 Asia Pacific (Singapore) Not required Not available
-ap-southeast-2 Asia Pacific (Sydney) Not required Not available
-ap-northeast-1 Asia Pacific (Tokyo) Not required Not available
-ca-central-1 Canada (Central) Not required Not available
-eu-central-1 Europe (Frankfurt) Not required Not available
-eu-west-1 Europe (Ireland) Not required Not available
-eu-west-2 Europe (London) Not required Not available
-eu-south-1 Europe (Milan) Required Not available
-eu-west-3 Europe (Paris) Not required Not available
-eu-north-1 Europe (Stockholm) Not required Not available
-me-south-1 Middle East (Bahrain) Required Not available
-sa-east-1 South America (São Paulo) Not required Not available
- */
export const regions = [
'us-east-2',
'us-east-1',
@@ -130,6 +109,7 @@ function ObjectStoreForm(props: Props) {
setRegion,
} = props;
const { t } = useTranslation();
+ const devMode: boolean = useSelector(isDevMode);
function handleRegionChange(inputValue: any, value: string, reason: string) {
if (reason === 'input') {
@@ -178,7 +158,16 @@ function ObjectStoreForm(props: Props) {
data-tid="locationPath"
onChange={(event) => setStorePath(event.target.value)}
value={storePath}
- label={t('core:createLocationPath')}
+ label={
+ <>
+ {t('core:createLocationPath')}
+ <InfoIcon
+ tooltip={t(
+ 'Optional parameter which can be used to specify a path to folder in the bucket, which will be the root of the location',
+ )}
+ />
+ </>
+ }
/>
{cloudErrorTextPath && (
<FormHelperText
@@ -290,20 +279,22 @@ function ObjectStoreForm(props: Props) {
/>
</FormControl>
</Grid>
- <Grid size={12}>
- <FormControl fullWidth={true}>
- <TsTextField
- name="sessionToken"
- data-tid="sessionTokenTID"
- slotProps={{
- input: { autoCorrect: 'off', autoCapitalize: 'none' },
- }}
- onChange={(event) => setSessionToken(event.target.value)}
- value={sessionToken}
- label={t('core:sessionToken')}
- />
- </FormControl>
- </Grid>
+ {devMode && (
+ <Grid size={12}>
+ <FormControl fullWidth={true}>
+ <TsTextField
+ name="sessionToken"
+ data-tid="sessionTokenTID"
+ slotProps={{
+ input: { autoCorrect: 'off', autoCapitalize: 'none' },
+ }}
+ onChange={(event) => setSessionToken(event.target.value)}
+ value={sessionToken}
+ label={t('core:sessionToken')}
+ />
+ </FormControl>
+ </Grid>
+ )}
</Grid>
);
}