2016-07-07 18:03:32 +02:00
|
|
|
/*
|
|
|
|
Copyright (c) 2016 VMware, Inc. All Rights Reserved.
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
2016-04-17 17:53:26 +02:00
|
|
|
(function() {
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
angular
|
|
|
|
.module('harbor.details')
|
|
|
|
.directive('switchPaneProjects', switchPaneProjects);
|
|
|
|
|
2016-04-27 12:29:55 +02:00
|
|
|
SwitchPaneProjectsController.$inject = ['$scope'];
|
2016-04-19 19:20:07 +02:00
|
|
|
|
2016-04-27 12:29:55 +02:00
|
|
|
function SwitchPaneProjectsController($scope) {
|
2016-04-17 17:53:26 +02:00
|
|
|
var vm = this;
|
2016-05-19 12:54:30 +02:00
|
|
|
|
2016-05-01 19:46:50 +02:00
|
|
|
$scope.$watch('vm.selectedProject', function(current, origin) {
|
|
|
|
if(current){
|
2016-06-14 08:54:00 +02:00
|
|
|
vm.projectName = current.name;
|
2016-05-01 19:46:50 +02:00
|
|
|
vm.selectedProject = current;
|
|
|
|
}
|
|
|
|
});
|
2016-04-27 12:29:55 +02:00
|
|
|
|
2016-04-17 17:53:26 +02:00
|
|
|
vm.switchPane = switchPane;
|
|
|
|
|
|
|
|
function switchPane() {
|
2016-04-19 19:20:07 +02:00
|
|
|
if(vm.isOpen) {
|
|
|
|
vm.isOpen = false;
|
2016-04-17 17:53:26 +02:00
|
|
|
}else{
|
2016-04-19 19:20:07 +02:00
|
|
|
vm.isOpen = true;
|
2016-04-17 17:53:26 +02:00
|
|
|
}
|
|
|
|
}
|
2016-04-28 19:36:39 +02:00
|
|
|
|
2016-04-17 17:53:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function switchPaneProjects() {
|
|
|
|
var directive = {
|
|
|
|
restrict: 'E',
|
2016-06-16 08:10:35 +02:00
|
|
|
templateUrl: '/static/resources/js/components/details/switch-pane-projects.directive.html',
|
2016-04-17 17:53:26 +02:00
|
|
|
scope: {
|
2016-05-19 12:54:30 +02:00
|
|
|
'isOpen': '=',
|
|
|
|
'selectedProject': '='
|
2016-04-17 17:53:26 +02:00
|
|
|
},
|
|
|
|
controller: SwitchPaneProjectsController,
|
|
|
|
controllerAs: 'vm',
|
|
|
|
bindToController: true
|
2016-05-23 12:29:17 +02:00
|
|
|
};
|
2016-04-17 17:53:26 +02:00
|
|
|
|
|
|
|
return directive;
|
2016-05-19 12:54:30 +02:00
|
|
|
|
2016-04-17 17:53:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
})();
|