2017-01-31 23:26:29 +00:00
|
|
|
angular.module('portainer.filters', []);
|
|
|
|
angular.module('portainer.rest', ['ngResource']);
|
|
|
|
angular.module('portainer.services', []);
|
|
|
|
angular.module('portainer.helpers', []);
|
2016-09-04 02:50:37 +00:00
|
|
|
angular.module('portainer', [
|
2016-06-02 05:34:03 +00:00
|
|
|
'ui.bootstrap',
|
|
|
|
'ui.router',
|
|
|
|
'ui.select',
|
|
|
|
'ngCookies',
|
|
|
|
'ngSanitize',
|
2016-12-25 20:34:02 +00:00
|
|
|
'ngFileUpload',
|
2016-11-17 12:50:46 +00:00
|
|
|
'angularUtils.directives.dirPagination',
|
2016-12-15 03:33:47 +00:00
|
|
|
'LocalStorageModule',
|
|
|
|
'angular-jwt',
|
2017-02-13 22:39:26 +00:00
|
|
|
'angular-google-analytics',
|
2017-01-31 23:26:29 +00:00
|
|
|
'portainer.templates',
|
2016-09-04 02:50:37 +00:00
|
|
|
'portainer.filters',
|
2017-01-31 23:26:29 +00:00
|
|
|
'portainer.rest',
|
|
|
|
'portainer.helpers',
|
|
|
|
'portainer.services',
|
2016-12-15 03:33:47 +00:00
|
|
|
'auth',
|
2016-06-02 05:34:03 +00:00
|
|
|
'dashboard',
|
|
|
|
'container',
|
2016-08-03 03:11:09 +00:00
|
|
|
'containerConsole',
|
|
|
|
'containerLogs',
|
2016-06-02 05:34:03 +00:00
|
|
|
'containers',
|
2016-07-06 00:19:09 +00:00
|
|
|
'createContainer',
|
2017-01-31 23:26:29 +00:00
|
|
|
'createNetwork',
|
|
|
|
'createService',
|
|
|
|
'createVolume',
|
2016-06-16 05:27:07 +00:00
|
|
|
'docker',
|
2016-12-25 20:34:02 +00:00
|
|
|
'endpoint',
|
|
|
|
'endpointInit',
|
|
|
|
'endpoints',
|
2016-07-26 23:08:18 +00:00
|
|
|
'events',
|
2016-06-02 05:34:03 +00:00
|
|
|
'image',
|
2017-01-31 23:26:29 +00:00
|
|
|
'images',
|
2016-12-15 03:33:47 +00:00
|
|
|
'main',
|
2017-01-31 23:26:29 +00:00
|
|
|
'network',
|
|
|
|
'networks',
|
|
|
|
'node',
|
2016-09-23 04:54:58 +00:00
|
|
|
'service',
|
|
|
|
'services',
|
2016-12-15 03:33:47 +00:00
|
|
|
'settings',
|
|
|
|
'sidebar',
|
2016-06-02 05:34:03 +00:00
|
|
|
'stats',
|
|
|
|
'swarm',
|
2016-09-23 04:54:58 +00:00
|
|
|
'task',
|
2016-08-23 06:09:14 +00:00
|
|
|
'templates',
|
2017-01-31 23:26:29 +00:00
|
|
|
'volumes'])
|
2017-02-13 22:39:26 +00:00
|
|
|
.config(['$stateProvider', '$urlRouterProvider', '$httpProvider', 'localStorageServiceProvider', 'jwtOptionsProvider', 'AnalyticsProvider', function ($stateProvider, $urlRouterProvider, $httpProvider, localStorageServiceProvider, jwtOptionsProvider, AnalyticsProvider) {
|
2016-06-02 05:34:03 +00:00
|
|
|
'use strict';
|
2016-04-01 04:54:12 +00:00
|
|
|
|
2016-12-15 03:33:47 +00:00
|
|
|
localStorageServiceProvider
|
|
|
|
.setStorageType('sessionStorage')
|
|
|
|
.setPrefix('portainer');
|
|
|
|
|
|
|
|
jwtOptionsProvider.config({
|
2017-01-22 23:14:34 +00:00
|
|
|
tokenGetter: ['LocalStorage', function(LocalStorage) {
|
|
|
|
return LocalStorage.getJWT();
|
2016-12-15 03:33:47 +00:00
|
|
|
}],
|
|
|
|
unauthenticatedRedirector: ['$state', function($state) {
|
|
|
|
$state.go('auth', {error: 'Your session has expired'});
|
|
|
|
}]
|
|
|
|
});
|
|
|
|
$httpProvider.interceptors.push('jwtInterceptor');
|
|
|
|
|
2017-02-13 22:39:26 +00:00
|
|
|
AnalyticsProvider.setAccount('@@CONFIG_GA_ID');
|
2017-02-13 23:37:37 +00:00
|
|
|
AnalyticsProvider.startOffline(true);
|
2017-02-13 22:39:26 +00:00
|
|
|
|
2016-12-15 03:33:47 +00:00
|
|
|
$urlRouterProvider.otherwise('/auth');
|
2016-03-19 23:50:11 +00:00
|
|
|
|
2016-06-08 06:34:26 +00:00
|
|
|
$stateProvider
|
2017-02-01 09:13:48 +00:00
|
|
|
.state('root', {
|
|
|
|
abstract: true,
|
|
|
|
resolve: {
|
|
|
|
requiresLogin: ['StateManager', function (StateManager) {
|
|
|
|
var applicationState = StateManager.getState();
|
|
|
|
return applicationState.application.authentication;
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
})
|
2016-12-15 03:33:47 +00:00
|
|
|
.state('auth', {
|
2017-02-01 09:13:48 +00:00
|
|
|
parent: 'root',
|
|
|
|
url: '/auth',
|
2016-12-15 03:33:47 +00:00
|
|
|
params: {
|
|
|
|
logout: false,
|
|
|
|
error: ''
|
|
|
|
},
|
|
|
|
views: {
|
2017-02-01 09:13:48 +00:00
|
|
|
"content@": {
|
2016-12-15 03:33:47 +00:00
|
|
|
templateUrl: 'app/components/auth/auth.html',
|
|
|
|
controller: 'AuthenticationController'
|
|
|
|
}
|
2017-02-01 09:13:48 +00:00
|
|
|
},
|
|
|
|
data: {
|
|
|
|
requiresLogin: false
|
2016-12-15 03:33:47 +00:00
|
|
|
}
|
2016-06-02 05:34:03 +00:00
|
|
|
})
|
|
|
|
.state('containers', {
|
2017-02-01 09:13:48 +00:00
|
|
|
parent: 'root',
|
2016-06-02 05:34:03 +00:00
|
|
|
url: '/containers/',
|
2016-12-15 03:33:47 +00:00
|
|
|
views: {
|
2017-02-01 09:13:48 +00:00
|
|
|
"content@": {
|
2016-12-15 03:33:47 +00:00
|
|
|
templateUrl: 'app/components/containers/containers.html',
|
|
|
|
controller: 'ContainersController'
|
|
|
|
},
|
2017-02-01 09:13:48 +00:00
|
|
|
"sidebar@": {
|
2016-12-15 03:33:47 +00:00
|
|
|
templateUrl: 'app/components/sidebar/sidebar.html',
|
|
|
|
controller: 'SidebarController'
|
|
|
|
}
|
|
|
|
}
|
2016-06-02 05:34:03 +00:00
|
|
|
})
|
|
|
|
.state('container', {
|
|
|
|
url: "^/containers/:id",
|
2016-12-15 03:33:47 +00:00
|
|
|
views: {
|
2017-02-01 09:13:48 +00:00
|
|
|
"content@": {
|
2016-12-15 03:33:47 +00:00
|
|
|
templateUrl: 'app/components/container/container.html',
|
|
|
|
controller: 'ContainerController'
|
|
|
|
},
|
2017-02-01 09:13:48 +00:00
|
|
|
"sidebar@": {
|
2016-12-15 03:33:47 +00:00
|
|
|
templateUrl: 'app/components/sidebar/sidebar.html',
|
|
|
|
controller: 'SidebarController'
|
|
|
|
}
|
|
|
|
}
|
2016-06-02 05:34:03 +00:00
|
|
|
})
|
|
|
|
.state('stats', {
|
|
|
|
url: "^/containers/:id/stats",
|
2016-12-15 03:33:47 +00:00
|
|
|
views: {
|
2017-02-01 09:13:48 +00:00
|
|
|
"content@": {
|
2016-12-15 03:33:47 +00:00
|
|
|
templateUrl: 'app/components/stats/stats.html',
|
|
|
|
controller: 'StatsController'
|
|
|
|
},
|
2017-02-01 09:13:48 +00:00
|
|
|
"sidebar@": {
|
2016-12-15 03:33:47 +00:00
|
|
|
templateUrl: 'app/components/sidebar/sidebar.html',
|
|
|
|
controller: 'SidebarController'
|
|
|
|
}
|
|
|
|
}
|
2016-06-02 05:34:03 +00:00
|
|
|
})
|
|
|
|
.state('logs', {
|
|
|
|
url: "^/containers/:id/logs",
|
2016-12-15 03:33:47 +00:00
|
|
|
views: {
|
2017-02-01 09:13:48 +00:00
|
|
|
"content@": {
|
2016-12-15 03:33:47 +00:00
|
|
|
templateUrl: 'app/components/containerLogs/containerlogs.html',
|
|
|
|
controller: 'ContainerLogsController'
|
|
|
|
},
|
2017-02-01 09:13:48 +00:00
|
|
|
"sidebar@": {
|
2016-12-15 03:33:47 +00:00
|
|
|
templateUrl: 'app/components/sidebar/sidebar.html',
|
|
|
|
controller: 'SidebarController'
|
|
|
|
}
|
|
|
|
}
|
2016-06-02 05:34:03 +00:00
|
|
|
})
|
2016-08-03 03:11:09 +00:00
|
|
|
.state('console', {
|
|
|
|
url: "^/containers/:id/console",
|
2016-12-15 03:33:47 +00:00
|
|
|
views: {
|
2017-02-01 09:13:48 +00:00
|
|
|
"content@": {
|
2016-12-15 03:33:47 +00:00
|
|
|
templateUrl: 'app/components/containerConsole/containerConsole.html',
|
|
|
|
controller: 'ContainerConsoleController'
|
|
|
|
},
|
2017-02-01 09:13:48 +00:00
|
|
|
"sidebar@": {
|
2016-12-15 03:33:47 +00:00
|
|
|
templateUrl: 'app/components/sidebar/sidebar.html',
|
|
|
|
controller: 'SidebarController'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.state('dashboard', {
|
2017-02-01 09:13:48 +00:00
|
|
|
parent: 'root',
|
2016-12-15 03:33:47 +00:00
|
|
|
url: '/dashboard',
|
|
|
|
views: {
|
2017-02-01 09:13:48 +00:00
|
|
|
"content@": {
|
2016-12-15 03:33:47 +00:00
|
|
|
templateUrl: 'app/components/dashboard/dashboard.html',
|
|
|
|
controller: 'DashboardController'
|
|
|
|
},
|
2017-02-01 09:13:48 +00:00
|
|
|
"sidebar@": {
|
2016-12-15 03:33:47 +00:00
|
|
|
templateUrl: 'app/components/sidebar/sidebar.html',
|
|
|
|
controller: 'SidebarController'
|
|
|
|
}
|
|
|
|
}
|
2016-08-03 03:11:09 +00:00
|
|
|
})
|
2016-07-06 00:19:09 +00:00
|
|
|
.state('actions', {
|
|
|
|
abstract: true,
|
|
|
|
url: "/actions",
|
2016-12-15 03:33:47 +00:00
|
|
|
views: {
|
2017-02-01 09:13:48 +00:00
|
|
|
"content@": {
|
|
|
|
template: '<div ui-view="content@"></div>'
|
2016-12-15 03:33:47 +00:00
|
|
|
},
|
2017-02-01 09:13:48 +00:00
|
|
|
"sidebar@": {
|
|
|
|
template: '<div ui-view="sidebar@"></div>'
|
2016-12-15 03:33:47 +00:00
|
|
|
}
|
|
|
|
}
|
2016-07-06 00:19:09 +00:00
|
|
|
})
|
|
|
|
.state('actions.create', {
|
|
|
|
abstract: true,
|
|
|
|
url: "/create",
|
2016-12-15 03:33:47 +00:00
|
|
|
views: {
|
2017-02-01 09:13:48 +00:00
|
|
|
"content@": {
|
|
|
|
template: '<div ui-view="content@"></div>'
|
2016-12-15 03:33:47 +00:00
|
|
|
},
|
2017-02-01 09:13:48 +00:00
|
|
|
"sidebar@": {
|
|
|
|
template: '<div ui-view="sidebar@"></div>'
|
2016-12-15 03:33:47 +00:00
|
|
|
}
|
|
|
|
}
|
2016-07-06 00:19:09 +00:00
|
|
|
})
|
|
|
|
.state('actions.create.container', {
|
|
|
|
url: "/container",
|
2016-12-15 03:33:47 +00:00
|
|
|
views: {
|
2017-02-01 09:13:48 +00:00
|
|
|
"content@": {
|
2016-12-15 03:33:47 +00:00
|
|
|
templateUrl: 'app/components/createContainer/createcontainer.html',
|
|
|
|
controller: 'CreateContainerController'
|
|
|
|
},
|
2017-02-01 09:13:48 +00:00
|
|
|
"sidebar@": {
|
2016-12-15 03:33:47 +00:00
|
|
|
templateUrl: 'app/components/sidebar/sidebar.html',
|
|
|
|
controller: 'SidebarController'
|
|
|
|
}
|
|
|
|
}
|
2016-07-06 00:19:09 +00:00
|
|
|
})
|
2016-07-06 03:38:34 +00:00
|
|
|
.state('actions.create.network', {
|
|
|
|
url: "/network",
|
2016-12-15 03:33:47 +00:00
|
|
|
views: {
|
2017-02-01 09:13:48 +00:00
|
|
|
"content@": {
|
2016-12-15 03:33:47 +00:00
|
|
|
templateUrl: 'app/components/createNetwork/createnetwork.html',
|
|
|
|
controller: 'CreateNetworkController'
|
|
|
|
},
|
2017-02-01 09:13:48 +00:00
|
|
|
"sidebar@": {
|
2016-12-15 03:33:47 +00:00
|
|
|
templateUrl: 'app/components/sidebar/sidebar.html',
|
|
|
|
controller: 'SidebarController'
|
|
|
|
}
|
|
|
|
}
|
2016-07-06 03:38:34 +00:00
|
|
|
})
|
2016-09-23 04:54:58 +00:00
|
|
|
.state('actions.create.service', {
|
|
|
|
url: "/service",
|
2016-12-15 03:33:47 +00:00
|
|
|
views: {
|
2017-02-01 09:13:48 +00:00
|
|
|
"content@": {
|
2016-12-15 03:33:47 +00:00
|
|
|
templateUrl: 'app/components/createService/createservice.html',
|
|
|
|
controller: 'CreateServiceController'
|
|
|
|
},
|
2017-02-01 09:13:48 +00:00
|
|
|
"sidebar@": {
|
2016-12-15 03:33:47 +00:00
|
|
|
templateUrl: 'app/components/sidebar/sidebar.html',
|
|
|
|
controller: 'SidebarController'
|
|
|
|
}
|
|
|
|
}
|
2016-09-23 04:54:58 +00:00
|
|
|
})
|
|
|
|
.state('actions.create.volume', {
|
|
|
|
url: "/volume",
|
2016-12-15 03:33:47 +00:00
|
|
|
views: {
|
2017-02-01 09:13:48 +00:00
|
|
|
"content@": {
|
2016-12-15 03:33:47 +00:00
|
|
|
templateUrl: 'app/components/createVolume/createvolume.html',
|
|
|
|
controller: 'CreateVolumeController'
|
|
|
|
},
|
2017-02-01 09:13:48 +00:00
|
|
|
"sidebar@": {
|
2016-12-15 03:33:47 +00:00
|
|
|
templateUrl: 'app/components/sidebar/sidebar.html',
|
|
|
|
controller: 'SidebarController'
|
|
|
|
}
|
|
|
|
}
|
2016-09-23 04:54:58 +00:00
|
|
|
})
|
2016-06-16 05:27:07 +00:00
|
|
|
.state('docker', {
|
|
|
|
url: '/docker/',
|
2016-12-15 03:33:47 +00:00
|
|
|
views: {
|
2017-02-01 09:13:48 +00:00
|
|
|
"content@": {
|
2016-12-15 03:33:47 +00:00
|
|
|
templateUrl: 'app/components/docker/docker.html',
|
|
|
|
controller: 'DockerController'
|
|
|
|
},
|
2017-02-01 09:13:48 +00:00
|
|
|
"sidebar@": {
|
2016-12-15 03:33:47 +00:00
|
|
|
templateUrl: 'app/components/sidebar/sidebar.html',
|
|
|
|
controller: 'SidebarController'
|
|
|
|
}
|
|
|
|
}
|
2016-06-16 05:27:07 +00:00
|
|
|
})
|
2016-12-25 20:34:02 +00:00
|
|
|
.state('endpoints', {
|
|
|
|
url: '/endpoints/',
|
|
|
|
views: {
|
2017-02-01 09:13:48 +00:00
|
|
|
"content@": {
|
2016-12-25 20:34:02 +00:00
|
|
|
templateUrl: 'app/components/endpoints/endpoints.html',
|
|
|
|
controller: 'EndpointsController'
|
|
|
|
},
|
2017-02-01 09:13:48 +00:00
|
|
|
"sidebar@": {
|
2016-12-25 20:34:02 +00:00
|
|
|
templateUrl: 'app/components/sidebar/sidebar.html',
|
|
|
|
controller: 'SidebarController'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.state('endpoint', {
|
|
|
|
url: '^/endpoints/:id',
|
|
|
|
views: {
|
2017-02-01 09:13:48 +00:00
|
|
|
"content@": {
|
2016-12-25 20:34:02 +00:00
|
|
|
templateUrl: 'app/components/endpoint/endpoint.html',
|
|
|
|
controller: 'EndpointController'
|
|
|
|
},
|
2017-02-01 09:13:48 +00:00
|
|
|
"sidebar@": {
|
2016-12-25 20:34:02 +00:00
|
|
|
templateUrl: 'app/components/sidebar/sidebar.html',
|
|
|
|
controller: 'SidebarController'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.state('endpointInit', {
|
|
|
|
url: '/init/endpoint',
|
|
|
|
views: {
|
2017-02-01 09:13:48 +00:00
|
|
|
"content@": {
|
2016-12-25 20:34:02 +00:00
|
|
|
templateUrl: 'app/components/endpointInit/endpointInit.html',
|
|
|
|
controller: 'EndpointInitController'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
2016-07-26 23:08:18 +00:00
|
|
|
.state('events', {
|
|
|
|
url: '/events/',
|
2016-12-15 03:33:47 +00:00
|
|
|
views: {
|
2017-02-01 09:13:48 +00:00
|
|
|
"content@": {
|
2016-12-15 03:33:47 +00:00
|
|
|
templateUrl: 'app/components/events/events.html',
|
|
|
|
controller: 'EventsController'
|
|
|
|
},
|
2017-02-01 09:13:48 +00:00
|
|
|
"sidebar@": {
|
2016-12-15 03:33:47 +00:00
|
|
|
templateUrl: 'app/components/sidebar/sidebar.html',
|
|
|
|
controller: 'SidebarController'
|
|
|
|
}
|
|
|
|
}
|
2016-07-26 23:08:18 +00:00
|
|
|
})
|
2016-06-02 05:34:03 +00:00
|
|
|
.state('images', {
|
|
|
|
url: '/images/',
|
2016-12-15 03:33:47 +00:00
|
|
|
views: {
|
2017-02-01 09:13:48 +00:00
|
|
|
"content@": {
|
2016-12-15 03:33:47 +00:00
|
|
|
templateUrl: 'app/components/images/images.html',
|
|
|
|
controller: 'ImagesController'
|
|
|
|
},
|
2017-02-01 09:13:48 +00:00
|
|
|
"sidebar@": {
|
2016-12-15 03:33:47 +00:00
|
|
|
templateUrl: 'app/components/sidebar/sidebar.html',
|
|
|
|
controller: 'SidebarController'
|
|
|
|
}
|
|
|
|
}
|
2016-06-02 05:34:03 +00:00
|
|
|
})
|
|
|
|
.state('image', {
|
|
|
|
url: '^/images/:id/',
|
2016-12-15 03:33:47 +00:00
|
|
|
views: {
|
2017-02-01 09:13:48 +00:00
|
|
|
"content@": {
|
2016-12-15 03:33:47 +00:00
|
|
|
templateUrl: 'app/components/image/image.html',
|
|
|
|
controller: 'ImageController'
|
|
|
|
},
|
2017-02-01 09:13:48 +00:00
|
|
|
"sidebar@": {
|
2016-12-15 03:33:47 +00:00
|
|
|
templateUrl: 'app/components/sidebar/sidebar.html',
|
|
|
|
controller: 'SidebarController'
|
|
|
|
}
|
|
|
|
}
|
2016-06-02 05:34:03 +00:00
|
|
|
})
|
|
|
|
.state('networks', {
|
|
|
|
url: '/networks/',
|
2016-12-15 03:33:47 +00:00
|
|
|
views: {
|
2017-02-01 09:13:48 +00:00
|
|
|
"content@": {
|
2016-12-15 03:33:47 +00:00
|
|
|
templateUrl: 'app/components/networks/networks.html',
|
|
|
|
controller: 'NetworksController'
|
|
|
|
},
|
2017-02-01 09:13:48 +00:00
|
|
|
"sidebar@": {
|
2016-12-15 03:33:47 +00:00
|
|
|
templateUrl: 'app/components/sidebar/sidebar.html',
|
|
|
|
controller: 'SidebarController'
|
|
|
|
}
|
|
|
|
}
|
2016-06-02 05:34:03 +00:00
|
|
|
})
|
|
|
|
.state('network', {
|
|
|
|
url: '^/networks/:id/',
|
2016-12-15 03:33:47 +00:00
|
|
|
views: {
|
2017-02-01 09:13:48 +00:00
|
|
|
"content@": {
|
2016-12-15 03:33:47 +00:00
|
|
|
templateUrl: 'app/components/network/network.html',
|
|
|
|
controller: 'NetworkController'
|
|
|
|
},
|
2017-02-01 09:13:48 +00:00
|
|
|
"sidebar@": {
|
2016-12-15 03:33:47 +00:00
|
|
|
templateUrl: 'app/components/sidebar/sidebar.html',
|
|
|
|
controller: 'SidebarController'
|
|
|
|
}
|
|
|
|
}
|
2016-06-02 05:34:03 +00:00
|
|
|
})
|
2017-01-25 21:12:04 +00:00
|
|
|
.state('node', {
|
|
|
|
url: '^/nodes/:id/',
|
|
|
|
views: {
|
2017-02-01 09:13:48 +00:00
|
|
|
"content@": {
|
2017-01-25 21:12:04 +00:00
|
|
|
templateUrl: 'app/components/node/node.html',
|
|
|
|
controller: 'NodeController'
|
|
|
|
},
|
2017-02-01 09:13:48 +00:00
|
|
|
"sidebar@": {
|
2017-01-25 21:12:04 +00:00
|
|
|
templateUrl: 'app/components/sidebar/sidebar.html',
|
|
|
|
controller: 'SidebarController'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
2016-09-23 04:54:58 +00:00
|
|
|
.state('services', {
|
|
|
|
url: '/services/',
|
2016-12-15 03:33:47 +00:00
|
|
|
views: {
|
2017-02-01 09:13:48 +00:00
|
|
|
"content@": {
|
2016-12-15 03:33:47 +00:00
|
|
|
templateUrl: 'app/components/services/services.html',
|
|
|
|
controller: 'ServicesController'
|
|
|
|
},
|
2017-02-01 09:13:48 +00:00
|
|
|
"sidebar@": {
|
2016-12-15 03:33:47 +00:00
|
|
|
templateUrl: 'app/components/sidebar/sidebar.html',
|
|
|
|
controller: 'SidebarController'
|
|
|
|
}
|
|
|
|
}
|
2016-09-23 04:54:58 +00:00
|
|
|
})
|
|
|
|
.state('service', {
|
|
|
|
url: '^/service/:id/',
|
2016-12-15 03:33:47 +00:00
|
|
|
views: {
|
2017-02-01 09:13:48 +00:00
|
|
|
"content@": {
|
2016-12-15 03:33:47 +00:00
|
|
|
templateUrl: 'app/components/service/service.html',
|
|
|
|
controller: 'ServiceController'
|
|
|
|
},
|
2017-02-01 09:13:48 +00:00
|
|
|
"sidebar@": {
|
2016-12-15 03:33:47 +00:00
|
|
|
templateUrl: 'app/components/sidebar/sidebar.html',
|
|
|
|
controller: 'SidebarController'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.state('settings', {
|
|
|
|
url: '/settings/',
|
|
|
|
views: {
|
2017-02-01 09:13:48 +00:00
|
|
|
"content@": {
|
2016-12-15 03:33:47 +00:00
|
|
|
templateUrl: 'app/components/settings/settings.html',
|
|
|
|
controller: 'SettingsController'
|
|
|
|
},
|
2017-02-01 09:13:48 +00:00
|
|
|
"sidebar@": {
|
2016-12-15 03:33:47 +00:00
|
|
|
templateUrl: 'app/components/sidebar/sidebar.html',
|
|
|
|
controller: 'SidebarController'
|
|
|
|
}
|
|
|
|
}
|
2016-09-23 04:54:58 +00:00
|
|
|
})
|
|
|
|
.state('task', {
|
|
|
|
url: '^/task/:id',
|
2016-12-15 03:33:47 +00:00
|
|
|
views: {
|
2017-02-01 09:13:48 +00:00
|
|
|
"content@": {
|
2016-12-15 03:33:47 +00:00
|
|
|
templateUrl: 'app/components/task/task.html',
|
|
|
|
controller: 'TaskController'
|
|
|
|
},
|
2017-02-01 09:13:48 +00:00
|
|
|
"sidebar@": {
|
2016-12-15 03:33:47 +00:00
|
|
|
templateUrl: 'app/components/sidebar/sidebar.html',
|
|
|
|
controller: 'SidebarController'
|
|
|
|
}
|
|
|
|
}
|
2016-09-23 04:54:58 +00:00
|
|
|
})
|
2016-08-23 06:09:14 +00:00
|
|
|
.state('templates', {
|
|
|
|
url: '/templates/',
|
2016-12-15 03:33:47 +00:00
|
|
|
views: {
|
2017-02-01 09:13:48 +00:00
|
|
|
"content@": {
|
2016-12-15 03:33:47 +00:00
|
|
|
templateUrl: 'app/components/templates/templates.html',
|
|
|
|
controller: 'TemplatesController'
|
|
|
|
},
|
2017-02-01 09:13:48 +00:00
|
|
|
"sidebar@": {
|
2016-12-15 03:33:47 +00:00
|
|
|
templateUrl: 'app/components/sidebar/sidebar.html',
|
|
|
|
controller: 'SidebarController'
|
|
|
|
}
|
|
|
|
}
|
2016-08-23 06:09:14 +00:00
|
|
|
})
|
2016-06-02 05:34:03 +00:00
|
|
|
.state('volumes', {
|
|
|
|
url: '/volumes/',
|
2016-12-15 03:33:47 +00:00
|
|
|
views: {
|
2017-02-01 09:13:48 +00:00
|
|
|
"content@": {
|
2016-12-15 03:33:47 +00:00
|
|
|
templateUrl: 'app/components/volumes/volumes.html',
|
|
|
|
controller: 'VolumesController'
|
|
|
|
},
|
2017-02-01 09:13:48 +00:00
|
|
|
"sidebar@": {
|
2016-12-15 03:33:47 +00:00
|
|
|
templateUrl: 'app/components/sidebar/sidebar.html',
|
|
|
|
controller: 'SidebarController'
|
|
|
|
}
|
|
|
|
}
|
2016-06-02 05:34:03 +00:00
|
|
|
})
|
|
|
|
.state('swarm', {
|
|
|
|
url: '/swarm/',
|
2016-12-15 03:33:47 +00:00
|
|
|
views: {
|
2017-02-01 09:13:48 +00:00
|
|
|
"content@": {
|
2016-12-15 03:33:47 +00:00
|
|
|
templateUrl: 'app/components/swarm/swarm.html',
|
|
|
|
controller: 'SwarmController'
|
|
|
|
},
|
2017-02-01 09:13:48 +00:00
|
|
|
"sidebar@": {
|
2016-12-15 03:33:47 +00:00
|
|
|
templateUrl: 'app/components/sidebar/sidebar.html',
|
|
|
|
controller: 'SidebarController'
|
|
|
|
}
|
|
|
|
}
|
2016-06-02 05:34:03 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
// The Docker API likes to return plaintext errors, this catches them and disp
|
|
|
|
$httpProvider.interceptors.push(function() {
|
|
|
|
return {
|
|
|
|
'response': function(response) {
|
2016-06-08 06:34:26 +00:00
|
|
|
if (typeof(response.data) === 'string' &&
|
2016-12-15 03:33:47 +00:00
|
|
|
(response.data.startsWith('Conflict.') || response.data.startsWith('conflict:'))) {
|
2016-06-02 05:34:03 +00:00
|
|
|
$.gritter.add({
|
|
|
|
title: 'Error',
|
|
|
|
text: $('<div>').text(response.data).html(),
|
|
|
|
time: 10000
|
|
|
|
});
|
|
|
|
}
|
|
|
|
return response;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
});
|
|
|
|
}])
|
2017-02-13 22:39:26 +00:00
|
|
|
.run(['$rootScope', '$state', 'Authentication', 'authManager', 'StateManager', 'Messages', 'Analytics', function ($rootScope, $state, Authentication, authManager, StateManager, Messages, Analytics) {
|
2017-02-01 09:13:48 +00:00
|
|
|
StateManager.initialize().then(function success(state) {
|
|
|
|
if (state.application.authentication) {
|
|
|
|
authManager.checkAuthOnRefresh();
|
|
|
|
authManager.redirectWhenUnauthenticated();
|
|
|
|
Authentication.init();
|
|
|
|
$rootScope.$on('tokenHasExpired', function($state) {
|
|
|
|
$state.go('auth', {error: 'Your session has expired'});
|
|
|
|
});
|
|
|
|
}
|
2017-02-13 23:37:37 +00:00
|
|
|
if (state.application.analytics) {
|
|
|
|
Analytics.offline(false);
|
|
|
|
Analytics.registerScriptTags();
|
|
|
|
Analytics.registerTrackers();
|
|
|
|
$rootScope.$on('$stateChangeSuccess', function (event, toState, toParams, fromState, fromParams) {
|
|
|
|
Analytics.trackPage(toState.url);
|
|
|
|
Analytics.pageView();
|
|
|
|
});
|
|
|
|
}
|
2017-02-01 09:13:48 +00:00
|
|
|
}, function error(err) {
|
|
|
|
Messages.error("Failure", err, 'Unable to retrieve application settings');
|
|
|
|
});
|
2017-01-22 23:14:34 +00:00
|
|
|
|
2016-12-15 03:33:47 +00:00
|
|
|
$rootScope.$state = $state;
|
|
|
|
}])
|
2016-06-02 05:34:03 +00:00
|
|
|
// 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
|
2016-12-15 03:33:47 +00:00
|
|
|
.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
|
2016-12-30 21:30:22 +00:00
|
|
|
.constant('DOCKER_ENDPOINT', 'api/docker')
|
|
|
|
.constant('CONFIG_ENDPOINT', 'api/settings')
|
|
|
|
.constant('AUTH_ENDPOINT', 'api/auth')
|
|
|
|
.constant('USERS_ENDPOINT', 'api/users')
|
|
|
|
.constant('ENDPOINTS_ENDPOINT', 'api/endpoints')
|
|
|
|
.constant('TEMPLATES_ENDPOINT', 'api/templates')
|
2016-11-17 12:50:46 +00:00
|
|
|
.constant('PAGINATION_MAX_ITEMS', 10)
|
2017-03-03 11:36:24 +00:00
|
|
|
.constant('UI_VERSION', 'v1.11.4');
|