mirror of
https://github.com/ansible/awx.git
synced 2026-03-24 04:15:02 -02:30
Merge pull request #2078 from marshmalien/fix/869-instance-groups-jobs-link
Add "running jobs" and "total jobs" links to instances and instance groups
This commit is contained in:
@@ -16,8 +16,7 @@ export default {
|
|||||||
job_search: {
|
job_search: {
|
||||||
value: {
|
value: {
|
||||||
page_size: '10',
|
page_size: '10',
|
||||||
order_by: '-id',
|
order_by: '-finished'
|
||||||
status: 'running'
|
|
||||||
},
|
},
|
||||||
dynamic: true
|
dynamic: true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ export default {
|
|||||||
name: 'instanceGroups.instanceJobs',
|
name: 'instanceGroups.instanceJobs',
|
||||||
url: '/:instance_group_id/instances/:instance_id/jobs',
|
url: '/:instance_group_id/instances/:instance_id/jobs',
|
||||||
ncyBreadcrumb: {
|
ncyBreadcrumb: {
|
||||||
parent: 'instanceGroups.edit',
|
parent: 'instanceGroups.instances',
|
||||||
label: N_('JOBS')
|
label: N_('JOBS')
|
||||||
},
|
},
|
||||||
views: {
|
views: {
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
{{ labelValue }}
|
{{ labelValue }}
|
||||||
</div>
|
</div>
|
||||||
<div class="at-RowItem-label" ng-if="labelValue && labelState">
|
<div class="at-RowItem-label" ng-if="labelValue && labelState">
|
||||||
<a ui-sref="{{ labelState }}" ui-sref-opts="{reload: true, notify: true}">{{ labelValue }}</a>
|
<a ui-sref="{{ labelState }}" ui-sref-opts="{reload: true, notify: true, inherit: false}">{{ labelValue }}</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="at-RowItem-value" ng-if="value && valueLink">
|
<div class="at-RowItem-value" ng-if="value && valueLink">
|
||||||
<a ng-href="{{ valueLink }}">{{ value }}</a>
|
<a ng-href="{{ valueLink }}">{{ value }}</a>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
function CapacityAdjuster (templateUrl, ProcessErrors, Wait) {
|
function CapacityAdjuster (templateUrl, ProcessErrors, Wait, strings) {
|
||||||
return {
|
return {
|
||||||
scope: {
|
scope: {
|
||||||
state: '=',
|
state: '=',
|
||||||
@@ -9,10 +9,10 @@ function CapacityAdjuster (templateUrl, ProcessErrors, Wait) {
|
|||||||
replace: true,
|
replace: true,
|
||||||
link: function(scope) {
|
link: function(scope) {
|
||||||
const adjustment_values = [{
|
const adjustment_values = [{
|
||||||
label: 'CPU',
|
label: strings.get('capacityAdjuster.CPU'),
|
||||||
value: scope.state.cpu_capacity,
|
value: scope.state.cpu_capacity,
|
||||||
},{
|
},{
|
||||||
label: 'RAM',
|
label: strings.get('capacityAdjuster.RAM'),
|
||||||
value: scope.state.mem_capacity
|
value: scope.state.mem_capacity
|
||||||
}];
|
}];
|
||||||
|
|
||||||
@@ -51,7 +51,8 @@ function CapacityAdjuster (templateUrl, ProcessErrors, Wait) {
|
|||||||
CapacityAdjuster.$inject = [
|
CapacityAdjuster.$inject = [
|
||||||
'templateUrl',
|
'templateUrl',
|
||||||
'ProcessErrors',
|
'ProcessErrors',
|
||||||
'Wait'
|
'Wait',
|
||||||
|
'InstanceGroupsStrings'
|
||||||
];
|
];
|
||||||
|
|
||||||
export default CapacityAdjuster;
|
export default CapacityAdjuster;
|
||||||
@@ -3,12 +3,10 @@
|
|||||||
<div ui-view="add"></div>
|
<div ui-view="add"></div>
|
||||||
<div ui-view="edit"></div>
|
<div ui-view="edit"></div>
|
||||||
|
|
||||||
<div ui-view="instanceJobs"></div>
|
<div ui-view="instanceJobsContainer"></div>
|
||||||
|
|
||||||
<div ui-view="instances"></div>
|
<div ui-view="instances"></div>
|
||||||
|
|
||||||
<div ui-view="instanceJobsContainer"></div>
|
|
||||||
|
|
||||||
<div ui-view="instanceGroupsJobsContainer"></div>
|
<div ui-view="instanceGroupsJobsContainer"></div>
|
||||||
|
|
||||||
<div ui-view="list"></div>
|
<div ui-view="list"></div>
|
||||||
|
|||||||
@@ -10,7 +10,11 @@ function InstanceGroupsStrings (BaseString) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
ns.list = {
|
ns.list = {
|
||||||
PANEL_TITLE: t.s('INSTANCE GROUPS')
|
PANEL_TITLE: t.s('INSTANCE GROUPS'),
|
||||||
|
ROW_ITEM_LABEL_INSTANCES: t.s('Instances'),
|
||||||
|
ROW_ITEM_LABEL_RUNNING_JOBS: t.s('Running Jobs'),
|
||||||
|
ROW_ITEM_LABEL_TOTAL_JOBS: t.s('Total Jobs'),
|
||||||
|
ROW_ITEM_LABEL_USED_CAPACITY: t.s('Used Capacity')
|
||||||
};
|
};
|
||||||
|
|
||||||
ns.tab = {
|
ns.tab = {
|
||||||
@@ -33,6 +37,11 @@ function InstanceGroupsStrings (BaseString) {
|
|||||||
IS_OFFLINE_LABEL: t.s('Unavailable')
|
IS_OFFLINE_LABEL: t.s('Unavailable')
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ns.capacityAdjuster = {
|
||||||
|
CPU: t.s('CPU'),
|
||||||
|
RAM: t.s('RAM')
|
||||||
|
};
|
||||||
|
|
||||||
ns.jobs = {
|
ns.jobs = {
|
||||||
PANEL_TITLE: t.s('Jobs')
|
PANEL_TITLE: t.s('Jobs')
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -61,17 +61,24 @@
|
|||||||
<div class="at-Row-items">
|
<div class="at-Row-items">
|
||||||
<at-row-item header-value="{{ instance.hostname }}"></at-row-item>
|
<at-row-item header-value="{{ instance.hostname }}"></at-row-item>
|
||||||
<at-row-item
|
<at-row-item
|
||||||
label-value="Running Jobs"
|
label-value="{{:: vm.strings.get('list.ROW_ITEM_LABEL_RUNNING_JOBS') }}"
|
||||||
label-state="instanceGroups.instanceJobs({instance_group_id: {{vm.instance_group_id}}, instance_id: {{instance.id}}})"
|
label-state="instanceGroups.instanceJobs({instance_group_id: {{vm.instance_group_id}}, instance_id: {{instance.id}}, job_search: {status__in: ['running,waiting']}})"
|
||||||
value="{{ instance.jobs_running }}"
|
value="{{ instance.jobs_running }}"
|
||||||
inline="true"
|
inline="true"
|
||||||
badge="true">
|
badge="true">
|
||||||
</at-row-item>
|
</at-row-item>
|
||||||
|
<at-row-item
|
||||||
|
label-value="{{:: vm.strings.get('list.ROW_ITEM_LABEL_TOTAL_JOBS') }}"
|
||||||
|
label-state="instanceGroups.instanceJobs({instance_group_id: {{vm.instance_group_id}}, instance_id: {{instance.id}}})"
|
||||||
|
value="{{ instance.jobs_total }}"
|
||||||
|
inline="true"
|
||||||
|
badge="true">
|
||||||
|
</at-row-item>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="at-Row-actions">
|
<div class="at-Row-actions">
|
||||||
<capacity-adjuster state="instance" disabled="{{vm.rowAction.capacity_adjustment._disabled}}"></capacity-adjuster>
|
<capacity-adjuster state="instance" disabled="{{vm.rowAction.capacity_adjustment._disabled}}"></capacity-adjuster>
|
||||||
<capacity-bar label-value="Used Capacity" capacity="instance.consumed_capacity" total-capacity="instance.capacity"></capacity-bar>
|
<capacity-bar label-value="{{:: vm.strings.get('list.ROW_ITEM_LABEL_USED_CAPACITY') }}" capacity="instance.consumed_capacity" total-capacity="instance.capacity"></capacity-bar>
|
||||||
</div>
|
</div>
|
||||||
</at-row>
|
</at-row>
|
||||||
</at-list>
|
</at-list>
|
||||||
|
|||||||
@@ -45,25 +45,31 @@
|
|||||||
|
|
||||||
<div class="at-Row--inline">
|
<div class="at-Row--inline">
|
||||||
<at-row-item
|
<at-row-item
|
||||||
label-value="Instances"
|
label-value="{{:: vm.strings.get('list.ROW_ITEM_LABEL_INSTANCES') }}"
|
||||||
label-link="/#/instance_groups/{{ instance_group.id }}/instances"
|
label-link="/#/instance_groups/{{ instance_group.id }}/instances"
|
||||||
value="{{ instance_group.instances }}"
|
value="{{ instance_group.instances }}"
|
||||||
inline="true"
|
inline="true"
|
||||||
badge="true">
|
badge="true">
|
||||||
</at-row-item>
|
</at-row-item>
|
||||||
|
|
||||||
<at-row-item
|
<at-row-item
|
||||||
label-value="Running Jobs"
|
label-value="{{:: vm.strings.get('list.ROW_ITEM_LABEL_RUNNING_JOBS') }}"
|
||||||
label-link="/#/instance_groups/{{ instance_group.id }}/jobs"
|
label-state="instanceGroups.jobs({instance_group_id: {{ instance_group.id }}, job_search: {status__in: ['running,waiting']}})"
|
||||||
value="{{ instance_group.jobs_running }}"
|
value="{{ instance_group.jobs_running }}"
|
||||||
inline="true"
|
inline="true"
|
||||||
badge="true">
|
badge="true">
|
||||||
</at-row-item>
|
</at-row-item>
|
||||||
|
<at-row-item
|
||||||
|
label-value="{{:: vm.strings.get('list.ROW_ITEM_LABEL_TOTAL_JOBS') }}"
|
||||||
|
label-state="instanceGroups.jobs({instance_group_id: {{ instance_group.id }}})"
|
||||||
|
value="{{ instance_group.jobs_total }}"
|
||||||
|
inline="true"
|
||||||
|
badge="true">
|
||||||
|
</at-row-item>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="at-Row-actions">
|
<div class="at-Row-actions">
|
||||||
<capacity-bar label-value="Used Capacity" capacity="instance_group.consumed_capacity" total-capacity="instance_group.capacity"></capacity-bar>
|
<capacity-bar label-value="{{:: vm.strings.get('list.ROW_ITEM_LABEL_USED_CAPACITY') }}" capacity="instance_group.consumed_capacity" total-capacity="instance_group.capacity"></capacity-bar>
|
||||||
<at-row-action icon="fa-trash" ng-click="vm.deleteInstanceGroup(instance_group)" ng-if="vm.rowAction.trash(instance_group)">
|
<at-row-action icon="fa-trash" ng-click="vm.deleteInstanceGroup(instance_group)" ng-if="vm.rowAction.trash(instance_group)">
|
||||||
</at-row-action>
|
</at-row-action>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -10,9 +10,10 @@ export default [function() {
|
|||||||
const maxPanels = parseInt(scope.maxPanels);
|
const maxPanels = parseInt(scope.maxPanels);
|
||||||
|
|
||||||
scope.$watch(
|
scope.$watch(
|
||||||
() => angular.element('#' + scope.panelContainer).find('.Panel').length,
|
() => angular.element('#' + scope.panelContainer).find('.Panel, .at-Panel').length,
|
||||||
() => {
|
() => {
|
||||||
const panels = angular.element('#' + scope.panelContainer).find('.Panel');
|
const panels = angular.element('#' + scope.panelContainer).find('.Panel, .at-Panel');
|
||||||
|
|
||||||
if(panels.length > maxPanels) {
|
if(panels.length > maxPanels) {
|
||||||
// hide the excess panels
|
// hide the excess panels
|
||||||
$(panels).each(function( index ) {
|
$(panels).each(function( index ) {
|
||||||
|
|||||||
Reference in New Issue
Block a user