harbor/static/resources/js/layout/index/index.controller.js

106 lines
3.3 KiB
JavaScript
Raw Normal View History

/*
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-05-01 19:46:50 +02:00
(function() {
'use strict';
angular
.module('harbor.layout.index')
.controller('IndexController', IndexController);
2016-07-02 12:20:31 +02:00
IndexController.$inject = ['$scope', '$filter', 'trFilter', '$timeout'];
2016-07-02 12:20:31 +02:00
function IndexController($scope, $filter, trFilter, $timeout) {
2016-06-25 21:12:17 +02:00
$scope.subsHeight = 110;
$scope.subsSection = 32;
$scope.subsSubPane = 226;
2016-06-25 21:12:17 +02:00
var vm = this;
vm.customBodyHeight = {'height': '180px'};
vm.viewAll = viewAll;
function viewAll() {
var indexDesc = $filter('tr')('index_desc', []);
var indexDesc1 = $filter('tr')('index_desc_1', []);
var indexDesc2 = $filter('tr')('index_desc_2', []);
var indexDesc3 = $filter('tr')('index_desc_3', []);
var indexDesc4 = $filter('tr')('index_desc_4', []);
var indexDesc5 = $filter('tr')('index_desc_5', []);
2016-07-06 10:39:40 +02:00
var indexDesc6 = $filter('tr')('index_desc_6', []);
2016-07-02 12:20:31 +02:00
$scope.$emit('modalTitle', $filter('tr')('harbor_intro_title'));
$scope.$emit('modalMessage', '<p class="page-content text-justify">'+
indexDesc +
'</p>' +
'<ul>' +
2016-07-06 19:12:20 +02:00
'<li class="long-line">▪︎ ' + indexDesc1 + '</li>' +
'<li class="long-line">▪︎ ' + indexDesc2 + '</li>' +
'<li class="long-line">▪︎ ' + indexDesc3 + '</li>' +
'<li class="long-line">▪︎ ' + indexDesc4 + '</li>' +
'<li class="long-line">▪︎ ' + indexDesc5 + '</li>' +
'<li class="long-line">▪︎ ' + indexDesc6 + '</li>' +
2016-07-02 12:20:31 +02:00
'</ul>');
var emitInfo = {
'contentType': 'text/html',
'confirmOnly': true,
'action': function() {
$scope.$broadcast('showDialog', false);
}
};
$scope.$emit('raiseInfo', emitInfo);
}
2016-05-01 19:46:50 +02:00
2016-07-02 12:20:31 +02:00
//Message dialog handler for index.
$scope.$on('modalTitle', function(e, val) {
vm.modalTitle = val;
});
$scope.$on('modalMessage', function(e, val) {
vm.modalMessage = val;
});
$scope.$on('raiseError', function(e, val) {
if(val) {
vm.action = function() {
$scope.$broadcast('showDialog', false);
};
vm.contentType = 'text/plain';
2016-07-02 12:20:31 +02:00
vm.confirmOnly = true;
$timeout(function() {
$scope.$broadcast('showDialog', true);
}, 350);
}
});
2016-07-02 12:20:31 +02:00
$scope.$on('raiseInfo', function(e, val) {
if(val) {
vm.action = function() {
val.action();
$scope.$broadcast('showDialog', false);
2016-07-11 12:38:51 +02:00
};
2016-07-02 12:20:31 +02:00
vm.contentType = val.contentType;
vm.confirmOnly = val.confirmOnly;
$scope.$broadcast('showDialog', true);
}
});
}
2016-07-11 12:38:51 +02:00
})();