[arvados-workbench2] updated: 2.5.0-104-g95f1dba8
git repository hosting
git at public.arvados.org
Thu Mar 30 23:24:51 UTC 2023
Summary of changes:
.../sharing-dialog/sharing-dialog-component.tsx | 26 +++++++++++++++++-----
.../sharing-dialog/sharing-dialog.tsx | 5 +++++
2 files changed, 26 insertions(+), 5 deletions(-)
via 95f1dba808337fed91cbcba656f94b68fc421e41 (commit)
from 074cc61145869165217e2d35a4b949f92a6829e7 (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 95f1dba808337fed91cbcba656f94b68fc421e41
Author: Daniel Kutyła <daniel.kutyla at contractors.roche.com>
Date: Fri Mar 31 01:24:18 2023 +0200
200085: Added changes to share dialog layout
Arvados-DCO-1.1-Signed-off-by: Daniel Kutyła <daniel.kutyla at contractors.roche.com>
diff --git a/src/views-components/sharing-dialog/sharing-dialog-component.tsx b/src/views-components/sharing-dialog/sharing-dialog-component.tsx
index b2f31397..6c4d4f02 100644
--- a/src/views-components/sharing-dialog/sharing-dialog-component.tsx
+++ b/src/views-components/sharing-dialog/sharing-dialog-component.tsx
@@ -16,6 +16,7 @@ import {
Checkbox,
FormControlLabel,
Typography,
+ Tooltip,
} from '@material-ui/core';
import {
StyleRulesCallback,
@@ -39,6 +40,7 @@ import {
import DateFnsUtils from "@date-io/date-fns";
import moment from 'moment';
import { SharingPublicAccessForm } from './sharing-public-access-form';
+import { AddIcon } from 'components/icon/icon';
export interface SharingDialogDataProps {
open: boolean;
@@ -48,6 +50,7 @@ export interface SharingDialogDataProps {
sharingURLsNr: number;
privateAccess: boolean;
sharingURLsDisabled: boolean;
+ permissions: any[];
}
export interface SharingDialogActionProps {
onClose: () => void;
@@ -63,18 +66,29 @@ export type SharingDialogComponentProps = SharingDialogDataProps & SharingDialog
export default (props: SharingDialogComponentProps) => {
const { open, loading, saveEnabled, sharedResourceUuid,
- sharingURLsNr, privateAccess, sharingURLsDisabled,
+ sharingURLsNr, privateAccess, sharingURLsDisabled, permissions,
onClose, onSave, onCreateSharingToken, refreshPermissions } = props;
const showTabs = !sharingURLsDisabled && extractUuidObjectType(sharedResourceUuid) === ResourceObjectType.COLLECTION;
const [tabNr, setTabNr] = React.useState<number>(SharingDialogTab.PERMISSIONS);
const [expDate, setExpDate] = React.useState<Date>();
const [withExpiration, setWithExpiration] = React.useState<boolean>(false);
+ const [permissionsCount, setPermissionsCount] = React.useState<number>(0);
// Sets up the dialog depending on the resource type
if (!showTabs && tabNr !== SharingDialogTab.PERMISSIONS) {
setTabNr(SharingDialogTab.PERMISSIONS);
}
+ React.useEffect(() => {
+ if (permissions && permissions.length !== permissionsCount) {
+ if (permissionsCount > permissions.length) {
+ setTimeout(onSave, 0);
+ }
+
+ setPermissionsCount(permissions.length);
+ }
+ }, [permissions, onSave, setPermissionsCount, permissionsCount])
+
React.useEffect(() => {
if (!withExpiration) {
setExpDate(undefined);
@@ -180,10 +194,12 @@ export default (props: SharingDialogComponentProps) => {
}
{ tabNr === SharingDialogTab.PERMISSIONS &&
<Grid item>
- <Button onClick={onSave} variant="contained" color="primary"
- disabled={!saveEnabled}>
- Save changes
- </Button>
+ <Tooltip title="Add authorization">
+ <Button onClick={onSave} variant="contained" color="primary"
+ disabled={!saveEnabled}>
+ <AddIcon />
+ </Button>
+ </Tooltip>
</Grid>
}
<Grid item>
diff --git a/src/views-components/sharing-dialog/sharing-dialog.tsx b/src/views-components/sharing-dialog/sharing-dialog.tsx
index 01cd390b..283f1a67 100644
--- a/src/views-components/sharing-dialog/sharing-dialog.tsx
+++ b/src/views-components/sharing-dialog/sharing-dialog.tsx
@@ -5,6 +5,7 @@
import { compose, Dispatch } from 'redux';
import { connect } from 'react-redux';
import { RootState } from 'store/store';
+import { formValueSelector } from 'redux-form'
import {
connectSharingDialog,
saveSharingDialogChanges,
@@ -22,6 +23,7 @@ import {
getSharingPublicAccessFormData,
hasChanges,
SHARING_DIALOG_NAME,
+ SHARING_MANAGEMENT_FORM_NAME,
VisibilityLevel
} from 'store/sharing-dialog/sharing-dialog-types';
import { WithProgressStateProps } from 'store/progress-indicator/with-progress';
@@ -32,12 +34,15 @@ import { ResourceKind } from 'models/resource';
type Props = WithDialogProps<string> & WithProgressStateProps;
+const sharingManagementFormSelector = formValueSelector(SHARING_MANAGEMENT_FORM_NAME);
+
const mapStateToProps = (state: RootState, { working, ...props }: Props): SharingDialogDataProps => {
const dialog = getDialog<SharingDialogData>(state.dialog, SHARING_DIALOG_NAME);
const sharedResourceUuid = dialog?.data.resourceUuid || '';
const sharingURLsDisabled = state.auth.config.clusterConfig.Workbench.DisableSharingURLsUI;
return ({
...props,
+ permissions: sharingManagementFormSelector(state, 'permissions'),
saveEnabled: hasChanges(state),
loading: working,
sharedResourceUuid,
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list