Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #29516 - Add Tracer bulk action support
- Loading branch information
Showing
17 changed files
with
326 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module Katello | ||
module Authorization::HostTracer | ||
extend ActiveSupport::Concern | ||
|
||
include Authorizable | ||
|
||
module ClassMethods | ||
def resolvable | ||
relation = joins_authorized(::Host::Managed, :edit_hosts) | ||
relation | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
...ascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-traces-modal.controller.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/** | ||
* @ngdoc object | ||
* @name Bastion.content-hosts.controller:ContentHostsBulkTracesController | ||
* | ||
* @requires $scope | ||
* @requires $uibModalInstance | ||
* @requires HostBulkAction | ||
* @requires Notification | ||
* @requires Nutupane | ||
* @requires BastionConfig | ||
* @requires hostIds | ||
* @requires HostTracesResolve | ||
* @requires translate | ||
* | ||
* @description | ||
* Provides the functionality to support resolving traces on multiple hosts. | ||
*/ | ||
/*jshint camelcase:false*/ | ||
angular.module('Bastion.content-hosts').controller('ContentHostsBulkTracesController', | ||
['$scope', '$uibModalInstance', 'HostBulkAction', 'Notification', 'Nutupane', 'BastionConfig', 'hostIds', 'HostTracesResolve', 'translate', | ||
function ($scope, $uibModalInstance, HostBulkAction, Notification, Nutupane, BastionConfig, hostIds, HostTracesResolve, translate) { | ||
|
||
var tracesNutupane = new Nutupane(HostBulkAction, hostIds, 'traces'); | ||
tracesNutupane.enableSelectAllResults(); | ||
tracesNutupane.masterOnly = true; | ||
$scope.table = tracesNutupane.table; | ||
$scope.remoteExecutionPresent = BastionConfig.remoteExecutionPresent; | ||
|
||
$scope.performViaRemoteExecution = function() { | ||
var traceids = _.map($scope.table.getSelected(), 'id'); | ||
|
||
var onSuccess = function () { | ||
var message = translate('Successfully initiated restart of services.'); | ||
Notification.setSuccessMessage(message, { | ||
link: { | ||
children: translate("View job invocations."), | ||
href: translate("/job_invocations") | ||
}}); | ||
$scope.ok(); | ||
}; | ||
|
||
var onFailure = function (response) { | ||
angular.forEach(response.data.errors, function (responseError) { | ||
Notification.setErrorMessage(responseError); | ||
}); | ||
}; | ||
/* eslint-disable camelcase */ | ||
HostTracesResolve.resolve({trace_ids: traceids}, onSuccess, onFailure); | ||
/* eslint-enable camelcase */ | ||
}; | ||
|
||
$scope.ok = function () { | ||
$uibModalInstance.close(); | ||
}; | ||
|
||
$scope.cancel = function () { | ||
$uibModalInstance.dismiss('cancel'); | ||
}; | ||
|
||
} | ||
]); |
74 changes: 74 additions & 0 deletions
74
...javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-traces-modal.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<div data-extend-template="components/views/bst-modal.html"> | ||
<h4 data-block="modal-header">Content Host Traces Management</h4> | ||
|
||
<div data-block="modal-body"> | ||
|
||
<div class="row"> | ||
<div class="col-sm-12"> | ||
<div bst-global-notification></div> | ||
</div> | ||
</div> | ||
|
||
<div bst-alert="info" ng-hide="remoteExecutionPresent"> | ||
<span translate> | ||
The Remote Execution plugin needs to be installed in order to resolve Traces. | ||
</span> | ||
</div> | ||
|
||
<div data-extend-template="layouts/partials/table.html"> | ||
<div data-block="search" ng-show="false"></div> | ||
<span data-block="list-actions"> | ||
<div bst-modal="performViaRemoteExecution()"> | ||
<div data-block="modal-header" translate>Confirm services restart</div> | ||
<div data-block="modal-body" translate>Are you sure you want to restart the services on the selected content hosts?</div> | ||
<span data-block="modal-confirm-button"> | ||
<button class="btn btn-danger" ng-click="ok()"> | ||
<span translate>Restart</span> | ||
</button> | ||
</span> | ||
</div> | ||
|
||
<span class="btn-group"> | ||
<button class="btn btn-danger" type="button" | ||
translate | ||
ng-hide="denied('edit_hosts', host)" | ||
ng-disabled="table.getSelected().length == 0 || !remoteExecutionPresent" | ||
ng-click="openModal()"> | ||
Restart Selected | ||
</button> | ||
</span> | ||
</span> | ||
|
||
<span data-block="no-rows-message" translate> | ||
There are no Traces to display. | ||
</span> | ||
|
||
<div data-block="table"> | ||
<div data-extend-template="layouts/select-all-results.html"></div> | ||
<table bst-table="table" class="table table-striped table-bordered" ng-class="{'table-mask': table.working}"> | ||
<thead> | ||
<tr bst-table-head row-select> | ||
<th bst-table-column="application" translate>Application</th> | ||
<th bst-table-column="app_type" translate>Type</th> | ||
<th bst-table-column="helper" translate>Helper</th> | ||
<th bst-table-column="affected_hosts" translate>Hostname</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr bst-table-row ng-repeat="trace in table.rows" row-select="trace"> | ||
<td bst-table-cell >{{ trace.application }}</td> | ||
<td bst-table-cell >{{ trace.app_type }}</td> | ||
<td bst-table-cell >{{ trace.helper }}</td> | ||
<td bst-table-cell >{{ trace.host }}</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
</div> | ||
<div data-block="modal-footer"> | ||
<button type="button" class="btn btn-primary" ng-click="cancel()" translate> | ||
Cancel | ||
</button> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
...stion_katello/app/assets/javascripts/bastion_katello/hosts/host-traces-resolve.factory.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* @ngdoc service | ||
* @name Bastion.hosts.factory:HostTracesResolve | ||
* | ||
* @requires BastionResource | ||
* | ||
* @description | ||
* Provides a BastionResource for resolving traces on a set of systems. | ||
*/ | ||
angular.module('Bastion.hosts').factory('HostTracesResolve', | ||
['BastionResource', function (BastionResource) { | ||
|
||
return BastionResource('katello/api/v2/traces/:action', {}, { | ||
resolve: {method: 'PUT', isArray: true, params: {action: 'resolve'}} | ||
}); | ||
|
||
}] | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.