Skip to content

Commit

Permalink
Merge pull request #428 from DigitalSlideArchive/app-button
Browse files Browse the repository at this point in the history
Add and support app buttons.
  • Loading branch information
manthey authored Oct 17, 2024
2 parents 3f37985 + 68f81bc commit 18a7051
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 11 deletions.
35 changes: 25 additions & 10 deletions histomicsui/web_client/views/itemList.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {wrap} from '@girder/core/utilities/PluginUtils';
import {AccessType} from '@girder/core/constants';
import {restRequest} from '@girder/core/rest';
import events from '@girder/core/events';
import ItemListWidget from '@girder/core/views/widgets/ItemListWidget';
import ItemListWidget from '@girder/large_image/views/itemList';

import {HuiSettings} from './utils';

Expand Down Expand Up @@ -63,17 +63,32 @@ wrap(ItemListWidget, 'render', function (render) {
}

HuiSettings.getSettings().then((settings) => {
const brandName = (settings['histomicsui.brand_name'] || '');
const webrootPath = (settings['histomicsui.webroot_path'] || '');
if (!this.$el.closest('.modal-dialog').length) {
for (let ix = 0; ix < this.collection.length; ix++) {
if (!this.$el.find('.g-item-list li.g-item-list-entry:eq(' + ix + ') .g-hui-open-link').length && this.collection.models[ix].attributes.largeImage) {
this.$el.find('.g-item-list li.g-item-list-entry:eq(' + ix + ') a[class^=g-]:last').after(
`<a class="g-hui-open-link" title="Open in ${brandName}" href="${webrootPath}#?image=${this.collection.models[ix].id}" target="_blank"><i class="icon-link-ext"></i></a>`
);
const brandName = (settings['histomicsui.brand_name'] || 'HistomicsUI');
const webrootPath = (settings['histomicsui.webroot_path'] || 'histomics');

ItemListWidget.registeredApplications.histomicsui = {
name: brandName,
// icon:
check: (modelType, model) => {
if (modelType !== 'item' || !model.get('largeImage')) {
return false;
}
const li = model.get('largeImage');
if (!li.fileId || li.expected === true) {
return false;
}
let priority = 0;
try {
if (model.get('meta') && model.get('meta').dicom && model.get('meta').dicom.Modality && model.get('meta').dicom.Modality !== 'SM') {
priority = 1;
}
} catch (e) {}
return {
url: `${webrootPath}#?image=${model.id}`,
priority: priority
};
}
}
};
if (this.accessLevel >= AccessType.WRITE) {
adjustView.call(this, settings);
}
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def prerelease_local_scheme(version):
'Programming Language :: Python :: 3.12',
],
install_requires=[
'girder-large-image-annotation>=1.29.10',
'girder-large-image-annotation>=1.30.1',
'girder-slicer-cli-web[girder]>=1.4.0',
'cachetools',
'orjson',
Expand Down

0 comments on commit 18a7051

Please sign in to comment.