mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-02 15:14:09 +01:00
50 lines
1.0 KiB
JavaScript
50 lines
1.0 KiB
JavaScript
(function() {
|
|
|
|
'use strict';
|
|
|
|
angular
|
|
.module('harbor.details')
|
|
.directive('switchPaneProjects', switchPaneProjects);
|
|
|
|
SwitchPaneProjectsController.$inject = ['$scope'];
|
|
|
|
function SwitchPaneProjectsController($scope) {
|
|
var vm = this;
|
|
|
|
$scope.$watch('vm.selectedProject', function(current, origin) {
|
|
if(current){
|
|
vm.projectName = current.name;
|
|
vm.selectedProject = current;
|
|
}
|
|
});
|
|
|
|
vm.switchPane = switchPane;
|
|
|
|
function switchPane() {
|
|
if(vm.isOpen) {
|
|
vm.isOpen = false;
|
|
}else{
|
|
vm.isOpen = true;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
function switchPaneProjects() {
|
|
var directive = {
|
|
restrict: 'E',
|
|
templateUrl: '/static/resources/js/components/details/switch-pane-projects.directive.html',
|
|
scope: {
|
|
'isOpen': '=',
|
|
'selectedProject': '='
|
|
},
|
|
controller: SwitchPaneProjectsController,
|
|
controllerAs: 'vm',
|
|
bindToController: true
|
|
};
|
|
|
|
return directive;
|
|
|
|
}
|
|
|
|
})(); |