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

refactor(api): API overhaul (#392)

This commit is contained in:
Anthony Lapenna 2016-12-18 18:21:29 +13:00 committed by GitHub
parent d9f6124609
commit 0a38bba874
36 changed files with 1275 additions and 869 deletions

View file

@ -498,10 +498,11 @@ angular.module('portainer', [
}])
// This is your docker url that the api will use to make requests
// You need to set this to the api endpoint without the port i.e. http://192.168.1.9
.constant('DOCKER_ENDPOINT', 'dockerapi')
.constant('DOCKER_ENDPOINT', '/api/docker')
.constant('DOCKER_PORT', '') // Docker port, leave as an empty string if no port is required. If you have a port, prefix it with a ':' i.e. :4243
.constant('CONFIG_ENDPOINT', 'settings')
.constant('AUTH_ENDPOINT', 'auth')
.constant('TEMPLATES_ENDPOINT', 'templates')
.constant('CONFIG_ENDPOINT', '/api/settings')
.constant('AUTH_ENDPOINT', '/api/auth')
.constant('USERS_ENDPOINT', '/api/users')
.constant('TEMPLATES_ENDPOINT', '/api/templates')
.constant('PAGINATION_MAX_ITEMS', 10)
.constant('UI_VERSION', 'v1.10.2');

View file

@ -55,7 +55,7 @@ function ($scope, $stateParams, Settings, Container, Image, Exec, $timeout, Mess
} else {
var execId = d.Id;
resizeTTY(execId, termHeight, termWidth);
var url = window.location.href.split('#')[0] + 'ws/exec?id=' + execId;
var url = window.location.href.split('#')[0] + 'api/websocket/exec?id=' + execId;
if (url.indexOf('https') > -1) {
url = url.replace('https://', 'wss://');
} else {

View file

@ -229,9 +229,9 @@ angular.module('portainer.services', ['ngResource', 'ngSanitize'])
}
});
}])
.factory('Users', ['$resource', function UsersFactory($resource) {
.factory('Users', ['$resource', 'USERS_ENDPOINT', function UsersFactory($resource, USERS_ENDPOINT) {
'use strict';
return $resource('/users/:username/:action', {}, {
return $resource(USERS_ENDPOINT + '/:username/:action', {}, {
create: { method: 'POST' },
get: {method: 'GET', params: { username: '@username' } },
update: { method: 'PUT', params: { username: '@username' } },