chore(project): add prettier for code format (#3645)

* chore(project): install prettier and lint-staged

* chore(project): apply prettier to html too

* chore(project): git ignore eslintcache

* chore(project): add a comment about format script

* chore(prettier): update printWidth

* chore(prettier): remove useTabs option

* chore(prettier): add HTML validation

* refactor(prettier): fix closing tags

* feat(prettier): define angular parser for html templates

* style(prettier): run prettier on codebase

Co-authored-by: Anthony Lapenna <lapenna.anthony@gmail.com>
pull/3702/head
Chaim Lev-Ari 2020-04-11 00:54:53 +03:00 committed by GitHub
parent 6663073be1
commit cf5056d9c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
714 changed files with 31228 additions and 28305 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@ portainer-checksum.txt
api/cmd/portainer/portainer*
.tmp
.vscode
.eslintcache

13
.prettierrc Normal file
View File

@ -0,0 +1,13 @@
{
"printWidth": 180,
"singleQuote": true,
"htmlWhitespaceSensitivity": "strict",
"overrides": [
{
"files": ["*.html"],
"options": {
"parser": "angular"
}
}
]
}

View File

@ -32,7 +32,7 @@ angular.module('portainer', [
'portainer.extensions',
'portainer.integrations',
'rzModule',
'moment-picker'
'moment-picker',
]);
if (require) {

View File

@ -4,7 +4,7 @@ angular.module('portainer.agent').controller('FileUploaderController', [
var ctrl = this;
ctrl.state = {
uploadInProgress: false
uploadInProgress: false,
};
ctrl.onFileSelected = onFileSelected;
@ -19,5 +19,5 @@ angular.module('portainer.agent').controller('FileUploaderController', [
ctrl.state.uploadInProgress = false;
});
}
}
},
]);

View File

@ -1,6 +1,3 @@
<button
ngf-select="$ctrl.onFileSelected($file)"
class="btn ng-scope"
button-spinner="$ctrl.state.uploadInProgress">
<i style="margin:0" class="fa fa-upload" ng-if="!$ctrl.state.uploadInProgress"></i>
<button ngf-select="$ctrl.onFileSelected($file)" class="btn ng-scope" button-spinner="$ctrl.state.uploadInProgress">
<i style="margin: 0;" class="fa fa-upload" ng-if="!$ctrl.state.uploadInProgress"></i>
</button>

View File

@ -2,6 +2,6 @@ angular.module('portainer.agent').component('fileUploader', {
templateUrl: './file-uploader.html',
controller: 'FileUploaderController',
bindings: {
uploadFile: '<onFileSelected'
}
uploadFile: '<onFileSelected',
},
});

View File

@ -1,14 +1,20 @@
<div class="datatable">
<rd-widget>
<rd-widget-header icon="{{ $ctrl.titleIcon }}" title-text="{{ $ctrl.titleText }}">
<file-uploader authorization="DockerAgentBrowsePut" ng-if="$ctrl.isUploadAllowed" on-file-selected="$ctrl.onFileSelectedForUpload">
</file-uploader>
<file-uploader authorization="DockerAgentBrowsePut" ng-if="$ctrl.isUploadAllowed" on-file-selected="($ctrl.onFileSelectedForUpload)"> </file-uploader>
</rd-widget-header>
<rd-widget-body classes="no-padding">
<div class="searchBar">
<i class="fa fa-search searchIcon" aria-hidden="true"></i>
<input type="text" class="searchInput" ng-model="$ctrl.state.textFilter" ng-model-options="{ debounce: 300 }"
ng-change="$ctrl.onTextFilterChange()" placeholder="Search..." auto-focus>
<input
type="text"
class="searchInput"
ng-model="$ctrl.state.textFilter"
ng-model-options="{ debounce: 300 }"
ng-change="$ctrl.onTextFilterChange()"
placeholder="Search..."
auto-focus
/>
</div>
<div class="table-responsive">
<table class="table">
@ -43,36 +49,33 @@
<tbody>
<tr ng-if="!$ctrl.isRoot">
<td colspan="4">
<a ng-click="$ctrl.goToParent()"><i class="fa fa-level-up-alt space-right"></i>Go
to parent</a>
<a ng-click="$ctrl.goToParent()"><i class="fa fa-level-up-alt space-right"></i>Go to parent</a>
</td>
</tr>
<tr ng-repeat="item in ($ctrl.state.filteredDataSet = ($ctrl.dataset | filter:$ctrl.state.textFilter | orderBy:$ctrl.state.orderBy:$ctrl.state.reverseOrder))">
<td>
<span ng-if="item.edit">
<input class="input-sm" type="text" ng-model="item.newName"
on-enter-key="$ctrl.rename({name: item.Name, newName: item.newName}); item.edit = false;"
auto-focus />
<input
class="input-sm"
type="text"
ng-model="item.newName"
on-enter-key="$ctrl.rename({ name: item.Name, newName: item.newName }); item.edit = false"
auto-focus
/>
<a class="interactive" ng-click="item.edit = false;"><i class="fa fa-times"></i></a>
<a class="interactive" ng-click="$ctrl.rename({name: item.Name, newName: item.newName}); item.edit = false;"><i
class="fa fa-check-square"></i></a>
<a class="interactive" ng-click="$ctrl.rename({name: item.Name, newName: item.newName}); item.edit = false;"><i class="fa fa-check-square"></i></a>
</span>
<span ng-if="!item.edit && item.Dir">
<a ng-click="$ctrl.browse({name: item.Name})"><i class="fa fa-folder space-right"
aria-hidden="true"></i>{{ item.Name }}</a>
</span>
<span ng-if="!item.edit && !item.Dir">
<i class="fa fa-file space-right" aria-hidden="true"></i>{{
item.Name }}
<a ng-click="$ctrl.browse({name: item.Name})"><i class="fa fa-folder space-right" aria-hidden="true"></i>{{ item.Name }}</a>
</span>
<span ng-if="!item.edit && !item.Dir"> <i class="fa fa-file space-right" aria-hidden="true"></i>{{ item.Name }} </span>
</td>
<td>{{ item.Size | humansize }}</td>
<td>
{{ item.ModTime | getisodatefromtimestamp }}
</td>
<td>
<btn authorization="DockerAgentBrowseGet" class="btn btn-xs btn-primary space-right" ng-click="$ctrl.download({ name: item.Name })"
ng-if="!item.Dir">
<btn authorization="DockerAgentBrowseGet" class="btn btn-xs btn-primary space-right" ng-click="$ctrl.download({ name: item.Name })" ng-if="!item.Dir">
<i class="fa fa-download" aria-hidden="true"></i> Download
</btn>
<btn authorization="DockerAgentBrowseRename" class="btn btn-xs btn-primary space-right" ng-click="item.newName = item.Name; item.edit = true">

View File

@ -17,6 +17,6 @@ angular.module('portainer.agent').component('filesDatatable', {
delete: '&',
isUploadAllowed: '<',
onFileSelectedForUpload: '<'
}
onFileSelectedForUpload: '<',
},
});

View File

@ -1,12 +1,15 @@
import _ from 'lodash-es';
angular.module('portainer.agent').controller('HostBrowserController', [
'HostBrowserService', 'Notifications', 'FileSaver', 'ModalService',
'HostBrowserService',
'Notifications',
'FileSaver',
'ModalService',
function HostBrowserController(HostBrowserService, Notifications, FileSaver, ModalService) {
var ctrl = this;
var ROOT_PATH = '/host';
ctrl.state = {
path: ROOT_PATH
path: ROOT_PATH,
};
ctrl.goToParent = goToParent;
@ -21,7 +24,7 @@ angular.module('portainer.agent').controller('HostBrowserController', [
function getRelativePath(path) {
path = path || ctrl.state.path;
var rootPathRegex = new RegExp('^' + ROOT_PATH + '\/?');
var rootPathRegex = new RegExp('^' + ROOT_PATH + '/?');
var relativePath = path.replace(rootPathRegex, '/');
return relativePath;
}
@ -71,7 +74,7 @@ angular.module('portainer.agent').controller('HostBrowserController', [
HostBrowserService.get(filePath)
.then(function onFileReceived(data) {
var downloadData = new Blob([data.file], {
type: 'text/plain;charset=utf-8'
type: 'text/plain;charset=utf-8',
});
FileSaver.saveAs(downloadData, file);
})
@ -83,15 +86,12 @@ angular.module('portainer.agent').controller('HostBrowserController', [
function confirmDeleteFile(name) {
var filePath = buildPath(ctrl.state.path, name);
ModalService.confirmDeletion(
'Are you sure that you want to delete ' + getRelativePath(filePath) + ' ?',
function onConfirm(confirmed) {
ModalService.confirmDeletion('Are you sure that you want to delete ' + getRelativePath(filePath) + ' ?', function onConfirm(confirmed) {
if (!confirmed) {
return;
}
return deleteFile(filePath);
}
);
});
}
function deleteFile(path) {
@ -145,5 +145,5 @@ angular.module('portainer.agent').controller('HostBrowserController', [
function refreshList() {
getFilesForPath(ctrl.state.path);
}
}
},
]);

View File

@ -1,6 +1,8 @@
<files-datatable
title-text="Host browser - {{$ctrl.getRelativePath()}}" title-icon="fa-file"
dataset="$ctrl.files" table-key="host_browser"
title-text="Host browser - {{ $ctrl.getRelativePath() }}"
title-icon="fa-file"
dataset="$ctrl.files"
table-key="host_browser"
order-by="Dir"
is-root="$ctrl.isRoot()"
go-to-parent="$ctrl.goToParent()"
@ -8,9 +10,7 @@
rename="$ctrl.renameFile(name, newName)"
download="$ctrl.downloadFile(name)"
delete="$ctrl.deleteFile(name)"
is-upload-allowed="true"
on-file-selected-for-upload="$ctrl.onFileSelectedForUpload"
on-file-selected-for-upload="($ctrl.onFileSelectedForUpload)"
>
</files-datatable>

View File

@ -1,5 +1,5 @@
angular.module('portainer.agent').component('hostBrowser', {
controller: 'HostBrowserController',
templateUrl: './host-browser.html',
bindings: {}
bindings: {},
});

View File

@ -2,6 +2,6 @@ angular.module('portainer.agent').component('nodeSelector', {
templateUrl: './nodeSelector.html',
controller: 'NodeSelectorController',
bindings: {
model: '='
}
model: '=',
},
});

View File

@ -1,8 +1,6 @@
<div class="form-group">
<label for="target_node" class="col-sm-1 control-label text-left">Node</label>
<div class="col-sm-11">
<select class="form-control"
ng-model="$ctrl.model" ng-options="agent.NodeName as agent.NodeName for agent in $ctrl.agents"
></select>
<select class="form-control" ng-model="$ctrl.model" ng-options="agent.NodeName as agent.NodeName for agent in $ctrl.agents"></select>
</div>
</div>

View File

@ -1,5 +1,7 @@
angular.module('portainer.agent')
.controller('NodeSelectorController', ['AgentService', 'Notifications', function (AgentService, Notifications) {
angular.module('portainer.agent').controller('NodeSelectorController', [
'AgentService',
'Notifications',
function (AgentService, Notifications) {
var ctrl = this;
this.$onInit = function () {
@ -14,5 +16,5 @@ angular.module('portainer.agent')
Notifications.error('Failure', err, 'Unable to load agents');
});
};
}]);
},
]);

View File

@ -4,6 +4,6 @@ angular.module('portainer.agent').component('volumeBrowser', {
bindings: {
volumeId: '<',
nodeName: '<',
isUploadEnabled: '<'
}
isUploadEnabled: '<',
},
});

View File

@ -1,6 +1,8 @@
<files-datatable
title-text="Volume browser" title-icon="fa-file"
dataset="$ctrl.files" table-key="volume_browser"
title-text="Volume browser"
title-icon="fa-file"
dataset="$ctrl.files"
table-key="volume_browser"
order-by="Dir"
is-root="$ctrl.state.path === '/'"
go-to-parent="$ctrl.up()"
@ -8,7 +10,6 @@
rename="$ctrl.rename(name, newName)"
download="$ctrl.download(name)"
delete="$ctrl.delete(name)"
is-upload-allowed="$ctrl.isUploadEnabled"
on-file-selected-for-upload="$ctrl.onFileSelectedForUpload"
on-file-selected-for-upload="($ctrl.onFileSelectedForUpload)"
></files-datatable>

View File

@ -1,12 +1,17 @@
import _ from 'lodash-es';
angular.module('portainer.agent')
.controller('VolumeBrowserController', ['HttpRequestHelper', 'VolumeBrowserService', 'FileSaver', 'Blob', 'ModalService', 'Notifications',
angular.module('portainer.agent').controller('VolumeBrowserController', [
'HttpRequestHelper',
'VolumeBrowserService',
'FileSaver',
'Blob',
'ModalService',
'Notifications',
function (HttpRequestHelper, VolumeBrowserService, FileSaver, Blob, ModalService, Notifications) {
var ctrl = this;
this.state = {
path: '/'
path: '/',
};
this.rename = function (file, newName) {
@ -29,13 +34,12 @@ function (HttpRequestHelper, VolumeBrowserService, FileSaver, Blob, ModalService
this.delete = function (file) {
var filePath = this.state.path === '/' ? file : this.state.path + '/' + file;
ModalService.confirmDeletion(
'Are you sure that you want to delete ' + filePath + ' ?',
function onConfirm(confirmed) {
if(!confirmed) { return; }
deleteFile(filePath);
ModalService.confirmDeletion('Are you sure that you want to delete ' + filePath + ' ?', function onConfirm(confirmed) {
if (!confirmed) {
return;
}
);
deleteFile(filePath);
});
};
this.download = function (file) {
@ -74,7 +78,6 @@ function (HttpRequestHelper, VolumeBrowserService, FileSaver, Blob, ModalService
});
}
function browse(path) {
VolumeBrowserService.ls(ctrl.volumeId, path)
.then(function success(data) {
@ -112,7 +115,6 @@ function (HttpRequestHelper, VolumeBrowserService, FileSaver, Blob, ModalService
return parent + '/' + file;
}
this.$onInit = function () {
HttpRequestHelper.setPortainerAgentTargetHeader(this.nodeName);
VolumeBrowserService.ls(this.volumeId, this.state.path)
@ -131,7 +133,5 @@ function (HttpRequestHelper, VolumeBrowserService, FileSaver, Blob, ModalService
function refreshList() {
browse(ctrl.state.path);
}
}]);
},
]);

View File

@ -1,12 +1,19 @@
angular.module('portainer.agent')
.factory('Agent', ['$resource', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider', 'StateManager',
angular.module('portainer.agent').factory('Agent', [
'$resource',
'API_ENDPOINT_ENDPOINTS',
'EndpointProvider',
'StateManager',
function AgentFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider, StateManager) {
'use strict';
return $resource(API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/v:version/agents', {
return $resource(
API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/v:version/agents',
{
endpointId: EndpointProvider.endpointID,
version: StateManager.getAgentApiVersion
version: StateManager.getAgentApiVersion,
},
{
query: { method: 'GET', isArray: true }
});
}]);
query: { method: 'GET', isArray: true },
}
);
},
]);

View File

@ -1,27 +1,39 @@
import { browseGetResponse } from './response/browse';
angular.module('portainer.agent')
.factory('Browse', ['$resource', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider', 'StateManager',
angular.module('portainer.agent').factory('Browse', [
'$resource',
'API_ENDPOINT_ENDPOINTS',
'EndpointProvider',
'StateManager',
function BrowseFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider, StateManager) {
'use strict';
return $resource(API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/v:version/browse/:action', {
return $resource(
API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/v:version/browse/:action',
{
endpointId: EndpointProvider.endpointID,
version: StateManager.getAgentApiVersion
version: StateManager.getAgentApiVersion,
},
{
ls: {
method: 'GET', isArray: true, params: { action: 'ls' }
method: 'GET',
isArray: true,
params: { action: 'ls' },
},
get: {
method: 'GET', params: { action: 'get' },
method: 'GET',
params: { action: 'get' },
transformResponse: browseGetResponse,
responseType: 'arraybuffer'
responseType: 'arraybuffer',
},
delete: {
method: 'DELETE', params: { action: 'delete' }
method: 'DELETE',
params: { action: 'delete' },
},
rename: {
method: 'PUT', params: { action: 'rename' }
method: 'PUT',
params: { action: 'rename' },
},
}
});
}]);
);
},
]);

View File

@ -1,16 +1,19 @@
angular.module('portainer.agent').factory('Host', [
'$resource', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider', 'StateManager',
'$resource',
'API_ENDPOINT_ENDPOINTS',
'EndpointProvider',
'StateManager',
function AgentFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider, StateManager) {
'use strict';
return $resource(
API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/v:version/host/:action',
{
endpointId: EndpointProvider.endpointID,
version: StateManager.getAgentApiVersion
version: StateManager.getAgentApiVersion,
},
{
info: { method: 'GET', params: { action: 'info' } }
info: { method: 'GET', params: { action: 'info' } },
}
);
}
},
]);

View File

@ -1,11 +1,14 @@
angular.module('portainer.agent').factory('AgentPing', [
'$resource', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider', '$q',
'$resource',
'API_ENDPOINT_ENDPOINTS',
'EndpointProvider',
'$q',
function AgentPingFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider, $q) {
'use strict';
return $resource(
API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/ping',
{
endpointId: EndpointProvider.endpointID
endpointId: EndpointProvider.endpointID,
},
{
ping: {
@ -13,8 +16,7 @@ angular.module('portainer.agent').factory('AgentPing', [
interceptor: {
response: function versionInterceptor(response) {
var instance = response.resource;
var version =
response.headers('Portainer-Agent-Api-Version') || 1;
var version = response.headers('Portainer-Agent-Api-Version') || 1;
instance.version = Number(version);
return instance;
},
@ -24,10 +26,10 @@ angular.module('portainer.agent').factory('AgentPing', [
return { version: 1 };
}
return $q.reject(error);
}
}
}
},
},
},
}
);
}
},
]);

