2 * ============LICENSE_START===================================================
3 * SPARKY (AAI UI service)
4 * ============================================================================
5 * Copyright © 2017 AT&T Intellectual Property.
6 * Copyright © 2017 Amdocs
8 * ============================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 * ============LICENSE_END=====================================================
22 * ECOMP and OpenECOMP are trademarks
23 * and service marks of AT&T Intellectual Property.
27 AUDIT_SEARCH_DATE_FORMAT,
28 AUDIT_SEARCH_DATE_TIME_ZONE
29 } from './NetworkConstants.js';
31 export function getTableDateQueryString(requestObject) {
34 'startDate': requestObject.dateRange.startDate.format(
35 AUDIT_SEARCH_DATE_FORMAT),
36 'endDate': requestObject.dateRange.endDate.format(
37 AUDIT_SEARCH_DATE_FORMAT),
38 'time_zone': requestObject.dateRange.startDate.format(
39 AUDIT_SEARCH_DATE_TIME_ZONE),
42 'from': requestObject.startIndex,
43 'size': requestObject.resultCount
49 export function getTSUIElasticSearchQueryString(query) {
50 // Create the query request
51 let posFirstEqualSign = query.indexOf('=');
52 let newQuery = query.substring(posFirstEqualSign + 1); // remove the first
54 //'attrName=attrValue'
55 newQuery = newQuery.replace(/\,[^\=]+\=/gi, ' '); // remove all ', attrName='
56 newQuery = newQuery.trim(); // remove whitespace at both ends, if any
63 export function getSeverityVisualizationQueryString(requestObject) {
66 'startDate': requestObject.dateRange.startDate.format(
67 AUDIT_SEARCH_DATE_FORMAT),
68 'endDate': requestObject.dateRange.endDate.format(
69 AUDIT_SEARCH_DATE_FORMAT),
70 'time_zone': requestObject.dateRange.startDate.format(
71 AUDIT_SEARCH_DATE_TIME_ZONE),
74 'groupByField': 'severity'
80 export function getStatusVisualizationQueryString(requestObject) {
83 'startDate': requestObject.dateRange.startDate.format(
84 AUDIT_SEARCH_DATE_FORMAT),
85 'endDate': requestObject.dateRange.endDate.format(
86 AUDIT_SEARCH_DATE_FORMAT),
87 'time_zone': requestObject.dateRange.startDate.format(
88 AUDIT_SEARCH_DATE_TIME_ZONE),
91 'groupByField': 'category'
97 export function getEntityTypeVisualizationQueryString(requestObject) {
100 'startDate': requestObject.dateRange.startDate.format(
101 AUDIT_SEARCH_DATE_FORMAT),
102 'endDate': requestObject.dateRange.endDate.format(
103 AUDIT_SEARCH_DATE_FORMAT),
104 'time_zone': requestObject.dateRange.startDate.format(
105 AUDIT_SEARCH_DATE_TIME_ZONE),
108 'groupByField': 'entityType'
114 export function getDateVisualizationQueryString(requestObject) {
117 'startDate': requestObject.dateRange.startDate.format(
118 AUDIT_SEARCH_DATE_FORMAT),
119 'endDate': requestObject.dateRange.endDate.format(
120 AUDIT_SEARCH_DATE_FORMAT),
121 'time_zone': requestObject.dateRange.startDate.format(
122 AUDIT_SEARCH_DATE_TIME_ZONE),
124 'type': 'dateHistogram'
130 export function getVnfOrchStatusQueryString(requestObject) {
132 'hashId': requestObject,
133 'groupby': 'orchestration-status'
136 export function getVnfProvStatusQueryString(requestObject) {
138 'hashId': requestObject,
139 'groupby': 'prov-status'
142 export function getVnfCountQueryString(requestObject) {
144 'hashId': requestObject