From 65c102eb86308d1952466ebad7f431d4448bd7d2 Mon Sep 17 00:00:00 2001 From: Jayasanka Date: Thu, 20 Jun 2019 23:24:37 +0530 Subject: [PATCH 1/2] Create new lifecycle component in APPM publisher UI --- .../react-app/package.json | 1 + .../src/components/apps/release/LifeCycle.css | 7 - .../components/apps/release/ReleaseView.js | 2 +- .../apps/release/lifeCycle/LifeCycle.css | 17 ++ .../apps/release/lifeCycle/LifeCycle.js | 225 ++++++++++++++++++ .../components/apps/release/review/Reviews.js | 2 +- .../pages/dashboard/apps/release/Release.js | 43 ++-- 7 files changed, 265 insertions(+), 32 deletions(-) delete mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/release/LifeCycle.css create mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/release/lifeCycle/LifeCycle.css create mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/release/lifeCycle/LifeCycle.js diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/package.json b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/package.json index be4c3bbe85..127a5e7eae 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/package.json +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/package.json @@ -22,6 +22,7 @@ "react-dom": "^16.8.4", "react-highlight-words": "^0.16.0", "react-infinite-scroller": "^1.2.4", + "react-quill": "^1.3.3", "react-router": "latest", "react-router-config": "^5.0.0", "react-router-dom": "latest", diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/release/LifeCycle.css b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/release/LifeCycle.css deleted file mode 100644 index 912a757eba..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/release/LifeCycle.css +++ /dev/null @@ -1,7 +0,0 @@ -.srd-diagram{ - height: 100%; - min-height: 300px; - background-color: #3c3c3c !important; - background-image: linear-gradient(0deg, transparent 24%, rgba(255, 255, 255, 0.05) 25%, rgba(255, 255, 255, 0.05) 26%, transparent 27%, transparent 74%, rgba(255, 255, 255, 0.05) 75%, rgba(255, 255, 255, 0.05) 76%, transparent 77%, transparent), linear-gradient(90deg, transparent 24%, rgba(255, 255, 255, 0.05) 25%, rgba(255, 255, 255, 0.05) 26%, transparent 27%, transparent 74%, rgba(255, 255, 255, 0.05) 75%, rgba(255, 255, 255, 0.05) 76%, transparent 77%, transparent); - background-size: 50px 50px; -} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/release/ReleaseView.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/release/ReleaseView.js index 5764b8ce9a..31290b0a89 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/release/ReleaseView.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/release/ReleaseView.js @@ -41,7 +41,7 @@ class ReleaseView extends React.Component { + + + + You are going to change the lifecycle state from,
+ {currentStatus}to {selectedStatus} +
+

+ +
+ + + ); + } + +} + +export default LifeCycle; \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/release/review/Reviews.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/release/review/Reviews.js index b4ace63734..bc3726ba01 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/release/review/Reviews.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/release/review/Reviews.js @@ -42,7 +42,7 @@ class Reviews extends React.Component { }).catch(function (error) { if (error.response.status === 401) { - window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + '/store/login'; + window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + '/publisher/login'; } else { message.warning('Something went wrong'); diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/apps/release/Release.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/apps/release/Release.js index a9a18c6e4a..3536a8e06b 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/apps/release/Release.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/apps/release/Release.js @@ -4,24 +4,10 @@ import {PageHeader, Typography, Row, Col, message, Card} from "antd"; import axios from 'axios'; import config from "../../../../../public/conf/config.json"; import ReleaseView from "../../../../components/apps/release/ReleaseView"; -import LifeCycle from "../../../../components/apps/release/LifeCycle"; +import LifeCycle from "../../../../components/apps/release/lifeCycle/LifeCycle"; const {Title} = Typography; -const routes = [ - { - path: 'index', - breadcrumbName: 'Publisher', - }, - { - path: 'first', - breadcrumbName: 'Dashboard', - }, - { - path: 'second', - breadcrumbName: 'Apps', - }, -]; class Release extends React.Component { @@ -33,7 +19,9 @@ class Release extends React.Component { this.state = { loading: true, app: null, - uuid: null + uuid: null, + release: null, + currentLifecycleStatus: null, } } @@ -48,6 +36,11 @@ class Release extends React.Component { this.fetchData(uuid); } } + changeCurrentLifecycleStatus = (status) =>{ + this.setState({ + currentLifecycleStatus: status + }); + }; fetchData = (uuid) => { @@ -59,19 +52,23 @@ class Release extends React.Component { } ).then(res => { if (res.status === 200) { - let app = res.data.data; + const app = res.data.data; + const release = (app !== null) ? app.applicationReleases[0] : null; + const currentLifecycleStatus = (release!==null) ? release.currentStatus : null; this.setState({ app: app, + release: release, + currentLifecycleStatus: currentLifecycleStatus, loading: false, uuid: uuid - }) + }); } }).catch((error) => { if (error.hasOwnProperty("response") && error.response.status === 401) { //todo display a popop with error message.error('You are not logged in'); - window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + '/store/login'; + window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + '/publisher/login'; } else { message.error('Something went wrong... :('); } @@ -81,9 +78,9 @@ class Release extends React.Component { }; render() { - const {app} = this.state; + const {app, release, currentLifecycleStatus} = this.state; - if (app == null) { + if (release == null) { return (
No Apps Found @@ -98,12 +95,12 @@ class Release extends React.Component { - + - {/**/} + From 05d23272050fbfc272277fa578091cb418649613 Mon Sep 17 00:00:00 2001 From: Jayasanka Date: Fri, 21 Jun 2019 00:02:19 +0530 Subject: [PATCH 2/2] Complete lifecycle component in APPM publisher UI --- .../apps/release/lifeCycle/LifeCycle.js | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/release/lifeCycle/LifeCycle.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/release/lifeCycle/LifeCycle.js index 72f2b11869..24f721a0c4 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/release/lifeCycle/LifeCycle.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/release/lifeCycle/LifeCycle.js @@ -1,5 +1,5 @@ import React from "react"; -import {Typography, Tag, Divider, Select, Button, Modal, message, notification} from "antd"; +import {Typography, Tag, Divider, Select, Button, Modal, message, notification, Collapse} from "antd"; import axios from "axios"; import config from "../../../../../public/conf/config.json"; @@ -9,6 +9,7 @@ import './LifeCycle.css'; const {Text, Title, Paragraph} = Typography; const {Option} = Select; +const Panel = Collapse.Panel; const modules = { toolbar: [ @@ -193,6 +194,33 @@ class LifeCycle extends React.Component { Change + + + Lorem Ipsum + + { + Object.keys(lifecycle).map(lifecycleState => { + return ( + + { + Object.keys(lifecycle).map(state => { + // console.log(lifecycle[lifecycleState].proceedingStates); + const isEnabled = lifecycle[lifecycleState].hasOwnProperty("proceedingStates") && (lifecycle[lifecycleState].proceedingStates.includes(state)); + const color = isEnabled ? "green" : ""; + return ( + {state} + ) + }) + } + + ) + }) + } + + +