View File

@ -1,10 +1,17 @@
angular.module('portainer.agent')
.factory('AgentVersion1', ['$resource', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider', function AgentFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
angular.module('portainer.agent').factory('AgentVersion1', [
'$resource',
'API_ENDPOINT_ENDPOINTS',
'EndpointProvider',
function AgentFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
'use strict';
return $resource(API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/agents', {
endpointId: EndpointProvider.endpointID
return $resource(
API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/agents',
{
endpointId: EndpointProvider.endpointID,
},
{
query: { method: 'GET', isArray: true }
});
}]);
query: { method: 'GET', isArray: true },
}
);
},
]);

View File

@ -1,25 +1,37 @@
import { browseGetResponse } from '../response/browse';
angular.module('portainer.agent')
.factory('BrowseVersion1', ['$resource', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider', function BrowseFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
angular.module('portainer.agent').factory('BrowseVersion1', [
'$resource',
'API_ENDPOINT_ENDPOINTS',
'EndpointProvider',
function BrowseFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
'use strict';
return $resource(API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/browse/:volumeID/:action', {
endpointId: EndpointProvider.endpointID
return $resource(
API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/browse/:volumeID/:action',
{
endpointId: EndpointProvider.endpointID,
},
{
ls: {
method: 'GET', isArray: true, params: { action: 'ls' }
method: 'GET',
isArray: true,
params: { action: 'ls' },
},
get: {
method: 'GET', params: { action: 'get' },
method: 'GET',
params: { action: 'get' },
transformResponse: browseGetResponse,
responseType: 'arraybuffer'
responseType: 'arraybuffer',
},
delete: {
method: 'DELETE', params: { action: 'delete' }
method: 'DELETE',
params: { action: 'delete' },
},
rename: {
method: 'PUT', params: { action: 'rename' }
method: 'PUT',
params: { action: 'rename' },
},
}
});
}]);
);
},
]);

View File

@ -1,7 +1,12 @@
import { AgentViewModel } from '../models/agent';
angular.module('portainer.agent').factory('AgentService', [
'$q', 'Agent', 'AgentVersion1', 'HttpRequestHelper', 'Host', 'StateManager',
'$q',
'Agent',
'AgentVersion1',
'HttpRequestHelper',
'Host',
'StateManager',
function AgentServiceFactory($q, Agent, AgentVersion1, HttpRequestHelper, Host, StateManager) {
'use strict';
var service = {};
@ -25,7 +30,8 @@ angular.module('portainer.agent').factory('AgentService', [
var agentVersion = getAgentApiVersion();
var service = agentVersion > 1 ? Agent : AgentVersion1;
service.query({ version: agentVersion })
service
.query({ version: agentVersion })
.$promise.then(function success(data) {
var agents = data.map(function (item) {
return new AgentViewModel(item);
@ -40,5 +46,5 @@ angular.module('portainer.agent').factory('AgentService', [
}
return service;
}
},
]);

View File

@ -1,5 +1,10 @@
angular.module('portainer.agent').factory('HostBrowserService', [
'Browse', 'Upload', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider', '$q', 'StateManager',
'Browse',
'Upload',
'API_ENDPOINT_ENDPOINTS',
'EndpointProvider',
'$q',
'StateManager',
function HostBrowserServiceFactory(Browse, Upload, API_ENDPOINT_ENDPOINTS, EndpointProvider, $q, StateManager) {
var service = {};
@ -24,7 +29,7 @@ angular.module('portainer.agent').factory('HostBrowserService', [
function rename(path, newPath) {
var payload = {
CurrentFilePath: path,
NewFilePath: newPath
NewFilePath: newPath,
};
return Browse.rename({}, payload).$promise;
}
@ -32,21 +37,15 @@ angular.module('portainer.agent').factory('HostBrowserService', [
function upload(path, file, onProgress) {
var deferred = $q.defer();
var agentVersion = StateManager.getAgentApiVersion();
var url =
API_ENDPOINT_ENDPOINTS +
'/' +
EndpointProvider.endpointID() +
'/docker' +
(agentVersion > 1 ? '/v' + agentVersion : '') +
'/browse/put';
var url = API_ENDPOINT_ENDPOINTS + '/' + EndpointProvider.endpointID() + '/docker' + (agentVersion > 1 ? '/v' + agentVersion : '') + '/browse/put';
Upload.upload({
url: url,
data: { file: file, Path: path }
data: { file: file, Path: path },
}).then(deferred.resolve, deferred.reject, onProgress);
return deferred.promise;
}
return service;
}
},
]);

View File

@ -10,5 +10,5 @@ angular.module('portainer.agent').service('AgentPingService', [
}
return service;
}
},
]);

View File

@ -1,5 +1,11 @@
angular.module('portainer.agent').factory('VolumeBrowserService', [
'StateManager', 'Browse', 'BrowseVersion1', '$q', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider', 'Upload',
'StateManager',
'Browse',
'BrowseVersion1',
'$q',
'API_ENDPOINT_ENDPOINTS',
'EndpointProvider',
'Upload',
function VolumeBrowserServiceFactory(StateManager, Browse, BrowseVersion1, $q, API_ENDPOINT_ENDPOINTS, EndpointProvider, Upload) {
'use strict';
var service = {};
@ -29,7 +35,7 @@ angular.module('portainer.agent').factory('VolumeBrowserService', [
service.rename = function (volumeId, path, newPath) {
var payload = {
CurrentFilePath: path,
NewFilePath: newPath
NewFilePath: newPath,
};
return getBrowseService().rename({ volumeID: volumeId, version: getAgentApiVersion() }, payload).$promise;
};
@ -41,22 +47,15 @@ angular.module('portainer.agent').factory('VolumeBrowserService', [
deferred.reject('upload is not supported on this agent version');
return;
}
var url =
API_ENDPOINT_ENDPOINTS +
'/' +
EndpointProvider.endpointID() +
'/docker' +
'/v' + agentVersion +
'/browse/put?volumeID=' +
volumeId;
var url = API_ENDPOINT_ENDPOINTS + '/' + EndpointProvider.endpointID() + '/docker' + '/v' + agentVersion + '/browse/put?volumeID=' + volumeId;
Upload.upload({
url: url,
data: { file: file, Path: path }
data: { file: file, Path: path },
}).then(deferred.resolve, deferred.reject, onProgress);
return deferred.promise;
};
return service;
}
},
]);

View File

@ -1,8 +1,16 @@
import $ from 'jquery';
import '@babel/polyfill'
import '@babel/polyfill';
angular.module('portainer')
.run(['$rootScope', '$state', '$interval', 'LocalStorage', 'EndpointProvider', 'SystemService', 'cfpLoadingBar', '$transitions', 'HttpRequestHelper',
angular.module('portainer').run([
'$rootScope',
'$state',
'$interval',
'LocalStorage',
'EndpointProvider',
'SystemService',
'cfpLoadingBar',
'$transitions',
'HttpRequestHelper',
function ($rootScope, $state, $interval, LocalStorage, EndpointProvider, SystemService, cfpLoadingBar, $transitions, HttpRequestHelper) {
'use strict';
@ -30,7 +38,7 @@ function ($rootScope, $state, $interval, LocalStorage, EndpointProvider, SystemS
// Keep-alive Edge endpoints by sending a ping request every minute
$interval(function () {
ping(EndpointProvider, SystemService);
}, 60 * 1000)
}, 60 * 1000);
$(document).ajaxSend(function (event, jqXhr, jqOpts) {
const type = jqOpts.type === 'POST' || jqOpts.type === 'PUT' || jqOpts.type === 'PATCH';
@ -40,7 +48,8 @@ function ($rootScope, $state, $interval, LocalStorage, EndpointProvider, SystemS
}
jqXhr.setRequestHeader('Authorization', 'Bearer ' + LocalStorage.getJWT());
});
}]);
},
]);
function ping(EndpointProvider, SystemService) {
let endpoint = EndpointProvider.currentEndpoint();

View File

@ -1,12 +1,13 @@
angular.module('portainer.azure', ['portainer.app'])
.config(['$stateRegistryProvider', function ($stateRegistryProvider) {
angular.module('portainer.azure', ['portainer.app']).config([
'$stateRegistryProvider',
function ($stateRegistryProvider) {
'use strict';
var azure = {
name: 'azure',
url: '/azure',
parent: 'root',
abstract: true
abstract: true,
};
var containerInstances = {
@ -15,9 +16,9 @@ angular.module('portainer.azure', ['portainer.app'])
views: {
'content@': {
templateUrl: './views/containerinstances/containerinstances.html',
controller: 'AzureContainerInstancesController'
}
}
controller: 'AzureContainerInstancesController',
},
},
};
var containerInstanceCreation = {
@ -26,9 +27,9 @@ angular.module('portainer.azure', ['portainer.app'])
views: {
'content@': {
templateUrl: './views/containerinstances/create/createcontainerinstance.html',
controller: 'AzureCreateContainerInstanceController'
}
}
controller: 'AzureCreateContainerInstanceController',
},
},
};
var dashboard = {
@ -37,13 +38,14 @@ angular.module('portainer.azure', ['portainer.app'])
views: {
'content@': {
templateUrl: './views/dashboard/dashboard.html',
controller: 'AzureDashboardController'
}
}
controller: 'AzureDashboardController',
},
},
};
$stateRegistryProvider.register(azure);
$stateRegistryProvider.register(containerInstances);
$stateRegistryProvider.register(containerInstanceCreation);
$stateRegistryProvider.register(dashboard);
}]);
},
]);

View File

@ -2,7 +2,7 @@ angular.module('portainer.azure').component('azureEndpointConfig', {
bindings: {
applicationId: '=',
tenantId: '=',
authenticationKey: '='
authenticationKey: '=',
},
templateUrl: './azureEndpointConfig.html'
templateUrl: './azureEndpointConfig.html',
});

View File

@ -6,7 +6,7 @@
<div class="form-group">
<label for="azure_credential_appid" class="col-sm-3 col-lg-2 control-label text-left">Application ID</label>
<div class="col-sm-9 col-lg-10">
<input type="text" class="form-control" name="azure_credential_appid" ng-model="$ctrl.applicationId" placeholder="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" required>
<input type="text" class="form-control" name="azure_credential_appid" ng-model="$ctrl.applicationId" placeholder="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" required />
</div>
</div>
<!-- !applicationId-input -->
@ -14,7 +14,7 @@
<div class="form-group">
<label for="azure_credential_tenantid" class="col-sm-3 col-lg-2 control-label text-left">Tenant ID</label>
<div class="col-sm-9 col-lg-10">
<input type="text" class="form-control" name="azure_credential_tenantid" ng-model="$ctrl.tenantId" placeholder="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" required>
<input type="text" class="form-control" name="azure_credential_tenantid" ng-model="$ctrl.tenantId" placeholder="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" required />
</div>
</div>
<!-- !tenantId-input -->
@ -22,7 +22,14 @@
<div class="form-group">
<label for="azure_credential_authkey" class="col-sm-3 col-lg-2 control-label text-left">Authentication key</label>
<div class="col-sm-9 col-lg-10">
<input type="text" class="form-control" name="azure_credential_authkey" ng-model="$ctrl.authenticationKey" placeholder="cOrXoK/1D35w8YQ8nH1/8ZGwzz45JIYD5jxHKXEQknk=" required>
<input
type="text"
class="form-control"
name="azure_credential_authkey"
ng-model="$ctrl.authenticationKey"
placeholder="cOrXoK/1D35w8YQ8nH1/8ZGwzz45JIYD5jxHKXEQknk="
required
/>
</div>
</div>
<!-- !authenticationkey-input -->

View File

@ -1,3 +1,3 @@
angular.module('portainer.azure').component('azureSidebarContent', {
templateUrl: './azureSidebarContent.html'
templateUrl: './azureSidebarContent.html',
});

View File

@ -2,13 +2,10 @@
<rd-widget>
<rd-widget-body classes="no-padding">
<div class="toolBar">
<div class="toolBarTitle">
<i class="fa" ng-class="$ctrl.titleIcon" aria-hidden="true" style="margin-right: 2px;"></i> {{ $ctrl.titleText }}
</div>
<div class="toolBarTitle"> <i class="fa" ng-class="$ctrl.titleIcon" aria-hidden="true" style="margin-right: 2px;"></i> {{ $ctrl.titleText }} </div>
</div>
<div class="actionBar">
<button type="button" class="btn btn-sm btn-danger"
ng-disabled="$ctrl.state.selectedItemCount === 0" ng-click="$ctrl.removeAction($ctrl.state.selectedItems)">
<button type="button" class="btn btn-sm btn-danger" ng-disabled="$ctrl.state.selectedItemCount === 0" ng-click="$ctrl.removeAction($ctrl.state.selectedItems)">
<i class="fa fa-trash-alt space-right" aria-hidden="true"></i>Remove
</button>
<button type="button" class="btn btn-sm btn-primary" ui-sref="azure.containerinstances.new">
@ -17,7 +14,15 @@
</div>
<div class="searchBar">
<i class="fa fa-search searchIcon" aria-hidden="true"></i>
<input type="text" class="searchInput" ng-model="$ctrl.state.textFilter" ng-change="$ctrl.onTextFilterChange()" placeholder="Search..." auto-focus ng-model-options="{ debounce: 300 }">
<input
type="text"
class="searchInput"
ng-model="$ctrl.state.textFilter"
ng-change="$ctrl.onTextFilterChange()"
placeholder="Search..."
auto-focus
ng-model-options="{ debounce: 300 }"
/>
</div>
<div class="table-responsive">
<table class="table table-hover table-filters nowrap-cells">
@ -47,7 +52,10 @@
</tr>
</thead>
<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>
<span class="md-checkbox">
<input id="select_{{ $index }}" type="checkbox" ng-model="item.Checked" ng-click="$ctrl.selectItem(item, $event)" />
@ -73,9 +81,7 @@
</table>
</div>
<div class="footer" ng-if="$ctrl.dataset">
<div class="infoBar" ng-if="$ctrl.state.selectedItemCount !== 0">
{{ $ctrl.state.selectedItemCount }} item(s) selected
</div>
<div class="infoBar" ng-if="$ctrl.state.selectedItemCount !== 0"> {{ $ctrl.state.selectedItemCount }} item(s) selected </div>
<div class="paginationControls">
<form class="form-inline">
<span class="limitSelector">

View File

@ -8,6 +8,6 @@ angular.module('portainer.azure').component('containergroupsDatatable', {
tableKey: '@',
orderBy: '@',
reverseOrder: '<',
removeAction: '<'
}
removeAction: '<',
},
});

View File

@ -8,8 +8,8 @@ export function ContainerGroupDefaultModel() {
{
container: 80,
host: 80,
protocol: 'TCP'
}
protocol: 'TCP',
},
];
this.CPU = 1;
this.Memory = 1;
@ -32,12 +32,12 @@ export function CreateContainerGroupRequest(model) {
var binding = model.Ports[i];
containerPorts.push({
port: binding.container
port: binding.container,
});
addressPorts.push({
port: binding.host,
protocol: binding.protocol
protocol: binding.protocol,
});
}
@ -52,15 +52,15 @@ export function CreateContainerGroupRequest(model) {
resources: {
requests: {
cpu: model.CPU,
memoryInGB: model.Memory
}
}
}
}
memoryInGB: model.Memory,
},
},
},
},
],
ipAddress: {
type: model.AllocatePublicIP ? 'Public' : 'Private',
ports: addressPorts
}
ports: addressPorts,
},
};
}

View File

@ -4,6 +4,6 @@ export function ContainerInstanceProviderViewModel(data) {
this.Id = data.id;
this.Namespace = data.namespace;
var containerGroupType = _.find(data.resourceTypes, { 'resourceType': 'containerGroups' });
var containerGroupType = _.find(data.resourceTypes, { resourceType: 'containerGroups' });
this.Locations = containerGroupType.locations;
}

View File

@ -1,5 +1,7 @@
angular.module('portainer.azure')
.factory('Azure', ['$http', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider',
angular.module('portainer.azure').factory('Azure', [
'$http',
'API_ENDPOINT_ENDPOINTS',
'EndpointProvider',
function AzureFactory($http, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
'use strict';
@ -9,9 +11,10 @@ function AzureFactory($http, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
var url = API_ENDPOINT_ENDPOINTS + '/' + EndpointProvider.endpointID() + '/azure' + id + '?api-version=' + apiVersion;
return $http({
method: 'DELETE',
url: url
url: url,
});
};
return service;
}]);
},
]);

