Skip to content

Commit

Permalink
Handle optional plugins and plugin order.
Browse files Browse the repository at this point in the history
  • Loading branch information
manthey committed Nov 7, 2023
1 parent b5664aa commit 106b714
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
5 changes: 5 additions & 0 deletions import_tracker/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,11 @@ class GirderPlugin(plugin.GirderPlugin):

def load(self, info):
plugin.getPlugin('jobs').load(info)
try:
import large_image_source_dicom # noqa
plugin.getPlugin('dicomweb').load(info)
except ImportError:
pass
ModelImporter.registerModel(
'assetstoreImport', AssetstoreImport, 'import_tracker'
)
Expand Down
29 changes: 19 additions & 10 deletions import_tracker/web_client/main.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import $ from 'jquery';

import AssetstoreView from '@girder/core/views/body/AssetstoresView';
import FilesystemImportView from '@girder/core/views/body/FilesystemImportView';
import S3ImportView from '@girder/core/views/body/S3ImportView';
Expand All @@ -22,16 +24,23 @@ import './JobStatus';
wrap(AssetstoreView, 'render', function (render) {
// Call the underlying render function that we are wrapping
render.call(this);

this.$el.find('.g-current-assetstores-container .g-body-title').after(
'<a class="g-view-imports btn btn-sm btn-primary" href="#assetstore/all_imports"><i class="icon-link-ext"></i>View all past Imports</a>'
);

// Inject new button into each assetstore
const assetstores = this.collection.toArray();
this.$('.g-assetstore-import-button-container').after(
(i) => importDataButton({ importsPageLink: `#assetstore/${assetstores[i].id}/imports` })
);
// defer adding buttons so optional plugins can render first.
window.setTimeout(() => {
this.$el.find('.g-current-assetstores-container .g-body-title').after(
'<a class="g-view-imports btn btn-sm btn-primary" href="#assetstore/all_imports"><i class="icon-link-ext"></i>View all past Imports</a>'
);

// Inject new button into each assetstore
const assetstores = this.collection;
this.$('.g-assetstore-import-button-container').after(
function () {
// we can't just use the index of the after call, since not
// all assetstores will have import buttons.
var assetstore = assetstores.get($(this).closest('.g-assetstore-buttons').find('[cid]').attr('cid'));
return importDataButton({ importsPageLink: `#assetstore/${assetstore.id}/imports` });
}
);
}, 0);
});

// Add duplicate_files option to Import Asset form
Expand Down

0 comments on commit 106b714

Please sign in to comment.