blob: 181171d4cd7a4e186115dc3569492fafa6331645 [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';
Avi Ziv61070c92017-07-26 17:37:57 +030018import InputOptions, {other as optionInputOther} from 'nfvo-components/input/validation/InputOptions.jsx';
Michael Landoefa037d2017-02-19 12:57:33 +020019
20export const actionTypes = keyMirror({
21 LICENSE_AGREEMENT_LIST_LOADED: null,
Michael Landoefa037d2017-02-19 12:57:33 +020022 DELETE_LICENSE_AGREEMENT: null,
Michael Landoefa037d2017-02-19 12:57:33 +020023
24 licenseAgreementEditor: {
25 OPEN: null,
26 CLOSE: null,
27 DATA_CHANGED: null,
AviZi280f8012017-06-09 02:39:56 +030028 SELECT_TAB: null
Michael Landoefa037d2017-02-19 12:57:33 +020029 }
30
31});
32
AviZi280f8012017-06-09 02:39:56 +030033export const LA_EDITOR_FORM = 'LA_EDITOR_FORM';
34
Michael Landoefa037d2017-02-19 12:57:33 +020035export const enums = keyMirror({
36 SELECTED_LICENSE_AGREEMENT_TAB: {
37 GENERAL: 1,
38 FEATURE_GROUPS: 2
Michael Landoefa037d2017-02-19 12:57:33 +020039 }
40});
41
42export const defaultState = {
43 LICENSE_AGREEMENT_EDITOR_DATA: {
44 licenseTerm: {choice: '', other: ''}
45 }
46};
47
48export const optionsInputValues = {
49 LICENSE_MODEL_TYPE: [
50 {enum: '', title: i18n('please select…')},
51 {enum: 'Fixed_Term', title: 'Fixed Term'},
52 {enum: 'Perpetual', title: 'Perpetual'},
53 {enum: 'Unlimited', title: 'Unlimited'}
54 ]
55};
AviZi280f8012017-06-09 02:39:56 +030056
57export const extractValue = (item) => {
58 if (item === undefined) {
59 return '';
60 } //TODO fix it later
61
62 return item ? item.choice === optionInputOther.OTHER ? item.other : InputOptions.getTitleByName(optionsInputValues, item.choice) : '';
63};