View File

@ -1,5 +1,7 @@
angular.module('portainer.azure')
.factory('ContainerGroup', ['$resource', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider',
angular.module('portainer.azure').factory('ContainerGroup', [
'$resource',
'API_ENDPOINT_ENDPOINTS',
'EndpointProvider',
function ContainerGroupFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
'use strict';
@ -8,19 +10,20 @@ function ContainerGroupFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvid
var base = $resource(
API_ENDPOINT_ENDPOINTS + '/:endpointId/azure/subscriptions/:subscriptionId/providers/Microsoft.ContainerInstance/containerGroups',
{
'endpointId': EndpointProvider.endpointID,
'api-version': '2018-04-01'
endpointId: EndpointProvider.endpointID,
'api-version': '2018-04-01',
},
{
query: { method: 'GET', params: { subscriptionId: '@subscriptionId' } }
query: { method: 'GET', params: { subscriptionId: '@subscriptionId' } },
}
);
var withResourceGroup = $resource(
API_ENDPOINT_ENDPOINTS +'/:endpointId/azure/subscriptions/:subscriptionId/resourceGroups/:resourceGroupName/providers/Microsoft.ContainerInstance/containerGroups/:containerGroupName',
API_ENDPOINT_ENDPOINTS +
'/:endpointId/azure/subscriptions/:subscriptionId/resourceGroups/:resourceGroupName/providers/Microsoft.ContainerInstance/containerGroups/:containerGroupName',
{
'endpointId': EndpointProvider.endpointID,
'api-version': '2018-04-01'
endpointId: EndpointProvider.endpointID,
'api-version': '2018-04-01',
},
{
create: {
@ -28,9 +31,9 @@ function ContainerGroupFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvid
params: {
subscriptionId: '@subscriptionId',
resourceGroupName: '@resourceGroupName',
containerGroupName: '@containerGroupName'
}
}
containerGroupName: '@containerGroupName',
},
},
}
);
@ -38,4 +41,5 @@ function ContainerGroupFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvid
resource.create = withResourceGroup.create;
return resource;
}]);
},
]);

View File

@ -1,12 +1,18 @@
angular.module('portainer.azure')
.factory('Location', ['$resource', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider',
angular.module('portainer.azure').factory('Location', [
'$resource',
'API_ENDPOINT_ENDPOINTS',
'EndpointProvider',
function LocationFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
'use strict';
return $resource(API_ENDPOINT_ENDPOINTS +'/:endpointId/azure/subscriptions/:subscriptionId/locations', {
'endpointId': EndpointProvider.endpointID,
'api-version': '2016-06-01'
return $resource(
API_ENDPOINT_ENDPOINTS + '/:endpointId/azure/subscriptions/:subscriptionId/locations',
{
endpointId: EndpointProvider.endpointID,
'api-version': '2016-06-01',
},
{
query: { method: 'GET', params: { subscriptionId: '@subscriptionId' } }
});
}]);
query: { method: 'GET', params: { subscriptionId: '@subscriptionId' } },
}
);
},
]);

View File

@ -1,12 +1,18 @@
angular.module('portainer.azure')
.factory('Provider', ['$resource', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider',
angular.module('portainer.azure').factory('Provider', [
'$resource',
'API_ENDPOINT_ENDPOINTS',
'EndpointProvider',
function ProviderFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
'use strict';
return $resource(API_ENDPOINT_ENDPOINTS +'/:endpointId/azure/subscriptions/:subscriptionId/providers/:providerNamespace', {
'endpointId': EndpointProvider.endpointID,
'api-version': '2018-02-01'
return $resource(
API_ENDPOINT_ENDPOINTS + '/:endpointId/azure/subscriptions/:subscriptionId/providers/:providerNamespace',
{
endpointId: EndpointProvider.endpointID,
'api-version': '2018-02-01',
},
{
get: { method: 'GET', params: { subscriptionId: '@subscriptionId', providerNamespace: '@providerNamespace' } }
});
}]);
get: { method: 'GET', params: { subscriptionId: '@subscriptionId', providerNamespace: '@providerNamespace' } },
}
);
},
]);

View File

@ -1,12 +1,18 @@
angular.module('portainer.azure')
.factory('ResourceGroup', ['$resource', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider',
angular.module('portainer.azure').factory('ResourceGroup', [
'$resource',
'API_ENDPOINT_ENDPOINTS',
'EndpointProvider',
function ResourceGroupFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
'use strict';
return $resource(API_ENDPOINT_ENDPOINTS +'/:endpointId/azure/subscriptions/:subscriptionId/resourcegroups', {
'endpointId': EndpointProvider.endpointID,
'api-version': '2018-02-01'
return $resource(
API_ENDPOINT_ENDPOINTS + '/:endpointId/azure/subscriptions/:subscriptionId/resourcegroups',
{
endpointId: EndpointProvider.endpointID,
'api-version': '2018-02-01',
},
{
query: { method: 'GET', params: { subscriptionId: '@subscriptionId' } }
});
}]);
query: { method: 'GET', params: { subscriptionId: '@subscriptionId' } },
}
);
},
]);

View File

@ -1,12 +1,18 @@
angular.module('portainer.azure')
.factory('Subscription', ['$resource', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider',
angular.module('portainer.azure').factory('Subscription', [
'$resource',
'API_ENDPOINT_ENDPOINTS',
'EndpointProvider',
function SubscriptionFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
'use strict';
return $resource(API_ENDPOINT_ENDPOINTS + '/:endpointId/azure/subscriptions', {
'endpointId': EndpointProvider.endpointID,
'api-version': '2016-06-01'
return $resource(
API_ENDPOINT_ENDPOINTS + '/:endpointId/azure/subscriptions',
{
endpointId: EndpointProvider.endpointID,
'api-version': '2016-06-01',
},
{
query: { method: 'GET' }
});
}]);
query: { method: 'GET' },
}
);
},
]);

View File

@ -1,5 +1,10 @@
angular.module('portainer.azure')
.factory('AzureService', ['$q', 'Azure', 'SubscriptionService', 'ResourceGroupService', 'ContainerGroupService', 'ProviderService',
angular.module('portainer.azure').factory('AzureService', [
'$q',
'Azure',
'SubscriptionService',
'ResourceGroupService',
'ContainerGroupService',
'ProviderService',
function AzureServiceFactory($q, Azure, SubscriptionService, ResourceGroupService, ContainerGroupService, ProviderService) {
'use strict';
var service = {};
@ -63,4 +68,5 @@ function AzureServiceFactory($q, Azure, SubscriptionService, ResourceGroupServic
}
return service;
}]);
},
]);

View File

