1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-05 13:55:21 +02:00

feat(settings): add settings management (#906)

This commit is contained in:
Anthony Lapenna 2017-06-01 10:14:55 +02:00 committed by GitHub
parent 5e74a3993b
commit c7e306841a
93 changed files with 1086 additions and 457 deletions

8
app/rest/api/settings.js Normal file
View file

@ -0,0 +1,8 @@
angular.module('portainer.rest')
.factory('Settings', ['$resource', 'SETTINGS_ENDPOINT', function SettingsFactory($resource, SETTINGS_ENDPOINT) {
'use strict';
return $resource(SETTINGS_ENDPOINT, {}, {
get: { method: 'GET' },
update: { method: 'PUT' }
});
}]);

7
app/rest/api/status.js Normal file
View file

@ -0,0 +1,7 @@
angular.module('portainer.rest')
.factory('Status', ['$resource', 'STATUS_ENDPOINT', function StatusFactory($resource, STATUS_ENDPOINT) {
'use strict';
return $resource(STATUS_ENDPOINT, {}, {
get: { method: 'GET' }
});
}]);

View file

@ -1,4 +0,0 @@
angular.module('portainer.rest')
.factory('Config', ['$resource', 'CONFIG_ENDPOINT', function ConfigFactory($resource, CONFIG_ENDPOINT) {
return $resource(CONFIG_ENDPOINT).get();
}]);

View file

@ -1,10 +0,0 @@
angular.module('portainer.rest')
.factory('ContainerCommit', ['$resource', 'Settings', 'EndpointProvider', function ContainerCommitFactory($resource, Settings, EndpointProvider) {
'use strict';
return $resource(Settings.url + '/:endpointId/commit', {
endpointId: EndpointProvider.endpointID
},
{
commit: {method: 'POST', params: {container: '@id', repo: '@repo', tag: '@tag'}}
});
}]);

View file

@ -1,7 +1,7 @@
angular.module('portainer.rest')
.factory('Container', ['$resource', 'Settings', 'EndpointProvider', function ContainerFactory($resource, Settings, EndpointProvider) {
.factory('Container', ['$resource', 'DOCKER_ENDPOINT', 'EndpointProvider', function ContainerFactory($resource, DOCKER_ENDPOINT, EndpointProvider) {
'use strict';
return $resource(Settings.url + '/:endpointId/containers/:id/:action', {
return $resource(DOCKER_ENDPOINT + '/:endpointId/containers/:id/:action', {
name: '@name',
endpointId: EndpointProvider.endpointID
},

View file

@ -0,0 +1,10 @@
angular.module('portainer.rest')
.factory('ContainerCommit', ['$resource', 'DOCKER_ENDPOINT', 'EndpointProvider', function ContainerCommitFactory($resource, DOCKER_ENDPOINT, EndpointProvider) {
'use strict';
return $resource(DOCKER_ENDPOINT + '/:endpointId/commit', {
endpointId: EndpointProvider.endpointID
},
{
commit: {method: 'POST', params: {container: '@id', repo: '@repo', tag: '@tag'}}
});
}]);

View file

@ -1,11 +1,11 @@
angular.module('portainer.rest')
.factory('ContainerLogs', ['$http', 'Settings', 'EndpointProvider', function ContainerLogsFactory($http, Settings, EndpointProvider) {
.factory('ContainerLogs', ['$http', 'DOCKER_ENDPOINT', 'EndpointProvider', function ContainerLogsFactory($http, DOCKER_ENDPOINT, EndpointProvider) {
'use strict';
return {
get: function (id, params, callback) {
$http({
method: 'GET',
url: Settings.url + '/' + EndpointProvider.endpointID() + '/containers/' + id + '/logs',
url: DOCKER_ENDPOINT + '/' + EndpointProvider.endpointID() + '/containers/' + id + '/logs',
params: {
'stdout': params.stdout || 0,
'stderr': params.stderr || 0,

View file

@ -1,11 +1,11 @@
angular.module('portainer.rest')
.factory('ContainerTop', ['$http', 'Settings', 'EndpointProvider', function ($http, Settings, EndpointProvider) {
.factory('ContainerTop', ['$http', 'DOCKER_ENDPOINT', 'EndpointProvider', function ($http, DOCKER_ENDPOINT, EndpointProvider) {
'use strict';
return {
get: function (id, params, callback, errorCallback) {
$http({
method: 'GET',
url: Settings.url + '/' + EndpointProvider.endpointID() + '/containers/' + id + '/top',
url: DOCKER_ENDPOINT + '/' + EndpointProvider.endpointID() + '/containers/' + id + '/top',
params: {
ps_args: params.ps_args
}

View file

@ -1,7 +1,7 @@
angular.module('portainer.rest')
.factory('Events', ['$resource', 'Settings', 'EndpointProvider', function EventFactory($resource, Settings, EndpointProvider) {
.factory('Events', ['$resource', 'DOCKER_ENDPOINT', 'EndpointProvider', function EventFactory($resource, DOCKER_ENDPOINT, EndpointProvider) {
'use strict';
return $resource(Settings.url + '/:endpointId/events', {
return $resource(DOCKER_ENDPOINT + '/:endpointId/events', {
endpointId: EndpointProvider.endpointID
},
{

View file

@ -1,7 +1,7 @@
angular.module('portainer.rest')
.factory('Exec', ['$resource', 'Settings', 'EndpointProvider', function ExecFactory($resource, Settings, EndpointProvider) {
.factory('Exec', ['$resource', 'DOCKER_ENDPOINT', 'EndpointProvider', function ExecFactory($resource, DOCKER_ENDPOINT, EndpointProvider) {
'use strict';
return $resource(Settings.url + '/:endpointId/exec/:id/:action', {
return $resource(DOCKER_ENDPOINT + '/:endpointId/exec/:id/:action', {
endpointId: EndpointProvider.endpointID
},
{

View file

@ -1,7 +1,7 @@
angular.module('portainer.rest')
.factory('Image', ['$resource', 'Settings', 'EndpointProvider', function ImageFactory($resource, Settings, EndpointProvider) {
.factory('Image', ['$resource', 'DOCKER_ENDPOINT', 'EndpointProvider', function ImageFactory($resource, DOCKER_ENDPOINT, EndpointProvider) {
'use strict';
return $resource(Settings.url + '/:endpointId/images/:id/:action', {
return $resource(DOCKER_ENDPOINT + '/:endpointId/images/:id/:action', {
endpointId: EndpointProvider.endpointID
},
{

7
app/rest/docker/info.js Normal file
View file

@ -0,0 +1,7 @@
angular.module('portainer.rest')
.factory('Info', ['$resource', 'DOCKER_ENDPOINT', 'EndpointProvider', function InfoFactory($resource, DOCKER_ENDPOINT, EndpointProvider) {
'use strict';
return $resource(DOCKER_ENDPOINT + '/:endpointId/info', {
endpointId: EndpointProvider.endpointID
});
}]);

View file

@ -1,7 +1,7 @@
angular.module('portainer.rest')
.factory('Network', ['$resource', 'Settings', 'EndpointProvider', function NetworkFactory($resource, Settings, EndpointProvider) {
.factory('Network', ['$resource', 'DOCKER_ENDPOINT', 'EndpointProvider', function NetworkFactory($resource, DOCKER_ENDPOINT, EndpointProvider) {
'use strict';
return $resource(Settings.url + '/:endpointId/networks/:id/:action', {
return $resource(DOCKER_ENDPOINT + '/:endpointId/networks/:id/:action', {
id: '@id',
endpointId: EndpointProvider.endpointID
},

View file

@ -1,7 +1,7 @@
angular.module('portainer.rest')
.factory('Node', ['$resource', 'Settings', 'EndpointProvider', function NodeFactory($resource, Settings, EndpointProvider) {
.factory('Node', ['$resource', 'DOCKER_ENDPOINT', 'EndpointProvider', function NodeFactory($resource, DOCKER_ENDPOINT, EndpointProvider) {
'use strict';
return $resource(Settings.url + '/:endpointId/nodes/:id/:action', {
return $resource(DOCKER_ENDPOINT + '/:endpointId/nodes/:id/:action', {
endpointId: EndpointProvider.endpointID
},
{

View file

@ -1,7 +1,7 @@
angular.module('portainer.rest')
.factory('Secret', ['$resource', 'Settings', 'EndpointProvider', function SecretFactory($resource, Settings, EndpointProvider) {
.factory('Secret', ['$resource', 'DOCKER_ENDPOINT', 'EndpointProvider', function SecretFactory($resource, DOCKER_ENDPOINT, EndpointProvider) {
'use strict';
return $resource(Settings.url + '/:endpointId/secrets/:id/:action', {
return $resource(DOCKER_ENDPOINT + '/:endpointId/secrets/:id/:action', {
endpointId: EndpointProvider.endpointID
}, {
get: { method: 'GET', params: {id: '@id'} },

View file

@ -1,7 +1,7 @@
angular.module('portainer.rest')
.factory('Service', ['$resource', 'Settings', 'EndpointProvider', function ServiceFactory($resource, Settings, EndpointProvider) {
.factory('Service', ['$resource', 'DOCKER_ENDPOINT', 'EndpointProvider', function ServiceFactory($resource, DOCKER_ENDPOINT, EndpointProvider) {
'use strict';
return $resource(Settings.url + '/:endpointId/services/:id/:action', {
return $resource(DOCKER_ENDPOINT + '/:endpointId/services/:id/:action', {
endpointId: EndpointProvider.endpointID
},
{

10
app/rest/docker/swarm.js Normal file
View file

@ -0,0 +1,10 @@
angular.module('portainer.rest')
.factory('Swarm', ['$resource', 'DOCKER_ENDPOINT', 'EndpointProvider', function SwarmFactory($resource, DOCKER_ENDPOINT, EndpointProvider) {
'use strict';
return $resource(DOCKER_ENDPOINT + '/:endpointId/swarm', {
endpointId: EndpointProvider.endpointID
},
{
get: {method: 'GET'}
});
}]);

View file

@ -1,7 +1,7 @@
angular.module('portainer.rest')
.factory('Task', ['$resource', 'Settings', 'EndpointProvider', function TaskFactory($resource, Settings, EndpointProvider) {
.factory('Task', ['$resource', 'DOCKER_ENDPOINT', 'EndpointProvider', function TaskFactory($resource, DOCKER_ENDPOINT, EndpointProvider) {
'use strict';
return $resource(Settings.url + '/:endpointId/tasks/:id', {
return $resource(DOCKER_ENDPOINT + '/:endpointId/tasks/:id', {
endpointId: EndpointProvider.endpointID
},
{

View file

@ -0,0 +1,7 @@
angular.module('portainer.rest')
.factory('Version', ['$resource', 'DOCKER_ENDPOINT', 'EndpointProvider', function VersionFactory($resource, DOCKER_ENDPOINT, EndpointProvider) {
'use strict';
return $resource(DOCKER_ENDPOINT + '/:endpointId/version', {
endpointId: EndpointProvider.endpointID
});
}]);

View file

@ -1,7 +1,7 @@
angular.module('portainer.rest')
.factory('Volume', ['$resource', 'Settings', 'EndpointProvider', function VolumeFactory($resource, Settings, EndpointProvider) {
.factory('Volume', ['$resource', 'DOCKER_ENDPOINT', 'EndpointProvider', function VolumeFactory($resource, DOCKER_ENDPOINT, EndpointProvider) {
'use strict';
return $resource(Settings.url + '/:endpointId/volumes/:id/:action',
return $resource(DOCKER_ENDPOINT + '/:endpointId/volumes/:id/:action',
{
endpointId: EndpointProvider.endpointID
},

View file

@ -1,7 +0,0 @@
angular.module('portainer.rest')
.factory('Info', ['$resource', 'Settings', 'EndpointProvider', function InfoFactory($resource, Settings, EndpointProvider) {
'use strict';
return $resource(Settings.url + '/:endpointId/info', {
endpointId: EndpointProvider.endpointID
});
}]);

View file

@ -1,10 +0,0 @@
angular.module('portainer.rest')
.factory('Swarm', ['$resource', 'Settings', 'EndpointProvider', function SwarmFactory($resource, Settings, EndpointProvider) {
'use strict';
return $resource(Settings.url + '/:endpointId/swarm', {
endpointId: EndpointProvider.endpointID
},
{
get: {method: 'GET'}
});
}]);

View file

@ -1,7 +0,0 @@
angular.module('portainer.rest')
.factory('Version', ['$resource', 'Settings', 'EndpointProvider', function VersionFactory($resource, Settings, EndpointProvider) {
'use strict';
return $resource(Settings.url + '/:endpointId/version', {
endpointId: EndpointProvider.endpointID
});
}]);