Skip to content

Commit

Permalink
fix issue with date-node dropdown not being populated, re #4771
Browse files Browse the repository at this point in the history
  • Loading branch information
apeters committed Jun 6, 2019
1 parent cbdf9e8 commit 2ef9611
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
7 changes: 5 additions & 2 deletions arches/app/media/js/views/components/search/time-filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ function($, _, ko, moment, BaseFilter, arches) {
this.selectedPeriod = ko.observable();
this.wheelConfig = ko.observable();
this.getTimeWheelConfig();
this.date_nodes = ko.observableArray();
this.graph_models = ko.observableArray();
this.selectedPeriod.subscribe(function (d) {
if (d) {
var start = moment(0, 'YYYY').add(d.start, 'years').format(this.format);
Expand Down Expand Up @@ -94,8 +96,9 @@ function($, _, ko, moment, BaseFilter, arches) {
url: arches.urls.api_search_component_data + componentName,
context: this
}).done(function(response) {
this.date_nodes = response.date_nodes;
this.graph_models = response.graph_models;
this.date_nodes(response.date_nodes);
this.graph_models(response.graph_models);
$("select[data-bind^=chosen]").trigger("chosen:updated");
});

this.filterChanged = ko.computed(function(){
Expand Down
20 changes: 9 additions & 11 deletions arches/app/templates/views/components/search/time-filter.htm
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,17 @@ <h3 class="search-title" data-bind="visible: showWheel()">{% trans "Time Wheel"
<!-- Date Type -->
<div class="calendar">
<h3 class="search-label">{% trans "Type" %}</h3>
<select id="" class="resources" data-placeholder="Date type" tabindex="-1" data-bind="value: filter.dateNodeId, chosen:{ width: '100%' }">
<select class="resources" data-placeholder="Date type" tabindex="-1" data-bind="value: filter.dateNodeId, chosen:{ width: '100%' }">
<option value="">{% trans "Search all dates" %}</option>
{% for graph in graph_models %}
{% if graph.isresource and graph.isactive %}
<optgroup label="{{ graph.name }}">
{% for node in date_nodes %}
{% if graph.graphid == node.graph_id %}
<option value="{{ node.nodeid }}">{{ node.name }}</option>
{% endif %}
{% endfor %}
<!-- ko foreach: { data: graph_models, as: 'graph' } -->
<optgroup data-bind="if: (graph.isresource && graph.isactive), attr: { label: graph.name }">
<!-- ko foreach: { data: $parent.date_nodes, as: 'node' } -->
<!-- ko if: graph.graphid === node.graph_id -->
<option data-bind="attr: { value: node.nodeid }, text: node.name"></option>
<!-- /ko -->
<!-- /ko -->
</optgroup>
{% endif %}
{% endfor %}
<!-- /ko -->
</select>
</div>

Expand Down

0 comments on commit 2ef9611

Please sign in to comment.