From dbba16253408ae28d6fe32030112bb8521431e57 Mon Sep 17 00:00:00 2001 From: Malek Date: Thu, 9 Aug 2018 12:07:58 +0300 Subject: [PATCH] Fix errors and warnings Issue-ID: SDC-1622 Change-Id: I1a284c29ed1332545752bf04c14027d1199bbd4e Signed-off-by: Malek --- .../src/main/frontend/package.json | 1 - workflow-designer-ui/src/main/frontend/src/App.js | 34 +++-- .../frontend/src/features/catalog/CatalogView.jsx | 2 +- .../version/composition/CompositionView.js | 2 +- .../CreateVersionView_snapshot-test.js.snap | 2 +- .../src/features/version/general/GeneralView.js | 55 +++---- .../CreateWorkflowView_snapshot-test.js.snap | 2 +- .../src/main/frontend/src/index.js | 20 ++- .../src/shared/components/Description/index.js | 6 +- .../frontend/src/shared/scroll/InfiniteScroll.js | 158 +++++++++++++++++++++ workflow-designer-ui/src/main/frontend/yarn.lock | 6 - 11 files changed, 223 insertions(+), 65 deletions(-) create mode 100644 workflow-designer-ui/src/main/frontend/src/shared/scroll/InfiniteScroll.js diff --git a/workflow-designer-ui/src/main/frontend/package.json b/workflow-designer-ui/src/main/frontend/package.json index f1f33712..e3c657e0 100644 --- a/workflow-designer-ui/src/main/frontend/package.json +++ b/workflow-designer-ui/src/main/frontend/package.json @@ -34,7 +34,6 @@ "react-datepicker": "^0.48.0", "react-dom": "^16.3.2", "react-hot-loader": "^4.3.3", - "react-infinite-scroller": "^1.2.0", "react-redux": "^5.0.6", "react-redux-i18n": "^1.9.2", "react-router": "^4.3.1", diff --git a/workflow-designer-ui/src/main/frontend/src/App.js b/workflow-designer-ui/src/main/frontend/src/App.js index 4b42f6f3..3d9f302b 100644 --- a/workflow-designer-ui/src/main/frontend/src/App.js +++ b/workflow-designer-ui/src/main/frontend/src/App.js @@ -5,9 +5,9 @@ * 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 +* http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software +* 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 @@ -17,6 +17,7 @@ import { hot } from 'react-hot-loader'; import React, { Component } from 'react'; import { Route } from 'react-router-dom'; +import qs from 'qs'; import { PluginPubSub } from 'shared/pubsub/plugin-pubsub'; import 'resources/scss/style.scss'; @@ -36,28 +37,35 @@ class App extends Component { constructor(props) { super(props); - this.searchParams = new URLSearchParams(location.search); + this.searchParams = qs.parse(location.search, { + ignoreQueryPrefix: true + }); - if (this.searchParams.get('userId')) { - localStorage.setItem(USER_ID, this.searchParams.get('userId')); + if (this.searchParams && this.searchParams.userId) { + localStorage.setItem(USER_ID, this.searchParams.userId); } } componentDidMount() { - const eventsClientId = this.searchParams.get('eventsClientId'); - const parentUrl = this.searchParams.get('parentUrl'); + if (this.searchParams) { + const { eventsClientId, parentUrl } = this.searchParams; - if (eventsClientId && parentUrl) { - const client = new PluginPubSub(eventsClientId, parentUrl); + if (eventsClientId && parentUrl) { + const client = new PluginPubSub(eventsClientId, parentUrl); - client.notify('READY'); + client.notify('READY'); + } } } render() { - return routes.map((route, i) => ( - - )); + return ( +
+ {routes.map((route, i) => ( + + ))} +
+ ); } } diff --git a/workflow-designer-ui/src/main/frontend/src/features/catalog/CatalogView.jsx b/workflow-designer-ui/src/main/frontend/src/features/catalog/CatalogView.jsx index e833a01e..2d8c8d7d 100644 --- a/workflow-designer-ui/src/main/frontend/src/features/catalog/CatalogView.jsx +++ b/workflow-designer-ui/src/main/frontend/src/features/catalog/CatalogView.jsx @@ -16,7 +16,7 @@ import React from 'react'; import PropTypes from 'prop-types'; -import InfiniteScroll from 'react-infinite-scroller'; +import InfiniteScroll from 'shared/scroll/InfiniteScroll'; import Workflows from 'features/catalog/views/Workflows'; import AddWorkflow from 'features/catalog/views/AddWorkflow'; diff --git a/workflow-designer-ui/src/main/frontend/src/features/version/composition/CompositionView.js b/workflow-designer-ui/src/main/frontend/src/features/version/composition/CompositionView.js index d549456f..f47a6ecc 100644 --- a/workflow-designer-ui/src/main/frontend/src/features/version/composition/CompositionView.js +++ b/workflow-designer-ui/src/main/frontend/src/features/version/composition/CompositionView.js @@ -27,7 +27,7 @@ class CompositionView extends Component { static propTypes = { compositionUpdate: PropTypes.func, showErrorModal: PropTypes.func, - composition: PropTypes.string, + composition: PropTypes.bool, name: PropTypes.string }; constructor() { diff --git a/workflow-designer-ui/src/main/frontend/src/features/version/create/__tests__/__snapshots__/CreateVersionView_snapshot-test.js.snap b/workflow-designer-ui/src/main/frontend/src/features/version/create/__tests__/__snapshots__/CreateVersionView_snapshot-test.js.snap index 08389c6e..55357b5c 100644 --- a/workflow-designer-ui/src/main/frontend/src/features/version/create/__tests__/__snapshots__/CreateVersionView_snapshot-test.js.snap +++ b/workflow-designer-ui/src/main/frontend/src/features/version/create/__tests__/__snapshots__/CreateVersionView_snapshot-test.js.snap @@ -51,7 +51,7 @@ exports[`Create new version snapshot renders correctly 1`] = ` className="custom-textarea field-section sdc-input__input" data-test-id="new-version-description" onChange={[Function]} - value={undefined} + value="" /> diff --git a/workflow-designer-ui/src/main/frontend/src/features/version/general/GeneralView.js b/workflow-designer-ui/src/main/frontend/src/features/version/general/GeneralView.js index 930c6071..d10d5784 100644 --- a/workflow-designer-ui/src/main/frontend/src/features/version/general/GeneralView.js +++ b/workflow-designer-ui/src/main/frontend/src/features/version/general/GeneralView.js @@ -5,9 +5,9 @@ * 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 +* http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software +* 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 @@ -16,36 +16,39 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { I18n, Localize, Translate } from 'react-redux-i18n'; +import { I18n, Translate } from 'react-redux-i18n'; import Description from 'shared/components/Description'; import { VersionInfo, LabeledValue } from 'shared/components/VersionInfo'; -const GeneralView = ({ onDataChange, description, created, modified }) => ( -
-
- -
-
- - - - } - /> - } +const GeneralView = ({ onDataChange, description, created, modified }) => { + const modifiedValue = I18n.l(modified, { dateFormat: 'date.short' }); + const createdValue = I18n.l(created, { dateFormat: 'date.short' }); + + return ( +
+
+ +
+
+ - + + + + +
-
-); + ); +}; GeneralView.propTypes = { onDataChange: PropTypes.func, diff --git a/workflow-designer-ui/src/main/frontend/src/features/workflow/create/__tests__/__snapshots__/CreateWorkflowView_snapshot-test.js.snap b/workflow-designer-ui/src/main/frontend/src/features/workflow/create/__tests__/__snapshots__/CreateWorkflowView_snapshot-test.js.snap index de14dc3e..1a050ef9 100644 --- a/workflow-designer-ui/src/main/frontend/src/features/workflow/create/__tests__/__snapshots__/CreateWorkflowView_snapshot-test.js.snap +++ b/workflow-designer-ui/src/main/frontend/src/features/workflow/create/__tests__/__snapshots__/CreateWorkflowView_snapshot-test.js.snap @@ -49,7 +49,7 @@ exports[`New Workflow View Snapshot renders correctly 1`] = ` className="custom-textarea field-section sdc-input__input" data-test-id="description" onChange={[Function]} - value={undefined} + value="" />
diff --git a/workflow-designer-ui/src/main/frontend/src/index.js b/workflow-designer-ui/src/main/frontend/src/index.js index d33f47cb..46a87603 100644 --- a/workflow-designer-ui/src/main/frontend/src/index.js +++ b/workflow-designer-ui/src/main/frontend/src/index.js @@ -27,18 +27,14 @@ import store from './store'; ReactDOM.render( - - - - - -
- -
- -
-
-
+ + + + + + + +
, document.getElementById('root') ); diff --git a/workflow-designer-ui/src/main/frontend/src/shared/components/Description/index.js b/workflow-designer-ui/src/main/frontend/src/shared/components/Description/index.js index 15a88341..4aa48f8a 100644 --- a/workflow-designer-ui/src/main/frontend/src/shared/components/Description/index.js +++ b/workflow-designer-ui/src/main/frontend/src/shared/components/Description/index.js @@ -4,9 +4,9 @@ * 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. @@ -24,7 +24,7 @@ const Description = ({ description, onDataChange, dataTestId }) => ( {I18n.t('workflow.general.description')}