mirror of
https://github.com/getredash/redash.git
synced 2025-12-25 10:00:45 -05:00
Fixing PR #112 as discussed with Arik
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -279,7 +279,7 @@
|
||||
Query.prototype.getHash = function() {
|
||||
return [this.name, this.description, this.query].join('!#');
|
||||
};
|
||||
|
||||
|
||||
return Query;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user