2 * Copyright © 2016-2018 European Support Limited
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, {
19 other as optionInputOther
20 } from 'nfvo-components/input/validation/InputOptions.jsx';
22 export const actionTypes = keyMirror(
24 ENTITLEMENT_POOLS_LIST_LOADED: null,
25 entitlementPoolsEditor: {
29 LIMITS_LIST_LOADED: null
32 '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 time: { choice: '', other: '' }
55 export const thresholdUnitType = {
57 PERCENTAGE: 'Percentage'
60 export const optionsInputValues = {
62 { enum: '', title: i18n('please select…') },
63 { enum: 'Universal', title: 'Universal' },
64 { enum: 'Unique', title: 'Unique' },
65 { enum: 'One_Time', title: 'One Time' }
68 { enum: '', title: i18n('please select…') },
69 { enum: 'Hour', title: 'Hour' },
70 { enum: 'Day', title: 'Day' },
71 { enum: 'Month', title: 'Month' }
74 { enum: '', title: i18n('please select…') },
75 { enum: 'Peak', title: 'Peak' },
76 { enum: 'Average', title: 'Average' }
79 { enum: '', title: i18n('please select…') },
80 { enum: 'Software_Instances_Count', title: 'Software Instances' },
81 { enum: 'Core', title: 'Core' },
82 { enum: 'CPU', title: 'CPU' },
83 { enum: 'Trunks', title: 'Trunks' },
84 { enum: 'User', title: 'User' },
85 { enum: 'Subscribers', title: 'Subscribers' },
86 { enum: 'Tenants', title: 'Tenants' },
87 { enum: 'Tokens', title: 'Tokens' },
88 { enum: 'Seats', title: 'Seats' },
89 { enum: 'Units_TB', title: 'Units-TB' },
90 { enum: 'Units_GB', title: 'Units-GB' },
91 { enum: 'Units_MB', title: 'Units-MB' }
95 export const extractValue = item => {
96 if (item === undefined) {
100 ? item === optionInputOther.OTHER
102 : InputOptions.getTitleByName(optionsInputValues, item)
106 export const extractUnits = units => {
107 if (units === undefined) {
109 } //TODO fix it later
110 return units === 'Absolute' ? '' : '%';
113 export const tabIds = {
115 SP_LIMITS: 'SP_LIMITS',
116 VENDOR_LIMITS: 'VENDOR_LIMITS',
117 ADD_LIMIT_BUTTON: 'ADD_LIMIT_BUTTON'
120 export const SP_ENTITLEMENT_POOL_FORM = 'SPENTITLEMENTPOOL';