mirror of
https://github.com/portainer/portainer.git
synced 2025-08-05 05:45:22 +02:00
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>
This commit is contained in:
parent
6663073be1
commit
cf5056d9c0
714 changed files with 31228 additions and 28305 deletions
|
@ -1,20 +1,31 @@
|
|||
import { jsonObjectsToArrayHandler } from './response/handlers';
|
||||
|
||||
angular.module('portainer.docker')
|
||||
.factory('Build', ['$resource', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider', function BuildFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
|
||||
'use strict';
|
||||
return $resource(API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/build', {
|
||||
endpointId: EndpointProvider.endpointID
|
||||
angular.module('portainer.docker').factory('Build', [
|
||||
'$resource',
|
||||
'API_ENDPOINT_ENDPOINTS',
|
||||
'EndpointProvider',
|
||||
function BuildFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
|
||||
'use strict';
|
||||
return $resource(
|
||||
API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/build',
|
||||
{
|
||||
endpointId: EndpointProvider.endpointID,
|
||||
},
|
||||
{
|
||||
buildImage: {
|
||||
method: 'POST',
|
||||
ignoreLoadingBar: true,
|
||||
transformResponse: jsonObjectsToArrayHandler,
|
||||
isArray: true,
|
||||
headers: { 'Content-Type': 'application/x-tar' },
|
||||
},
|
||||
buildImageOverride: {
|
||||
method: 'POST',
|
||||
ignoreLoadingBar: true,
|
||||
transformResponse: jsonObjectsToArrayHandler,
|
||||
isArray: true,
|
||||
},
|
||||
}
|
||||
);
|
||||
},
|
||||
{
|
||||
buildImage: {
|
||||
method: 'POST', ignoreLoadingBar: true,
|
||||
transformResponse: jsonObjectsToArrayHandler, isArray: true,
|
||||
headers: { 'Content-Type': 'application/x-tar' }
|
||||
},
|
||||
buildImageOverride: {
|
||||
method: 'POST', ignoreLoadingBar: true,
|
||||
transformResponse: jsonObjectsToArrayHandler, isArray: true
|
||||
}
|
||||
});
|
||||
}]);
|
||||
]);
|
||||
|
|
|
@ -1,10 +1,17 @@
|
|||
angular.module('portainer.docker')
|
||||
.factory('Commit', ['$resource', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider', function CommitFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
|
||||
'use strict';
|
||||
return $resource(API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/commit', {
|
||||
endpointId: EndpointProvider.endpointID
|
||||
angular.module('portainer.docker').factory('Commit', [
|
||||
'$resource',
|
||||
'API_ENDPOINT_ENDPOINTS',
|
||||
'EndpointProvider',
|
||||
function CommitFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
|
||||
'use strict';
|
||||
return $resource(
|
||||
API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/commit',
|
||||
{
|
||||
endpointId: EndpointProvider.endpointID,
|
||||
},
|
||||
{
|
||||
commitContainer: { method: 'POST', params: { container: '@id', repo: '@repo' }, ignoreLoadingBar: true },
|
||||
}
|
||||
);
|
||||
},
|
||||
{
|
||||
commitContainer: {method: 'POST', params: {container: '@id', repo: '@repo'}, ignoreLoadingBar: true}
|
||||
});
|
||||
}]);
|
||||
]);
|
||||
|
|
|
@ -1,12 +1,20 @@
|
|||
angular.module('portainer.docker')
|
||||
.factory('Config', ['$resource', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider', function ConfigFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
|
||||
'use strict';
|
||||
return $resource(API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/configs/:id/:action', {
|
||||
endpointId: EndpointProvider.endpointID
|
||||
}, {
|
||||
get: { method: 'GET', params: { id: '@id' } },
|
||||
query: { method: 'GET', isArray: true },
|
||||
create: { method: 'POST', params: { action: 'create' }, ignoreLoadingBar: true },
|
||||
remove: { method: 'DELETE', params: { id: '@id' } }
|
||||
});
|
||||
}]);
|
||||
angular.module('portainer.docker').factory('Config', [
|
||||
'$resource',
|
||||
'API_ENDPOINT_ENDPOINTS',
|
||||
'EndpointProvider',
|
||||
function ConfigFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
|
||||
'use strict';
|
||||
return $resource(
|
||||
API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/configs/:id/:action',
|
||||
{
|
||||
endpointId: EndpointProvider.endpointID,
|
||||
},
|
||||
{
|
||||
get: { method: 'GET', params: { id: '@id' } },
|
||||
query: { method: 'GET', isArray: true },
|
||||
create: { method: 'POST', params: { action: 'create' }, ignoreLoadingBar: true },
|
||||
remove: { method: 'DELETE', params: { id: '@id' } },
|
||||
}
|
||||
);
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -1,82 +1,115 @@
|
|||
import {genericHandler, logsHandler} from './response/handlers';
|
||||
import { genericHandler, logsHandler } from './response/handlers';
|
||||
|
||||
angular.module('portainer.docker')
|
||||
.factory('Container', ['$resource', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider', 'ContainersInterceptor',
|
||||
function ContainerFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider, ContainersInterceptor) {
|
||||
'use strict';
|
||||
return $resource(API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/containers/:id/:action', {
|
||||
name: '@name',
|
||||
endpointId: EndpointProvider.endpointID
|
||||
angular.module('portainer.docker').factory('Container', [
|
||||
'$resource',
|
||||
'API_ENDPOINT_ENDPOINTS',
|
||||
'EndpointProvider',
|
||||
'ContainersInterceptor',
|
||||
function ContainerFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider, ContainersInterceptor) {
|
||||
'use strict';
|
||||
return $resource(
|
||||
API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/containers/:id/:action',
|
||||
{
|
||||
name: '@name',
|
||||
endpointId: EndpointProvider.endpointID,
|
||||
},
|
||||
{
|
||||
query: {
|
||||
method: 'GET',
|
||||
params: { all: 0, action: 'json', filters: '@filters' },
|
||||
isArray: true,
|
||||
interceptor: ContainersInterceptor,
|
||||
timeout: 15000,
|
||||
},
|
||||
get: {
|
||||
method: 'GET',
|
||||
params: { action: 'json' },
|
||||
},
|
||||
stop: {
|
||||
method: 'POST',
|
||||
params: { id: '@id', action: 'stop' },
|
||||
},
|
||||
restart: {
|
||||
method: 'POST',
|
||||
params: { id: '@id', action: 'restart' },
|
||||
},
|
||||
kill: {
|
||||
method: 'POST',
|
||||
params: { id: '@id', action: 'kill' },
|
||||
},
|
||||
pause: {
|
||||
method: 'POST',
|
||||
params: { id: '@id', action: 'pause' },
|
||||
},
|
||||
unpause: {
|
||||
method: 'POST',
|
||||
params: { id: '@id', action: 'unpause' },
|
||||
},
|
||||
logs: {
|
||||
method: 'GET',
|
||||
params: { id: '@id', action: 'logs' },
|
||||
timeout: 4500,
|
||||
ignoreLoadingBar: true,
|
||||
transformResponse: logsHandler,
|
||||
},
|
||||
stats: {
|
||||
method: 'GET',
|
||||
params: { id: '@id', stream: false, action: 'stats' },
|
||||
timeout: 4500,
|
||||
ignoreLoadingBar: true,
|
||||
},
|
||||
top: {
|
||||
method: 'GET',
|
||||
params: { id: '@id', action: 'top' },
|
||||
timeout: 4500,
|
||||
ignoreLoadingBar: true,
|
||||
},
|
||||
start: {
|
||||
method: 'POST',
|
||||
params: { id: '@id', action: 'start' },
|
||||
transformResponse: genericHandler,
|
||||
},
|
||||
create: {
|
||||
method: 'POST',
|
||||
params: { action: 'create' },
|
||||
transformResponse: genericHandler,
|
||||
ignoreLoadingBar: true,
|
||||
},
|
||||
remove: {
|
||||
method: 'DELETE',
|
||||
params: { id: '@id', v: '@v', force: '@force' },
|
||||
transformResponse: genericHandler,
|
||||
},
|
||||
rename: {
|
||||
method: 'POST',
|
||||
params: { id: '@id', action: 'rename', name: '@name' },
|
||||
transformResponse: genericHandler,
|
||||
},
|
||||
exec: {
|
||||
method: 'POST',
|
||||
params: { id: '@id', action: 'exec' },
|
||||
transformResponse: genericHandler,
|
||||
ignoreLoadingBar: true,
|
||||
},
|
||||
inspect: {
|
||||
method: 'GET',
|
||||
params: { id: '@id', action: 'json' },
|
||||
},
|
||||
update: {
|
||||
method: 'POST',
|
||||
params: { id: '@id', action: 'update' },
|
||||
},
|
||||
prune: {
|
||||
method: 'POST',
|
||||
params: { action: 'prune', filters: '@filters' },
|
||||
},
|
||||
resize: {
|
||||
method: 'POST',
|
||||
params: { id: '@id', action: 'resize', h: '@height', w: '@width' },
|
||||
transformResponse: genericHandler,
|
||||
ignoreLoadingBar: true,
|
||||
},
|
||||
}
|
||||
);
|
||||
},
|
||||
{
|
||||
query: {
|
||||
method: 'GET', params: { all: 0, action: 'json', filters: '@filters' },
|
||||
isArray: true, interceptor: ContainersInterceptor, timeout: 15000
|
||||
},
|
||||
get: {
|
||||
method: 'GET', params: { action: 'json' }
|
||||
},
|
||||
stop: {
|
||||
method: 'POST', params: { id: '@id', action: 'stop' }
|
||||
},
|
||||
restart: {
|
||||
method: 'POST', params: { id: '@id', action: 'restart' }
|
||||
},
|
||||
kill: {
|
||||
method: 'POST', params: { id: '@id', action: 'kill' }
|
||||
},
|
||||
pause: {
|
||||
method: 'POST', params: { id: '@id', action: 'pause' }
|
||||
},
|
||||
unpause: {
|
||||
method: 'POST', params: { id: '@id', action: 'unpause' }
|
||||
},
|
||||
logs: {
|
||||
method: 'GET', params: { id: '@id', action: 'logs' },
|
||||
timeout: 4500, ignoreLoadingBar: true,
|
||||
transformResponse: logsHandler
|
||||
},
|
||||
stats: {
|
||||
method: 'GET', params: { id: '@id', stream: false, action: 'stats' },
|
||||
timeout: 4500, ignoreLoadingBar: true
|
||||
},
|
||||
top: {
|
||||
method: 'GET', params: { id: '@id', action: 'top' },
|
||||
timeout: 4500, ignoreLoadingBar: true
|
||||
},
|
||||
start: {
|
||||
method: 'POST', params: {id: '@id', action: 'start'},
|
||||
transformResponse: genericHandler
|
||||
},
|
||||
create: {
|
||||
method: 'POST', params: {action: 'create'},
|
||||
transformResponse: genericHandler,
|
||||
ignoreLoadingBar: true
|
||||
},
|
||||
remove: {
|
||||
method: 'DELETE', params: {id: '@id', v: '@v', force: '@force'},
|
||||
transformResponse: genericHandler
|
||||
},
|
||||
rename: {
|
||||
method: 'POST', params: { id: '@id', action: 'rename', name: '@name' },
|
||||
transformResponse: genericHandler
|
||||
},
|
||||
exec: {
|
||||
method: 'POST', params: {id: '@id', action: 'exec'},
|
||||
transformResponse: genericHandler, ignoreLoadingBar: true
|
||||
},
|
||||
inspect: {
|
||||
method: 'GET', params: { id: '@id', action: 'json' }
|
||||
},
|
||||
update: {
|
||||
method: 'POST', params: { id: '@id', action: 'update'}
|
||||
},
|
||||
prune: {
|
||||
method: 'POST', params: { action: 'prune', filters: '@filters' }
|
||||
},
|
||||
resize: {
|
||||
method: 'POST', params: {id: '@id', action: 'resize', h: '@height', w: '@width'},
|
||||
transformResponse: genericHandler, ignoreLoadingBar: true
|
||||
}
|
||||
});
|
||||
}]);
|
||||
]);
|
||||
|
|
|
@ -1,16 +1,24 @@
|
|||
import { genericHandler } from './response/handlers';
|
||||
|
||||
angular.module('portainer.docker')
|
||||
.factory('Exec', ['$resource', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider',
|
||||
function ExecFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
|
||||
'use strict';
|
||||
return $resource(API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/exec/:id/:action', {
|
||||
endpointId: EndpointProvider.endpointID
|
||||
angular.module('portainer.docker').factory('Exec', [
|
||||
'$resource',
|
||||
'API_ENDPOINT_ENDPOINTS',
|
||||
'EndpointProvider',
|
||||
function ExecFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
|
||||
'use strict';
|
||||
return $resource(
|
||||
API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/exec/:id/:action',
|
||||
{
|
||||
endpointId: EndpointProvider.endpointID,
|
||||
},
|
||||
{
|
||||
resize: {
|
||||
method: 'POST',
|
||||
params: { id: '@id', action: 'resize', h: '@height', w: '@width' },
|
||||
transformResponse: genericHandler,
|
||||
ignoreLoadingBar: true,
|
||||
},
|
||||
}
|
||||
);
|
||||
},
|
||||
{
|
||||
resize: {
|
||||
method: 'POST', params: {id: '@id', action: 'resize', h: '@height', w: '@width'},
|
||||
transformResponse: genericHandler, ignoreLoadingBar: true
|
||||
}
|
||||
});
|
||||
}]);
|
||||
]);
|
||||
|
|
|
@ -1,43 +1,58 @@
|
|||
import {deleteImageHandler, jsonObjectsToArrayHandler} from './response/handlers';
|
||||
import {imageGetResponse} from './response/image';
|
||||
import { deleteImageHandler, jsonObjectsToArrayHandler } from './response/handlers';
|
||||
import { imageGetResponse } from './response/image';
|
||||
|
||||
angular.module('portainer.docker')
|
||||
.factory('Image', ['$resource', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider', 'HttpRequestHelper', 'ImagesInterceptor',
|
||||
function ImageFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider, HttpRequestHelper, ImagesInterceptor) {
|
||||
'use strict';
|
||||
angular.module('portainer.docker').factory('Image', [
|
||||
'$resource',
|
||||
'API_ENDPOINT_ENDPOINTS',
|
||||
'EndpointProvider',
|
||||
'HttpRequestHelper',
|
||||
'ImagesInterceptor',
|
||||
function ImageFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider, HttpRequestHelper, ImagesInterceptor) {
|
||||
'use strict';
|
||||
|
||||
return $resource(API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/images/:id/:action', {
|
||||
endpointId: EndpointProvider.endpointID
|
||||
return $resource(
|
||||
API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/images/:id/:action',
|
||||
{
|
||||
endpointId: EndpointProvider.endpointID,
|
||||
},
|
||||
{
|
||||
query: { method: 'GET', params: { all: 0, action: 'json' }, isArray: true, interceptor: ImagesInterceptor, timeout: 15000 },
|
||||
get: { method: 'GET', params: { action: 'json' } },
|
||||
search: { method: 'GET', params: { action: 'search' } },
|
||||
history: { method: 'GET', params: { action: 'history' }, isArray: true },
|
||||
insert: { method: 'POST', params: { id: '@id', action: 'insert' } },
|
||||
tag: { method: 'POST', params: { id: '@id', action: 'tag', force: 0, repo: '@repo' }, ignoreLoadingBar: true },
|
||||
inspect: { method: 'GET', params: { id: '@id', action: 'json' } },
|
||||
push: {
|
||||
method: 'POST',
|
||||
params: { action: 'push', id: '@imageName' },
|
||||
isArray: true,
|
||||
transformResponse: jsonObjectsToArrayHandler,
|
||||
headers: { 'X-Registry-Auth': HttpRequestHelper.registryAuthenticationHeader },
|
||||
ignoreLoadingBar: true,
|
||||
},
|
||||
create: {
|
||||
method: 'POST',
|
||||
params: { action: 'create', fromImage: '@fromImage' },
|
||||
isArray: true,
|
||||
transformResponse: jsonObjectsToArrayHandler,
|
||||
headers: { 'X-Registry-Auth': HttpRequestHelper.registryAuthenticationHeader },
|
||||
ignoreLoadingBar: true,
|
||||
},
|
||||
download: {
|
||||
method: 'GET',
|
||||
params: { action: 'get', names: '@names' },
|
||||
transformResponse: imageGetResponse,
|
||||
responseType: 'blob',
|
||||
ignoreLoadingBar: true,
|
||||
},
|
||||
remove: {
|
||||
method: 'DELETE',
|
||||
params: { id: '@id', force: '@force' },
|
||||
isArray: true,
|
||||
transformResponse: deleteImageHandler,
|
||||
},
|
||||
}
|
||||
);
|
||||
},
|
||||
{
|
||||
query: {method: 'GET', params: {all: 0, action: 'json'}, isArray: true, interceptor: ImagesInterceptor, timeout: 15000},
|
||||
get: {method: 'GET', params: {action: 'json'}},
|
||||
search: {method: 'GET', params: {action: 'search'}},
|
||||
history: {method: 'GET', params: {action: 'history'}, isArray: true},
|
||||
insert: {method: 'POST', params: {id: '@id', action: 'insert'}},
|
||||
tag: {method: 'POST', params: {id: '@id', action: 'tag', force: 0, repo: '@repo'}, ignoreLoadingBar: true},
|
||||
inspect: {method: 'GET', params: {id: '@id', action: 'json'}},
|
||||
push: {
|
||||
method: 'POST', params: {action: 'push', id: '@imageName'},
|
||||
isArray: true, transformResponse: jsonObjectsToArrayHandler,
|
||||
headers: { 'X-Registry-Auth': HttpRequestHelper.registryAuthenticationHeader },
|
||||
ignoreLoadingBar: true
|
||||
},
|
||||
create: {
|
||||
method: 'POST', params: {action: 'create', fromImage: '@fromImage'},
|
||||
isArray: true, transformResponse: jsonObjectsToArrayHandler,
|
||||
headers: { 'X-Registry-Auth': HttpRequestHelper.registryAuthenticationHeader },
|
||||
ignoreLoadingBar: true
|
||||
},
|
||||
download: {
|
||||
method: 'GET', params: {action:'get', names: '@names'},
|
||||
transformResponse: imageGetResponse,
|
||||
responseType: 'blob',
|
||||
ignoreLoadingBar: true
|
||||
},
|
||||
remove: {
|
||||
method: 'DELETE', params: {id: '@id', force: '@force'},
|
||||
isArray: true, transformResponse: deleteImageHandler
|
||||
}
|
||||
});
|
||||
}]);
|
||||
]);
|
||||
|
|
|
@ -1,32 +1,47 @@
|
|||
import {genericHandler} from './response/handlers';
|
||||
import { genericHandler } from './response/handlers';
|
||||
|
||||
angular.module('portainer.docker')
|
||||
.factory('Network', ['$resource', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider', 'NetworksInterceptor',
|
||||
function NetworkFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider, NetworksInterceptor) {
|
||||
'use strict';
|
||||
return $resource(API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/networks/:id/:action', {
|
||||
id: '@id',
|
||||
endpointId: EndpointProvider.endpointID
|
||||
angular.module('portainer.docker').factory('Network', [
|
||||
'$resource',
|
||||
'API_ENDPOINT_ENDPOINTS',
|
||||
'EndpointProvider',
|
||||
'NetworksInterceptor',
|
||||
function NetworkFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider, NetworksInterceptor) {
|
||||
'use strict';
|
||||
return $resource(
|
||||
API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/networks/:id/:action',
|
||||
{
|
||||
id: '@id',
|
||||
endpointId: EndpointProvider.endpointID,
|
||||
},
|
||||
{
|
||||
query: {
|
||||
method: 'GET',
|
||||
isArray: true,
|
||||
interceptor: NetworksInterceptor,
|
||||
timeout: 15000,
|
||||
},
|
||||
get: {
|
||||
method: 'GET',
|
||||
},
|
||||
create: {
|
||||
method: 'POST',
|
||||
params: { action: 'create' },
|
||||
transformResponse: genericHandler,
|
||||
ignoreLoadingBar: true,
|
||||
},
|
||||
remove: {
|
||||
method: 'DELETE',
|
||||
transformResponse: genericHandler,
|
||||
},
|
||||
connect: {
|
||||
method: 'POST',
|
||||
params: { action: 'connect' },
|
||||
},
|
||||
disconnect: {
|
||||
method: 'POST',
|
||||
params: { action: 'disconnect' },
|
||||
},
|
||||
}
|
||||
);
|
||||
},
|
||||
{
|
||||
query: {
|
||||
method: 'GET', isArray: true, interceptor: NetworksInterceptor, timeout: 15000
|
||||
},
|
||||
get: {
|
||||
method: 'GET'
|
||||
},
|
||||
create: {
|
||||
method: 'POST', params: {action: 'create'},
|
||||
transformResponse: genericHandler, ignoreLoadingBar: true
|
||||
},
|
||||
remove: {
|
||||
method: 'DELETE', transformResponse: genericHandler
|
||||
},
|
||||
connect: {
|
||||
method: 'POST', params: { action: 'connect' }
|
||||
},
|
||||
disconnect: {
|
||||
method: 'POST', params: { action: 'disconnect' }
|
||||
}
|
||||
});
|
||||
}]);
|
||||
]);
|
||||
|
|
|
@ -1,13 +1,20 @@
|
|||
angular.module('portainer.docker')
|
||||
.factory('Node', ['$resource', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider', function NodeFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
|
||||
'use strict';
|
||||
return $resource(API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/nodes/:id/:action', {
|
||||
endpointId: EndpointProvider.endpointID
|
||||
angular.module('portainer.docker').factory('Node', [
|
||||
'$resource',
|
||||
'API_ENDPOINT_ENDPOINTS',
|
||||
'EndpointProvider',
|
||||
function NodeFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
|
||||
'use strict';
|
||||
return $resource(
|
||||
API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/nodes/:id/:action',
|
||||
{
|
||||
endpointId: EndpointProvider.endpointID,
|
||||
},
|
||||
{
|
||||
query: { method: 'GET', isArray: true },
|
||||
get: { method: 'GET', params: { id: '@id' } },
|
||||
update: { method: 'POST', params: { id: '@id', action: 'update', version: '@version' } },
|
||||
remove: { method: 'DELETE', params: { id: '@id' } },
|
||||
}
|
||||
);
|
||||
},
|
||||
{
|
||||
query: {method: 'GET', isArray: true},
|
||||
get: {method: 'GET', params: {id: '@id'}},
|
||||
update: { method: 'POST', params: {id: '@id', action: 'update', version: '@version'} },
|
||||
remove: { method: 'DELETE', params: {id: '@id'} }
|
||||
});
|
||||
}]);
|
||||
]);
|
||||
|
|
|
@ -1,9 +1,17 @@
|
|||
angular.module('portainer.docker')
|
||||
.factory('Plugin', ['$resource', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider', function PluginFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
|
||||
'use strict';
|
||||
return $resource(API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/plugins/:id/:action', {
|
||||
endpointId: EndpointProvider.endpointID
|
||||
}, {
|
||||
query: { method: 'GET', isArray: true }
|
||||
});
|
||||
}]);
|
||||
angular.module('portainer.docker').factory('Plugin', [
|
||||
'$resource',
|
||||
'API_ENDPOINT_ENDPOINTS',
|
||||
'EndpointProvider',
|
||||
function PluginFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
|
||||
'use strict';
|
||||
return $resource(
|
||||
API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/plugins/:id/:action',
|
||||
{
|
||||
endpointId: EndpointProvider.endpointID,
|
||||
},
|
||||
{
|
||||
query: { method: 'GET', isArray: true },
|
||||
}
|
||||
);
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
function isJSONArray(jsonString) {
|
||||
return Object.prototype.toString.call(jsonString) === '[object Array]';
|
||||
return Object.prototype.toString.call(jsonString) === '[object Array]';
|
||||
}
|
||||
|
||||
function isJSON(jsonString) {
|
||||
try {
|
||||
var o = JSON.parse(jsonString);
|
||||
if (o && typeof o === 'object') {
|
||||
return o;
|
||||
return o;
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
} catch (e) {
|
||||
//empty
|
||||
}
|
||||
return false;
|
||||
|
@ -50,7 +49,7 @@ export function genericHandler(data) {
|
|||
// This handler wraps the data in a JSON object under the "logs" property.
|
||||
export function logsHandler(data) {
|
||||
return {
|
||||
logs: data
|
||||
logs: data,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -63,7 +62,7 @@ export function deleteImageHandler(data) {
|
|||
// A string is returned on failure (Docker < 1.12)
|
||||
var response = [];
|
||||
if (!isJSON(data)) {
|
||||
response.push({message: data});
|
||||
response.push({ message: data });
|
||||
}
|
||||
// A JSON object is returned on failure (Docker = 1.12)
|
||||
else if (!isJSONArray(data)) {
|
||||
|
|
|
@ -3,8 +3,7 @@
|
|||
// This functions simply creates a response object and assign
|
||||
// the data to a field.
|
||||
export function imageGetResponse(data) {
|
||||
var response = {};
|
||||
response.file = data;
|
||||
return response;
|
||||
}
|
||||
|
||||
var response = {};
|
||||
response.file = data;
|
||||
return response;
|
||||
}
|
||||
|
|
|
@ -1,12 +1,20 @@
|
|||
angular.module('portainer.docker')
|
||||
.factory('Secret', ['$resource', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider', function SecretFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
|
||||
'use strict';
|
||||
return $resource(API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/secrets/:id/:action', {
|
||||
endpointId: EndpointProvider.endpointID
|
||||
}, {
|
||||
get: { method: 'GET', params: {id: '@id'} },
|
||||
query: { method: 'GET', isArray: true },
|
||||
create: { method: 'POST', params: {action: 'create'}, ignoreLoadingBar: true },
|
||||
remove: { method: 'DELETE', params: {id: '@id'} }
|
||||
});
|
||||
}]);
|
||||
angular.module('portainer.docker').factory('Secret', [
|
||||
'$resource',
|
||||
'API_ENDPOINT_ENDPOINTS',
|
||||
'EndpointProvider',
|
||||
function SecretFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
|
||||
'use strict';
|
||||
return $resource(
|
||||
API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/secrets/:id/:action',
|
||||
{
|
||||
endpointId: EndpointProvider.endpointID,
|
||||
},
|
||||
{
|
||||
get: { method: 'GET', params: { id: '@id' } },
|
||||
query: { method: 'GET', isArray: true },
|
||||
create: { method: 'POST', params: { action: 'create' }, ignoreLoadingBar: true },
|
||||
remove: { method: 'DELETE', params: { id: '@id' } },
|
||||
}
|
||||
);
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -1,34 +1,45 @@
|
|||
import { logsHandler } from './response/handlers';
|
||||
|
||||
angular.module('portainer.docker')
|
||||
.factory('Service', ['$resource', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider', 'HttpRequestHelper',
|
||||
function ServiceFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider, HttpRequestHelper) {
|
||||
'use strict';
|
||||
return $resource(API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/services/:id/:action', {
|
||||
endpointId: EndpointProvider.endpointID
|
||||
},
|
||||
{
|
||||
get: { method: 'GET', params: {id: '@id'} },
|
||||
query: { method: 'GET', isArray: true, params: {filters: '@filters'} },
|
||||
create: {
|
||||
method: 'POST', params: {action: 'create'},
|
||||
headers: {
|
||||
'X-Registry-Auth': HttpRequestHelper.registryAuthenticationHeader,
|
||||
'version': '1.29'
|
||||
angular.module('portainer.docker').factory('Service', [
|
||||
'$resource',
|
||||
'API_ENDPOINT_ENDPOINTS',
|
||||
'EndpointProvider',
|
||||
'HttpRequestHelper',
|
||||
function ServiceFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider, HttpRequestHelper) {
|
||||
'use strict';
|
||||
return $resource(
|
||||
API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/services/:id/:action',
|
||||
{
|
||||
endpointId: EndpointProvider.endpointID,
|
||||
},
|
||||
ignoreLoadingBar: true
|
||||
},
|
||||
update: {
|
||||
method: 'POST', params: { id: '@id', action: 'update', version: '@version', rollback: '@rollback' },
|
||||
headers: {
|
||||
'version': '1.29'
|
||||
{
|
||||
get: { method: 'GET', params: { id: '@id' } },
|
||||
query: { method: 'GET', isArray: true, params: { filters: '@filters' } },
|
||||
create: {
|
||||
method: 'POST',
|
||||
params: { action: 'create' },
|
||||
headers: {
|
||||
'X-Registry-Auth': HttpRequestHelper.registryAuthenticationHeader,
|
||||
version: '1.29',
|
||||
},
|
||||
ignoreLoadingBar: true,
|
||||
},
|
||||
update: {
|
||||
method: 'POST',
|
||||
params: { id: '@id', action: 'update', version: '@version', rollback: '@rollback' },
|
||||
headers: {
|
||||
version: '1.29',
|
||||
},
|
||||
},
|
||||
remove: { method: 'DELETE', params: { id: '@id' } },
|
||||
logs: {
|
||||
method: 'GET',
|
||||
params: { id: '@id', action: 'logs' },
|
||||
timeout: 4500,
|
||||
ignoreLoadingBar: true,
|
||||
transformResponse: logsHandler,
|
||||
},
|
||||
}
|
||||
},
|
||||
remove: { method: 'DELETE', params: {id: '@id'} },
|
||||
logs: {
|
||||
method: 'GET', params: { id: '@id', action: 'logs' },
|
||||
timeout: 4500, ignoreLoadingBar: true,
|
||||
transformResponse: logsHandler
|
||||
}
|
||||
});
|
||||
}]);
|
||||
);
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -1,10 +1,17 @@
|
|||
angular.module('portainer.docker')
|
||||
.factory('Swarm', ['$resource', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider', function SwarmFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
|
||||
'use strict';
|
||||
return $resource(API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/swarm', {
|
||||
endpointId: EndpointProvider.endpointID
|
||||
angular.module('portainer.docker').factory('Swarm', [
|
||||
'$resource',
|
||||
'API_ENDPOINT_ENDPOINTS',
|
||||
'EndpointProvider',
|
||||
function SwarmFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
|
||||
'use strict';
|
||||
return $resource(
|
||||
API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/swarm',
|
||||
{
|
||||
endpointId: EndpointProvider.endpointID,
|
||||
},
|
||||
{
|
||||
get: { method: 'GET' },
|
||||
}
|
||||
);
|
||||
},
|
||||
{
|
||||
get: { method: 'GET' }
|
||||
});
|
||||
}]);
|
||||
]);
|
||||
|
|
|
@ -1,23 +1,36 @@
|
|||
import {jsonObjectsToArrayHandler} from './response/handlers';
|
||||
import { jsonObjectsToArrayHandler } from './response/handlers';
|
||||
|
||||
angular.module('portainer.docker')
|
||||
.factory('System', ['$resource', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider', 'InfoInterceptor', 'VersionInterceptor',
|
||||
angular.module('portainer.docker').factory('System', [
|
||||
'$resource',
|
||||
'API_ENDPOINT_ENDPOINTS',
|
||||
'EndpointProvider',
|
||||
'InfoInterceptor',
|
||||
'VersionInterceptor',
|
||||
function SystemFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider, InfoInterceptor, VersionInterceptor) {
|
||||
'use strict';
|
||||
return $resource(API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/:action/:subAction', {
|
||||
name: '@name',
|
||||
endpointId: EndpointProvider.endpointID
|
||||
'use strict';
|
||||
return $resource(
|
||||
API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/:action/:subAction',
|
||||
{
|
||||
name: '@name',
|
||||
endpointId: EndpointProvider.endpointID,
|
||||
},
|
||||
{
|
||||
info: {
|
||||
method: 'GET',
|
||||
params: { action: 'info' },
|
||||
timeout: 15000,
|
||||
interceptor: InfoInterceptor,
|
||||
},
|
||||
version: { method: 'GET', params: { action: 'version' }, timeout: 4500, interceptor: VersionInterceptor },
|
||||
events: {
|
||||
method: 'GET',
|
||||
params: { action: 'events', since: '@since', until: '@until' },
|
||||
isArray: true,
|
||||
transformResponse: jsonObjectsToArrayHandler,
|
||||
},
|
||||
auth: { method: 'POST', params: { action: 'auth' } },
|
||||
dataUsage: { method: 'GET', params: { action: 'system', subAction: 'df' } },
|
||||
}
|
||||
);
|
||||
},
|
||||
{
|
||||
info: {
|
||||
method: 'GET', params: { action: 'info' }, timeout: 15000, interceptor: InfoInterceptor
|
||||
},
|
||||
version: { method: 'GET', params: { action: 'version' }, timeout: 4500, interceptor: VersionInterceptor },
|
||||
events: {
|
||||
method: 'GET', params: { action: 'events', since: '@since', until: '@until' },
|
||||
isArray: true, transformResponse: jsonObjectsToArrayHandler
|
||||
},
|
||||
auth: { method: 'POST', params: { action: 'auth' } },
|
||||
dataUsage: { method: 'GET', params: { action: 'system', subAction: 'df' } }
|
||||
});
|
||||
}]);
|
||||
]);
|
||||
|
|
|
@ -1,13 +1,19 @@
|
|||
angular.module('portainer.docker')
|
||||
.factory('SystemEndpoint', ['$resource', 'API_ENDPOINT_ENDPOINTS',
|
||||
angular.module('portainer.docker').factory('SystemEndpoint', [
|
||||
'$resource',
|
||||
'API_ENDPOINT_ENDPOINTS',
|
||||
function SystemEndpointFactory($resource, API_ENDPOINT_ENDPOINTS) {
|
||||
'use strict';
|
||||
return $resource(API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/:action/:subAction', {
|
||||
name: '@name'
|
||||
'use strict';
|
||||
return $resource(
|
||||
API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/:action/:subAction',
|
||||
{
|
||||
name: '@name',
|
||||
},
|
||||
{
|
||||
ping: {
|
||||
method: 'GET',
|
||||
params: { action: '_ping', endpointId: '@endpointId' },
|
||||
},
|
||||
}
|
||||
);
|
||||
},
|
||||
{
|
||||
ping: {
|
||||
method: 'GET', params: { action: '_ping', endpointId: '@endpointId' }
|
||||
}
|
||||
});
|
||||
}]);
|
||||
]);
|
||||
|
|
|
@ -1,18 +1,27 @@
|
|||
import { logsHandler } from './response/handlers';
|
||||
|
||||
angular.module('portainer.docker')
|
||||
.factory('Task', ['$resource', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider', function TaskFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
|
||||
'use strict';
|
||||
return $resource(API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/tasks/:id/:action', {
|
||||
endpointId: EndpointProvider.endpointID
|
||||
angular.module('portainer.docker').factory('Task', [
|
||||
'$resource',
|
||||
'API_ENDPOINT_ENDPOINTS',
|
||||
'EndpointProvider',
|
||||
function TaskFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
|
||||
'use strict';
|
||||
return $resource(
|
||||
API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/tasks/:id/:action',
|
||||
{
|
||||
endpointId: EndpointProvider.endpointID,
|
||||
},
|
||||
{
|
||||
get: { method: 'GET', params: { id: '@id' } },
|
||||
query: { method: 'GET', isArray: true, params: { filters: '@filters' } },
|
||||
logs: {
|
||||
method: 'GET',
|
||||
params: { id: '@id', action: 'logs' },
|
||||
timeout: 4500,
|
||||
ignoreLoadingBar: true,
|
||||
transformResponse: logsHandler,
|
||||
},
|
||||
}
|
||||
);
|
||||
},
|
||||
{
|
||||
get: { method: 'GET', params: {id: '@id'} },
|
||||
query: { method: 'GET', isArray: true, params: {filters: '@filters'} },
|
||||
logs: {
|
||||
method: 'GET', params: { id: '@id', action: 'logs' },
|
||||
timeout: 4500, ignoreLoadingBar: true,
|
||||
transformResponse: logsHandler
|
||||
}
|
||||
});
|
||||
}]);
|
||||
]);
|
||||
|
|
|
@ -1,19 +1,27 @@
|
|||
import {genericHandler} from './response/handlers';
|
||||
import { genericHandler } from './response/handlers';
|
||||
|
||||
angular.module('portainer.docker')
|
||||
.factory('Volume', ['$resource', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider', 'VolumesInterceptor',
|
||||
angular.module('portainer.docker').factory('Volume', [
|
||||
'$resource',
|
||||
'API_ENDPOINT_ENDPOINTS',
|
||||
'EndpointProvider',
|
||||
'VolumesInterceptor',
|
||||
function VolumeFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider, VolumesInterceptor) {
|
||||
'use strict';
|
||||
return $resource(API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/volumes/:id/:action',
|
||||
{
|
||||
endpointId: EndpointProvider.endpointID
|
||||
'use strict';
|
||||
return $resource(
|
||||
API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/volumes/:id/:action',
|
||||
{
|
||||
endpointId: EndpointProvider.endpointID,
|
||||
},
|
||||
{
|
||||
query: { method: 'GET', interceptor: VolumesInterceptor, timeout: 15000 },
|
||||
get: { method: 'GET', params: { id: '@id' } },
|
||||
create: { method: 'POST', params: { action: 'create' }, transformResponse: genericHandler, ignoreLoadingBar: true },
|
||||
remove: {
|
||||
method: 'DELETE',
|
||||
transformResponse: genericHandler,
|
||||
params: { id: '@id' },
|
||||
},
|
||||
}
|
||||
);
|
||||
},
|
||||
{
|
||||
query: { method: 'GET', interceptor: VolumesInterceptor, timeout: 15000},
|
||||
get: { method: 'GET', params: {id: '@id'} },
|
||||
create: {method: 'POST', params: {action: 'create'}, transformResponse: genericHandler, ignoreLoadingBar: true},
|
||||
remove: {
|
||||
method: 'DELETE', transformResponse: genericHandler, params: {id: '@id'}
|
||||
}
|
||||
});
|
||||
}]);
|
||||
]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue