mirror of
https://github.com/getredash/redash.git
synced 2025-12-19 17:37:19 -05:00
* Prettier all the JS files * Add GitHub Action to autoformat code pushed to master * Fix eslint violation due to formatting. * Remove GitHub actions for styling * Add restyled.io config
35 lines
923 B
JavaScript
35 lines
923 B
JavaScript
function cancelQueryButton() {
|
|
return {
|
|
restrict: "E",
|
|
scope: {
|
|
queryId: "=",
|
|
taskId: "=",
|
|
},
|
|
transclude: true,
|
|
template:
|
|
'<button class="btn btn-default" ng-disabled="inProgress" ng-click="cancelExecution()"><i class="zmdi zmdi-spinner zmdi-hc-spin" ng-if="inProgress"></i> Cancel</button>',
|
|
replace: true,
|
|
controller($scope, $http, currentUser, Events) {
|
|
$scope.inProgress = false;
|
|
|
|
$scope.cancelExecution = () => {
|
|
$http.delete(`api/jobs/${$scope.taskId}`).success(() => {});
|
|
|
|
let queryId = $scope.queryId;
|
|
if ($scope.queryId === "adhoc") {
|
|
queryId = null;
|
|
}
|
|
|
|
Events.record("cancel_execute", "query", queryId, { admin: true });
|
|
$scope.inProgress = true;
|
|
};
|
|
},
|
|
};
|
|
}
|
|
|
|
export default function init(ngModule) {
|
|
ngModule.directive("cancelQueryButton", cancelQueryButton);
|
|
}
|
|
|
|
init.init = true;
|