blob: 571b512007e016748f337d771e7eb61bede10359 [file] [log] [blame]
AviZi280f8012017-06-09 02:39:56 +03001/*!
svishnev8f133302018-08-06 23:08:39 +03002 * Copyright © 2016-2018 European Support Limited
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
svishnevbacc7152018-11-05 12:11:30 +020022export const actionTypes = keyMirror(
23 {
24 ENTITLEMENT_POOLS_LIST_LOADED: null,
25 entitlementPoolsEditor: {
26 OPEN: null,
27 CLOSE: null,
28 DATA_CHANGED: null,
29 LIMITS_LIST_LOADED: null
30 }
31 },
32 'entitlementPoolsEditor'
33);
Michael Landoefa037d2017-02-19 12:57:33 +020034
35export const enums = keyMirror({
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020036 SELECTED_FEATURE_GROUP_TAB: {
37 GENERAL: 1,
38 ENTITLEMENT_POOLS: 2,
39 LICENCE_KEY_GROUPS: 3
40 },
41 SELECTED_ENTITLEMENT_POOLS_BUTTONTAB: {
42 ASSOCIATED_ENTITLEMENT_POOLS: 1,
43 AVAILABLE_ENTITLEMENT_POOLS: 2
44 }
Michael Landoefa037d2017-02-19 12:57:33 +020045});
46
47export const defaultState = {
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020048 ENTITLEMENT_POOLS_EDITOR_DATA: {
49 entitlementMetric: { choice: '', other: '' },
50 aggregationFunction: { choice: '', other: '' },
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020051 time: { choice: '', other: '' }
52 }
Michael Landoefa037d2017-02-19 12:57:33 +020053};
54
55export const thresholdUnitType = {
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020056 ABSOLUTE: 'Absolute',
57 PERCENTAGE: 'Percentage'
Michael Landoefa037d2017-02-19 12:57:33 +020058};
59
60export const optionsInputValues = {
Ben David, Elad (eb7504)ec7da6a2020-03-17 18:12:17 +020061 TYPE: [
62 { enum: '', title: i18n('please select…') },
63 { enum: 'Universal', title: 'Universal' },
64 { enum: 'Unique', title: 'Unique' },
65 { enum: 'One_Time', title: 'One Time' }
66 ],
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020067 TIME: [
68 { enum: '', title: i18n('please select…') },
69 { enum: 'Hour', title: 'Hour' },
70 { enum: 'Day', title: 'Day' },
71 { enum: 'Month', title: 'Month' }
72 ],
73 AGGREGATE_FUNCTION: [
74 { enum: '', title: i18n('please select…') },
75 { enum: 'Peak', title: 'Peak' },
76 { enum: 'Average', title: 'Average' }
77 ],
78 ENTITLEMENT_METRIC: [
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' }
92 ]
Michael Landoefa037d2017-02-19 12:57:33 +020093};
94
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020095export const extractValue = item => {
96 if (item === undefined) {
97 return '';
98 } //TODO fix it later
99 return item
Ben David, Elad (eb7504)ec7da6a2020-03-17 18:12:17 +0200100 ? item === optionInputOther.OTHER
101 ? item
102 : InputOptions.getTitleByName(optionsInputValues, item)
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200103 : '';
AviZi280f8012017-06-09 02:39:56 +0300104};
Michael Landoefa037d2017-02-19 12:57:33 +0200105
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200106export const extractUnits = units => {
107 if (units === undefined) {
108 return '';
109 } //TODO fix it later
110 return units === 'Absolute' ? '' : '%';
AviZi280f8012017-06-09 02:39:56 +0300111};
Michael Landoefa037d2017-02-19 12:57:33 +0200112
Avi Ziv61070c92017-07-26 17:37:57 +0300113export const tabIds = {
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200114 GENERAL: 'GENERAL',
115 SP_LIMITS: 'SP_LIMITS',
116 VENDOR_LIMITS: 'VENDOR_LIMITS',
117 ADD_LIMIT_BUTTON: 'ADD_LIMIT_BUTTON'
Avi Ziv61070c92017-07-26 17:37:57 +0300118};
Avi Zivb8e2faf2017-07-18 19:45:38 +0300119
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200120export const SP_ENTITLEMENT_POOL_FORM = 'SPENTITLEMENTPOOL';