From 9015d0d86d23a83e578ded1bd95485d467515208 Mon Sep 17 00:00:00 2001 From: "Christopher Lott (cl778h)" Date: Thu, 17 Aug 2017 14:52:44 -0400 Subject: Publish seed code for the OOM Dashboard First open-source release of the ONAP Operations Manager Dashboard web application. Issue: CCSDK-61 Change-Id: I902f789692d76ee583aa967682e39f03b6578fe9 Signed-off-by: Christopher Lott (cl778h) --- .../webapp/app/ecdapp/home/tree-view-directive.js | 186 +++++++++++++++++++++ 1 file changed, 186 insertions(+) create mode 100644 ecd-app-overlay/src/main/webapp/app/ecdapp/home/tree-view-directive.js (limited to 'ecd-app-overlay/src/main/webapp/app/ecdapp/home/tree-view-directive.js') diff --git a/ecd-app-overlay/src/main/webapp/app/ecdapp/home/tree-view-directive.js b/ecd-app-overlay/src/main/webapp/app/ecdapp/home/tree-view-directive.js new file mode 100644 index 0000000..64b41ec --- /dev/null +++ b/ecd-app-overlay/src/main/webapp/app/ecdapp/home/tree-view-directive.js @@ -0,0 +1,186 @@ +/******************************************************************************* + * =============LICENSE_START========================================================= + * + * ================================================================================= + * Copyright (c) 2017 AT&T Intellectual Property. 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. + * ============LICENSE_END========================================================= + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + *******************************************************************************/ +(function() { + 'use strict'; + + appDS2.directive("orgChart", supervisorOrgChart); + supervisorOrgChart.$inject = ['$http', '$templateCache', 'ExecutionService']; + + function supervisorOrgChart($http, $templateCache, ExecutionService) { + return { + restrict: 'E', + scope: { + data: '=', + getCall: '&', + modalCall: '&', + status: '=' + }, + + link: function(scope, elem, attrs) { + + scope.$on('listenEvent', function(event, data) { + data = data.data; + scope.data = data; + $('.jOrgChart').remove(); + drawOrgChart(data); + }); + + + var items = [], + mCheck = []; + var currentZoom = 100; + var data = scope.data; + var selectedStatus = scope.status; + function statusSelectoin(status){ + $('#statusclick li').removeClass('active'); + scope.getCall()(status); + } + + function drawOrgChart(data, supervisorOrg) { + items = []; + var itemHtml = ""; + for(var i=0; i" + + "
" + + ""+ + ""+ + ""+ + "" + root.blueprint_id + ""+ + ""+ + "

"+ + "
"+ + "
'); + var listElem = $("
    ", { + "class": "org", + "style": "float:right;", + html: items.join("") + }).appendTo(elem); + + var opts = { + chartElement: elem, + rowcolor: false + }; + //elem.html(''); + $(elem).find(".org").jOrgChart(opts); + listElem.remove(); + + setTimeout(function(){ + $('.dropdown .dropdown-toggle').on("click", function(e){ + var cls = '.'+ e.target.id; + var subcls = cls + ' a.test'; + if($(cls).hasClass('open')){ + $(cls).removeClass('open'); + $(subcls).next('ul').css({display: 'none'}); + } else{ + $(cls).addClass('open'); + } + }); + + $('.dropdown-submenu a.test').on("mouseover", function(e){ + console.log("hi"); + $('#'+e.target.id).next('ul').toggle(); + }); + + $('#statusclick li').click(function(event){ + statusSelectoin(event.target.id); + }) + + $('.openmodal').click(function(event){ + openModal(); + }) + + $(document).on('click','.expandBtn', function(event, data) { + event.stopImmediatePropagation() + var $this = $(this); + var $tr = $this.closest("tr"); + if ($tr.hasClass('contracted')) { + $(this).addClass('fa-minus').removeClass('fa-plus'); + $tr.removeClass('contracted').addClass('expanded'); + $tr.nextAll("tr").css('visibility', ''); + } else { + $(this).addClass('fa-plus').removeClass('fa-minus'); + $tr.removeClass('expanded').addClass('contracted'); + $tr.nextAll("tr").css('visibility', 'hidden'); + } + }); + + var selectedStatus = scope.status; + if(selectedStatus){ + $('#'+selectedStatus).addClass('active'); + } + + function openModal(){ + scope.modalCall()(); + } + + },0); + } + + drawOrgChart(data); + + }, + }; + }; +})(); \ No newline at end of file -- cgit 1.2.3-korg