Skip to content

Commit

Permalink
make a component out of the related-resources-manager, re #4771
Browse files Browse the repository at this point in the history
  • Loading branch information
apeters committed Apr 27, 2019
1 parent 249f998 commit e62c3e1
Show file tree
Hide file tree
Showing 5 changed files with 380 additions and 345 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
define(['knockout',
'views/resource/related-resources-manager'
], function(ko, RelatedResourcesManager) {
return ko.components.register('related-resources-filter', {
viewModel: function(options) {
this.ready = ko.observable(false);
this.options = options;
// this component is just a light weight wrapper around the relatd resources manager
// need to wait for the search-resutls filter to be ready
// before we can load the realated-resources-filter
// because we need to pass the entire rsearch results filter into the
// related resources filter
var loaded = ko.computed(function(){
return options.filters['search-results']();
}, this);
loaded.subscribe(function(loaded) {
options.searchResultsVm = options.filters['search-results']();
options.filters['related-resources-filter'](this);
this.ready(true);
}, this);
},
template: { require: 'text!templates/views/components/search/related-resources-filter.htm'}
});
});
13 changes: 6 additions & 7 deletions arches/app/media/js/views/resource/new-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@ define([
'viewmodels/provisional-tile',
'arches',
'resource-editor-data',
'views/search/search-results',
'views/resource/related-resources-manager',
'report-templates',
'bindings/resizable-sidepanel',
'bindings/sortable',
'widgets',
'card-components'
], function($, _, ko, moment, BaseManagerView, AlertViewModel, GraphModel, ReportModel, CardViewModel, ProvisionalTileViewModel, arches, data, searchResults, RelatedResourcesManager, reportLookup) {
'card-components',
'views/resource/related-resources-manager'
], function($, _, ko, moment, BaseManagerView, AlertViewModel, GraphModel, ReportModel, CardViewModel, ProvisionalTileViewModel, arches, data, reportLookup) {
var handlers = {
'after-update': [],
'tile-reset': []
Expand Down Expand Up @@ -280,13 +279,13 @@ define([
data: {"ontology_class": vm.graph.ontologyclass}
}).done(function(data){
vm.graph.domain_connections = data;
vm.relatedResourcesManager = new RelatedResourcesManager({
searchResults: new searchResults(),
vm.relatedResourcesManagerObj = {
searchResultsVm: undefined,
resourceEditorContext: true,
editing_instance_id: vm.resourceId(),
relationship_types: vm.relationship_types,
graph: vm.graph
});
};
vm.selection('related-resources');
});
});
Expand Down
Loading

0 comments on commit e62c3e1

Please sign in to comment.