2 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
13 * or implied. See the License for the specific language governing
14 * permissions and limitations under the License.
16 import keyMirror from 'nfvo-utils/KeyMirror.js';
17 import i18n from 'nfvo-utils/i18n/i18n.js';
18 import InputOptions, {other as optionInputOther} from 'nfvo-components/input/inputOptions/InputOptions.jsx';
20 export const actionTypes = keyMirror({
22 ENTITLEMENT_POOLS_LIST_LOADED: null,
23 ADD_ENTITLEMENT_POOL: null,
24 EDIT_ENTITLEMENT_POOL: null,
25 DELETE_ENTITLEMENT_POOL: null,
27 entitlementPoolsEditor: {
35 export const enums = keyMirror({
36 SELECTED_FEATURE_GROUP_TAB: {
41 SELECTED_ENTITLEMENT_POOLS_BUTTONTAB: {
42 ASSOCIATED_ENTITLEMENT_POOLS: 1,
43 AVAILABLE_ENTITLEMENT_POOLS: 2
47 export const defaultState = {
48 ENTITLEMENT_POOLS_EDITOR_DATA: {
49 entitlementMetric: {choice: '', other: ''},
50 aggregationFunction: {choice: '', other: ''},
51 operationalScope: {choices: [], other: ''},
52 time: {choice: '', other: ''}
56 export const thresholdUnitType = {
58 PERCENTAGE: 'Percentage'
61 export const optionsInputValues = {
63 {enum: '', title: i18n('please select…')},
64 {enum: 'Network_Wide', title: 'Network Wide'},
65 {enum: 'Availability_Zone', title: 'Availability Zone'},
66 {enum: 'Data_Center', title: 'Data Center'},
67 {enum: 'Tenant', title: 'Tenant'},
68 {enum: 'VM', title: 'VM'},
69 {enum: 'CPU', title: 'CPU'},
70 {enum: 'Core', title: 'Core'}
73 {enum: '', title: i18n('please select…')},
74 {enum: 'Hour', title: 'Hour'},
75 {enum: 'Day', title: 'Day'},
76 {enum: 'Month', title: 'Month'}
79 {enum: '', title: i18n('please select…')},
80 {enum: 'Peak', title: 'Peak'},
81 {enum: 'Average', title: 'Average'}
84 {enum: '', title: i18n('please select…')},
85 {enum: 'Software_Instances_Count', title: 'Software Instances'},
86 {enum: 'Core', title: 'Core'},
87 {enum: 'CPU', title: 'CPU'},
88 {enum: 'Trunks', title: 'Trunks'},
89 {enum: 'User', title: 'User'},
90 {enum: 'Subscribers', title: 'Subscribers'},
91 {enum: 'Tenants', title: 'Tenants'},
92 {enum: 'Tokens', title: 'Tokens'},
93 {enum: 'Seats', title: 'Seats'},
94 {enum: 'Units_TB', title: 'Units-TB'},
95 {enum: 'Units_GB', title: 'Units-GB'},
96 {enum: 'Units_MB', title: 'Units-MB'}
99 {enum: '', title: i18n('please select…')},
100 {enum: thresholdUnitType.ABSOLUTE, title: 'Absolute'},
101 {enum: thresholdUnitType.PERCENTAGE, title: '%'}
105 export const extractValue = (item) => {
106 if (item === undefined) {return '';} //TODO fix it later
107 return item ? item.choice === optionInputOther.OTHER ? item.other : InputOptions.getTitleByName(optionsInputValues, item.choice) : '';
110 export const extractUnits = (units) => {
111 if (units === undefined) {return '';} //TODO fix it later
112 return units === 'Absolute' ? '' : '%';
115 export const SP_ENTITLEMENT_POOL_FORM = 'SPENTITLEMENTPOOL';
117 export const EP_TIME_FORMAT = 'MM/DD/YYYY';