@ -1,15 +1,17 @@
import { ContainerGroupViewModel, CreateContainerGroupRequest } from '../models/container_group';
angular.module('portainer.azure')
.factory('ContainerGroupService', ['$q', 'ContainerGroup', function ContainerGroupServiceFactory($q, ContainerGroup) {
angular.module('portainer.azure').factory('ContainerGroupService', [
'$q',
'ContainerGroup',
function ContainerGroupServiceFactory($q, ContainerGroup) {
'use strict';
var service = {};
service.containerGroups = function (subscriptionId) {
var deferred = $q.defer();
ContainerGroup.query({ subscriptionId: subscriptionId }).$promise
.then(function success(data) {
ContainerGroup.query({ subscriptionId: subscriptionId })
.$promise.then(function success(data) {
var containerGroups = data.value.map(function (item) {
return new ContainerGroupViewModel(item);
});
@ -24,12 +26,16 @@ angular.module('portainer.azure')
service.create = function (model, subscriptionId, resourceGroupName) {
var payload = new CreateContainerGroupRequest(model);
return ContainerGroup.create({
return ContainerGroup.create(
{
subscriptionId: subscriptionId,
resourceGroupName: resourceGroupName,
containerGroupName: model.Name
}, payload).$promise;
containerGroupName: model.Name,
},
payload
).$promise;
};
return service;
}]);
},
]);

View File

@ -1,15 +1,17 @@
import { LocationViewModel } from '../models/location';
angular.module('portainer.azure')
.factory('LocationService', ['$q', 'Location', function LocationServiceFactory($q, Location) {
angular.module('portainer.azure').factory('LocationService', [
'$q',
'Location',
function LocationServiceFactory($q, Location) {
'use strict';
var service = {};
service.locations = function (subscriptionId) {
var deferred = $q.defer();
Location.query({ subscriptionId: subscriptionId }).$promise
.then(function success(data) {
Location.query({ subscriptionId: subscriptionId })
.$promise.then(function success(data) {
var locations = data.value.map(function (item) {
return new LocationViewModel(item);
});
@ -23,4 +25,5 @@ angular.module('portainer.azure')
};
return service;
}]);
},
]);

View File

@ -1,15 +1,17 @@
import { ContainerInstanceProviderViewModel } from '../models/provider';
angular.module('portainer.azure')
.factory('ProviderService', ['$q', 'Provider', function ProviderServiceFactory($q, Provider) {
angular.module('portainer.azure').factory('ProviderService', [
'$q',
'Provider',
function ProviderServiceFactory($q, Provider) {
'use strict';
var service = {};
service.containerInstanceProvider = function (subscriptionId) {
var deferred = $q.defer();
Provider.get({ subscriptionId: subscriptionId, providerNamespace: 'Microsoft.ContainerInstance' }).$promise
.then(function success(data) {
Provider.get({ subscriptionId: subscriptionId, providerNamespace: 'Microsoft.ContainerInstance' })
.$promise.then(function success(data) {
var provider = new ContainerInstanceProviderViewModel(data);
deferred.resolve(provider);
})
@ -21,4 +23,5 @@ angular.module('portainer.azure')
};
return service;
}]);
},
]);

View File

@ -1,15 +1,17 @@
import { ResourceGroupViewModel } from '../models/resource_group';
angular.module('portainer.azure')
.factory('ResourceGroupService', ['$q', 'ResourceGroup', function ResourceGroupServiceFactory($q, ResourceGroup) {
angular.module('portainer.azure').factory('ResourceGroupService', [
'$q',
'ResourceGroup',
function ResourceGroupServiceFactory($q, ResourceGroup) {
'use strict';
var service = {};
service.resourceGroups = function (subscriptionId) {
var deferred = $q.defer();
ResourceGroup.query({ subscriptionId: subscriptionId }).$promise
.then(function success(data) {
ResourceGroup.query({ subscriptionId: subscriptionId })
.$promise.then(function success(data) {
var resourceGroups = data.value.map(function (item) {
return new ResourceGroupViewModel(item, subscriptionId);
});
@ -23,4 +25,5 @@ angular.module('portainer.azure')
};
return service;
}]);
},
]);

View File

@ -1,15 +1,17 @@
import { SubscriptionViewModel } from '../models/subscription';
angular.module('portainer.azure')
.factory('SubscriptionService', ['$q', 'Subscription', function SubscriptionServiceFactory($q, Subscription) {
angular.module('portainer.azure').factory('SubscriptionService', [
'$q',
'Subscription',
function SubscriptionServiceFactory($q, Subscription) {
'use strict';
var service = {};
service.subscriptions = function () {
var deferred = $q.defer();
Subscription.query({}).$promise
.then(function success(data) {
Subscription.query({})
.$promise.then(function success(data) {
var subscriptions = data.value.map(function (item) {
return new SubscriptionViewModel(item);
});
@ -23,4 +25,5 @@ angular.module('portainer.azure')
};
return service;
}]);
},
]);

View File

@ -1,7 +1,9 @@
angular.module('portainer.azure')
.controller('AzureContainerInstancesController', ['$scope', '$state', 'AzureService', 'Notifications',
angular.module('portainer.azure').controller('AzureContainerInstancesController', [
'$scope',
'$state',
'AzureService',
'Notifications',
function ($scope, $state, AzureService, Notifications) {
function initView() {
AzureService.subscriptions()
.then(function success(data) {
@ -38,4 +40,5 @@ function ($scope, $state, AzureService, Notifications) {
};
initView();
}]);
},
]);

View File

@ -10,8 +10,10 @@
<div class="row">
<div class="col-sm-12">
<containergroups-datatable
title-text="Containers" title-icon="fa-server"
dataset="containerGroups" table-key="containergroups"
title-text="Containers"
title-icon="fa-server"
dataset="containerGroups"
table-key="containergroups"
order-by="Name"
remove-action="deleteAction"
></containergroups-datatable>

View File

@ -1,16 +1,19 @@
import { ContainerGroupDefaultModel } from '../../../models/container_group';
angular.module('portainer.azure')
.controller('AzureCreateContainerInstanceController', ['$q', '$scope', '$state', 'AzureService', 'Notifications',
angular.module('portainer.azure').controller('AzureCreateContainerInstanceController', [
'$q',
'$scope',
'$state',
'AzureService',
'Notifications',
function ($q, $scope, $state, AzureService, Notifications) {
var allResourceGroups = [];
var allProviders = [];
$scope.state = {
actionInProgress: false,
selectedSubscription: null,
selectedResourceGroup: null
selectedResourceGroup: null,
};
$scope.changeSubscription = function () {
@ -65,7 +68,7 @@ function ($q, $scope, $state, AzureService, Notifications) {
return $q.all({
resourceGroups: AzureService.resourceGroups(subscriptions),
containerInstancesProviders: AzureService.containerInstanceProvider(subscriptions)
containerInstancesProviders: AzureService.containerInstanceProvider(subscriptions),
});
})
.then(function success(data) {
@ -86,4 +89,5 @@ function ($q, $scope, $state, AzureService, Notifications) {
}
initView();
}]);
},
]);

View File

@ -1,8 +1,6 @@
<rd-header>
<rd-header-title title-text="Create container instance"></rd-header-title>
<rd-header-content>
<a ui-sref="azure.containerinstances">Container instances</a> &gt; Add container
</rd-header-content>
<rd-header-content> <a ui-sref="azure.containerinstances">Container instances</a> &gt; Add container </rd-header-content>
</rd-header>
<div class="row">
@ -17,7 +15,13 @@
<div class="form-group">
<label for="azure_subscription" class="col-sm-1 control-label text-left">Subscription</label>
<div class="col-sm-11">
<select class="form-control" name="azure_subscription" ng-model="state.selectedSubscription" ng-options="subscription.Name for subscription in subscriptions" ng-change="changeSubscription()"></select>
<select
class="form-control"
name="azure_subscription"
ng-model="state.selectedSubscription"
ng-options="subscription.Name for subscription in subscriptions"
ng-change="changeSubscription()"
></select>
</div>
</div>
<!-- !subscription-input -->
@ -25,7 +29,12 @@
<div class="form-group">
<label for="azure_resourcegroup" class="col-sm-1 control-label text-left">Resource group</label>
<div class="col-sm-11">
<select class="form-control" name="azure_resourcegroup" ng-model="state.selectedResourceGroup" ng-options="resourceGroup.Name for resourceGroup in resourceGroups"></select>
<select
class="form-control"
name="azure_resourcegroup"
ng-model="state.selectedResourceGroup"
ng-options="resourceGroup.Name for resourceGroup in resourceGroups"
></select>
</div>
</div>
<!-- !resourcegroup-input -->
@ -44,7 +53,7 @@
<div class="form-group">
<label for="container_name" class="col-sm-1 control-label text-left">Name</label>
<div class="col-sm-11">
<input type="text" class="form-control" ng-model="model.Name" name="container_name" placeholder="e.g. myContainer">
<input type="text" class="form-control" ng-model="model.Name" name="container_name" placeholder="e.g. myContainer" />
</div>
</div>
<!-- !name-input -->
@ -52,7 +61,7 @@
<div class="form-group">
<label for="image_name" class="col-sm-1 control-label text-left">Image</label>
<div class="col-sm-11">
<input type="text" class="form-control" ng-model="model.Image" name="image_name" placeholder="e.g. nginx:alpine">
<input type="text" class="form-control" ng-model="model.Image" name="image_name" placeholder="e.g. nginx:alpine" />
</div>
</div>
<!-- !image-input -->
@ -81,7 +90,7 @@
<!-- host-port -->
<div class="input-group col-sm-4 input-group-sm">
<span class="input-group-addon">host</span>
<input type="text" class="form-control" ng-model="binding.host" placeholder="e.g. 80">
<input type="text" class="form-control" ng-model="binding.host" placeholder="e.g. 80" />
</div>
<!-- !host-port -->
<span style="margin: 0 10px 0 10px;">
@ -90,7 +99,7 @@
<!-- container-port -->
<div class="input-group col-sm-4 input-group-sm">
<span class="input-group-addon">container</span>
<input type="text" class="form-control" ng-model="binding.container" placeholder="e.g. 80">
<input type="text" class="form-control" ng-model="binding.container" placeholder="e.g. 80" />
</div>
<!-- !container-port -->
<!-- protocol-actions -->
@ -115,9 +124,7 @@
<label for="public_ip" class="control-label text-left">
Allocate public IP address
</label>
<label class="switch" style="margin-left: 20px;">
<input type="checkbox" name="public_ip" ng-model="model.AllocatePublicIP"><i></i>
</label>
<label class="switch" style="margin-left: 20px;"> <input type="checkbox" name="public_ip" ng-model="model.AllocatePublicIP" /><i></i> </label>
</div>
</div>
<!-- public-ip -->
@ -128,7 +135,7 @@
<div class="form-group">
<label for="container_cpu" class="col-sm-1 control-label text-left">CPU</label>
<div class="col-sm-11">
<input type="number" class="form-control" ng-model="model.CPU" name="container_cpu" placeholder="1">
<input type="number" class="form-control" ng-model="model.CPU" name="container_cpu" placeholder="1" />
</div>
</div>
<!-- !cpu-input -->
@ -136,7 +143,7 @@
<div class="form-group">
<label for="container_memory" class="col-sm-1 control-label text-left">Memory</label>
<div class="col-sm-11">
<input type="number" class="form-control" ng-model="model.Memory" name="container_memory" placeholder="1">
<input type="number" class="form-control" ng-model="model.Memory" name="container_memory" placeholder="1" />
</div>
</div>
<!-- !memory-input -->

View File

@ -1,7 +1,8 @@
angular.module('portainer.azure')
.controller('AzureDashboardController', ['$scope', 'AzureService', 'Notifications',
angular.module('portainer.azure').controller('AzureDashboardController', [
'$scope',
'AzureService',
'Notifications',
function ($scope, AzureService, Notifications) {
function initView() {
AzureService.subscriptions()
.then(function success(data) {
@ -18,4 +19,5 @@ function ($scope, AzureService, Notifications) {
}
initView();
}]);
},
]);

View File

@ -2,8 +2,15 @@ import toastr from 'toastr';
import { Terminal } from 'xterm';
import * as fit from 'xterm/lib/addons/fit/fit';
angular.module('portainer')
.config(['$urlRouterProvider', '$httpProvider', 'localStorageServiceProvider', 'jwtOptionsProvider', 'AnalyticsProvider', '$uibTooltipProvider', '$compileProvider', 'cfpLoadingBarProvider',
angular.module('portainer').config([
'$urlRouterProvider',
'$httpProvider',
'localStorageServiceProvider',
'jwtOptionsProvider',
'AnalyticsProvider',
'$uibTooltipProvider',
'$compileProvider',
'cfpLoadingBarProvider',
function ($urlRouterProvider, $httpProvider, localStorageServiceProvider, jwtOptionsProvider, AnalyticsProvider, $uibTooltipProvider, $compileProvider, cfpLoadingBarProvider) {
'use strict';
@ -12,13 +19,15 @@ angular.module('portainer')
$compileProvider.debugInfoEnabled(false);
}
localStorageServiceProvider
.setPrefix('portainer');
localStorageServiceProvider.setPrefix('portainer');
jwtOptionsProvider.config({
tokenGetter: ['LocalStorage', function(LocalStorage) {
tokenGetter: [
'LocalStorage',
function (LocalStorage) {
return LocalStorage.getJWT();
}]
},
],
});
$httpProvider.interceptors.push('jwtInterceptor');
$httpProvider.interceptors.push('EndpointStatusInterceptor');
@ -26,7 +35,9 @@ angular.module('portainer')
$httpProvider.defaults.headers.put['Content-Type'] = 'application/json';
$httpProvider.defaults.headers.patch['Content-Type'] = 'application/json';
$httpProvider.interceptors.push(['HttpRequestHelper', function(HttpRequestHelper) {
$httpProvider.interceptors.push([
'HttpRequestHelper',
function (HttpRequestHelper) {
return {
request: function (config) {
if (config.url.indexOf('/docker/') > -1) {
@ -36,9 +47,10 @@ angular.module('portainer')
}
}
return config;
}
},
};
}]);
},
]);
AnalyticsProvider.setAccount({ tracker: __CONFIG_GA_ID, set: { anonymizeIp: true } });
AnalyticsProvider.startOffline(true);
@ -48,10 +60,10 @@ angular.module('portainer')
Terminal.applyAddon(fit);
$uibTooltipProvider.setTriggers({
'mouseenter': 'mouseleave',
'click': 'click',
'focus': 'blur',
'outsideClick': 'outsideClick'
mouseenter: 'mouseleave',
click: 'click',
focus: 'blur',
outsideClick: 'outsideClick',
});
cfpLoadingBarProvider.includeSpinner = false;
@ -59,4 +71,5 @@ angular.module('portainer')
cfpLoadingBarProvider.latencyThreshold = 600;
$urlRouterProvider.otherwise('/auth');
}]);
},
]);

View File

@ -1,4 +1,5 @@
angular.module('portainer')
angular
.module('portainer')
.constant('API_ENDPOINT_AUTH', 'api/auth')
.constant('API_ENDPOINT_DOCKERHUB', 'api/dockerhub')
.constant('API_ENDPOINT_ENDPOINTS', 'api/endpoints')

View File

@ -1,5 +1,6 @@
angular.module('portainer.docker', ['portainer.app'])
.config(['$stateRegistryProvider', function ($stateRegistryProvider) {
angular.module('portainer.docker', ['portainer.app']).config([
'$stateRegistryProvider',
function ($stateRegistryProvider) {
'use strict';
var docker = {
@ -7,15 +8,17 @@ angular.module('portainer.docker', ['portainer.app'])
parent: 'root',
abstract: true,
resolve: {
endpointID: ['EndpointProvider', '$state',
endpointID: [
'EndpointProvider',
'$state',
function (EndpointProvider, $state) {
var id = EndpointProvider.endpointID();
if (!id) {
return $state.go('portainer.home');
}
}
]
}
},
],
},
};
var configs = {
@ -25,9 +28,9 @@ angular.module('portainer.docker', ['portainer.app'])
'content@': {
templateUrl: './views/configs/configs.html',
controller: 'ConfigsController',
controllerAs: 'ctrl'
}
}
controllerAs: 'ctrl',
},
},
};
var config = {
@ -36,9 +39,9 @@ angular.module('portainer.docker', ['portainer.app'])
views: {
'content@': {
templateUrl: './views/configs/edit/config.html',
controller: 'ConfigController'
}
}
controller: 'ConfigController',
},
},
};
var configCreation = {
@ -48,9 +51,9 @@ angular.module('portainer.docker', ['portainer.app'])
'content@': {
templateUrl: './views/configs/create/createconfig.html',
controller: 'CreateConfigController',
controllerAs: 'ctrl'
}
}
controllerAs: 'ctrl',
},
},
};
var containers = {
@ -59,9 +62,9 @@ angular.module('portainer.docker', ['portainer.app'])
views: {
'content@': {
templateUrl: './views/containers/containers.html',
controller: 'ContainersController'
}
}
controller: 'ContainersController',
},
},
};
var container = {
@ -70,9 +73,9 @@ angular.module('portainer.docker', ['portainer.app'])
views: {
'content@': {
templateUrl: './views/containers/edit/container.html',
controller: 'ContainerController'
}
}
controller: 'ContainerController',
},
},
};
var containerAttachConsole = {
@ -81,9 +84,9 @@ angular.module('portainer.docker', ['portainer.app'])
views: {
'content@': {
templateUrl: './views/containers/console/attach.html',
controller: 'ContainerConsoleController'
}
}
controller: 'ContainerConsoleController',
},
},
};
var containerExecConsole = {
@ -92,9 +95,9 @@ angular.module('portainer.docker', ['portainer.app'])
views: {
'content@': {
templateUrl: './views/containers/console/exec.html',
controller: 'ContainerConsoleController'
}
}
controller: 'ContainerConsoleController',
},
},
};
var containerCreation = {
@ -103,9 +106,9 @@ angular.module('portainer.docker', ['portainer.app'])
views: {
'content@': {
templateUrl: './views/containers/create/createcontainer.html',
controller: 'CreateContainerController'
}
}
controller: 'CreateContainerController',
},
},
};
var containerInspect = {
@ -114,9 +117,9 @@ angular.module('portainer.docker', ['portainer.app'])
views: {
'content@': {
templateUrl: './views/containers/inspect/containerinspect.html',
controller: 'ContainerInspectController'
}
}
controller: 'ContainerInspectController',
},
},
};
var containerLogs = {
@ -125,9 +128,9 @@ angular.module('portainer.docker', ['portainer.app'])
views: {
'content@': {
templateUrl: './views/containers/logs/containerlogs.html',
controller: 'ContainerLogsController'
}
}
controller: 'ContainerLogsController',
},
},
};
var containerStats = {
@ -136,9 +139,9 @@ angular.module('portainer.docker', ['portainer.app'])
views: {
'content@': {
templateUrl: './views/containers/stats/containerstats.html',
controller: 'ContainerStatsController'
}
}
controller: 'ContainerStatsController',
},
},
};
var dashboard = {
@ -147,9 +150,9 @@ angular.module('portainer.docker', ['portainer.app'])
views: {
'content@': {
templateUrl: './views/dashboard/dashboard.html',
controller: 'DashboardController'
}
}
controller: 'DashboardController',
},
},
};
var host = {
@ -157,9 +160,9 @@ angular.module('portainer.docker', ['portainer.app'])
url: '/host',
views: {
'content@': {
component: 'hostView'
}
}
component: 'hostView',
},
},
};
var hostBrowser = {
@ -167,9 +170,9 @@ angular.module('portainer.docker', ['portainer.app'])
url: '/browser',
views: {
'content@': {
component: 'hostBrowserView'
}
}
component: 'hostBrowserView',
},
},
};
var hostJob = {
@ -177,9 +180,9 @@ angular.module('portainer.docker', ['portainer.app'])
url: '/job',
views: {
'content@': {
component: 'hostJobView'
}
}
component: 'hostJobView',
},
},
};
var events = {
@ -188,9 +191,9 @@ angular.module('portainer.docker', ['portainer.app'])
views: {
'content@': {
templateUrl: './views/events/events.html',
controller: 'EventsController'
}
}
controller: 'EventsController',
},
},
};
var images = {
@ -199,9 +202,9 @@ angular.module('portainer.docker', ['portainer.app'])
views: {
'content@': {
templateUrl: './views/images/images.html',
controller: 'ImagesController'
}
}
controller: 'ImagesController',
},
},
};
var image = {
@ -210,9 +213,9 @@ angular.module('portainer.docker', ['portainer.app'])
views: {
'content@': {
templateUrl: './views/images/edit/image.html',
controller: 'ImageController'
}
}
controller: 'ImageController',
},
},
};
var imageBuild = {
@ -221,9 +224,9 @@ angular.module('portainer.docker', ['portainer.app'])
views: {
'content@': {
templateUrl: './views/images/build/buildimage.html',
controller: 'BuildImageController'
}
}
controller: 'BuildImageController',
},
},
};
var imageImport = {
@ -232,9 +235,9 @@ angular.module('portainer.docker', ['portainer.app'])
views: {
'content@': {
templateUrl: './views/images/import/importimage.html',
controller: 'ImportImageController'
}
}
controller: 'ImportImageController',
},
},
};
var networks = {
@ -243,9 +246,9 @@ angular.module('portainer.docker', ['portainer.app'])
views: {
'content@': {
templateUrl: './views/networks/networks.html',
controller: 'NetworksController'
}
}
controller: 'NetworksController',
},
},
};
var network = {
@ -254,9 +257,9 @@ angular.module('portainer.docker', ['portainer.app'])
views: {
'content@': {
templateUrl: './views/networks/edit/network.html',
controller: 'NetworkController'
}
}
controller: 'NetworkController',
},
},
};
var networkCreation = {
@ -265,15 +268,15 @@ angular.module('portainer.docker', ['portainer.app'])
views: {
'content@': {
templateUrl: './views/networks/create/createnetwork.html',
controller: 'CreateNetworkController'
}
}
controller: 'CreateNetworkController',
},
},
};
var nodes = {
name: 'docker.nodes',
url: '/nodes',
abstract: true
abstract: true,
};
var node = {
@ -281,9 +284,9 @@ angular.module('portainer.docker', ['portainer.app'])
url: '/:id',
views: {
'content@': {
component: 'nodeDetailsView'
}
}
component: 'nodeDetailsView',
},
},
};
var nodeBrowser = {
@ -291,9 +294,9 @@ angular.module('portainer.docker', ['portainer.app'])
url: '/browse',
views: {
'content@': {
component: 'nodeBrowserView'
}
}
component: 'nodeBrowserView',
},
},
};
var nodeJob = {
@ -301,9 +304,9 @@ angular.module('portainer.docker', ['portainer.app'])
url: '/job',
views: {
'content@': {
component: 'nodeJobView'
}
}
component: 'nodeJobView',
},
},
};
var secrets = {
@ -312,9 +315,9 @@ angular.module('portainer.docker', ['portainer.app'])
views: {
'content@': {
templateUrl: './views/secrets/secrets.html',
controller: 'SecretsController'
}
}
controller: 'SecretsController',
},
},
};
var secret = {
@ -323,9 +326,9 @@ angular.module('portainer.docker', ['portainer.app'])
views: {
'content@': {
templateUrl: './views/secrets/edit/secret.html',
controller: 'SecretController'
}
}
controller: 'SecretController',
},
},
};
var secretCreation = {
@ -334,9 +337,9 @@ angular.module('portainer.docker', ['portainer.app'])
views: {
'content@': {
templateUrl: './views/secrets/create/createsecret.html',
controller: 'CreateSecretController'
}
}
controller: 'CreateSecretController',
},
},
};
var services = {
@ -345,9 +348,9 @@ angular.module('portainer.docker', ['portainer.app'])
views: {
'content@': {
templateUrl: './views/services/services.html',
controller: 'ServicesController'
}
}
controller: 'ServicesController',
},
},
};
var service = {
@ -356,9 +359,9 @@ angular.module('portainer.docker', ['portainer.app'])
views: {
'content@': {
templateUrl: './views/services/edit/service.html',
controller: 'ServiceController'
}
}
controller: 'ServiceController',
},
},
};
var serviceCreation = {
@ -367,9 +370,9 @@ angular.module('portainer.docker', ['portainer.app'])
views: {
'content@': {
templateUrl: './views/services/create/createservice.html',
controller: 'CreateServiceController'
}
}
controller: 'CreateServiceController',
},
},
};
var serviceLogs = {
@ -378,9 +381,9 @@ angular.module('portainer.docker', ['portainer.app'])
views: {
'content@': {
templateUrl: './views/services/logs/servicelogs.html',
controller: 'ServiceLogsController'
}
}
controller: 'ServiceLogsController',
},
},
};
var swarm = {
@ -389,9 +392,9 @@ angular.module('portainer.docker', ['portainer.app'])
views: {
'content@': {
templateUrl: './views/swarm/swarm.html',
controller: 'SwarmController'
}
}
controller: 'SwarmController',
},
},
};
var swarmVisualizer = {
@ -400,15 +403,15 @@ angular.module('portainer.docker', ['portainer.app'])
views: {
'content@': {
templateUrl: './views/swarm/visualizer/swarmvisualizer.html',
controller: 'SwarmVisualizerController'
}
}
controller: 'SwarmVisualizerController',
},
},
};
var tasks = {
name: 'docker.tasks',
url: '/tasks',
abstract: true
abstract: true,
};
var task = {
@ -417,9 +420,9 @@ angular.module('portainer.docker', ['portainer.app'])
views: {
'content@': {
templateUrl: './views/tasks/edit/task.html',
controller: 'TaskController'
}
}
controller: 'TaskController',
},
},
};
var taskLogs = {
@ -428,9 +431,9 @@ angular.module('portainer.docker', ['portainer.app'])
views: {
'content@': {
templateUrl: './views/tasks/logs/tasklogs.html',
controller: 'TaskLogsController'
}
}
controller: 'TaskLogsController',
},
},
};
var volumes = {
@ -439,9 +442,9 @@ angular.module('portainer.docker', ['portainer.app'])
views: {
'content@': {
templateUrl: './views/volumes/volumes.html',
controller: 'VolumesController'
}
}
controller: 'VolumesController',
},
},
};
var volume = {
@ -450,9 +453,9 @@ angular.module('portainer.docker', ['portainer.app'])
views: {
'content@': {
templateUrl: './views/volumes/edit/volume.html',
controller: 'VolumeController'
}
}
controller: 'VolumeController',
},
},
};
var volumeBrowse = {
@ -461,9 +464,9 @@ angular.module('portainer.docker', ['portainer.app'])
views: {
'content@': {
templateUrl: './views/volumes/browse/browsevolume.html',
controller: 'BrowseVolumeController'
}
}
controller: 'BrowseVolumeController',
},
},
};
var volumeCreation = {
@ -472,13 +475,11 @@ angular.module('portainer.docker', ['portainer.app'])
views: {
'content@': {
templateUrl: './views/volumes/create/createvolume.html',
controller: 'CreateVolumeController'
}
}
controller: 'CreateVolumeController',
},
},
};
$stateRegistryProvider.register(configs);
$stateRegistryProvider.register(config);
$stateRegistryProvider.register(configCreation);
@ -523,4 +524,5 @@ angular.module('portainer.docker', ['portainer.app'])
$stateRegistryProvider.register(volume);
$stateRegistryProvider.register(volumeBrowse);
$stateRegistryProvider.register(volumeCreation);
}]);
},
]);

