Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PORTALS-2818 #5286

Merged
merged 1 commit into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ public interface Callback {
void run();
}

@JsFunction
public interface BooleanCallback {
void run(boolean value);
}

String entityId;
boolean show;

Expand All @@ -29,14 +34,18 @@ public interface Callback {
@JsNullable
Double versionNumber;

@JsNullable
BooleanCallback onEditModeChanged;

@JsOverlay
public static EntityModalProps create(
String entityId,
Long versionNumber,
boolean show,
Callback onClose,
String initialTab,
boolean showTabs
boolean showTabs,
BooleanCallback onEditModeChanged
) {
EntityModalProps props = new EntityModalProps();
props.entityId = entityId;
Expand All @@ -47,6 +56,7 @@ public static EntityModalProps create(
props.onClose = onClose;
props.initialTab = initialTab;
props.showTabs = showTabs;
props.onEditModeChanged = onEditModeChanged;
return props;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
import org.gwtbootstrap3.client.ui.html.Paragraph;
import org.gwtbootstrap3.client.ui.html.Span;
import org.gwtbootstrap3.client.ui.html.Text;
import org.sagebionetworks.web.client.SynapseJSNIUtils;
import org.sagebionetworks.web.client.GlobalApplicationState;
import org.sagebionetworks.web.client.context.SynapseReactClientFullContextPropsProvider;
import org.sagebionetworks.web.client.cookie.CookieProvider;
import org.sagebionetworks.web.client.jsinterop.EntityModalProps;
import org.sagebionetworks.web.client.jsinterop.React;
import org.sagebionetworks.web.client.jsinterop.ReactNode;
Expand All @@ -32,15 +31,15 @@ public class EntityMetadataViewImpl
interface EntityMetadataViewImplUiBinder
extends UiBinder<Widget, EntityMetadataViewImpl> {}

private static EntityMetadataViewImplUiBinder uiBinder = GWT.create(
private static final EntityMetadataViewImplUiBinder uiBinder = GWT.create(
EntityMetadataViewImplUiBinder.class
);

private Presenter presenter;
private String entityId;
private Long versionNumber;
private CookieProvider cookies;
private SynapseReactClientFullContextPropsProvider propsProvider;
private final SynapseReactClientFullContextPropsProvider propsProvider;
private final GlobalApplicationState globalApplicationState;

@UiField
HTMLPanel detailedMetadata;
Expand Down Expand Up @@ -92,10 +91,11 @@ interface EntityMetadataViewImplUiBinder

@Inject
public EntityMetadataViewImpl(
final SynapseJSNIUtils jsniUtils,
final SynapseReactClientFullContextPropsProvider propsProvider
final SynapseReactClientFullContextPropsProvider propsProvider,
final GlobalApplicationState globalApplicationState
) {
this.propsProvider = propsProvider;
this.globalApplicationState = globalApplicationState;
initWidget(uiBinder.createAndBindUi(this));
idField.addClickHandler(event -> idField.selectAll());
annotationsContentCloseButton.addClickHandler(event ->
Expand Down Expand Up @@ -137,21 +137,26 @@ public void setUploadDestinationText(String text) {

@Override
public void setAnnotationsModalVisible(boolean visible) {
boolean showTabs = false;
EntityModalProps props = EntityModalProps.create(
entityId,
versionNumber,
visible,
() -> setAnnotationsModalVisible(false),
"ANNOTATIONS",
showTabs
);
ReactNode component = React.createElementWithSynapseContext(
SRC.SynapseComponents.EntityModal,
props,
propsProvider.getJsInteropContextProps()
);
annotationsModalContainer.render(component);
if (visible) {
boolean showTabs = false;
EntityModalProps props = EntityModalProps.create(
entityId,
versionNumber,
visible,
() -> setAnnotationsModalVisible(false),
"ANNOTATIONS",
showTabs,
globalApplicationState::setIsEditing
);
ReactNode component = React.createElementWithSynapseContext(
SRC.SynapseComponents.EntityModal,
props,
propsProvider.getJsInteropContextProps()
);
annotationsModalContainer.render(component);
} else {
annotationsModalContainer.clear();
}
}

@Override
Expand Down
Loading