Fixing PR #112 as discussed with Arik

This commit is contained in:
Christopher Valles
2014-03-03 16:45:45 +00:00
parent 2bcb56d249
commit ffb2ec9bd1
3 changed files with 12 additions and 22 deletions

View File

@@ -130,15 +130,11 @@
})
}
$scope.saveQuery = function (duplicate, oldId, updateUrl) {
$scope.saveQuery = function (duplicate, oldId) {
if (!oldId) {
oldId = $scope.query.id;
}
if (updateUrl == undefined) {
updateUrl = true;
}
delete $scope.query.latest_query_data;
$scope.query.$save(function (q) {
pristineHash = q.getHash();
@@ -151,7 +147,7 @@
}
if (oldId != q.id) {
if (oldId == undefined && updateUrl) {
if (oldId == undefined) {
$location.path($location.path().replace('new', q.id)).replace();
} else {
// TODO: replace this with a safer method

View File

@@ -76,7 +76,7 @@
};
scope.stacking = "none";
if (!scope.vis) {
// create new visualization
// wait for query to load to populate with defaults
@@ -92,7 +92,7 @@
}
}, true);
}
function newOptions(chartType) {
if (chartType === Visualization.prototype.TYPES.CHART) {
return {
@@ -145,19 +145,13 @@
Visualization.save(scope.vis, function success(result) {
growl.addSuccessMessage("Visualization saved");
if (updateTabs) {
scope.vis = {
'query_id': scope.query.id
};
var visIds = _.pluck(scope.query.visualizations, 'id');
var index = visIds.indexOf(result.id);
if (index > -1) {
scope.query.visualizations[index] = result;
} else {
scope.query.visualizations.push(result);
}
var visIds = _.pluck(scope.query.visualizations, 'id');
var index = visIds.indexOf(result.id);
if (index > -1) {
scope.query.visualizations[index] = result;
} else {
scope.query.visualizations.push(result);
}
}, function error() {
growl.addErrorMessage("Visualization could not be saved");

View File

@@ -279,7 +279,7 @@
Query.prototype.getHash = function() {
return [this.name, this.description, this.query].join('!#');
};
return Query;
};