2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
6 * Copyright © 2017-2018 Amdocs
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=========================================================
21 import {encrypt } from './Crypto.js';
22 import { decrypt } from '../utils/Crypto.js';
25 export function changeUrlAddress(pathObj, historyObj) {
26 let toGo = '/' + pathObj.route;
27 // left global search to act the same as before for our 2 static views for now
28 // until we decide to change those 2 views too to act like extensible views.
29 if (pathObj.route === 'schema' || pathObj.route === 'vnfSearch') {
30 if (pathObj.filterValues && pathObj.filterValues.length > 0) {
32 for (let index in pathObj.filterValues) {
33 if (pathObj.filterValues[index].filterValue !== undefined) {
34 filterList.push(pathObj.filterValues[index].filterId +
36 pathObj.filterValues[index].filterValue);
38 filterList.push(pathObj.filterValues[index].filterId + '=');
41 toGo = toGo + '/' + filterList.toString();
43 toGo = toGo + '/' + pathObj.hashId;
46 toGo += '/' + encrypt(JSON.stringify(pathObj));
48 historyObj.push(toGo, {lastRoute: pathObj.route});
51 export function buildRouteObjWithHash(routePath, routeHash) {
59 export function decryptParamsForView(params) {
62 function isJson(str) {
74 stringParams = decrypt(params);
76 //add inline message in next story
77 //happens when user changes the url.
80 if(!isJson(stringParams)) {
84 jsonParam = JSON.parse(stringParams);
88 export function buildRouteObjWithFilters(routePath, routeFiltersObj) {
89 let filterValues = [];
90 if (routeFiltersObj !== undefined) {
91 for (let id in routeFiltersObj) {
92 if (routeFiltersObj[id] !== undefined) {
96 'filterValue': routeFiltersObj[id]
112 filterValues: filterValues