-
Notifications
You must be signed in to change notification settings - Fork 2
Hide Projects & Screens until published #57
Description
When we migrate IDR to new infrastructure at UoD, we won't have 2 complete production servers (idr and idr-next) so we won't be able to "publish" each release by switching the IP address between the 2 servers.
We will only have a single Production server, so we need some way that we can keep new data hidden for a short time, during import and final checks before we allow public users to view it.
This is probably not going to be a general-purpose feature that should go into the webclient, so instead we want the functionality to be in a web app such as idr-gallery.
How to add code to webclient?
There are various ways to inject code from installed apps into the main webclient page, such as code for centre or right panel plugins, but I don't know a way to do it without those plugins configured? I also don't know how to use a different Django html template for the main webclient page (which could extend the main page and add some code). mapr extends the webclient page, but that's only under a /mapr/ url, not the home page.
Are there any other "hooks" we can use to inject code? cc @knabar ?
How to filter Projects / Screens?
With the following code, I can filter out newly loaded Projects or Screens based on name. However, we would prefer not to rename Projects and Screens because we want to index them in the searchengine with their correct names. So, what other criteria can we use to filter them?
<script>
$(document).ready(function(){
$("#dataTree").on("load_node.jstree", function(event, data) {
data.node.children = data.node.children.filter(function(childId){
let child = data.instance.get_node(childId);
if (child.text.startsWith("idr001")) {
return false;
}
return true;
});
});
});
</script>
The data that we load in JSON when populating the jsTree is quite limited. E.g. for each item it is like this:
{
"id": 51,
"name": "idr0021-lawo-pericentriolarmaterial/experimentA",
"ownerId": 2,
"childCount": 10,
"permsCss": ""
},
We don't really have the ability to make another fetch() call to the server to load e.g. annotations on the Projects/Screens, as the filtering above is not async. Also it would be too slow to load e.g. Tags/Comments etc on all Projects/Screens.
We could possibly store IDs of Projects/Screens to exclude as an annotation elsewhere and load that up front. But, we'd have to make sure that this happened BEFORE the jsTree loads. E.g. in the code above, as soon as the script runs, we do a fetch() to load e.g. a Comment annotation with a particular namespace like idr.hidden.containers which could be linked to the the containers we want to hide...?