diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/package.json b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/package.json index 784a4bc702..6b4aba3fbd 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/package.json +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/package.json @@ -31,7 +31,6 @@ "react-scripts": "2.1.8", "react-star-ratings": "^2.3.0", "react-virtualized": "^9.21.1", - "redux-thunk": "^2.3.0", "reqwest": "^2.0.5", "storm-react-diagrams": "^5.2.1" }, @@ -66,8 +65,6 @@ "react": "^15.6.2", "react-dom": "^15.6.2", "react-intl": "^2.4.0", - "react-redux": "^7.0.2", - "redux": "^4.0.1", "sass-loader": "^6.0.7", "style-loader": "^0.18.2", "url-loader": "^1.1.2", diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/AppCard.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/AppCard.js index 44082e690b..1ef3f3333a 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/AppCard.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/AppCard.js @@ -1,21 +1,13 @@ -import { - Skeleton, Switch, Card, Icon, Avatar, Typography, Col, Row, Rate -} from 'antd'; +import {Card, Typography, Col, Row} from 'antd'; import React from "react"; -import {openReleasesModal} from "../../js/actions"; -import {connect} from "react-redux"; import {Link} from "react-router-dom"; import "../../App.css"; import StarRatings from 'react-star-ratings'; const {Meta} = Card; -const {Text, Title} = Typography; +const {Text} = Typography; -const mapDispatchToProps = dispatch => ({ - openReleasesModal: (app) => dispatch(openReleasesModal(app)) -}); - -class ConnectedAppCard extends React.Component { +class AppCard extends React.Component { constructor(props) { super(props); @@ -65,6 +57,4 @@ class ConnectedAppCard extends React.Component { } } -const AppCard = connect(null, mapDispatchToProps)(ConnectedAppCard); - export default AppCard; \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/ReleaseModal.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/ReleaseModal.js deleted file mode 100644 index 2265aa6d3f..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/ReleaseModal.js +++ /dev/null @@ -1,85 +0,0 @@ -import React from "react"; -import {Modal, Typography,List, Avatar} from 'antd'; -import {connect} from 'react-redux'; -import {Link} from "react-router-dom"; - -// connecting state.releaseView with the component -const mapStateToProps = state => { - return {releaseView: state.releaseView} -}; - -const Text = Typography; - -class ConnectedReleaseModal extends React.Component { - constructor(props) { - super(props); - this.state = { - visible: false, - app: null - }; - } - - componentWillReceiveProps(nextProps) { - if (nextProps !== this.props) { - this.setState({ - visible: nextProps.releaseView.visible, - app: nextProps.releaseView.app - }) - } - } - - showModal = () => { - this.setState({ - visible: true, - }); - }; - - handleOk = (e) => { - this.setState({ - visible: false, - }); - }; - - handleCancel = (e) => { - this.setState({ - visible: false, - }); - }; - - render() { - if (this.props.releaseView.app != null) { - const app = this.props.releaseView.app; - return ( -
- -

Some contents...

- ( - - } - title={{release.version}} - description={release.description} - /> - - )} - /> -
-
- ); - } else { - return null; - } - } -} - -const ReleaseModal = connect(mapStateToProps, null)(ConnectedReleaseModal); - -export default ReleaseModal; \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/index.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/index.js index f98a4a1939..3e415a3cee 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/index.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/index.js @@ -7,9 +7,6 @@ import Dashboard from "./pages/dashboard/Dashboard"; import Apps from "./pages/dashboard/apps/Apps"; import Release from "./pages/dashboard/apps/release/Release"; import './index.css'; -import store from "./js/store/index"; -import {Provider} from "react-redux"; - const routes = [ { @@ -38,9 +35,7 @@ const routes = [ ReactDOM.render( - - - , + , document.getElementById('root')); // If you want your app to work offline and load faster, you can change diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/js/actions/index.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/js/actions/index.js deleted file mode 100644 index aad30831b3..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/js/actions/index.js +++ /dev/null @@ -1,168 +0,0 @@ -import axios from "axios"; -import ActionTypes from "../constants/ActionTypes"; -import config from "../../../public/conf/config.json"; - -export const getApps = () => dispatch => { - - const request = "method=post&content-type=application/json&payload={}&api-endpoint=/application-mgt-store/v1.0/applications"; - - return axios.post(config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request - ).then(res => { - if (res.status === 200) { - let apps = []; - - if (res.data.data.hasOwnProperty("applications")) { - apps = res.data.data.applications; - } - dispatch({type: ActionTypes.GET_APPS, payload: apps}); - } - - }).catch(function (error) { - if (error.response.status === 401) { - window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/store/login'; - } - }); - -}; - -export const getRelease = (uuid) => dispatch => { - - const request = "method=get&content-type=application/json&payload={}&api-endpoint=/application-mgt-store/v1.0/applications/" + uuid; - - return axios.post(config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request - ).then(res => { - if (res.status === 200) { - let release = res.data.data.applicationReleases[0]; - dispatch({ - type: ActionTypes.GET_RELEASE, - payload: { - release: release, - releaseLoading: false - } - }); - } - }).catch(function (error) { - if (error.response.status === 401) { - window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/store/login'; - }else if(error.response.status===404){ - dispatch({ - type: ActionTypes.GET_RELEASE, - payload: { - release: null, - releaseLoading: false - }}); - } - }); - - -}; - -export const openReleasesModal = (app) => dispatch => { - dispatch({ - type: ActionTypes.OPEN_RELEASES_MODAL, - payload: { - app: app - } - }); -}; - - -export const openLifecycleModal = (nextState) => dispatch => { - dispatch({ - type: ActionTypes.OPEN_LIFECYCLE_MODAL, - payload: { - nextState: nextState - } - }); -}; - -export const closeLifecycleModal = () => dispatch => { - dispatch({ - type: ActionTypes.CLOSE_LIFECYCLE_MODAL - }); -}; - -export const setLoading = (stateToLoad) => dispatch => { - dispatch({ - type: ActionTypes.SET_LOADING_STATE, - payload: { - stateToLoad: stateToLoad - } - }); -}; - -export const getLifecycle = () => dispatch => { - const request = "method=get&content-type=application/json&payload={}&api-endpoint=/application-mgt-store/v1.0/applications/lifecycle-config"; - - return axios.post(config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request - ).then(res => { - if (res.status === 200) { - let lifecycle = res.data.data; - dispatch({type: ActionTypes.GET_LIFECYCLE, payload: lifecycle}); - } - - }).catch(function (error) { - if (error.response.status === 401) { - window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/store/login'; - } - }); -}; - -export const updateLifecycleState = (uuid, nextState, reason) => dispatch => { - - const payload = { - action: nextState, - reason: reason - }; - - const request = "method=post&content-type=application/json&payload=" + JSON.stringify(payload) + "&api-endpoint=/application-mgt-store/v1.0/applications/life-cycle/" + uuid; - - - return axios.post(config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request - ).then(res => { - if (res.status === 201) { - let release = res.data.data; - dispatch({type: ActionTypes.UPDATE_LIFECYCLE_STATE, payload: release}); - }else { - alert("error"); - dispatch({ - type: ActionTypes.CLOSE_LIFECYCLE_MODAL - }); - } - - }).catch(function (error) { - if (error.response.status === 401) { - window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/store/login'; - } else if (error.response.status === 500) { - alert("error"); - dispatch({ - type: ActionTypes.CLOSE_LIFECYCLE_MODAL - }); - } - }); - - -}; - -export const getDetailedRating = (uuid) => dispatch => { - const request = "method=get&content-type=application/json&payload={}&api-endpoint=/application-mgt-store/v1.0/reviews/"+uuid+"/rating"; - - return axios.post(config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request - ).then(res => { - if (res.status === 200) { - let detailedRating = res.data.data; - dispatch({type: ActionTypes.GET_DETAILED_RATING, payload: detailedRating}); - } - - }).catch(function (error) { - if (error.response.status === 401) { - window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/store/login'; - } else{ - dispatch({ - type: ActionTypes.GET_DETAILED_RATING, payload: null - }); - } - }); - - -}; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/js/constants/ActionTypes.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/js/constants/ActionTypes.js deleted file mode 100644 index bd47f22074..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/js/constants/ActionTypes.js +++ /dev/null @@ -1,17 +0,0 @@ -import keyMirror from 'keymirror'; - -const ActionTypes = keyMirror({ - LOGIN: null, - GET_APPS: null, - OPEN_RELEASES_MODAL: null, - CLOSE_RELEASES_MODAL: null, - GET_RELEASE: null, - GET_LIFECYCLE: null, - OPEN_LIFECYCLE_MODAL: null, - CLOSE_LIFECYCLE_MODAL: null, - UPDATE_LIFECYCLE_STATE: null, - SET_LOADING_STATE: null, - GET_DETAILED_RATING: null -}); - -export default ActionTypes; \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/js/reducers/index.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/js/reducers/index.js deleted file mode 100644 index fcf1aa7db6..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/js/reducers/index.js +++ /dev/null @@ -1,83 +0,0 @@ -import ActionTypes from "../constants/ActionTypes"; - -const initialState = { - apps: [], - releaseView: { - visible: false, - app: null - }, - release: null, - lifecycle: null, - lifecycleModal: { - visible: false, - nextState: null - }, - loadingState: { - release: true - }, - detailedRating: null - -}; - -function rootReducer(state = initialState, action) { - if (action.type === ActionTypes.GET_APPS) { - return Object.assign({}, state, { - apps: action.payload - }); - } else if (action.type === ActionTypes.OPEN_RELEASES_MODAL) { - return Object.assign({}, state, { - releaseView: { - visible: true, - app: action.payload.app - } - }); - } else if (action.type === ActionTypes.GET_RELEASE) { - let loadingState = {...state.loadingState}; - loadingState.release = action.payload.releaseLoading; - return Object.assign({}, state, { - release: action.payload.release, - loadingState: loadingState - }); - } else if (action.type === ActionTypes.GET_LIFECYCLE) { - return Object.assign({}, state, { - lifecycle: action.payload - }); - } else if (action.type === ActionTypes.OPEN_LIFECYCLE_MODAL) { - return Object.assign({}, state, { - lifecycleModal: { - visible: true, - nextState: action.payload.nextState - } - }); - } else if (action.type === ActionTypes.CLOSE_LIFECYCLE_MODAL) { - return Object.assign({}, state, { - lifecycleModal: { - visible: false, - nextState: null - } - }); - } else if (action.type === ActionTypes.UPDATE_LIFECYCLE_STATE) { - return Object.assign({}, state, { - lifecycleModal: { - visible: false, - nextState: null, - }, - release: action.payload - }); - } else if (action.type === ActionTypes.SET_LOADING_STATE) { - let loadingState = {...state.loadingState}; - loadingState[action.payload.stateToLoad] = true; - return Object.assign({}, state, { - loadingState: loadingState - }); - } else if (action.type === ActionTypes.GET_DETAILED_RATING) { - return Object.assign({}, state, { - detailedRating: action.payload - }); - } - - return state; -} - - -export default rootReducer; \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/js/store/index.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/js/store/index.js deleted file mode 100644 index 04957eb39a..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/js/store/index.js +++ /dev/null @@ -1,5 +0,0 @@ -import { createStore, applyMiddleware } from "redux"; -import rootReducer from "../reducers/index"; -import thunk from "redux-thunk"; -const store = createStore(rootReducer, applyMiddleware(thunk)); -export default store; \ No newline at end of file