Skip to content

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

ui adjustments

Ilian Sapundshievd759394c55d3
diff --git a/app/components/dialogs/CreateLocationDialog.js b/app/components/dialogs/CreateLocationDialog.js
index 0dfa07c87..70e502062 100644
--- a/app/components/dialogs/CreateLocationDialog.js
+++ b/app/components/dialogs/CreateLocationDialog.js
@@ -25,6 +25,7 @@ import DialogActions from '@material-ui/core/DialogActions';
import DialogContent from '@material-ui/core/DialogContent';
import DialogTitle from '@material-ui/core/DialogTitle';
import Switch from '@material-ui/core/Switch';
+import FormControl from '@material-ui/core/FormControl';
import FormControlLabel from '@material-ui/core/FormControlLabel';
import FormGroup from '@material-ui/core/FormGroup';
import Grid from '@material-ui/core/Grid';
@@ -108,9 +109,9 @@ class CreateLocationDialog extends React.Component<Props, State> {
}
}; */
- componentWillUnmount = () => {
+ /* componentWillUnmount = () => {
console.log('CreateLocationDialog componentWillUnmount');
- };
+ }; */
handleInputChange = (event: Object) => {
const target = event.target;
@@ -155,12 +156,10 @@ class CreateLocationDialog extends React.Component<Props, State> {
resolve(true);
}));
}
-
if (!this.state.path || this.state.path.length === 0) {
- errorTextPath = true;
+ errorTextPath = true; // make it optinal in cloud mode
disableConfirmButton = true;
}
-
return new Promise(resolve => this.setState({ errorTextName, errorTextPath, disableConfirmButton }, resolve(!disableConfirmButton)));
} else if (this.state.type === locationType.TYPE_CLOUD) {
let cloudErrorTextName = false;
@@ -298,7 +297,7 @@ class CreateLocationDialog extends React.Component<Props, State> {
isDefault: this.state.isDefault,
isReadOnly: this.state.isReadOnly,
persistIndex: this.state.persistIndex,
- watchForChanges: this.state.watchForChanges
+ watchForChanges: false
});
}
this.props.onClose();
@@ -310,6 +309,11 @@ class CreateLocationDialog extends React.Component<Props, State> {
});
};
+ onCancel = () => {
+ this.props.onClose();
+ this.props.resetState('createLocationDialogKey');
+ }
+
renderTitle = () => (
<DialogTitle>{i18n.t('core:createLocationTitle')}</DialogTitle>
);
@@ -324,22 +328,25 @@ class CreateLocationDialog extends React.Component<Props, State> {
}
return (
<DialogContent>
- <Grid container spacing={24}>
- <Grid item xs={2} style={{ lineHeight: 3, textAlign: 'right' }}>
+ <Grid container spacing={30}>
+ <Grid item xs={2} style={{ lineHeight: 3, textAlign: 'left' }}>
Type
</Grid>
<Grid item xs={10}>
- <RadioGroup
- component="label"
- aria-label="Type"
- name="type"
- value={this.state.type}
- onChange={this.handleInputChange}
- row
- >
- <FormControlLabel value={locationType.TYPE_LOCAL} control={<Radio />} label="Local" />
- <FormControlLabel value={locationType.TYPE_CLOUD} control={<Radio />} label="Cloud (S3 AWS)" />
- </RadioGroup>
+ <FormControl disabled={!Pro}>
+ <RadioGroup
+ title={!Pro && i18n.t('core:thisFunctionalityIsAvailableInPro')}
+ component="label"
+ aria-label="Type"
+ name="type"
+ value={this.state.type}
+ onChange={this.handleInputChange}
+ row
+ >
+ <FormControlLabel value={locationType.TYPE_LOCAL} control={<Radio />} label="Local" />
+ <FormControlLabel value={locationType.TYPE_CLOUD} control={<Radio />} label="Cloud (S3 AWS)" />
+ </RadioGroup>
+ </FormControl>
</Grid>
</Grid>
{content}
@@ -382,7 +389,7 @@ class CreateLocationDialog extends React.Component<Props, State> {
<FormControlLabel
control={
<Switch
- disabled={!Pro}
+ disabled={!Pro || this.state.type === locationType.TYPE_CLOUD}
data-tid="changeWatchForChanges"
name="watchForChanges"
checked={this.state.watchForChanges}
@@ -396,28 +403,9 @@ class CreateLocationDialog extends React.Component<Props, State> {
);
};
- /*
- <FormControl
- fullWidth={true}
- >
- <InputLabel htmlFor="perspective">{i18n.t('core:createLocationDefaultPerspective')}</InputLabel>
- <Select
- native
- autoWidth
- label={i18n.t('core:createLocationDefaultPerspective')}
- name="perspective"
- value={this.state.perspective}
- onChange={this.handleInputChange}
- input={<Input id="perspective" />}
- >
- {this.props.perspectives.map((persp) => (<option key={persp.id} value={persp.id}>{persp.name}</option>))}
- </Select>
- </FormControl>
-*/
-
renderActions = () => (
<DialogActions>
- <Button onClick={this.props.onClose} >
+ <Button onClick={this.onCancel} >
{i18n.t('core:cancel')}
</Button>
<Button
diff --git a/app/components/dialogs/EditLocationDialog.js b/app/components/dialogs/EditLocationDialog.js
index be7a3b68c..ba55d22a5 100644
--- a/app/components/dialogs/EditLocationDialog.js
+++ b/app/components/dialogs/EditLocationDialog.js
@@ -142,12 +142,10 @@ class EditLocationDialog extends React.Component<Props, State> {
errorTextName = true;
disableConfirmButton = true;
}
-
if (!this.state.path || this.state.path.length === 0) {
- errorTextPath = true;
+ errorTextPath = true; // make in optional in cloud mode
disableConfirmButton = true;
}
-
this.setState({ errorTextName, errorTextPath, disableConfirmButton });
} else if (this.state.type === locationType.TYPE_CLOUD) {
let cloudErrorTextName = false;
@@ -240,7 +238,7 @@ class EditLocationDialog extends React.Component<Props, State> {
isDefault: this.state.isDefault,
isReadOnly: this.state.isReadOnly,
persistIndex: this.state.persistIndex,
- watchForChanges: this.state.watchForChanges
+ watchForChanges: false
});
}
this.props.onClose();
@@ -248,6 +246,11 @@ class EditLocationDialog extends React.Component<Props, State> {
}
};
+ onCancel = () => {
+ this.props.onClose();
+ this.props.resetState('editLocationDialogKey');
+ }
+
renderTitle = () => (
<DialogTitle>{i18n.t('core:editLocationTitle')}</DialogTitle>
);
@@ -270,22 +273,25 @@ class EditLocationDialog extends React.Component<Props, State> {
}
return (
<DialogContent>
- <Grid container spacing={24}>
- <Grid item xs={2} style={{ lineHeight: 3, textAlign: 'right' }}>
+ <Grid container spacing={30}>
+ <Grid item xs={2} style={{ lineHeight: 3, textAlign: 'left' }}>
Type
</Grid>
<Grid item xs={10}>
- <RadioGroup
- component="label"
- aria-label="Type"
- name="type"
- value={this.state.type}
- onChange={this.handleInputChange}
- row
- >
- <FormControlLabel value={locationType.TYPE_LOCAL} control={<Radio />} label="Local" />
- <FormControlLabel value={locationType.TYPE_CLOUD} control={<Radio />} label="Cloud (S3 AWS)" />
- </RadioGroup>
+ <FormControl disabled={!Pro}>
+ <RadioGroup
+ title={!Pro && i18n.t('core:thisFunctionalityIsAvailableInPro')}
+ component="label"
+ aria-label="Type"
+ name="type"
+ value={this.state.type}
+ onChange={this.handleInputChange}
+ row
+ >
+ <FormControlLabel value={locationType.TYPE_LOCAL} control={<Radio />} label="Local" />
+ <FormControlLabel value={locationType.TYPE_CLOUD} control={<Radio />} label="Cloud (S3 AWS)" />
+ </RadioGroup>
+ </FormControl>
</Grid>
</Grid>
{content}
@@ -329,7 +335,7 @@ class EditLocationDialog extends React.Component<Props, State> {
<FormControlLabel
control={
<Switch
- disabled={!Pro}
+ disabled={!Pro || this.state.type === locationType.TYPE_CLOUD}
data-tid="changeWatchForChanges"
name="watchForChanges"
checked={this.state.watchForChanges}
@@ -344,26 +350,6 @@ class EditLocationDialog extends React.Component<Props, State> {
);
};
- /*
- <FormControl
- fullWidth={true}
- >
- <InputLabel htmlFor="perspective">{i18n.t('core:createLocationDefaultPerspective')}</InputLabel>
- <Select
- data-tid="editLocationDefaultPerspective"
- native
- autoWidth
- label={i18n.t('core:createLocationDefaultPerspective')}
- name="perspective"
- value={this.state.perspective}
- onChange={this.handleInputChange}
- input={<Input id="perspective" />}
- >
- {this.props.perspectives.map((persp) => (<option key={persp.id} value={persp.id}>{persp.name}</option>))}
- </Select>
- </FormControl>
-*/
-
renderActions = () => (
<DialogActions>
<Button
@@ -388,7 +374,7 @@ class EditLocationDialog extends React.Component<Props, State> {
return (
<GenericDialog
open={this.props.open}
- onClose={() => { this.props.onClose(); this.props.resetState('editLocationDialogKey'); }}
+ onClose={this.onCancel}
onEnterKey={(event) => onEnterKeyHandler(event, this.onConfirm)}
renderTitle={this.renderTitle}
renderContent={this.renderContent}