feat(tasks): change task name format in tasks datatable (#1884)

pull/1892/head
Anthony Lapenna 2018-05-10 17:17:53 +02:00 committed by GitHub
parent b2b1c86067
commit a0a667053e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 14 additions and 10 deletions

View File

@ -60,8 +60,8 @@
<tbody> <tbody>
<tr dir-paginate="item in ($ctrl.state.filteredDataSet = ($ctrl.dataset | filter:$ctrl.state.textFilter | orderBy:$ctrl.state.orderBy:$ctrl.state.reverseOrder | itemsPerPage: $ctrl.state.paginatedItemLimit))" ng-class="{active: item.Checked}"> <tr dir-paginate="item in ($ctrl.state.filteredDataSet = ($ctrl.dataset | filter:$ctrl.state.textFilter | orderBy:$ctrl.state.orderBy:$ctrl.state.reverseOrder | itemsPerPage: $ctrl.state.paginatedItemLimit))" ng-class="{active: item.Checked}">
<td> <td>
<a ng-if="!$ctrl.agentProxy || !item.Container" ui-sref="docker.tasks.task({id: item.Id})" class="monospaced">{{ item.Id }}</a> <a ng-if="!$ctrl.agentProxy || !item.Container" ui-sref="docker.tasks.task({id: item.Id})" class="monospaced">{{ item.Service.Name }}{{ item.Slot ? '.' + item.Slot : '' }}{{ '.' + item.Id }}</a>
<a ng-if="$ctrl.agentProxy && item.Container" ui-sref="docker.containers.container({ id: item.Container.Id, nodeName: item.Container.NodeName })" class="monospaced">{{ item.Id }}</a> <a ng-if="$ctrl.agentProxy && item.Container" ui-sref="docker.containers.container({ id: item.Container.Id, nodeName: item.Container.NodeName })" class="monospaced">{{ item.Service.Name }}{{ item.Slot ? '.' + item.Slot : '' }}{{ '.' + item.Id }}</a>
</td> </td>
<td><span class="label label-{{ item.Status.State | taskstatusbadge }}">{{ item.Status.State }}</span></td> <td><span class="label label-{{ item.Status.State | taskstatusbadge }}">{{ item.Status.State }}</span></td>
<td ng-if="$ctrl.showSlotColumn">{{ item.Slot ? item.Slot : '-' }}</td> <td ng-if="$ctrl.showSlotColumn">{{ item.Slot ? item.Slot : '-' }}</td>

View File

@ -11,6 +11,7 @@ angular.module('portainer.docker')
var task = tasks[i]; var task = tasks[i];
if (task.ServiceId === service.Id) { if (task.ServiceId === service.Id) {
service.Tasks.push(task); service.Tasks.push(task);
task.Service = service;
} else { } else {
otherServicesTasks.push(task); otherServicesTasks.push(task);
} }

View File

@ -7,6 +7,6 @@
show-text-filter="true" show-text-filter="true"
show-slot-column="service.Mode !== 'global'" show-slot-column="service.Mode !== 'global'"
show-logs-button="applicationState.endpoint.apiVersion >= 1.30" show-logs-button="applicationState.endpoint.apiVersion >= 1.30"
agent-powered="applicationState.endpoint.mode.agentProxy" agent-proxy="applicationState.endpoint.mode.agentProxy"
></tasks-datatable> ></tasks-datatable>
</div> </div>

View File

@ -413,9 +413,10 @@ function ($q, $scope, $transition$, $state, $location, $timeout, $anchorScroll,
var apiVersion = $scope.applicationState.endpoint.apiVersion; var apiVersion = $scope.applicationState.endpoint.apiVersion;
var agentProxy = $scope.applicationState.endpoint.mode.agentProxy; var agentProxy = $scope.applicationState.endpoint.mode.agentProxy;
var service = null;
ServiceService.service($transition$.params().id) ServiceService.service($transition$.params().id)
.then(function success(data) { .then(function success(data) {
var service = data; service = data;
$scope.isUpdating = $scope.lastVersion >= service.Version; $scope.isUpdating = $scope.lastVersion >= service.Version;
if (!$scope.isUpdating) { if (!$scope.isUpdating) {
$scope.lastVersion = service.Version; $scope.lastVersion = service.Version;
@ -460,6 +461,8 @@ function ($q, $scope, $transition$, $state, $location, $timeout, $anchorScroll,
} }
} }
ServiceHelper.associateTasksToService(service, tasks);
$scope.tasks = data.tasks; $scope.tasks = data.tasks;

View File

@ -42,7 +42,7 @@
show-text-filter="true" show-text-filter="true"
show-slot-column="true" show-slot-column="true"
show-logs-button="applicationState.endpoint.apiVersion >= 1.30" show-logs-button="applicationState.endpoint.apiVersion >= 1.30"
agent-powered="applicationState.endpoint.mode.agentProxy" agent-proxy="applicationState.endpoint.mode.agentProxy"
></tasks-datatable> ></tasks-datatable>
</div> </div>
</div> </div>

View File

@ -67,11 +67,6 @@ function ($q, $scope, $state, $transition$, StackService, NodeService, ServiceSe
var services = data.services; var services = data.services;
var tasks = data.tasks; var tasks = data.tasks;
for (var i = 0; i < services.length; i++) {
var service = services[i];
ServiceHelper.associateTasksToService(service, tasks);
}
if (agentProxy) { if (agentProxy) {
var containers = data.containers; var containers = data.containers;
for (var j = 0; j < tasks.length; j++) { for (var j = 0; j < tasks.length; j++) {
@ -80,6 +75,11 @@ function ($q, $scope, $state, $transition$, StackService, NodeService, ServiceSe
} }
} }
for (var i = 0; i < services.length; i++) {
var service = services[i];
ServiceHelper.associateTasksToService(service, tasks);
}
$scope.tasks = tasks; $scope.tasks = tasks;
$scope.services = services; $scope.services = services;
}) })