View File

@ -1,6 +1,6 @@
angular.module('portainer.docker').component('containerCapabilities', {
templateUrl: './containerCapabilities.html',
bindings: {
capabilities: '='
}
capabilities: '=',
},
});

View File

@ -11,12 +11,9 @@
</label>
</div>
<div class="col-xs-4 col-sm-2 col-md-1">
<label class="switch" style="margin-left: 20px;">
<input type="checkbox" name="capability" ng-model="cap.allowed"><i></i>
</label>
</div>
<div class="col-xs-0 col-sm-1 col-md-1">
<label class="switch" style="margin-left: 20px;"> <input type="checkbox" name="capability" ng-model="cap.allowed" /><i></i> </label>
</div>
<div class="col-xs-0 col-sm-1 col-md-1"> </div>
</div>
</div>
</form>

View File

@ -4,7 +4,8 @@
ng-if="$ctrl.state.showQuickActionLogs && $ctrl.taskId === undefined"
style="margin: 0 2.5px;"
ui-sref="docker.containers.container.logs({id: $ctrl.containerId, nodeName: $ctrl.nodeName})"
title="Logs">
title="Logs"
>
<i class="fa fa-file-alt space-right" aria-hidden="true"></i>
</a>
<a
@ -12,7 +13,8 @@
ng-if="$ctrl.state.showQuickActionLogs && $ctrl.taskId !== undefined"
style="margin: 0 2.5px;"
ui-sref="docker.tasks.task.logs({id: $ctrl.taskId})"
title="Logs">
title="Logs"
>
<i class="fa fa-file-alt space-right" aria-hidden="true"></i>
</a>
<a
@ -20,7 +22,8 @@
ng-if="$ctrl.state.showQuickActionInspect && $ctrl.taskId === undefined"
style="margin: 0 2.5px;"
ui-sref="docker.containers.container.inspect({id: $ctrl.containerId, nodeName: $ctrl.nodeName})"
title="Inspect">
title="Inspect"
>
<i class="fa fa-info-circle space-right" aria-hidden="true"></i>
</a>
<a
@ -28,7 +31,8 @@
ng-if="$ctrl.state.showQuickActionInspect && $ctrl.taskId !== undefined"
style="margin: 0 2.5px;"
ui-sref="docker.tasks.task({id: $ctrl.taskId})"
title="Inspect">
title="Inspect"
>
<i class="fa fa-info-circle space-right" aria-hidden="true"></i>
</a>
<a
@ -36,7 +40,8 @@
ng-if="$ctrl.state.showQuickActionStats && ['starting', 'running', 'healthy', 'unhealthy'].indexOf($ctrl.status) !== -1 && $ctrl.taskId === undefined"
style="margin: 0 2.5px;"
ui-sref="docker.containers.container.stats({id: $ctrl.containerId, nodeName: $ctrl.nodeName})"
title="Stats">
title="Stats"
>
<i class="fa fa-chart-area space-right" aria-hidden="true"></i>
</a>
<a
@ -44,7 +49,8 @@
ng-if="$ctrl.state.showQuickActionExec && ['starting', 'running', 'healthy', 'unhealthy'].indexOf($ctrl.status) !== -1 && $ctrl.taskId === undefined"
style="margin: 0 2.5px;"
ui-sref="docker.containers.container.exec({id: $ctrl.containerId, nodeName: $ctrl.nodeName})"
title="Exec Console">
title="Exec Console"
>
<i class="fa fa-terminal space-right" aria-hidden="true"></i>
</a>
<a
@ -52,7 +58,8 @@
ng-if="$ctrl.state.showQuickActionAttach && ['starting', 'running', 'healthy', 'unhealthy'].indexOf($ctrl.status) !== -1 && $ctrl.taskId === undefined"
style="margin: 0 2.5px;"
ui-sref="docker.containers.container.attach({id: $ctrl.containerId, nodeName: $ctrl.nodeName})"
title="Attach Console">
title="Attach Console"
>
<i class="fa fa-plug space-right" aria-hidden="true"></i>
</a>
</div>

View File

@ -5,6 +5,6 @@ angular.module('portainer.docker').component('containerQuickActions', {
nodeName: '<',
status: '<',
state: '<',
taskId: '<'
}
taskId: '<',
},
});

View File

@ -1,10 +1,9 @@
angular
.module('portainer.docker')
.controller('ContainerRestartPolicyController', [function ContainerRestartPolicyController() {
angular.module('portainer.docker').controller('ContainerRestartPolicyController', [
function ContainerRestartPolicyController() {
var ctrl = this;
this.state = {
editModel : {}
editModel: {},
};
ctrl.save = save;
@ -19,8 +18,8 @@ angular
this.$onInit = function () {
ctrl.state.editModel = {
name: ctrl.name ? ctrl.name : 'no',
maximumRetryCount: ctrl.maximumRetryCount
maximumRetryCount: ctrl.maximumRetryCount,
};
};
}
},
]);

View File

@ -1,10 +1,9 @@
angular.module('portainer.docker')
.component('containerRestartPolicy', {
angular.module('portainer.docker').component('containerRestartPolicy', {
templateUrl: './container-restart-policy.html',
controller: 'ContainerRestartPolicyController',
bindings: {
'name': '<',
'maximumRetryCount': '<',
'updateRestartPolicy': '&'
}
name: '<',
maximumRetryCount: '<',
updateRestartPolicy: '&',
},
});

View File

@ -1,4 +1,4 @@
angular.module('portainer.docker').component('dashboardClusterAgentInfo', {
templateUrl: './dashboardClusterAgentInfo.html',
controller: 'DashboardClusterAgentInfoController'
controller: 'DashboardClusterAgentInfoController',
});

View File

@ -1,5 +1,6 @@
angular.module('portainer.docker')
.controller('DashboardClusterAgentInfoController', ['AgentService', 'Notifications',
angular.module('portainer.docker').controller('DashboardClusterAgentInfoController', [
'AgentService',
'Notifications',
function (AgentService, Notifications) {
var ctrl = this;
@ -12,5 +13,5 @@ function (AgentService, Notifications) {
Notifications.error('Failure', err, 'Unable to retrieve agent information');
});
};
}]);
},
]);

View File

@ -2,9 +2,7 @@
<rd-widget>
<rd-widget-body classes="no-padding">
<div class="toolBar">
<div class="toolBarTitle">
<i class="fa" ng-class="$ctrl.titleIcon" aria-hidden="true" style="margin-right: 2px;"></i> {{ $ctrl.titleText }}
</div>
<div class="toolBarTitle"> <i class="fa" ng-class="$ctrl.titleIcon" aria-hidden="true" style="margin-right: 2px;"></i> {{ $ctrl.titleText }} </div>
<div class="settings">
<span class="setting" ng-class="{ 'setting-active': $ctrl.settings.open }" uib-dropdown dropdown-append-to-body auto-close="disabled" is-open="$ctrl.settings.open">
<span uib-dropdown-toggle><i class="fa fa-cog" aria-hidden="true"></i> Settings</span>
@ -45,8 +43,13 @@
</div>
</div>
<div class="actionBar" authorization="DockerConfigDelete, DockerConfigCreate">
<button type="button" class="btn btn-sm btn-danger" authorization="DockerConfigDelete"
ng-disabled="$ctrl.state.selectedItemCount === 0" ng-click="$ctrl.removeAction($ctrl.state.selectedItems)">
<button
type="button"
class="btn btn-sm btn-danger"
authorization="DockerConfigDelete"
ng-disabled="$ctrl.state.selectedItemCount === 0"
ng-click="$ctrl.removeAction($ctrl.state.selectedItems)"
>
<i class="fa fa-trash-alt space-right" aria-hidden="true"></i>Remove
</button>
<button type="button" class="btn btn-sm btn-primary" ui-sref="docker.configs.new" authorization="DockerConfigCreate">
@ -55,7 +58,15 @@
</div>
<div class="searchBar">
<i class="fa fa-search searchIcon" aria-hidden="true"></i>
<input type="text" class="searchInput" ng-model="$ctrl.state.textFilter" ng-change="$ctrl.onTextFilterChange()" placeholder="Search..." auto-focus ng-model-options="{ debounce: 300 }">
<input
type="text"
class="searchInput"
ng-model="$ctrl.state.textFilter"
ng-change="$ctrl.onTextFilterChange()"
placeholder="Search..."
auto-focus
ng-model-options="{ debounce: 300 }"
/>
</div>
<div class="table-responsive">
<table class="table table-hover nowrap-cells">
@ -89,7 +100,10 @@
</tr>
</thead>
<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>
<span class="md-checkbox" authorization="DockerConfigDelete, DockerConfigCreate">
<input id="select_{{ $index }}" type="checkbox" ng-model="item.Checked" ng-click="$ctrl.selectItem(item, $event)" />
@ -115,9 +129,7 @@
</table>
</div>
<div class="footer" ng-if="$ctrl.dataset">
<div class="infoBar" ng-if="$ctrl.state.selectedItemCount !== 0">
{{ $ctrl.state.selectedItemCount }} item(s) selected
</div>
<div class="infoBar" ng-if="$ctrl.state.selectedItemCount !== 0"> {{ $ctrl.state.selectedItemCount }} item(s) selected </div>
<div class="paginationControls">
<form class="form-inline">
<span class="limitSelector">

View File

@ -10,6 +10,6 @@ angular.module('portainer.docker').component('configsDatatable', {
reverseOrder: '<',
showOwnershipColumn: '<',
removeAction: '<',
refreshCallback: '<'
}
refreshCallback: '<',
},
});

View File

@ -2,9 +2,7 @@
<rd-widget>
<rd-widget-body classes="no-padding">
<div class="toolBar">
<div class="toolBarTitle">
<i class="fa" ng-class="$ctrl.titleIcon" aria-hidden="true" style="margin-right: 2px;"></i> {{ $ctrl.titleText }}
</div>
<div class="toolBarTitle"> <i class="fa" ng-class="$ctrl.titleIcon" aria-hidden="true" style="margin-right: 2px;"></i> {{ $ctrl.titleText }} </div>
</div>
<div class="actionBar">
<form class="form-horizontal">
@ -17,7 +15,13 @@
</select>
</div>
<div class="col-sm-1">
<button type="button" class="btn btn-primary btn-sm" ng-disabled="$ctrl.joinNetworkActionInProgress || !$ctrl.selectedNetwork" ng-click="$ctrl.joinNetworkAction($ctrl.container, $ctrl.selectedNetwork)" button-spinner="$ctrl.joinNetworkActionInProgress">
<button
type="button"
class="btn btn-primary btn-sm"
ng-disabled="$ctrl.joinNetworkActionInProgress || !$ctrl.selectedNetwork"
ng-click="$ctrl.joinNetworkAction($ctrl.container, $ctrl.selectedNetwork)"
button-spinner="$ctrl.joinNetworkActionInProgress"
>
<span ng-hide="$ctrl.joinNetworkActionInProgress">Join network</span>
<span ng-show="$ctrl.joinNetworkActionInProgress">Joining network...</span>
</button>
@ -38,12 +42,20 @@
</thead>
<tbody>
<tr dir-paginate="(key, value) in $ctrl.dataset | itemsPerPage: $ctrl.state.paginatedItemLimit" ng-class="{ active: item.Checked }">
<td><a ui-sref="docker.networks.network({ id: key, nodeName: $ctrl.nodeName })">{{ key }}</a></td>
<td
><a ui-sref="docker.networks.network({ id: key, nodeName: $ctrl.nodeName })">{{ key }}</a></td
>
<td>{{ value.IPAddress || '-' }}</td>
<td>{{ value.Gateway || '-' }}</td>
<td>{{ value.MacAddress || '-' }}</td>
<td authorization="DockerNetworkDisconnect">
<button type="button" class="btn btn-xs btn-danger" ng-disabled="$ctrl.leaveNetworkActionInProgress" button-spinner="$ctrl.leaveNetworkActionInProgress" ng-click="$ctrl.leaveNetworkAction($ctrl.container, key)">
<button
type="button"
class="btn btn-xs btn-danger"
ng-disabled="$ctrl.leaveNetworkActionInProgress"
button-spinner="$ctrl.leaveNetworkActionInProgress"
ng-click="$ctrl.leaveNetworkAction($ctrl.container, key)"
>
<span ng-hide="$ctrl.leaveNetworkActionInProgress"><i class="fa fa-trash-alt space-right" aria-hidden="true"></i> Leave network</span>
<span ng-show="$ctrl.leaveNetworkActionInProgress">Leaving network...</span>
</button>

View File

@ -12,6 +12,6 @@ angular.module('portainer.docker').component('containerNetworksDatatable', {
joinNetworkActionInProgress: '<',
leaveNetworkActionInProgress: '<',
leaveNetworkAction: '<',
nodeName: '<'
}
nodeName: '<',
},
});

View File

@ -2,13 +2,11 @@
<rd-widget>
<rd-widget-body classes="no-padding">
<div class="toolBar">
<div class="toolBarTitle">
<i class="fa" ng-class="$ctrl.titleIcon" aria-hidden="true" style="margin-right: 2px;"></i> {{ $ctrl.titleText }}
</div>
<div class="toolBarTitle"> <i class="fa" ng-class="$ctrl.titleIcon" aria-hidden="true" style="margin-right: 2px;"></i> {{ $ctrl.titleText }} </div>
</div>
<div class="searchBar">
<i class="fa fa-search searchIcon" aria-hidden="true"></i>
<input type="text" class="searchInput" ng-model="$ctrl.state.textFilter" placeholder="Search..." auto-focus ng-model-options="{ debounce: 300 }">
<input type="text" class="searchInput" ng-model="$ctrl.state.textFilter" placeholder="Search..." auto-focus ng-model-options="{ debounce: 300 }" />
</div>
<div class="table-responsive">
<table class="table table-hover nowrap-cells">

View File

@ -8,6 +8,6 @@ angular.module('portainer.docker').component('containerProcessesDatatable', {
headerset: '<',
tableKey: '@',
orderBy: '@',
reverseOrder: '<'
}
reverseOrder: '<',
},
});

View File

@ -1,31 +1,69 @@
<div class="actionBar" authorization="DockerContainerStart, DockerContainerStop, DockerContainerKill, DockerContainerRestart, DockerContainerPause, DockerContainerUnpause, DockerContainerDelete, DockerContainerCreate">
<div
class="actionBar"
authorization="DockerContainerStart, DockerContainerStop, DockerContainerKill, DockerContainerRestart, DockerContainerPause, DockerContainerUnpause, DockerContainerDelete, DockerContainerCreate"
>
<div class="btn-group" role="group" aria-label="...">
<button authorization="DockerContainerStart" type="button" class="btn btn-sm btn-success" ng-click="$ctrl.startAction($ctrl.selectedItems)"
ng-disabled="$ctrl.selectedItemCount === 0 || $ctrl.noStoppedItemsSelected">
<button
authorization="DockerContainerStart"
type="button"
class="btn btn-sm btn-success"
ng-click="$ctrl.startAction($ctrl.selectedItems)"
ng-disabled="$ctrl.selectedItemCount === 0 || $ctrl.noStoppedItemsSelected"
>
<i class="fa fa-play space-right" aria-hidden="true"></i>Start
</button>
<button authorization="DockerContainerStop" type="button" class="btn btn-sm btn-danger" ng-click="$ctrl.stopAction($ctrl.selectedItems)"
ng-disabled="$ctrl.selectedItemCount === 0 || $ctrl.noRunningItemsSelected">
<button
authorization="DockerContainerStop"
type="button"
class="btn btn-sm btn-danger"
ng-click="$ctrl.stopAction($ctrl.selectedItems)"
ng-disabled="$ctrl.selectedItemCount === 0 || $ctrl.noRunningItemsSelected"
>
<i class="fa fa-stop space-right" aria-hidden="true"></i>Stop
</button>
<button authorization="DockerContainerKill" type="button" class="btn btn-sm btn-danger" ng-click="$ctrl.killAction($ctrl.selectedItems)"
ng-disabled="$ctrl.selectedItemCount === 0">
<button
authorization="DockerContainerKill"
type="button"
class="btn btn-sm btn-danger"
ng-click="$ctrl.killAction($ctrl.selectedItems)"
ng-disabled="$ctrl.selectedItemCount === 0"
>
<i class="fa fa-bomb space-right" aria-hidden="true"></i>Kill
</button>
<button authorization="DockerContainerRestart" type="button" class="btn btn-sm btn-primary" ng-click="$ctrl.restartAction($ctrl.selectedItems)"
ng-disabled="$ctrl.selectedItemCount === 0">
<button
authorization="DockerContainerRestart"
type="button"
class="btn btn-sm btn-primary"
ng-click="$ctrl.restartAction($ctrl.selectedItems)"
ng-disabled="$ctrl.selectedItemCount === 0"
>
<i class="fa fa-sync space-right" aria-hidden="true"></i>Restart
</button>
<button authorization="DockerContainerPause" type="button" class="btn btn-sm btn-primary" ng-click="$ctrl.pauseAction($ctrl.selectedItems)"
ng-disabled="$ctrl.selectedItemCount === 0 || $ctrl.noRunningItemsSelected">
<button
authorization="DockerContainerPause"
type="button"
class="btn btn-sm btn-primary"
ng-click="$ctrl.pauseAction($ctrl.selectedItems)"
ng-disabled="$ctrl.selectedItemCount === 0 || $ctrl.noRunningItemsSelected"
>
<i class="fa fa-pause space-right" aria-hidden="true"></i>Pause
</button>
<button authorization="DockerContainerUnpause" type="button" class="btn btn-sm btn-primary" ng-click="$ctrl.resumeAction($ctrl.selectedItems)"
ng-disabled="$ctrl.selectedItemCount === 0 || $ctrl.noPausedItemsSelected">
<button
authorization="DockerContainerUnpause"
type="button"
class="btn btn-sm btn-primary"
ng-click="$ctrl.resumeAction($ctrl.selectedItems)"
ng-disabled="$ctrl.selectedItemCount === 0 || $ctrl.noPausedItemsSelected"
>
<i class="fa fa-play space-right" aria-hidden="true"></i>Resume
</button>
<button authorization="DockerContainerDelete" type="button" class="btn btn-sm btn-danger"
ng-disabled="$ctrl.selectedItemCount === 0" ng-click="$ctrl.removeAction($ctrl.selectedItems)">
<button
authorization="DockerContainerDelete"
type="button"
class="btn btn-sm btn-danger"
ng-disabled="$ctrl.selectedItemCount === 0"
ng-click="$ctrl.removeAction($ctrl.selectedItems)"
>
<i class="fa fa-trash-alt space-right" aria-hidden="true"></i>Remove
</button>
</div>

