Skip to content

Commit

Permalink
Merge pull request #5466 from jay-hodgson/SWC-6947
Browse files Browse the repository at this point in the history
  • Loading branch information
jay-hodgson authored Jul 25, 2024
2 parents 9b693ca + cbb78c4 commit 1a67bc8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import jsinterop.annotations.JsPackage;
import jsinterop.annotations.JsType;
import org.sagebionetworks.repo.model.AccessRequirement;
import org.sagebionetworks.repo.model.RestrictableObjectType;

@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "Object")
public class AccessRequirementListProps extends ReactComponentProps {
Expand All @@ -18,18 +19,21 @@ public interface Callback {
boolean renderAsModal;
Object[] accessRequirementFromProps;
Callback onHide;
String entityId;
String subjectId;
String subjectType;

@JsOverlay
public static AccessRequirementListProps create(
Callback onHide,
List<AccessRequirement> accessRequirements,
String entityId
String subjectId,
RestrictableObjectType subjectType
) {
AccessRequirementListProps props = new AccessRequirementListProps();
props.renderAsModal = true;
props.onHide = onHide;
props.entityId = entityId;
props.subjectId = subjectId;
props.subjectType = subjectType.name();
props.accessRequirementFromProps =
accessRequirements
.stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import org.sagebionetworks.repo.model.ManagedACTAccessRequirement;
import org.sagebionetworks.repo.model.RestrictableObjectDescriptor;
import org.sagebionetworks.repo.model.RestrictableObjectType;
import org.sagebionetworks.schema.adapter.JSONObjectAdapter;
import org.sagebionetworks.web.client.DisplayUtils;
import org.sagebionetworks.web.client.GlobalApplicationState;
import org.sagebionetworks.web.client.context.SynapseReactClientFullContextPropsProvider;
Expand Down Expand Up @@ -62,7 +61,9 @@ public class ManagedACTAccessRequirementWidgetViewImpl
Button loginButton;

@UiField
ReactComponent requestDataAccessWidget;
SimplePanel requestDataAccessWidgetContainer;

ReactComponent requestDataAccessWidget = new ReactComponent();

@UiField
Div editAccessRequirementContainer;
Expand Down Expand Up @@ -130,7 +131,6 @@ public class ManagedACTAccessRequirementWidgetViewImpl
@UiField
Div subjectsDefinedInAccessRequirementUI;

private final JSONObjectAdapter jsonObjectAdapter;
private final SynapseReactClientFullContextPropsProvider propsProvider;
Callback onAttachCallback;
public static final String DEFAULT_AR_DESCRIPTION = "these data";
Expand All @@ -145,11 +145,9 @@ public interface Binder
public ManagedACTAccessRequirementWidgetViewImpl(
Binder binder,
GlobalApplicationState globalAppState,
JSONObjectAdapter jsonObjectAdapter,
SynapseReactClientFullContextPropsProvider propsProvider
) {
this.w = binder.createAndBindUi(this);
this.jsonObjectAdapter = jsonObjectAdapter;
this.propsProvider = propsProvider;
cancelRequestButton.addClickHandler(event -> {
presenter.onCancelRequest();
Expand Down Expand Up @@ -386,7 +384,7 @@ public void showRequestAccessModal(
) {
AccessRequirementListProps.Callback onHide = () -> {
presenter.refreshApprovalState();
hideRequestAccessModal();
requestDataAccessWidgetContainer.clear();
};
String entityId = null;
if (
Expand All @@ -398,8 +396,10 @@ public void showRequestAccessModal(
AccessRequirementListProps props = AccessRequirementListProps.create(
onHide,
Collections.singletonList(accessRequirement),
entityId
entityId,
RestrictableObjectType.ENTITY
);
requestDataAccessWidgetContainer.add(requestDataAccessWidget);
requestDataAccessWidget.render(
React.createElementWithSynapseContext(
SRC.SynapseComponents.AccessRequirementList,
Expand All @@ -419,8 +419,4 @@ public void setSubjectsDefinedByAnnotations(
subjectsDefinedByAnnotationsUI.setVisible(v);
subjectsDefinedInAccessRequirementUI.setVisible(!v);
}

public void hideRequestAccessModal() {
requestDataAccessWidget.clear();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@
/>
</bh:Div>
<bh:ClearFix />
<w:ReactComponent ui:field="requestDataAccessWidget" />
<g:SimplePanel ui:field="requestDataAccessWidgetContainer" />
<bh:Div ui:field="synAlertContainer" />
</b:PanelBody>
</b:Panel>
Expand Down

0 comments on commit 1a67bc8

Please sign in to comment.