1 import {encrypt } from './Crypto.js';
2 import { decrypt } from '../utils/Crypto.js';
5 export function changeUrlAddress(pathObj, historyObj) {
6 let toGo = '/' + pathObj.route;
7 // left global search to act the same as before for our 2 static views for now
8 // until we decide to change those 2 views too to act like extensible views.
9 if (pathObj.route === 'schema' || pathObj.route === 'vnfSearch') {
10 if (pathObj.filterValues && pathObj.filterValues.length > 0) {
12 for (let index in pathObj.filterValues) {
13 if (pathObj.filterValues[index].filterValue !== undefined) {
14 filterList.push(pathObj.filterValues[index].filterId +
16 pathObj.filterValues[index].filterValue);
18 filterList.push(pathObj.filterValues[index].filterId + '=');
21 toGo = toGo + '/' + filterList.toString();
23 toGo = toGo + '/' + pathObj.hashId;
26 toGo += '/' + encrypt(JSON.stringify(pathObj));
28 historyObj.push(toGo, {lastRoute: pathObj.route});
31 export function buildRouteObjWithHash(routePath, routeHash) {
39 export function decryptParamsForView(params) {
42 function isJson(str) {
54 stringParams = decrypt(params);
56 //add inline message in next story
57 //happens when user changes the url.
60 if(!isJson(stringParams)) {
64 jsonParam = JSON.parse(stringParams);
68 export function buildRouteObjWithFilters(routePath, routeFiltersObj) {
69 let filterValues = [];
70 if (routeFiltersObj !== undefined) {
71 for (let id in routeFiltersObj) {
72 if (routeFiltersObj[id] !== undefined) {
76 'filterValue': routeFiltersObj[id]
92 filterValues: filterValues