View File

@ -7,6 +7,6 @@ angular.module('portainer.docker').component('containersDatatableActions', {
noStoppedItemsSelected: '=',
noRunningItemsSelected: '=',
noPausedItemsSelected: '=',
showAddAction: '<'
}
showAddAction: '<',
},
});

View File

@ -1,5 +1,9 @@
angular.module('portainer.docker')
.controller('ContainersDatatableActionsController', ['$state', 'ContainerService', 'ModalService', 'Notifications', 'HttpRequestHelper',
angular.module('portainer.docker').controller('ContainersDatatableActionsController', [
'$state',
'ContainerService',
'ModalService',
'Notifications',
'HttpRequestHelper',
function ($state, ContainerService, ModalService, Notifications, HttpRequestHelper) {
this.startAction = function (selectedItems) {
var successMessage = 'Container successfully started';
@ -53,14 +57,15 @@ function ($state, ContainerService, ModalService, Notifications, HttpRequestHelp
}
ModalService.confirmContainerDeletion(title, function (result) {
if(!result) { return; }
if (!result) {
return;
}
var cleanVolumes = false;
if (result[0]) {
cleanVolumes = true;
}
removeSelectedContainers(selectedItems, cleanVolumes);
}
);
});
};
function executeActionOnContainerList(containers, action, successMessage, errorMessage) {
@ -103,4 +108,5 @@ function ($state, ContainerService, ModalService, Notifications, HttpRequestHelp
});
});
}
}]);
},
]);

View File

@ -2,11 +2,16 @@
<rd-widget>
<rd-widget-body classes="no-padding">
<div class="toolBar">
<div class="toolBarTitle">
<i class="fa" ng-class="$ctrl.titleIcon" aria-hidden="true" style="margin-right: 2px;"></i> {{ $ctrl.titleText }}
</div>
<div class="toolBarTitle"> <i class="fa" ng-class="$ctrl.titleIcon" aria-hidden="true" style="margin-right: 2px;"></i> {{ $ctrl.titleText }} </div>
<div class="settings">
<span class="setting" ng-class="{ 'setting-active': $ctrl.columnVisibility.state.open }" uib-dropdown dropdown-append-to-body auto-close="disabled" is-open="$ctrl.columnVisibility.state.open">
<span
class="setting"
ng-class="{ 'setting-active': $ctrl.columnVisibility.state.open }"
uib-dropdown
dropdown-append-to-body
auto-close="disabled"
is-open="$ctrl.columnVisibility.state.open"
>
<span uib-dropdown-toggle><i class="fa fa-columns space-right" aria-hidden="true"></i>Columns</span>
<div class="dropdown-menu dropdown-menu-right" uib-dropdown-menu>
<div class="tableMenu">
@ -126,7 +131,8 @@
</span>
</div>
</div>
<containers-datatable-actions ng-if="!$ctrl.offlineMode"
<containers-datatable-actions
ng-if="!$ctrl.offlineMode"
selected-items="$ctrl.state.selectedItems"
selected-item-count="$ctrl.state.selectedItemCount"
no-stopped-items-selected="$ctrl.state.noStoppedItemsSelected"
@ -136,14 +142,26 @@
></containers-datatable-actions>
<div class="searchBar">
<i class="fa fa-search searchIcon" aria-hidden="true"></i>
<input type="text" class="searchInput" ng-model="$ctrl.state.textFilter" ng-change="$ctrl.onTextFilterChange()" placeholder="Search..." auto-focus ng-model-options="{ debounce: 300 }">
<input
type="text"
class="searchInput"
ng-model="$ctrl.state.textFilter"
ng-change="$ctrl.onTextFilterChange()"
placeholder="Search..."
auto-focus
ng-model-options="{ debounce: 300 }"
/>
</div>
<div class="table-responsive">
<table class="table table-hover table-filters nowrap-cells">
<thead>
<tr>
<th>
<span class="md-checkbox" ng-if="!$ctrl.offlineMode" authorization="DockerContainerStart, DockerContainerStop, DockerContainerKill, DockerContainerRestart, DockerContainerPause, DockerContainerUnpause, DockerContainerDelete, DockerContainerCreate">
<span
class="md-checkbox"
ng-if="!$ctrl.offlineMode"
authorization="DockerContainerStart, DockerContainerStop, DockerContainerKill, DockerContainerRestart, DockerContainerPause, DockerContainerUnpause, DockerContainerDelete, DockerContainerCreate"
>
<input id="select_all" type="checkbox" ng-model="$ctrl.state.selectAll" ng-change="$ctrl.selectAll()" />
<label for="select_all"></label>
</span>
@ -180,7 +198,17 @@
</div>
</div>
</th>
<th ng-if="$ctrl.settings.showQuickActionStats || $ctrl.settings.showQuickActionLogs || $ctrl.settings.showQuickActionExec || $ctrl.settings.showQuickActionAttach|| $ctrl.settings.showQuickActionInspect" ng-show="$ctrl.columnVisibility.columns.actions.display" authorization="DockerContainerStats, DockerContainerLogs, DockerExecStart, DockerContainerInspect, DockerTaskInspect, DockerTaskLogs, DockerContainerAttach">
<th
ng-if="
$ctrl.settings.showQuickActionStats ||
$ctrl.settings.showQuickActionLogs ||
$ctrl.settings.showQuickActionExec ||
$ctrl.settings.showQuickActionAttach ||
$ctrl.settings.showQuickActionInspect
"
ng-show="$ctrl.columnVisibility.columns.actions.display"
authorization="DockerContainerStats, DockerContainerLogs, DockerExecStart, DockerContainerInspect, DockerTaskInspect, DockerTaskLogs, DockerContainerAttach"
>
Quick actions
</th>
<th ng-show="$ctrl.columnVisibility.columns.stack.display">
@ -235,24 +263,48 @@
</tr>
</thead>
<tbody>
<tr dir-paginate="item in ($ctrl.state.filteredDataSet = ($ctrl.dataset | filter: $ctrl.applyFilters | 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.applyFilters | filter:$ctrl.state.textFilter | orderBy:$ctrl.state.orderBy:$ctrl.state.reverseOrder | itemsPerPage: $ctrl.state.paginatedItemLimit))"
ng-class="{ active: item.Checked }"
>
<td>
<span class="md-checkbox" ng-if="!$ctrl.offlineMode" authorization="DockerContainerStart, DockerContainerStop, DockerContainerKill, DockerContainerRestart, DockerContainerPause, DockerContainerUnpause, DockerContainerDelete, DockerContainerCreate">
<span
class="md-checkbox"
ng-if="!$ctrl.offlineMode"
authorization="DockerContainerStart, DockerContainerStop, DockerContainerKill, DockerContainerRestart, DockerContainerPause, DockerContainerUnpause, DockerContainerDelete, DockerContainerCreate"
>
<input id="select_{{ $index }}" type="checkbox" ng-model="item.Checked" ng-click="$ctrl.selectItem(item, $event)" />
<label for="select_{{ $index }}"></label>
</span>
<a ng-if="!$ctrl.offlineMode" ui-sref="docker.containers.container({ id: item.Id, nodeName: item.NodeName })" title="{{ item | containername }}">{{ item | containername | truncate: $ctrl.settings.containerNameTruncateSize }}</a>
<a ng-if="!$ctrl.offlineMode" ui-sref="docker.containers.container({ id: item.Id, nodeName: item.NodeName })" title="{{ item | containername }}">{{
item | containername | truncate: $ctrl.settings.containerNameTruncateSize
}}</a>
<span ng-if="$ctrl.offlineMode">{{ item | containername | truncate: $ctrl.settings.containerNameTruncateSize }}</span>
</td>
<td ng-show="$ctrl.columnVisibility.columns.state.display">
<span ng-if="['starting','healthy','unhealthy'].indexOf(item.Status) !== -1" class="label label-{{ item.Status|containerstatusbadge }} interactive" uib-tooltip="This container has a health check">{{ item.Status }}</span>
<span
ng-if="['starting', 'healthy', 'unhealthy'].indexOf(item.Status) !== -1"
class="label label-{{ item.Status | containerstatusbadge }} interactive"
uib-tooltip="This container has a health check"
>{{ item.Status }}</span
>
<span ng-if="['starting', 'healthy', 'unhealthy'].indexOf(item.Status) === -1" class="label label-{{ item.Status | containerstatusbadge }}">{{ item.Status }}</span>
</td>
<td ng-if="!$ctrl.offlineMode && ($ctrl.settings.showQuickActionStats || $ctrl.settings.showQuickActionLogs || $ctrl.settings.showQuickActionExec || $ctrl.settings.showQuickActionAttach || $ctrl.settings.showQuickActionInspect)" ng-show="$ctrl.columnVisibility.columns.actions.display" authorization="DockerContainerStats, DockerContainerLogs, DockerExecStart, DockerContainerInspect, DockerTaskInspect, DockerTaskLogs">
<td
ng-if="
!$ctrl.offlineMode &&
($ctrl.settings.showQuickActionStats ||
$ctrl.settings.showQuickActionLogs ||
$ctrl.settings.showQuickActionExec ||
$ctrl.settings.showQuickActionAttach ||
$ctrl.settings.showQuickActionInspect)
"
ng-show="$ctrl.columnVisibility.columns.actions.display"
authorization="DockerContainerStats, DockerContainerLogs, DockerExecStart, DockerContainerInspect, DockerTaskInspect, DockerTaskLogs"
>
<container-quick-actions container-id="item.Id" node-name="item.NodeName" status="item.Status" state="$ctrl.settings"></container-quick-actions>
</td>
<td ng-if="$ctrl.offlineMode">
</td>
<td ng-if="$ctrl.offlineMode"> </td>
<td ng-show="$ctrl.columnVisibility.columns.stack.display">{{ item.StackName ? item.StackName : '-' }}</td>
<td ng-show="$ctrl.columnVisibility.columns.image.display">
<a ng-if="!$ctrl.offlineMode" ui-sref="docker.images.image({ id: item.Image })">{{ item.Image | trimshasum }}</a>
@ -264,7 +316,13 @@
<td ng-show="$ctrl.columnVisibility.columns.ip.display">{{ item.IP ? item.IP : '-' }}</td>
<td ng-if="$ctrl.showHostColumn" ng-show="$ctrl.columnVisibility.columns.host.display">{{ item.NodeName ? item.NodeName : '-' }}</td>
<td ng-show="$ctrl.columnVisibility.columns.ports.display">
<a ng-if="item.Ports.length > 0" ng-repeat="p in item.Ports" class="image-tag" ng-href="http://{{ $ctrl.state.publicURL || p.host }}:{{p.public}}" target="_blank">
<a
ng-if="item.Ports.length > 0"
ng-repeat="p in item.Ports"
class="image-tag"
ng-href="http://{{ $ctrl.state.publicURL || p.host }}:{{ p.public }}"
target="_blank"
>
<i class="fa fa-external-link-alt" aria-hidden="true"></i> {{ p.public }}:{{ p.private }}
</a>
<span ng-if="item.Ports.length == 0">-</span>
@ -286,9 +344,7 @@
</table>
</div>
<div class="footer" ng-if="$ctrl.dataset">
<div class="infoBar" ng-if="$ctrl.state.selectedItemCount !== 0">
{{ $ctrl.state.selectedItemCount }} item(s) selected
</div>
<div class="infoBar" ng-if="$ctrl.state.selectedItemCount !== 0"> {{ $ctrl.state.selectedItemCount }} item(s) selected </div>
<div class="paginationControls">
<form class="form-inline">
<span class="limitSelector">

View File

@ -12,6 +12,6 @@ angular.module('portainer.docker').component('containersDatatable', {
showHostColumn: '<',
showAddAction: '<',
offlineMode: '<',
refreshCallback: '<'
}
refreshCallback: '<',
},
});

View File

@ -1,9 +1,11 @@
import _ from 'lodash-es';
angular.module('portainer.docker')
.controller('ContainersDatatableController', ['$scope', '$controller', 'DatatableService', 'EndpointProvider',
angular.module('portainer.docker').controller('ContainersDatatableController', [
'$scope',
'$controller',
'DatatableService',
'EndpointProvider',
function ($scope, $controller, DatatableService, EndpointProvider) {
angular.extend(this, $controller('GenericDatatableController', { $scope: $scope }));
var ctrl = this;
@ -12,7 +14,7 @@ function ($scope, $controller, DatatableService, EndpointProvider) {
noStoppedItemsSelected: true,
noRunningItemsSelected: true,
noPausedItemsSelected: true,
publicURL: EndpointProvider.endpointPublicURL()
publicURL: EndpointProvider.endpointPublicURL(),
});
this.settings = Object.assign(this.settings, {
@ -22,59 +24,59 @@ function ($scope, $controller, DatatableService, EndpointProvider) {
showQuickActionLogs: true,
showQuickActionExec: true,
showQuickActionInspect: true,
showQuickActionAttach: false
showQuickActionAttach: false,
});
this.filters = {
state: {
open: false,
enabled: false,
values: []
}
values: [],
},
};
this.columnVisibility = {
state: {
open: false
open: false,
},
columns: {
state: {
label: 'State',
display: true
display: true,
},
actions: {
label: 'Quick Actions',
display: true
display: true,
},
stack: {
label: 'Stack',
display: true
display: true,
},
image: {
label: 'Image',
display: true
display: true,
},
created: {
label: 'Created',
display: true
display: true,
},
ip: {
label: 'IP Address',
display: true
display: true,
},
host: {
label: 'Host',
display: true
display: true,
},
ports: {
label: 'Published Ports',
display: true
display: true,
},
ownership: {
label: 'Ownership',
display: true
}
}
display: true,
},
},
};
this.onColumnVisibilityChange = function () {
@ -83,7 +85,7 @@ function ($scope, $controller, DatatableService, EndpointProvider) {
this.onSelectionChanged = function () {
this.updateSelectionState();
}
};
this.updateSelectionState = function () {
this.state.noStoppedItemsSelected = true;
@ -204,4 +206,5 @@ function ($scope, $controller, DatatableService, EndpointProvider) {
this.columnVisibility.state.open = false;
}
};
}]);
},
]);

View File

@ -2,13 +2,19 @@
<rd-widget>
<rd-widget-body classes="no-padding">
<div class="toolBar">
<div class="toolBarTitle">
<i class="fa" ng-class="$ctrl.titleIcon" aria-hidden="true" style="margin-right: 2px;"></i> {{ $ctrl.titleText }}
</div>
<div class="toolBarTitle"> <i class="fa" ng-class="$ctrl.titleIcon" aria-hidden="true" style="margin-right: 2px;"></i> {{ $ctrl.titleText }} </div>
</div>
<div class="searchBar">
<i class="fa fa-search searchIcon" aria-hidden="true"></i>
<input type="text" class="searchInput" ng-model="$ctrl.state.textFilter" ng-change="$ctrl.onTextFilterChange()" placeholder="Search..." auto-focus ng-model-options="{ debounce: 300 }">
<input
type="text"
class="searchInput"
ng-model="$ctrl.state.textFilter"
ng-change="$ctrl.onTextFilterChange()"
placeholder="Search..."
auto-focus
ng-model-options="{ debounce: 300 }"
/>
</div>
<div class="table-responsive">
<table class="table table-hover nowrap-cells">
@ -38,7 +44,10 @@
</tr>
</thead>
<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>{{ item.Time | getisodatefromtimestamp }}</td>
<td>{{ item.Type }}</td>
<td>{{ item.Details }}</td>

View File

