[ARVADOS-WORKBENCH2] updated: 1.4.1-341-g4dc0af70
Git user
git at public.arvados.org
Mon Jun 1 21:42:28 UTC 2020
Summary of changes:
src/components/form-dialog/form-dialog.tsx | 10 ++++---
src/components/text-field/text-field.tsx | 2 +-
.../dialog-create/dialog-collection-create.tsx | 4 +--
.../dialog-create/dialog-project-create.tsx | 4 +--
.../form-fields/resource-form-fields.tsx | 10 +++----
.../side-panel-button/side-panel-button.tsx | 34 +++++++++++++++++-----
6 files changed, 43 insertions(+), 21 deletions(-)
via 4dc0af70795f76fc89eba414199cf4145f276b88 (commit)
via 3d1c23fe4f88c28a66ea1f4c5a730c37ecbe58bd (commit)
via 7c636b5648176c7138ecce3f5c632dac359d1690 (commit)
from 2d04921ec52baaa9da2e0ffee436ad24e13e9921 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 4dc0af70795f76fc89eba414199cf4145f276b88
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date: Mon Jun 1 18:30:19 2020 -0300
16439: Enables the +NEW button only when the user's view is writable.
Also, makes the SidePanelButton component to not depend on a state property
set by a something rendered later, because that makes the button being
re-renderered at least twice on every location change, instead try to get the
current item id from the location url.
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>
diff --git a/src/views-components/side-panel-button/side-panel-button.tsx b/src/views-components/side-panel-button/side-panel-button.tsx
index 0f797590..4e2e90f1 100644
--- a/src/views-components/side-panel-button/side-panel-button.tsx
+++ b/src/views-components/side-panel-button/side-panel-button.tsx
@@ -5,8 +5,6 @@
import * as React from 'react';
import { connect, DispatchProp } from 'react-redux';
import { RootState } from '~/store/store';
-import { getProperty } from '~/store/properties/properties';
-import { PROJECT_PANEL_CURRENT_UUID } from '~/store/project-panel/project-panel-action';
import { ArvadosTheme } from '~/common/custom-theme';
import { PopoverOrigin } from '@material-ui/core/Popover';
import { StyleRulesCallback, WithStyles, withStyles, Toolbar, Grid, Button, MenuItem, Menu } from '@material-ui/core';
@@ -15,6 +13,10 @@ import { openProjectCreateDialog } from '~/store/projects/project-create-actions
import { openCollectionCreateDialog } from '~/store/collections/collection-create-actions';
import { navigateToRunProcess } from '~/store/navigation/navigation-action';
import { runProcessPanelActions } from '~/store/run-process-panel/run-process-panel-actions';
+import { getUserUuid } from '~/common/getuser';
+import { matchProjectRoute } from '~/routes/routes';
+import { GroupResource } from '~/models/group';
+import { ResourcesState, getResource } from '~/store/resources/resources';
type CssRules = 'button' | 'menuItem' | 'icon';
@@ -36,6 +38,8 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
interface SidePanelDataProps {
location: any;
currentItemId: string;
+ resources: ResourcesState;
+ currentUserUUID: string | undefined;
}
interface SidePanelState {
@@ -51,8 +55,12 @@ const transformOrigin: PopoverOrigin = {
export const SidePanelButton = withStyles(styles)(
connect((state: RootState) => ({
- currentItemId: getProperty(PROJECT_PANEL_CURRENT_UUID)(state.properties),
- location: state.router.location
+ currentItemId: state.router.location
+ ? state.router.location.pathname.split('/').slice(-1)[0]
+ : null,
+ location: state.router.location,
+ resources: state.resources,
+ currentUserUUID: getUserUuid(state),
}))(
class extends React.Component<SidePanelProps> {
@@ -61,12 +69,24 @@ export const SidePanelButton = withStyles(styles)(
};
render() {
- const { classes } = this.props;
+ const { classes, location, resources, currentUserUUID, currentItemId } = this.props;
const { anchorEl } = this.state;
+ let enabled = false;
+ if (currentItemId === currentUserUUID) {
+ enabled = true;
+ } else if (matchProjectRoute(location ? location.pathname : '')) {
+ const currentProject = getResource<GroupResource>(currentItemId)(resources);
+ if (currentProject &&
+ currentProject.writableBy.indexOf(currentUserUUID || '') >= 0 &&
+ !currentProject.isTrashed) {
+ enabled = true;
+ }
+ }
return <Toolbar>
<Grid container>
<Grid container item xs alignItems="center" justify="flex-start">
- <Button variant="contained" color="primary" size="small" className={classes.button}
+ <Button variant="contained" disabled={!enabled}
+ color="primary" size="small" className={classes.button}
aria-owns={anchorEl ? 'aside-menu-list' : undefined}
aria-haspopup="true"
onClick={this.handleOpen}>
@@ -104,7 +124,7 @@ export const SidePanelButton = withStyles(styles)(
this.props.dispatch(runProcessPanelActions.RESET_RUN_PROCESS_PANEL());
this.props.dispatch(runProcessPanelActions.SET_PROCESS_PATHNAME(location.pathname));
this.props.dispatch(runProcessPanelActions.SET_PROCESS_OWNER_UUID(this.props.currentItemId));
-
+
this.props.dispatch<any>(navigateToRunProcess);
}
commit 3d1c23fe4f88c28a66ea1f4c5a730c37ecbe58bd
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date: Mon Jun 1 10:49:29 2020 -0300
16439: Reduces vertical spacing between form elements.
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>
diff --git a/src/components/form-dialog/form-dialog.tsx b/src/components/form-dialog/form-dialog.tsx
index e95693df..3df874b7 100644
--- a/src/components/form-dialog/form-dialog.tsx
+++ b/src/components/form-dialog/form-dialog.tsx
@@ -16,22 +16,24 @@ const styles: StyleRulesCallback<CssRules> = theme => ({
},
lastButton: {
marginLeft: theme.spacing.unit,
- marginRight: "20px",
+ marginRight: "0",
},
formContainer: {
display: "flex",
flexDirection: "column",
- marginTop: "20px",
+ paddingBottom: "0",
},
dialogTitle: {
- paddingBottom: "0"
+ paddingTop: theme.spacing.unit,
+ paddingBottom: theme.spacing.unit,
},
progressIndicator: {
position: "absolute",
minWidth: "20px",
},
dialogActions: {
- marginBottom: theme.spacing.unit * 3
+ marginBottom: theme.spacing.unit,
+ marginRight: theme.spacing.unit * 3,
}
});
diff --git a/src/components/text-field/text-field.tsx b/src/components/text-field/text-field.tsx
index 82d640d8..1cf9a81d 100644
--- a/src/components/text-field/text-field.tsx
+++ b/src/components/text-field/text-field.tsx
@@ -19,7 +19,7 @@ type CssRules = 'textField' | 'rte';
const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
textField: {
- marginBottom: theme.spacing.unit * 3
+ marginBottom: theme.spacing.unit
},
rte: {
fontFamily: 'Arial',
diff --git a/src/views-components/dialog-create/dialog-collection-create.tsx b/src/views-components/dialog-create/dialog-collection-create.tsx
index 86d6a217..a70030c7 100644
--- a/src/views-components/dialog-create/dialog-collection-create.tsx
+++ b/src/views-components/dialog-create/dialog-collection-create.tsx
@@ -9,7 +9,7 @@ import { CollectionCreateFormDialogData } from '~/store/collections/collection-c
import { FormDialog } from '~/components/form-dialog/form-dialog';
import { CollectionNameField, CollectionDescriptionField } from '~/views-components/form-fields/collection-form-fields';
import { FileUploaderField } from '../file-uploader/file-uploader';
-import { ResourceLocationField } from '../form-fields/resource-form-fields';
+import { ResourceParentField } from '../form-fields/resource-form-fields';
type DialogCollectionProps = WithDialogProps<{}> & InjectedFormProps<CollectionCreateFormDialogData>;
@@ -22,7 +22,7 @@ export const DialogCollectionCreate = (props: DialogCollectionProps) =>
/>;
const CollectionAddFields = () => <span>
- <ResourceLocationField />
+ <ResourceParentField />
<CollectionNameField />
<CollectionDescriptionField />
<Field
diff --git a/src/views-components/dialog-create/dialog-project-create.tsx b/src/views-components/dialog-create/dialog-project-create.tsx
index 7359ba84..c835e04e 100644
--- a/src/views-components/dialog-create/dialog-project-create.tsx
+++ b/src/views-components/dialog-create/dialog-project-create.tsx
@@ -10,7 +10,7 @@ import { FormDialog } from '~/components/form-dialog/form-dialog';
import { ProjectNameField, ProjectDescriptionField } from '~/views-components/form-fields/project-form-fields';
import { CreateProjectPropertiesForm } from '~/views-components/project-properties/create-project-properties-form';
import { CreateProjectPropertiesList } from '~/views-components/project-properties/create-project-properties-list';
-import { ResourceLocationField } from '../form-fields/resource-form-fields';
+import { ResourceParentField } from '../form-fields/resource-form-fields';
type DialogProjectProps = WithDialogProps<{}> & InjectedFormProps<ProjectCreateFormDialogData>;
@@ -23,7 +23,7 @@ export const DialogProjectCreate = (props: DialogProjectProps) =>
/>;
const ProjectAddFields = () => <span>
- <ResourceLocationField />
+ <ResourceParentField />
<ProjectNameField />
<ProjectDescriptionField />
<CreateProjectPropertiesForm />
diff --git a/src/views-components/form-fields/resource-form-fields.tsx b/src/views-components/form-fields/resource-form-fields.tsx
index 60bcafc0..0c4ae64a 100644
--- a/src/views-components/form-fields/resource-form-fields.tsx
+++ b/src/views-components/form-fields/resource-form-fields.tsx
@@ -11,19 +11,19 @@ import { GroupResource } from "~/models/group";
import { TextField } from "~/components/text-field/text-field";
import { getUserUuid } from "~/common/getuser";
-interface ResourceLocationFieldProps {
+interface ResourceParentFieldProps {
resources: ResourcesState;
userUuid: string|undefined;
}
-export const ResourceLocationField = connect(
+export const ResourceParentField = connect(
(state: RootState) => {
return {
resources: state.resources,
userUuid: getUserUuid(state),
};
})
- ((props: ResourceLocationFieldProps) =>
+ ((props: ResourceParentFieldProps) =>
<Field
name='ownerUuid'
disabled={true}
commit 7c636b5648176c7138ecce3f5c632dac359d1690
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date: Fri May 29 15:59:42 2020 -0300
16439: Updates field label.
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>
diff --git a/src/views-components/form-fields/resource-form-fields.tsx b/src/views-components/form-fields/resource-form-fields.tsx
index 0ba357c3..60bcafc0 100644
--- a/src/views-components/form-fields/resource-form-fields.tsx
+++ b/src/views-components/form-fields/resource-form-fields.tsx
@@ -27,7 +27,7 @@ export const ResourceLocationField = connect(
<Field
name='ownerUuid'
disabled={true}
- label='Location'
+ label='Parent project'
format={
(value, name) => {
if (value === props.userUuid) {
@@ -35,7 +35,7 @@ export const ResourceLocationField = connect(
}
const rsc = getResource<GroupResource>(value)(props.resources);
if (rsc !== undefined) {
- return `Project '${rsc.name}' (${rsc.uuid})`;
+ return `${rsc.name} (${rsc.uuid})`;
}
return value;
}
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list