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/validation/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: {
31 LIMITS_LIST_LOADED: null
36 export const enums = keyMirror({
37 SELECTED_FEATURE_GROUP_TAB: {
42 SELECTED_ENTITLEMENT_POOLS_BUTTONTAB: {
43 ASSOCIATED_ENTITLEMENT_POOLS: 1,
44 AVAILABLE_ENTITLEMENT_POOLS: 2
48 export const defaultState = {
49 ENTITLEMENT_POOLS_EDITOR_DATA: {
50 entitlementMetric: {choice: '', other: ''},
51 aggregationFunction: {choice: '', other: ''},
52 operationalScope: {choices: [], other: ''},
53 time: {choice: '', other: ''}
57 export const thresholdUnitType = {
59 PERCENTAGE: 'Percentage'
62 export const optionsInputValues = {
64 {enum: '', title: i18n('please select…')},
65 {enum: 'Network_Wide', title: 'Network Wide'},
66 {enum: 'Availability_Zone', title: 'Availability Zone'},
67 {enum: 'Data_Center', title: 'Data Center'},
68 {enum: 'Tenant', title: 'Tenant'},
69 {enum: 'VM', title: 'VM'},
70 {enum: 'CPU', title: 'CPU'},
71 {enum: 'Core', title: 'Core'}
74 {enum: '', title: i18n('please select…')},
75 {enum: 'Hour', title: 'Hour'},
76 {enum: 'Day', title: 'Day'},
77 {enum: 'Month', title: 'Month'}
80 {enum: '', title: i18n('please select…')},
81 {enum: 'Peak', title: 'Peak'},
82 {enum: 'Average', title: 'Average'}
85 {enum: '', title: i18n('please select…')},
86 {enum: 'Software_Instances_Count', title: 'Software Instances'},
87 {enum: 'Core', title: 'Core'},
88 {enum: 'CPU', title: 'CPU'},
89 {enum: 'Trunks', title: 'Trunks'},
90 {enum: 'User', title: 'User'},
91 {enum: 'Subscribers', title: 'Subscribers'},
92 {enum: 'Tenants', title: 'Tenants'},
93 {enum: 'Tokens', title: 'Tokens'},
94 {enum: 'Seats', title: 'Seats'},
95 {enum: 'Units_TB', title: 'Units-TB'},
96 {enum: 'Units_GB', title: 'Units-GB'},
97 {enum: 'Units_MB', title: 'Units-MB'}
101 export const extractValue = (item) => {
102 if (item === undefined) {return '';} //TODO fix it later
103 return item ? item.choice === optionInputOther.OTHER ? item.other : InputOptions.getTitleByName(optionsInputValues, item.choice) : '';
106 export const extractUnits = (units) => {
107 if (units === undefined) {return '';} //TODO fix it later
108 return units === 'Absolute' ? '' : '%';
111 export const tabIds = {
113 SP_LIMITS: 'SP_LIMITS',
114 VENDOR_LIMITS: 'VENDOR_LIMITS',
115 ADD_LIMIT_BUTTON: 'ADD_LIMIT_BUTTON'
118 export const SP_ENTITLEMENT_POOL_FORM = 'SPENTITLEMENTPOOL';