blob: e69ff688ab0bbe908dc6776bb0e1a69a8ea432b0 [file] [log] [blame]
AviZi280f8012017-06-09 02:39:56 +03001/*!
Michael Landoefa037d2017-02-19 12:57:33 +02002 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
AviZi280f8012017-06-09 02:39:56 +03003 *
Michael Landoefa037d2017-02-19 12:57:33 +02004 * 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
AviZi280f8012017-06-09 02:39:56 +03007 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
Michael Landoefa037d2017-02-19 12:57:33 +020010 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
AviZi280f8012017-06-09 02:39:56 +030012 * 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.
Michael Landoefa037d2017-02-19 12:57:33 +020015 */
Michael Landoefa037d2017-02-19 12:57:33 +020016import keyMirror from 'nfvo-utils/KeyMirror.js';
17import i18n from 'nfvo-utils/i18n/i18n.js';
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020018import InputOptions, {
19 other as optionInputOther
20} from 'nfvo-components/input/validation/InputOptions.jsx';
Michael Landoefa037d2017-02-19 12:57:33 +020021
22export const actionTypes = keyMirror({
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020023 ENTITLEMENT_POOLS_LIST_LOADED: null,
24 ADD_ENTITLEMENT_POOL: null,
25 EDIT_ENTITLEMENT_POOL: null,
26 DELETE_ENTITLEMENT_POOL: null,
Michael Landoefa037d2017-02-19 12:57:33 +020027
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020028 entitlementPoolsEditor: {
29 OPEN: null,
30 CLOSE: null,
31 DATA_CHANGED: null,
32 LIMITS_LIST_LOADED: null
33 }
Michael Landoefa037d2017-02-19 12:57:33 +020034});
35
36export const enums = keyMirror({
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020037 SELECTED_FEATURE_GROUP_TAB: {
38 GENERAL: 1,
39 ENTITLEMENT_POOLS: 2,
40 LICENCE_KEY_GROUPS: 3
41 },
42 SELECTED_ENTITLEMENT_POOLS_BUTTONTAB: {
43 ASSOCIATED_ENTITLEMENT_POOLS: 1,
44 AVAILABLE_ENTITLEMENT_POOLS: 2
45 }
Michael Landoefa037d2017-02-19 12:57:33 +020046});
47
48export const defaultState = {
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020049 ENTITLEMENT_POOLS_EDITOR_DATA: {
50 entitlementMetric: { choice: '', other: '' },
51 aggregationFunction: { choice: '', other: '' },
52 operationalScope: { choices: [], other: '' },
53 time: { choice: '', other: '' }
54 }
Michael Landoefa037d2017-02-19 12:57:33 +020055};
56
57export const thresholdUnitType = {
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020058 ABSOLUTE: 'Absolute',
59 PERCENTAGE: 'Percentage'
Michael Landoefa037d2017-02-19 12:57:33 +020060};
61
62export const optionsInputValues = {
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020063 OPERATIONAL_SCOPE: [
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' }
72 ],
73 TIME: [
74 { enum: '', title: i18n('please select…') },
75 { enum: 'Hour', title: 'Hour' },
76 { enum: 'Day', title: 'Day' },
77 { enum: 'Month', title: 'Month' }
78 ],
79 AGGREGATE_FUNCTION: [
80 { enum: '', title: i18n('please select…') },
81 { enum: 'Peak', title: 'Peak' },
82 { enum: 'Average', title: 'Average' }
83 ],
84 ENTITLEMENT_METRIC: [
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' }
98 ]
Michael Landoefa037d2017-02-19 12:57:33 +020099};
100
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200101export const extractValue = item => {
102 if (item === undefined) {
103 return '';
104 } //TODO fix it later
105 return item
106 ? item.choice === optionInputOther.OTHER
107 ? item.other
108 : InputOptions.getTitleByName(optionsInputValues, item.choice)
109 : '';
AviZi280f8012017-06-09 02:39:56 +0300110};
Michael Landoefa037d2017-02-19 12:57:33 +0200111
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200112export const extractUnits = units => {
113 if (units === undefined) {
114 return '';
115 } //TODO fix it later
116 return units === 'Absolute' ? '' : '%';
AviZi280f8012017-06-09 02:39:56 +0300117};
Michael Landoefa037d2017-02-19 12:57:33 +0200118
Avi Ziv61070c92017-07-26 17:37:57 +0300119export const tabIds = {
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200120 GENERAL: 'GENERAL',
121 SP_LIMITS: 'SP_LIMITS',
122 VENDOR_LIMITS: 'VENDOR_LIMITS',
123 ADD_LIMIT_BUTTON: 'ADD_LIMIT_BUTTON'
Avi Ziv61070c92017-07-26 17:37:57 +0300124};
Avi Zivb8e2faf2017-07-18 19:45:38 +0300125
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200126export const SP_ENTITLEMENT_POOL_FORM = 'SPENTITLEMENTPOOL';