@ -7,6 +7,6 @@ angular.module('portainer.docker').component('eventsDatatable', {
dataset: '<',
tableKey: '@',
orderBy: '@',
reverseOrder: '<'
}
reverseOrder: '<',
},
});

View File

@ -16,7 +16,15 @@
</div>
<div class="searchBar">
<i class="fa fa-search searchIcon" aria-hidden="true"></i>
<input type="text" class="searchInput" ng-model="$ctrl.state.textFilter" ng-change="$ctrl.onTextFilterChange()" placeholder="Search..." auto-focus ng-model-options="{ debounce: 300 }">
<input
type="text"
class="searchInput"
ng-model="$ctrl.state.textFilter"
ng-change="$ctrl.onTextFilterChange()"
placeholder="Search..."
auto-focus
ng-model-options="{ debounce: 300 }"
/>
</div>
<div class="table-responsive">
<table class="table table-hover table-filters nowrap-cells">
@ -36,10 +44,8 @@
<i class="fa fa-sort-alpha-up" aria-hidden="true" ng-if="$ctrl.state.orderBy === 'Status' && $ctrl.state.reverseOrder"></i>
</a>
<div>
<span uib-dropdown-toggle class="table-filter" ng-if="!$ctrl.filters.state.enabled"> Filter
<i class="fa fa-filter" aria-hidden="true"></i></span>
<span uib-dropdown-toggle class="table-filter filter-active" ng-if="$ctrl.filters.state.enabled">Filter
<i class="fa fa-check" aria-hidden="true"></i></span>
<span uib-dropdown-toggle class="table-filter" ng-if="!$ctrl.filters.state.enabled"> Filter <i class="fa fa-filter" aria-hidden="true"></i></span>
<span uib-dropdown-toggle class="table-filter filter-active" ng-if="$ctrl.filters.state.enabled">Filter <i class="fa fa-check" aria-hidden="true"></i></span>
</div>
<div class="dropdown-menu" uib-dropdown-menu>
<div class="tableMenu">
@ -68,16 +74,22 @@
</tr>
</thead>
<tbody>
<tr dir-paginate="item in ($ctrl.state.filteredDataSet = ($ctrl.dataset | filter: $ctrl.applyFilters | filter:$ctrl.state.textFilter | orderBy:$ctrl.state.orderBy:$ctrl.state.reverseOrder | itemsPerPage: $ctrl.state.paginatedItemLimit))">
<tr
dir-paginate="item in ($ctrl.state.filteredDataSet = ($ctrl.dataset | filter: $ctrl.applyFilters | filter:$ctrl.state.textFilter | orderBy:$ctrl.state.orderBy:$ctrl.state.reverseOrder | itemsPerPage: $ctrl.state.paginatedItemLimit))"
>
<td>
<a ui-sref="docker.containers.container.logs({ id: item.Id, nodeName: item.NodeName })" title="{{ item.Id }}">
{{ item | containername }}</a>
<a ui-sref="docker.containers.container.logs({ id: item.Id, nodeName: item.NodeName })" title="{{ item.Id }}"> {{ item | containername }}</a>
</td>
<td>
<span ng-if="['starting','healthy','unhealthy'].indexOf(item.Status) !== -1" class="label label-{{ item.Status|containerstatusbadge }} interactive"
uib-tooltip="This container has a health check">{{ item.Status }}</span>
<span
ng-if="['starting', 'healthy', 'unhealthy'].indexOf(item.Status) !== -1"
class="label label-{{ item.Status | containerstatusbadge }} interactive"
uib-tooltip="This container has a health check"
>{{ item.Status }}</span
>
<span ng-if="['starting', 'healthy', 'unhealthy'].indexOf(item.Status) === -1" class="label label-{{ item.Status | containerstatusbadge }}">
{{ item.Status }}</span>
{{ item.Status }}</span
>
</td>
<td>
{{ item.Created | getisodatefromtimestamp }}

View File

@ -7,6 +7,6 @@ angular.module('portainer.docker').component('jobsDatatable', {
dataset: '<',
tableKey: '@',
orderBy: '@',
reverseOrder: '<'
}
reverseOrder: '<',
},
});

View File

@ -1,9 +1,16 @@
import _ from 'lodash-es';
angular.module('portainer.docker')
.controller('JobsDatatableController', ['$scope', '$controller', '$q', '$state', 'PaginationService', 'DatatableService', 'ContainerService', 'ModalService', 'Notifications',
angular.module('portainer.docker').controller('JobsDatatableController', [
'$scope',
'$controller',
'$q',
'$state',
'PaginationService',
'DatatableService',
'ContainerService',
'ModalService',
'Notifications',
function ($scope, $controller, $q, $state, PaginationService, DatatableService, ContainerService, ModalService, Notifications) {
angular.extend(this, $controller('GenericDatatableController', { $scope: $scope }));
var ctrl = this;
@ -12,8 +19,8 @@ angular.module('portainer.docker')
state: {
open: false,
enabled: false,
values: []
}
values: [],
},
};
this.applyFilters = function (value) {
@ -47,7 +54,7 @@ angular.module('portainer.docker')
var item = this.dataset[i];
availableStateFilters.push({
label: item.Status,
display: true
display: true,
});
}
this.filters.state.values = _.uniqBy(availableStateFilters, 'label');
@ -78,12 +85,12 @@ angular.module('portainer.docker')
buttons: {
confirm: {
label: 'Purge',
className: 'btn-danger'
}
className: 'btn-danger',
},
},
callback: function onConfirm(confirmed) {
deferred.resolve(confirmed);
}
},
});
return deferred.promise;
@ -95,10 +102,12 @@ angular.module('portainer.docker')
if (!confirmed) {
return $q.when();
}
ContainerService.prune({ label: ['io.portainer.job.endpoint'] }).then(function success() {
ContainerService.prune({ label: ['io.portainer.job.endpoint'] })
.then(function success() {
Notifications.success('Success', 'Job history cleared');
$state.reload();
}).catch(function error(err) {
})
.catch(function error(err) {
Notifications.error('Failure', err.message, 'Unable to clear job history');
});
});
@ -137,5 +146,5 @@ angular.module('portainer.docker')
}
this.onSettingsRepeaterChange();
};
}
},
]);

View File

@ -2,9 +2,7 @@
<rd-widget>
<rd-widget-body classes="no-padding">
<div class="toolBar">
<div class="toolBarTitle">
<i class="fa" ng-class="$ctrl.titleIcon" aria-hidden="true" style="margin-right: 2px;"></i> {{ $ctrl.titleText }}
</div>
<div class="toolBarTitle"> <i class="fa" ng-class="$ctrl.titleIcon" aria-hidden="true" style="margin-right: 2px;"></i> {{ $ctrl.titleText }} </div>
<div class="settings">
<span class="setting" ng-class="{ 'setting-active': $ctrl.settings.open }" uib-dropdown dropdown-append-to-body auto-close="disabled" is-open="$ctrl.settings.open">
<span uib-dropdown-toggle><i class="fa fa-cog" aria-hidden="true"></i> Settings</span>
@ -46,11 +44,17 @@
</div>
<div class="actionBar" ng-if="!$ctrl.offlineMode" authorization="DockerImageDelete, DockerImageBuild, DockerImageLoad, DockerImageGet">
<div class="btn-group" authorization="DockerImageDelete">
<button type="button" class="btn btn-sm btn-danger"
ng-disabled="$ctrl.state.selectedItemCount === 0" ng-click="$ctrl.removeAction($ctrl.state.selectedItems, false)">
<button type="button" class="btn btn-sm btn-danger" ng-disabled="$ctrl.state.selectedItemCount === 0" ng-click="$ctrl.removeAction($ctrl.state.selectedItems, false)">
<i class="fa fa-trash-alt space-right" aria-hidden="true"></i>Remove
</button>
<button type="button" class="btn btn-sm btn-danger dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" ng-disabled="$ctrl.state.selectedItemCount === 0">
<button
type="button"
class="btn btn-sm btn-danger dropdown-toggle"
data-toggle="dropdown"
aria-haspopup="true"
aria-expanded="false"
ng-disabled="$ctrl.state.selectedItemCount === 0"
>
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
@ -65,8 +69,14 @@
<button type="button" class="btn btn-sm btn-primary" ng-disabled="$ctrl.exportInProgress" ui-sref="docker.images.import" authorization="DockerImageLoad">
<i class="fa fa-upload space-right" aria-hidden="true"></i>Import
</button>
<button type="button" class="btn btn-sm btn-primary" ng-disabled="$ctrl.state.selectedItemCount === 0 || $ctrl.exportInProgress"
ng-click="$ctrl.downloadAction($ctrl.state.selectedItems)" button-spinner="$ctrl.exportInProgress" authorization="DockerImageGet">
<button
type="button"
class="btn btn-sm btn-primary"
ng-disabled="$ctrl.state.selectedItemCount === 0 || $ctrl.exportInProgress"
ng-click="$ctrl.downloadAction($ctrl.state.selectedItems)"
button-spinner="$ctrl.exportInProgress"
authorization="DockerImageGet"
>
<i class="fa fa-download space-right" aria-hidden="true"></i>
<span ng-hide="$ctrl.exportInProgress">Export</span>
<span ng-show="$ctrl.exportInProgress">Export in progress...</span>
@ -75,7 +85,15 @@
</div>
<div class="searchBar">
<i class="fa fa-search searchIcon" aria-hidden="true"></i>
<input type="text" class="searchInput" ng-model="$ctrl.state.textFilter" ng-change="$ctrl.onTextFilterChange()" placeholder="Search..." auto-focus ng-model-options="{ debounce: 300 }">
<input
type="text"
class="searchInput"
ng-model="$ctrl.state.textFilter"
ng-change="$ctrl.onTextFilterChange()"
placeholder="Search..."
auto-focus
ng-model-options="{ debounce: 300 }"
/>
</div>
<div class="table-responsive">
<table class="table table-hover table-filters nowrap-cells">
@ -147,13 +165,18 @@
</tr>
</thead>
<tbody>
<tr dir-paginate="item in ($ctrl.state.filteredDataSet = ($ctrl.dataset | filter: $ctrl.applyFilters | 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.applyFilters | filter:$ctrl.state.textFilter | orderBy:$ctrl.state.orderBy:$ctrl.state.reverseOrder | itemsPerPage: $ctrl.state.paginatedItemLimit))"
ng-class="{ active: item.Checked }"
>
<td>
<span class="md-checkbox" ng-if="!$ctrl.offlineMode">
<input id="select_{{ $index }}" type="checkbox" ng-model="item.Checked" ng-click="$ctrl.selectItem(item, $event)" />
<label for="select_{{ $index }}"></label>
</span>
<a ng-if="!$ctrl.offlineMode" ui-sref="docker.images.image({ id: item.Id, nodeName: item.NodeName })" class="monospaced" title="{{ item.Id }}">{{ item.Id | truncate:40 }}</a>
<a ng-if="!$ctrl.offlineMode" ui-sref="docker.images.image({ id: item.Id, nodeName: item.NodeName })" class="monospaced" title="{{ item.Id }}">{{
item.Id | truncate: 40
}}</a>
<span ng-if="$ctrl.offlineMode">{{ item.Id | truncate: 40 }}</span>
<span style="margin-left: 10px;" class="label label-warning image-tag" ng-if="::item.ContainerCount === 0">Unused</span>
</td>
@ -174,9 +197,7 @@
</table>
</div>
<div class="footer" ng-if="$ctrl.dataset">
<div class="infoBar" ng-if="$ctrl.state.selectedItemCount !== 0">
{{ $ctrl.state.selectedItemCount }} item(s) selected
</div>
<div class="infoBar" ng-if="$ctrl.state.selectedItemCount !== 0"> {{ $ctrl.state.selectedItemCount }} item(s) selected </div>
<div class="paginationControls">
<form class="form-inline">
<span class="limitSelector">

View File

@ -14,6 +14,6 @@ angular.module('portainer.docker').component('imagesDatatable', {
forceRemoveAction: '<',
exportInProgress: '<',
offlineMode: '<',
refreshCallback: '<'
}
refreshCallback: '<',
},
});

View File

@ -1,7 +1,8 @@
angular.module('portainer.docker')
.controller('ImagesDatatableController', ['$scope', '$controller', 'DatatableService',
angular.module('portainer.docker').controller('ImagesDatatableController', [
'$scope',
'$controller',
'DatatableService',
function ($scope, $controller, DatatableService) {
angular.extend(this, $controller('GenericDatatableController', { $scope: $scope }));
var ctrl = this;
@ -11,15 +12,14 @@ function ($scope, $controller, DatatableService) {
open: false,
enabled: false,
showUsedImages: true,
showUnusedImages: true
}
showUnusedImages: true,
},
};
this.applyFilters = function (value) {
var image = value;
var filters = ctrl.filters;
if ((image.ContainerCount === 0 && filters.state.showUnusedImages)
|| (image.ContainerCount !== 0 && filters.state.showUsedImages)) {
if ((image.ContainerCount === 0 && filters.state.showUnusedImages) || (image.ContainerCount !== 0 && filters.state.showUsedImages)) {
return true;
}
return false;
@ -68,4 +68,5 @@ function ($scope, $controller, DatatableService) {
this.onSettingsRepeaterChange();
};
}]);
},
]);

View File

@ -2,13 +2,19 @@
<rd-widget>
<rd-widget-body classes="no-padding">
<div class="toolBar">
<div class="toolBarTitle">
<i class="fa" ng-class="$ctrl.titleIcon" aria-hidden="true" style="margin-right: 2px;"></i> {{ $ctrl.titleText }}
</div>
<div class="toolBarTitle"> <i class="fa" ng-class="$ctrl.titleIcon" aria-hidden="true" style="margin-right: 2px;"></i> {{ $ctrl.titleText }} </div>
</div>
<div class="searchBar">
<i class="fa fa-search searchIcon" aria-hidden="true"></i>
<input type="text" class="searchInput" ng-model="$ctrl.state.textFilter" ng-change="$ctrl.onTextFilterChange()" placeholder="Search..." auto-focus ng-model-options="{ debounce: 300 }">
<input
type="text"
class="searchInput"
ng-model="$ctrl.state.textFilter"
ng-change="$ctrl.onTextFilterChange()"
placeholder="Search..."
auto-focus
ng-model-options="{ debounce: 300 }"
/>
</div>
<div class="table-responsive">
<table class="table table-hover nowrap-cells">
@ -56,8 +62,10 @@
</tr>
</thead>
<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>
<span class="md-checkbox">
<input id="select_{{ $index }}" type="checkbox" ng-model="item.Checked" ng-click="$ctrl.selectItem(item, $event)" />

View File

@ -10,6 +10,6 @@ angular.module('portainer.docker').component('macvlanNodesDatatable', {
reverseOrder: '<',
showIpAddressColumn: '<',
accessToNodeDetails: '<',
state: '='
}
state: '=',
},
});

View File

@ -1,9 +1,17 @@
<td ng-if="allowCheckbox">
<span class="md-checkbox" ng-if="!parentCtrl.offlineMode" authorization="DockerNetworkDelete, DockerNetworkCreate">
<input id="select_{{ $index }}" type="checkbox" ng-model="item.Checked" ng-click="parentCtrl.selectItem(item, $event); $event.stopPropagation()" ng-disabled="parentCtrl.disableRemove(item)"/>
<input
id="select_{{ $index }}"
type="checkbox"
ng-model="item.Checked"
ng-click="parentCtrl.selectItem(item, $event); $event.stopPropagation()"
ng-disabled="parentCtrl.disableRemove(item)"
/>
<label for="select_{{ $index }}"></label>
</span>
<a ng-if="parentCtrl.itemCanExpand(item)"><i ng-class="{ 'fas fa-angle-down': item.Expanded, 'fas fa-angle-right': !item.Expanded }" class="space-right" aria-hidden="true"></i></a>
<a ng-if="parentCtrl.itemCanExpand(item)"
><i ng-class="{ 'fas fa-angle-down': item.Expanded, 'fas fa-angle-right': !item.Expanded }" class="space-right" aria-hidden="true"></i
></a>
</td>
<td ng-if="!allowCheckbox"></td>
<td>

View File

@ -1,7 +1,7 @@
import { ResourceControlOwnership as RCO } from 'Portainer/models/resourceControl/resourceControlOwnership';
angular.module('portainer.docker')
.directive('networkRowContent', [function networkRowContent() {
angular.module('portainer.docker').directive('networkRowContent', [
function networkRowContent() {
var directive = {
templateUrl: './networkRowContent.html',
restrict: 'A',
@ -10,11 +10,12 @@ angular.module('portainer.docker')
item: '<',
parentCtrl: '<',
allowCheckbox: '<',
allowExpand: '<'
allowExpand: '<',
},
controller: ($scope) => {
$scope.RCO = RCO;
}
},
};
return directive;
}]);
},
]);

View File

