Skip to content

Add gallery_api/annotations?ns=foo endpoint#58

Open
will-moore wants to merge 1 commit intoIDR:masterfrom
will-moore:hide_containers
Open

Add gallery_api/annotations?ns=foo endpoint#58
will-moore wants to merge 1 commit intoIDR:masterfrom
will-moore:hide_containers

Conversation

@will-moore
Copy link
Copy Markdown
Member

@will-moore will-moore commented Mar 24, 2026

Fixes #57

This is an investigation into how to hide Projects and Screens until we want to publish them in IDR:

Steps:

  • $ ssh -A -o 'ProxyCommand ssh idr-testing.openmicroscopy.org -W %h:%p' omeroreadwrite -L 1080:localhost:80 then login as demo user at local http://localhost:1080/webclient and add e.g. a Comment to Project/Screen.
  • You can see the Comment ID using the browser Dev tools Network tab when re-loading right panel.
  • Then, use CLI to set the namespace on that Comment.
$ omero obj update CommentAnnotation:38359142 ns=idr.gallery.hide

We need to inject the following script into main webclient page:
What it does:

  • When the page loads, it makes an immediate request to the endpoint in this PR to load annotations with ns=idr.gallery.hide and the IDs of attached Screens and Projects.
  • It then listens for load_node.jstree events on the jsTree and filters loaded child nodes to exclude the Screens and Projects that we want to hide
<script>
        $(document).ready(function(){
            let projectsToHide = [];
            let screensToHide = [];
            fetch("/gallery_api/annotations/?ns=idr.gallery.hide&type=project&type=screen")
            .then(response => response.json())
            .then(data => {
                data.annotations.forEach(annotation => {
                    console.log("ANNOTATION", annotation);
                    let link = annotation.link;
                    if (link.parent.class === "ProjectI") {
                        projectsToHide.push(link.parent.id);
                    } else if (link.parent.class === "ScreenI") {
                        screensToHide.push(link.parent.id);
                    }
                });
            });
            $("#dataTree").on("load_node.jstree", function(event, data) {
                data.node.children = data.node.children.filter(function(childId){
                    let child = data.instance.get_node(childId);
                    // console.log(child.type === "project", projectsToHide.includes(child.data.id));
                    if ((child.type === "project") && projectsToHide.includes(child.data.id)) {
                        console.log("Hiding project", child.data.id);
                        return false;
                    } else if ((child.type === "screen") && screensToHide.includes(child.data.id)) {
                        console.log("Hiding screen", child.data.id);
                        return false;
                    }
                    return true;
                });
            });
        });
    </script>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hide Projects & Screens until published

1 participant