@ -37,6 +37,13 @@ function DashboardController($scope, Container) {
}
}
function StatusBarController ( $scope , Settings ) {
$scope . template = 'partials/statusbar.html' ;
$scope . uiVersion = Settings . uiVersion ;
$scope . apiVersion = Settings . version ;
}
function SideBarController ( $scope , Container , Settings ) {
function SideBarController ( $scope , Container , Settings ) {
$scope . template = 'partials/sidebar.html' ;
$scope . template = 'partials/sidebar.html' ;
$scope . containers = [ ] ;
$scope . containers = [ ] ;
@ -65,7 +72,7 @@ function SettingsController($scope, Auth, System, Docker, Settings) {
Auth . update (
Auth . update (
{ username : $scope . auth . username , email : $scope . auth . email , password : $scope . auth . password } , function ( d ) {
{ username : $scope . auth . username , email : $scope . auth . email , password : $scope . auth . password } , function ( d ) {
console . log ( d ) ;
console . log ( d ) ;
setSuccessfulResponse ( $scope , 'Aut o information updated.', '#response' ) ;
setSuccessfulResponse ( $scope , 'Aut h information updated.', '#response' ) ;
} , function ( e ) {
} , function ( e ) {
console . log ( e ) ;
console . log ( e ) ;
setFailedResponse ( $scope , e . data , '#response' ) ;
setFailedResponse ( $scope , e . data , '#response' ) ;
@ -133,6 +140,10 @@ function ContainerController($scope, $routeParams, $location, Container) {
$scope . changes = [ ] ;
$scope . changes = [ ] ;
$scope . hasContent = function ( data ) {
return data !== null && data !== undefined && data . length > 1 ;
} ;
$scope . getChanges = function ( ) {
$scope . getChanges = function ( ) {
Container . changes ( { id : $routeParams . id } , function ( d ) {
Container . changes ( { id : $routeParams . id } , function ( d ) {
$scope . changes = d ;
$scope . changes = d ;
@ -143,7 +154,10 @@ function ContainerController($scope, $routeParams, $location, Container) {
$scope . container = d ;
$scope . container = d ;
} , function ( e ) {
} , function ( e ) {
console . log ( e ) ;
console . log ( e ) ;
$location . path ( '/containers/' ) ;
setFailedResponse ( $scope , e . data , '#response' ) ;
if ( e . status === 404 ) {
$ ( '.detail' ) . hide ( ) ;
}
} ) ;
} ) ;
$scope . getChanges ( ) ;
$scope . getChanges ( ) ;
@ -175,9 +189,14 @@ function ContainersController($scope, Container, Settings) {
function ImagesController ( $scope , Image ) {
function ImagesController ( $scope , Image ) {
$scope . predicate = '-Created' ;
$scope . predicate = '-Created' ;
$ ( '#response' ) . hide ( ) ;
$scope . alertClass = 'block' ;
Image . query ( { } , function ( d ) {
Image . query ( { } , function ( d ) {
$scope . images = d ;
$scope . images = d ;
} , function ( e ) {
console . log ( e ) ;
setFailedResponse ( $scope , e . data , '#response' ) ;
} ) ;
} ) ;
}
}
@ -221,7 +240,10 @@ function ImageController($scope, $routeParams, $location, Image) {
$scope . image = d ;
$scope . image = d ;
} , function ( e ) {
} , function ( e ) {
console . log ( e ) ;
console . log ( e ) ;
$location . path ( '/images/' ) ;
setFailedResponse ( $scope , e . data , '#response' ) ;
if ( e . status === 404 ) {
$ ( '.detail' ) . hide ( ) ;
}
} ) ;
} ) ;
$scope . getHistory ( ) ;
$scope . getHistory ( ) ;
@ -229,17 +251,21 @@ function ImageController($scope, $routeParams, $location, Image) {
function StartContainerController ( $scope , $routeParams , $location , Container ) {
function StartContainerController ( $scope , $routeParams , $location , Container ) {
$scope . template = 'partials/startcontainer.html' ;
$scope . template = 'partials/startcontainer.html' ;
$scope . memory = 0 ;
$scope . config = {
$scope . memorySwap = 0 ;
memory : 0 ,
$scope . env = '' ;
memorySwap : 0 ,
$scope . dns = '' ;
env : '' ,
$scope . volumesFrom = '' ;
commands : '' ,
$scope . commands = '' ;
volumesFrom : ''
} ;
$scope . commandPlaceholder = '["/bin/echo", "Hello world"]' ;
$scope . launchContainer = function ( ) {
$scope . launchContainer = function ( ) {
$scope . response = '' ;
var cmds = null ;
var cmds = null ;
if ( $scope . commands !== '' ) {
if ( $scope . co nfig. co mmands !== '' ) {
cmds = $scope. commands . split ( '\n' ) ;
cmds = angular. fromJson ( $scope . config . commands ) ;
}
}
var id = $routeParams . id ;
var id = $routeParams . id ;
var ctor = Container ;
var ctor = Container ;
@ -248,10 +274,10 @@ function StartContainerController($scope, $routeParams, $location, Container) {
Container . create ( {
Container . create ( {
Image : id ,
Image : id ,
Memory : $scope . memory,
Memory : $scope . config. memory,
MemorySwap : $scope . memorySwap,
MemorySwap : $scope . config. memorySwap,
Cmd : cmds ,
Cmd : cmds ,
VolumesFrom : $scope . volumesFrom
VolumesFrom : $scope . config. volumesFrom
} , function ( d ) {
} , function ( d ) {
console . log ( d ) ;
console . log ( d ) ;
if ( d . Id ) {
if ( d . Id ) {