aboutsummaryrefslogtreecommitdiffstats
path: root/sdc-workflow-designer-ui/src/main/frontend/src/features/version/versionController/views
diff options
context:
space:
mode:
Diffstat (limited to 'sdc-workflow-designer-ui/src/main/frontend/src/features/version/versionController/views')
-rw-r--r--sdc-workflow-designer-ui/src/main/frontend/src/features/version/versionController/views/ActionButtons.js92
-rw-r--r--sdc-workflow-designer-ui/src/main/frontend/src/features/version/versionController/views/OperationModeButtons.js70
-rw-r--r--sdc-workflow-designer-ui/src/main/frontend/src/features/version/versionController/views/SvgButton.js62
-rw-r--r--sdc-workflow-designer-ui/src/main/frontend/src/features/version/versionController/views/VersionButton.js38
-rw-r--r--sdc-workflow-designer-ui/src/main/frontend/src/features/version/versionController/views/VersionSelect.js69
-rw-r--r--sdc-workflow-designer-ui/src/main/frontend/src/features/version/versionController/views/VersionsContainer.js60
-rw-r--r--sdc-workflow-designer-ui/src/main/frontend/src/features/version/versionController/views/WorkflowTitle.js34
7 files changed, 425 insertions, 0 deletions
diff --git a/sdc-workflow-designer-ui/src/main/frontend/src/features/version/versionController/views/ActionButtons.js b/sdc-workflow-designer-ui/src/main/frontend/src/features/version/versionController/views/ActionButtons.js
new file mode 100644
index 00000000..0a9c2b1a
--- /dev/null
+++ b/sdc-workflow-designer-ui/src/main/frontend/src/features/version/versionController/views/ActionButtons.js
@@ -0,0 +1,92 @@
+/*
+* Copyright © 2018 European Support Limited
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+import React from 'react';
+import { I18n } from 'react-redux-i18n';
+import { Button } from 'onap-ui-react';
+import PropTypes from 'prop-types';
+import SvgButton from 'features/version/versionController/views/SvgButton';
+import CompositionUpdate from 'features/version/composition/CompositionUpdate';
+
+const ActionButtons = props => {
+ const {
+ onSaveClick,
+ certifyDisabled,
+ onCertifyClick,
+ isCompositionUpdating,
+ toggleCompositionUpdate,
+ onUndoClick,
+ saveDisabled
+ } = props;
+
+ return (
+ <div className="save-submit-cancel-container">
+ <div className="action-buttons">
+ <div className="select-action-buttons">
+ <div className={'separator vc-separator'} />
+ <SvgButton
+ dataTestId="vc-save-btn"
+ name="version-controller-save"
+ tooltipText={I18n.t('buttons.saveBtn')}
+ disabled={saveDisabled}
+ onClick={onSaveClick}
+ />
+
+ <div className={'separator vc-separator'} />
+
+ <SvgButton
+ dataTestId="vc-undo-btn"
+ name="version-controller-undo"
+ tooltipText={I18n.t('buttons.undoBtn')}
+ disabled={certifyDisabled}
+ onClick={onUndoClick}
+ />
+
+ <div className={'separator vc-separator'} />
+
+ <Button
+ className="certifyBtn"
+ btnType="primary"
+ disabled={certifyDisabled}
+ onClick={() => toggleCompositionUpdate(true)}>
+ {I18n.t('buttons.certifyBtn')}
+ </Button>
+
+ {isCompositionUpdating && (
+ <CompositionUpdate
+ certifyBack={() => {
+ toggleCompositionUpdate(false);
+ onCertifyClick();
+ }}
+ />
+ )}
+ </div>
+ </div>
+ </div>
+ );
+};
+
+ActionButtons.propTypes = {
+ onSaveClick: PropTypes.func,
+ certifyDisabled: PropTypes.bool,
+ onCertifyClick: PropTypes.func,
+ onUndoClick: PropTypes.func,
+ saveDisabled: PropTypes.bool,
+ isCompositionUpdating: PropTypes.bool,
+ toggleCompositionUpdate: PropTypes.func
+};
+
+export default ActionButtons;
diff --git a/sdc-workflow-designer-ui/src/main/frontend/src/features/version/versionController/views/OperationModeButtons.js b/sdc-workflow-designer-ui/src/main/frontend/src/features/version/versionController/views/OperationModeButtons.js
new file mode 100644
index 00000000..4d992adc
--- /dev/null
+++ b/sdc-workflow-designer-ui/src/main/frontend/src/features/version/versionController/views/OperationModeButtons.js
@@ -0,0 +1,70 @@
+/*
+* Copyright © 2018 European Support Limited
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+import React from 'react';
+import { I18n } from 'react-redux-i18n';
+import { Button } from 'onap-ui-react';
+import PropTypes from 'prop-types';
+import SvgButton from 'features/version/versionController/views/SvgButton';
+
+const OperationModeButtons = props => {
+ const {
+ onSaveClick,
+ saveDisabled,
+ sendMsgToCatalog,
+ onCertifyClick
+ } = props;
+ return (
+ <div className="save-submit-cancel-container">
+ <div className="action-buttons">
+ <div className="select-action-buttons">
+ <SvgButton
+ dataTestId="vc-save-btn"
+ name="version-controller-save"
+ tooltipText={I18n.t('buttons.saveBtn')}
+ disabled={saveDisabled}
+ onClick={onSaveClick}
+ />
+
+ <Button
+ disabled={saveDisabled}
+ className="certifyBtn"
+ btnType="primary"
+ onClick={onCertifyClick}>
+ {I18n.t('buttons.completeBtn')}
+ </Button>
+
+ <SvgButton
+ tooltipText={I18n.t('buttons.backToCatalog')}
+ className="vs-back-btn"
+ dataTestId="vc-back-btn"
+ name="upload"
+ onClick={sendMsgToCatalog}
+ />
+ </div>
+ </div>
+ </div>
+ );
+};
+
+OperationModeButtons.propTypes = {
+ onSaveClick: PropTypes.func,
+ saveDisabled: PropTypes.bool,
+ sendMsgToCatalog: PropTypes.func,
+ onCertifyClick: PropTypes.func
+};
+
+export default OperationModeButtons;
diff --git a/sdc-workflow-designer-ui/src/main/frontend/src/features/version/versionController/views/SvgButton.js b/sdc-workflow-designer-ui/src/main/frontend/src/features/version/versionController/views/SvgButton.js
new file mode 100644
index 00000000..41bdeb81
--- /dev/null
+++ b/sdc-workflow-designer-ui/src/main/frontend/src/features/version/versionController/views/SvgButton.js
@@ -0,0 +1,62 @@
+/*
+* Copyright © 2018 European Support Limited
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+ * http://www.apache.org/licenses/LICENSE-2.0
+*
+ * Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+import React from 'react';
+import { SVGIcon } from 'onap-ui-react';
+import PropTypes from 'prop-types';
+
+const SvgButton = props => {
+ const {
+ className = '',
+ name,
+ tooltipText,
+ disabled,
+ onClick,
+ dataTestId,
+ actiontype
+ } = props;
+ let onClickAction = disabled ? () => {} : () => onClick(actiontype);
+ return (
+ <div
+ className={`action-button-wrapper ${
+ disabled ? 'disabled' : 'clickable'
+ }`}
+ onClick={onClickAction}>
+ <div className="action-buttons-svg">
+ <SVGIcon
+ className={className}
+ label={tooltipText}
+ labelPosition="bottom"
+ labelClassName="action-button-label"
+ data-test-id={dataTestId}
+ name={name}
+ disabled={disabled}
+ />
+ </div>
+ </div>
+ );
+};
+
+SvgButton.propTypes = {
+ name: PropTypes.string,
+ tooltipText: PropTypes.string,
+ disabled: PropTypes.bool,
+ onClick: PropTypes.func,
+ dataTestId: PropTypes.string,
+ actiontype: PropTypes.string,
+ className: PropTypes.string
+};
+
+export default SvgButton;
diff --git a/sdc-workflow-designer-ui/src/main/frontend/src/features/version/versionController/views/VersionButton.js b/sdc-workflow-designer-ui/src/main/frontend/src/features/version/versionController/views/VersionButton.js
new file mode 100644
index 00000000..19e148cb
--- /dev/null
+++ b/sdc-workflow-designer-ui/src/main/frontend/src/features/version/versionController/views/VersionButton.js
@@ -0,0 +1,38 @@
+/*
+* Copyright © 2018 European Support Limited
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+ * http://www.apache.org/licenses/LICENSE-2.0
+*
+ * Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+import React from 'react';
+import { Button } from 'onap-ui-react';
+import { I18n } from 'react-redux-i18n';
+import PropTypes from 'prop-types';
+
+const VersionButton = props => {
+ const { onClick, actiontype } = props;
+ let onClickAction = () => onClick(actiontype);
+ return (
+ <div>
+ <Button btnType="primary" onClick={onClickAction}>
+ {I18n.t('buttons.certifyBtn')}
+ </Button>
+ </div>
+ );
+};
+
+VersionButton.propTypes = {
+ onClick: PropTypes.func,
+ actiontype: PropTypes.string
+};
+
+export default VersionButton;
diff --git a/sdc-workflow-designer-ui/src/main/frontend/src/features/version/versionController/views/VersionSelect.js b/sdc-workflow-designer-ui/src/main/frontend/src/features/version/versionController/views/VersionSelect.js
new file mode 100644
index 00000000..d8a6d02e
--- /dev/null
+++ b/sdc-workflow-designer-ui/src/main/frontend/src/features/version/versionController/views/VersionSelect.js
@@ -0,0 +1,69 @@
+/*
+* Copyright © 2018 European Support Limited
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+ * http://www.apache.org/licenses/LICENSE-2.0
+*
+ * Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+import React from 'react';
+import PropTypes from 'prop-types';
+import isEmpty from 'lodash.isempty';
+
+const VersionSelect = props => {
+ const {
+ currentWorkflowVersion,
+ viewableVersions,
+ onVersionSelectChange
+ } = props;
+
+ function onChangeHandler(ev) {
+ const versionIndex = Object.keys(viewableVersions).find(
+ key => viewableVersions[key].id === ev.target.value
+ );
+ const currentVersion = viewableVersions[versionIndex].id;
+ onVersionSelectChange(currentVersion);
+ }
+
+ return (
+ <select
+ className="version-selector"
+ key={'selector'}
+ value={currentWorkflowVersion.id}
+ onChange={onChangeHandler}
+ data-test-id="vc-versions-select-box">
+ {!isEmpty(viewableVersions) &&
+ viewableVersions.map(item => {
+ const displayedName = `${item.name} ${
+ currentWorkflowVersion.id === item.id
+ ? currentWorkflowVersion.state.toUpperCase()
+ : item.state
+ }`;
+ return (
+ <option
+ key={'versionSelect' + item.id}
+ value={item.id}
+ data-test-id="vc-version-option">
+ {displayedName}
+ </option>
+ );
+ })}
+ </select>
+ );
+};
+
+VersionSelect.propTypes = {
+ currentWorkflowVersion: PropTypes.object,
+ viewableVersions: PropTypes.arrayOf(Object),
+ onVersionSelectChange: PropTypes.func
+};
+
+export default VersionSelect;
diff --git a/sdc-workflow-designer-ui/src/main/frontend/src/features/version/versionController/views/VersionsContainer.js b/sdc-workflow-designer-ui/src/main/frontend/src/features/version/versionController/views/VersionsContainer.js
new file mode 100644
index 00000000..c84ab31d
--- /dev/null
+++ b/sdc-workflow-designer-ui/src/main/frontend/src/features/version/versionController/views/VersionsContainer.js
@@ -0,0 +1,60 @@
+/*
+* Copyright © 2018 European Support Limited
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+ * http://www.apache.org/licenses/LICENSE-2.0
+*
+ * Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+import React from 'react';
+import VersionSelect from 'features/version/versionController/views/VersionSelect';
+import { I18n } from 'react-redux-i18n';
+import PropTypes from 'prop-types';
+import ArchiveLabel from 'shared/archiveLabel/ArchiveLabel';
+
+const VersionContainer = props => {
+ const {
+ currentWorkflowVersion,
+ viewableVersions,
+ onOverviewClick,
+ onVersionSelectChange,
+ isArchive
+ } = props;
+
+ return (
+ <div className="version-section-wrapper">
+ <div className="version-status-container">
+ {I18n.t('workflow.version')}
+ <VersionSelect
+ currentWorkflowVersion={currentWorkflowVersion}
+ viewableVersions={viewableVersions}
+ onVersionSelectChange={onVersionSelectChange}
+ />
+ <span
+ className="version-selector-more-versions"
+ data-test-id="vc-versions-page-link"
+ onClick={onOverviewClick}>
+ {I18n.t('workflow.overview.viewOverview')}
+ </span>
+ {isArchive && <ArchiveLabel />}
+ </div>
+ </div>
+ );
+};
+
+VersionContainer.propTypes = {
+ currentWorkflowVersion: PropTypes.object,
+ viewableVersions: PropTypes.arrayOf(Object),
+ onOverviewClick: PropTypes.func,
+ onVersionSelectChange: PropTypes.func,
+ isArchive: PropTypes.bool
+};
+
+export default VersionContainer;
diff --git a/sdc-workflow-designer-ui/src/main/frontend/src/features/version/versionController/views/WorkflowTitle.js b/sdc-workflow-designer-ui/src/main/frontend/src/features/version/versionController/views/WorkflowTitle.js
new file mode 100644
index 00000000..230ecf08
--- /dev/null
+++ b/sdc-workflow-designer-ui/src/main/frontend/src/features/version/versionController/views/WorkflowTitle.js
@@ -0,0 +1,34 @@
+/*
+* Copyright © 2018 European Support Limited
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+ * http://www.apache.org/licenses/LICENSE-2.0
+*
+ * Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+import React from 'react';
+import PropTypes from 'prop-types';
+
+const WorkflowTitle = props => {
+ const { workflowName } = props;
+ return (
+ <div className="version-section-wrapper">
+ <div className="group-name-wrapper">
+ <div className="group-name">{workflowName || ''}</div>
+ </div>
+ </div>
+ );
+};
+
+WorkflowTitle.propTypes = {
+ workflowName: PropTypes.string
+};
+
+export default WorkflowTitle;