Remove reference to query result when changing data source

This commit is contained in:
Arik Fraimovich 2014-03-20 19:30:05 +02:00
parent addaf97489
commit 366cdbf616
3 changed files with 14 additions and 2 deletions

View File

@ -238,6 +238,19 @@
$scope.dirty = (newHash !== pristineHash);
});
$scope.updateDataSource = function() {
$scope.query.latest_query_data = null;
$scope.query.latest_query_data_id = null;
Query.save({
'id': $scope.query.id,
'data_source_id': $scope.query.data_source_id,
'latest_query_data_id': null
});
$scope.executeQuery();
};
$scope.executeQuery = function () {
$scope.queryResult = $scope.query.getQueryResult(0);
$scope.lockButton(true);

View File

@ -309,7 +309,6 @@
ttl = this.ttl;
}
var queryResult = null;
if (this.latest_query_data && ttl != 0) {
queryResult = new QueryResult({'query_result': this.latest_query_data});

View File

@ -115,7 +115,7 @@
<p>
<span class="glyphicon glyphicon-hdd"></span>
<span class="text-muted">Data Source</span>
<select ng-disabled="!isOwner" ng-model="query.data_source_id" ng-options="ds.id as ds.name for ds in dataSources"></select>
<select ng-disabled="!isOwner" ng-model="query.data_source_id" ng-change="updateDataSource()" ng-options="ds.id as ds.name for ds in dataSources"></select>
</p>
<hr>