@ -2,9 +2,7 @@
<rd-widget>
<rd-widget-body classes="no-padding">
<div class="toolBar">
<div class="toolBarTitle">
<i class="fa" ng-class="$ctrl.titleIcon" aria-hidden="true" style="margin-right: 2px;"></i> {{ $ctrl.titleText }}
</div>
<div class="toolBarTitle"> <i class="fa" ng-class="$ctrl.titleIcon" aria-hidden="true" style="margin-right: 2px;"></i> {{ $ctrl.titleText }} </div>
<div class="settings">
<span class="setting" ng-class="{ 'setting-active': $ctrl.settings.open }" uib-dropdown dropdown-append-to-body auto-close="disabled" is-open="$ctrl.settings.open">
<span uib-dropdown-toggle><i class="fa fa-cog" aria-hidden="true"></i> Settings</span>
@ -45,8 +43,13 @@
</div>
</div>
<div class="actionBar" ng-if="!$ctrl.offlineMode" authorization="DockerNetworkDelete, DockerNetworkCreate">
<button type="button" class="btn btn-sm btn-danger" authorization="DockerNetworkDelete"
ng-disabled="$ctrl.state.selectedItemCount === 0" ng-click="$ctrl.removeAction($ctrl.state.selectedItems)">
<button
type="button"
class="btn btn-sm btn-danger"
authorization="DockerNetworkDelete"
ng-disabled="$ctrl.state.selectedItemCount === 0"
ng-click="$ctrl.removeAction($ctrl.state.selectedItems)"
>
<i class="fa fa-trash-alt space-right" aria-hidden="true"></i>Remove
</button>
<button type="button" class="btn btn-sm btn-primary" ui-sref="docker.networks.new" authorization="DockerNetworkCreate">
@ -55,7 +58,15 @@
</div>
<div class="searchBar">
<i class="fa fa-search searchIcon" aria-hidden="true"></i>
<input type="text" class="searchInput" ng-model="$ctrl.state.textFilter" ng-change="$ctrl.onTextFilterChange()" placeholder="Search..." auto-focus ng-model-options="{ debounce: 300 }">
<input
type="text"
class="searchInput"
ng-model="$ctrl.state.textFilter"
ng-change="$ctrl.onTextFilterChange()"
placeholder="Search..."
auto-focus
ng-model-options="{ debounce: 300 }"
/>
</div>
<div class="table-responsive">
<table class="table table-hover nowrap-cells">
@ -150,12 +161,17 @@
</tr>
</thead>
<tbody>
<tr dir-paginate-start="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}" network-row-content item="item" parent-ctrl="$ctrl" ng-click="$ctrl.expandItem(item, !item.Expanded)" allow-checkbox="true">
</tr>
<tr dir-paginate-end ng-show="item.Expanded" ng-repeat="it in item.Subs" style="background: #d5e8f3;"
network-row-content item="it" parent-ctrl="$ctrl">
<tr
dir-paginate-start="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 }"
network-row-content
item="item"
parent-ctrl="$ctrl"
ng-click="$ctrl.expandItem(item, !item.Expanded)"
allow-checkbox="true"
>
</tr>
<tr dir-paginate-end ng-show="item.Expanded" ng-repeat="it in item.Subs" style="background: #d5e8f3;" network-row-content item="it" parent-ctrl="$ctrl"> </tr>
<tr ng-if="!$ctrl.dataset">
<td colspan="9" class="text-center text-muted">Loading...</td>
</tr>
@ -166,9 +182,7 @@
</table>
</div>
<div class="footer" ng-if="$ctrl.dataset">
<div class="infoBar" ng-if="$ctrl.state.selectedItemCount !== 0">
{{ $ctrl.state.selectedItemCount }} item(s) selected
</div>
<div class="infoBar" ng-if="$ctrl.state.selectedItemCount !== 0"> {{ $ctrl.state.selectedItemCount }} item(s) selected </div>
<div class="paginationControls">
<form class="form-inline">
<span class="limitSelector">

View File

@ -12,6 +12,6 @@ angular.module('portainer.docker').component('networksDatatable', {
showHostColumn: '<',
removeAction: '<',
offlineMode: '<',
refreshCallback: '<'
}
refreshCallback: '<',
},
});

View File

@ -1,9 +1,11 @@
import _ from 'lodash-es';
angular.module('portainer.docker')
.controller('NetworksDatatableController', ['$scope', '$controller', 'NetworkHelper', 'DatatableService',
angular.module('portainer.docker').controller('NetworksDatatableController', [
'$scope',
'$controller',
'NetworkHelper',
'DatatableService',
function ($scope, $controller, NetworkHelper, DatatableService) {
angular.extend(this, $controller('GenericDatatableController', { $scope: $scope }));
this.disableRemove = function (item) {
@ -11,15 +13,15 @@ angular.module('portainer.docker')
};
this.state = Object.assign(this.state, {
expandedItems: []
})
expandedItems: [],
});
/**
* Do not allow system networks to be selected
*/
this.allowSelection = function (item) {
return !this.disableRemove(item);
}
};
this.$onInit = function () {
this.setDefaults();
@ -60,7 +62,7 @@ angular.module('portainer.docker')
this.itemCanExpand = function (item) {
return item.Subs.length > 0;
}
};
this.hasExpandableItems = function () {
return _.filter(this.state.filteredDataSet, (item) => this.itemCanExpand(item)).length;
@ -74,5 +76,5 @@ angular.module('portainer.docker')
}
});
};
}
},
]);

View File

@ -2,13 +2,19 @@
<rd-widget>
<rd-widget-body classes="no-padding">
<div class="toolBar">
<div class="toolBarTitle">
<i class="fa" ng-class="$ctrl.titleIcon" aria-hidden="true" style="margin-right: 2px;"></i> {{ $ctrl.titleText }}
</div>
<div class="toolBarTitle"> <i class="fa" ng-class="$ctrl.titleIcon" aria-hidden="true" style="margin-right: 2px;"></i> {{ $ctrl.titleText }} </div>
</div>
<div class="searchBar">
<i class="fa fa-search searchIcon" aria-hidden="true"></i>
<input type="text" class="searchInput" ng-model="$ctrl.state.textFilter" ng-change="$ctrl.onTextFilterChange()" placeholder="Search..." auto-focus ng-model-options="{ debounce: 300 }">
<input
type="text"
class="searchInput"
ng-model="$ctrl.state.textFilter"
ng-change="$ctrl.onTextFilterChange()"
placeholder="Search..."
auto-focus
ng-model-options="{ debounce: 300 }"
/>
</div>
<div class="table-responsive">
<table class="table table-hover nowrap-cells">
@ -52,9 +58,16 @@
</tr>
</thead>
<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}">
<td><a ui-sref="docker.tasks.task({id: item.Id})" class="monospaced">{{ item.Id }}</a></td>
<td><span class="label label-{{ item.Status.State | taskstatusbadge }}">{{ item.Status.State }}</span></td>
<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
><a ui-sref="docker.tasks.task({id: item.Id})" class="monospaced">{{ item.Id }}</a></td
>
<td
><span class="label label-{{ item.Status.State | taskstatusbadge }}">{{ item.Status.State }}</span></td
>
<td>{{ item.Slot ? item.Slot : '-' }}</td>
<td>{{ item.Spec.ContainerSpec.Image | hideshasum }}</td>
<td>{{ item.Updated | getisodate }}</td>

View File

@ -7,6 +7,6 @@ angular.module('portainer.docker').component('nodeTasksDatatable', {
dataset: '<',
tableKey: '@',
orderBy: '@',
reverseOrder: '<'
}
reverseOrder: '<',
},
});

View File

@ -2,9 +2,7 @@
<rd-widget>
<rd-widget-body classes="no-padding">
<div class="toolBar">
<div class="toolBarTitle">
<i class="fa" ng-class="$ctrl.titleIcon" aria-hidden="true" style="margin-right: 2px;"></i> {{ $ctrl.titleText }}
</div>
<div class="toolBarTitle"> <i class="fa" ng-class="$ctrl.titleIcon" aria-hidden="true" style="margin-right: 2px;"></i> {{ $ctrl.titleText }} </div>
<div class="settings">
<span class="setting" ng-class="{ 'setting-active': $ctrl.settings.open }" uib-dropdown dropdown-append-to-body auto-close="disabled" is-open="$ctrl.settings.open">
<span uib-dropdown-toggle><i class="fa fa-cog" aria-hidden="true"></i> Settings</span>
@ -46,7 +44,15 @@
</div>
<div class="searchBar">
<i class="fa fa-search searchIcon" aria-hidden="true"></i>
<input type="text" class="searchInput" ng-model="$ctrl.state.textFilter" ng-change="$ctrl.onTextFilterChange()" placeholder="Search..." auto-focus ng-model-options="{ debounce: 300 }">
<input
type="text"
class="searchInput"
ng-model="$ctrl.state.textFilter"
ng-change="$ctrl.onTextFilterChange()"
placeholder="Search..."
auto-focus
ng-model-options="{ debounce: 300 }"
/>
</div>
<div class="table-responsive">
<table class="table table-hover nowrap-cells">
@ -111,7 +117,10 @@
</tr>
</thead>
<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>
<a ui-sref="docker.nodes.node({id: item.Id})" ng-if="$ctrl.accessToNodeDetails">{{ item.Name || item.Hostname }}</a>
<span ng-if="!$ctrl.accessToNodeDetails">{{ item.Name || item.Hostname }}</span>
@ -121,8 +130,12 @@
<td>{{ item.Memory | humansize }}</td>
<td>{{ item.EngineVersion }}</td>
<td ng-if="$ctrl.showIpAddressColumn">{{ item.Addr }}</td>
<td><span class="label label-{{ item.Status | nodestatusbadge }}">{{ item.Status }}</span></td>
<td><span class="label label-{{ item.Availability | dockerNodeAvailabilityBadge }}">{{ item.Availability }}</span></td>
<td
><span class="label label-{{ item.Status | nodestatusbadge }}">{{ item.Status }}</span></td
>
<td
><span class="label label-{{ item.Availability | dockerNodeAvailabilityBadge }}">{{ item.Availability }}</span></td
>
</tr>
<tr ng-if="!$ctrl.dataset">
<td colspan="7" class="text-center text-muted">Loading...</td>

View File

@ -10,6 +10,6 @@ angular.module('portainer.docker').component('nodesDatatable', {
reverseOrder: '<',
showIpAddressColumn: '<',
accessToNodeDetails: '<',
refreshCallback: '<'
}
refreshCallback: '<',
},
});

View File

@ -2,9 +2,7 @@
<rd-widget>
<rd-widget-body classes="no-padding">
<div class="toolBar">
<div class="toolBarTitle">
<i class="fa" ng-class="$ctrl.titleIcon" aria-hidden="true" style="margin-right: 2px;"></i> {{ $ctrl.titleText }}
</div>
<div class="toolBarTitle"> <i class="fa" ng-class="$ctrl.titleIcon" aria-hidden="true" style="margin-right: 2px;"></i> {{ $ctrl.titleText }} </div>
<div class="settings">
<span class="setting" ng-class="{ 'setting-active': $ctrl.settings.open }" uib-dropdown dropdown-append-to-body auto-close="disabled" is-open="$ctrl.settings.open">
<span uib-dropdown-toggle><i class="fa fa-cog" aria-hidden="true"></i> Settings</span>
@ -45,8 +43,13 @@
</div>
</div>
<div class="actionBar" authorization="DockerSecretDelete, DockerSecretCreate">
<button type="button" class="btn btn-sm btn-danger" authorization="DockerSecretDelete"
ng-disabled="$ctrl.state.selectedItemCount === 0" ng-click="$ctrl.removeAction($ctrl.state.selectedItems)">
<button
type="button"
class="btn btn-sm btn-danger"
authorization="DockerSecretDelete"
ng-disabled="$ctrl.state.selectedItemCount === 0"
ng-click="$ctrl.removeAction($ctrl.state.selectedItems)"
>
<i class="fa fa-trash-alt space-right" aria-hidden="true"></i>Remove
</button>
<button type="button" class="btn btn-sm btn-primary" ui-sref="docker.secrets.new" authorization="DockerSecretCreate">
@ -55,7 +58,15 @@
</div>
<div class="searchBar">
<i class="fa fa-search searchIcon" aria-hidden="true"></i>
<input type="text" class="searchInput" ng-model="$ctrl.state.textFilter" ng-change="$ctrl.onTextFilterChange()" placeholder="Search..." auto-focus ng-model-options="{ debounce: 300 }">
<input
type="text"
class="searchInput"
ng-model="$ctrl.state.textFilter"
ng-change="$ctrl.onTextFilterChange()"
placeholder="Search..."
auto-focus
ng-model-options="{ debounce: 300 }"
/>
</div>
<div class="table-responsive">
<table class="table table-hover nowrap-cells">
@ -89,7 +100,10 @@
</tr>
</thead>
<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>
<span class="md-checkbox" authorization="DockerSecretDelete, DockerSecretCreate">
<input id="select_{{ $index }}" type="checkbox" ng-model="item.Checked" ng-click="$ctrl.selectItem(item, $event)" />
@ -115,9 +129,7 @@
</table>
</div>
<div class="footer" ng-if="$ctrl.dataset">
<div class="infoBar" ng-if="$ctrl.state.selectedItemCount !== 0">
{{ $ctrl.state.selectedItemCount }} item(s) selected
</div>
<div class="infoBar" ng-if="$ctrl.state.selectedItemCount !== 0"> {{ $ctrl.state.selectedItemCount }} item(s) selected </div>
<div class="paginationControls">
<form class="form-inline">
<span class="limitSelector">

View File

@ -10,6 +10,6 @@ angular.module('portainer.docker').component('secretsDatatable', {
reverseOrder: '<',
showOwnershipColumn: '<',
removeAction: '<',
refreshCallback: '<'
}
refreshCallback: '<',
},
});

View File

@ -1,6 +1,6 @@
<div style="background-color: #d5e8f3; padding: 2px">
<div style="background-color: #d5e8f3; padding: 2px;">
<table class="table table-condensed table-hover nowrap-cells">
<thead style="background-color: #e7f6ff">
<thead style="background-color: #e7f6ff;">
<tr>
<th uib-dropdown dropdown-append-to-body auto-close="disabled" is-open="$ctrl.filters.state.open" style="width: 10%;">
<a ng-click="$ctrl.changeOrderBy('Status.State')">
@ -55,17 +55,33 @@
</tr>
</thead>
<tbody style="background-color: #f1f9fd;">
<tr ng-repeat="item in ($ctrl.state.filteredDataSet = ($ctrl.dataset | filter: $ctrl.applyFilters | filter:$ctrl.textFilter | orderBy:$ctrl.state.orderBy:$ctrl.state.reverseOrder))">
<tr
ng-repeat="item in ($ctrl.state.filteredDataSet = ($ctrl.dataset | filter: $ctrl.applyFilters | filter:$ctrl.textFilter | orderBy:$ctrl.state.orderBy:$ctrl.state.reverseOrder))"
>
<td class="text-center">
<span class="label label-{{ item.Status.State | taskstatusbadge }} space-right">{{ item.Status.State }}</span>
</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.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.Id
}}</a>
</td>
<td>
<container-quick-actions ng-if="!$ctrl.agentProxy || !item.Container" container-id="item.ContainerId" task-id="item.Id" status="item.Status.State" state="$ctrl.state"></container-quick-actions>
<container-quick-actions ng-if="$ctrl.agentProxy && item.Container" container-id="item.Container.Id" node-name="item.Container.NodeName" status="item.Status.State" state="$ctrl.state"></container-quick-actions>
<container-quick-actions
ng-if="!$ctrl.agentProxy || !item.Container"
container-id="item.ContainerId"
task-id="item.Id"
status="item.Status.State"
state="$ctrl.state"
></container-quick-actions>
<container-quick-actions
ng-if="$ctrl.agentProxy && item.Container"
container-id="item.Container.Id"
node-name="item.Container.NodeName"
status="item.Status.State"
state="$ctrl.state"
></container-quick-actions>
</td>
<td>{{ item.Slot ? item.Slot : '-' }}</td>
<td>{{ item.NodeId | tasknodename: $ctrl.nodes }}</td>

View File

@ -10,6 +10,6 @@ angular.module('portainer.docker').component('serviceTasksDatatable', {
nodes: '<',
agentProxy: '<',
textFilter: '=',
showTaskLogsButton: '<'
}
showTaskLogsButton: '<',
},
});

View File

@ -1,9 +1,10 @@
import _ from 'lodash-es';
angular.module('portainer.docker')
.controller('ServiceTasksDatatableController', ['$scope', '$controller', 'DatatableService',
angular.module('portainer.docker').controller('ServiceTasksDatatableController', [
'$scope',
'$controller',
'DatatableService',
function ($scope, $controller, DatatableService) {
angular.extend(this, $controller('GenericDatatableController', { $scope: $scope }));
var ctrl = this;
@ -14,15 +15,15 @@ angular.module('portainer.docker')
showQuickActionConsole: true,
showQuickActionInspect: true,
showQuickActionExec: true,
showQuickActionAttach: false
showQuickActionAttach: false,
});
this.filters = {
state: {
open: false,
enabled: false,
values: []
}
values: [],
},
};
this.applyFilters = function (item) {
@ -89,5 +90,5 @@ angular.module('portainer.docker')
}
this.onSettingsRepeaterChange();
};
}
},
]);

Some files were not shown because too many files have changed in this diff Show More