1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0//EN">
3 ============LICENSE_START=======================================================
5 ================================================================================
6 Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
7 ================================================================================
8 Licensed under the Apache License, Version 2.0 (the "License");
9 you may not use this file except in compliance with the License.
10 You may obtain a copy of the License at
12 http://www.apache.org/licenses/LICENSE-2.0
14 Unless required by applicable law or agreed to in writing, software
15 distributed under the License is distributed on an "AS IS" BASIS,
16 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 See the License for the specific language governing permissions and
18 limitations under the License.
19 ============LICENSE_END=========================================================
22 <meta http-equiv="X-UA-Compatible" content="IE=Edge;chrome=1"/>
23 <head><title>Acumos-ONAP Adapter Demo</title>
26 background-size: cover;
29 background-color: white;
34 list-style-type: none;
40 background-color: black;
46 text-transform: uppercase;
49 text-decoration: none;
54 background-color: green;
64 background-color: black;
72 #onboardingInProgress {
80 border: 3px solid #f1f1f1;
86 background-color: white;
88 .form-container input[type=text], .form-container input[type=password] {
101 <li><a onclick="openImportPopup()">Import ...</a></li>
104 <li class="auxNav"><a>Signout</a></li>
107 <form class="form-popup form-container" id="importPopup">
108 <h2 align="center">Import Model</h2>
109 <select id="importType" onchange="setImportType()">
110 <option value="-" selected="true">-- Choose Import Type --</option>
111 <option value="itAcumos" >Acumos</option>
115 <label for="furl"><b>Acumos Federation URL</b></label> <input id="furl" type="text" name="furl" placeholder="https://server:9084" required>
116 <button type="button" onclick="lookupCatalogs()">Lookup</button>
120 <label for="catMenu"><b>Select Catalog</b></label> <select id="catMenu" onchange="chooseCatalog()">
121 <option value="*">All Catalogs</option>
126 <label for="solMenu"><b>Select Solution</b></label> <select id="solMenu" onchange="chooseSolution()">
127 <option value="*">All Solutions</option>
132 <label for="revMenu"><b>Select Revision</b></label> <select id="revMenu">
133 <option value="*">All Revisions</option>
137 <button type="button" onclick="closeImportPopup()">Cancel</button>
138 <button id="onboard" type="button" onclick="onBoard()">Onboard</button>
139 <b id="onboardingInProgress">Onboarding - Please Wait ...</b>
143 return document.getElementById(n);
146 return fcomp(n).value;
149 function uecvalue(n) {
150 return encodeURIComponent("" + cvalue(n));
154 return s.replace(/&/g,'&').replace(/</g, '<').replace(/>/g, '>');
158 fcomp("onboardingInProgress").style.display = "block";
159 var url = "/onboard.js?acumos=" + uecvalue("furl");
160 if (cvalue("catMenu") != "*") {
161 url += "&catalogId=" + uecvalue("catMenu");
162 if (cvalue("solMenu") != "*") {
163 url += "&solutionId=" + uecvalue("solMenu");
164 if (cvalue("revMenu") != "*") {
165 url += "&revisionId=" + uecvalue("revMenu");
169 let xhr = new XMLHttpRequest();
170 xhr.onerror = xhr.onload = function() {
171 fcomp("onboardingInProgress").style.display = "none";
173 xhr.open("POST", url);
177 function chooseSolution() {
178 if (cvalue("solMenu") == "*") {
181 lookupItem("acRevs", "revMenu", "/listRevisions.js?acumos=" + uecvalue("furl") + "&solutionId=" + uecvalue("solMenu"));
184 function chooseCatalog() {
185 if (cvalue("catMenu") == "*") {
188 lookupItem("acSols", "solMenu", "/listSolutions.js?acumos=" + uecvalue("furl") + "&catalogId=" + uecvalue("catMenu"));
191 function lookupCatalogs() {
192 fcomp("onboard").style.display = "block";
193 lookupItem("cAcumos", "catMenu", "/listCatalogs.js?acumos=" + uecvalue("furl"));
195 function lookupItem(dblock, smenu, url) {
196 fcomp(dblock).style.display = "block";
197 let xhr = new XMLHttpRequest();
198 let catmenu = fcomp(smenu);
199 catmenu.options.length = 1;
200 catmenu.options[0].selected = true;
201 xhr.onload = function() {
202 let catresp = JSON.parse(this.response);
204 for (i = 0; i < catresp.length; i++) {
205 var option = document.createElement("option");
206 option.text = esc(catresp[i].name);
207 option.value = catresp[i].id;
212 xhr.open("GET", url);
216 function updatevis() {
217 if (cvalue("importType") != "itAcumos") {
218 fcomp("itAcumos").style.display = "none";
219 fcomp("furl").value = "";
221 if (cvalue("furl") == "") {
222 fcomp("cAcumos").style.display = "none";
223 fcomp("onboard").style.display = "none";
224 fcomp("catMenu").options[0].selected = true;
226 if (cvalue("catMenu") == "*") {
227 fcomp("acSols").style.display = "none";
228 fcomp("solMenu").options[0].selected = true;
230 if (cvalue("solMenu") == "*") {
231 fcomp("acRevs").style.display = "none";
232 fcomp("revMenu").options[0].selected = true;
236 function setImportType() {
237 let di = fcomp("itAcumos");
238 if (cvalue("importType") == "itAcumos") {
239 fcomp("furl").value = "";
240 di.style.display = "block";
244 function openImportPopup() {
245 fcomp("importType").options[0].selected = true;
246 fcomp("importPopup").style.display = "block";
249 function closeImportPopup() {
250 fcomp("importPopup").style.display = "none";