From 2e690892d5a7cec976dffe4918ab77a0718ba4b0 Mon Sep 17 00:00:00 2001 From: Jayasanka Date: Sun, 6 Oct 2019 17:06:26 +0530 Subject: [PATCH] Fix app name length issue in APPM Store --- .../apps/release/edit-release/EditRelease.js | 42 +++++++++++-------- .../react-app/src/js/Utils.js | 5 ++- .../react-app/src/pages/Login.js | 9 +++- .../src/pages/dashboard/Dashboard.js | 9 +++- .../react-app/src/components/apps/AppCard.css | 7 ++++ .../react-app/src/components/apps/AppCard.js | 2 +- .../react-app/src/js/Utils.js | 2 +- 7 files changed, 51 insertions(+), 25 deletions(-) diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/release/edit-release/EditRelease.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/release/edit-release/EditRelease.js index 9ad5f239f0..ecc6000ffe 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/release/edit-release/EditRelease.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/release/edit-release/EditRelease.js @@ -117,7 +117,7 @@ class EditReleaseModal extends React.Component { showModal = () => { - const {release} = this.props; + const {app, release} = this.props; const {formConfig} = this.state; const {specificElements} = formConfig; let metaData = []; @@ -143,6 +143,14 @@ class EditReleaseModal extends React.Component { } }); + // if (specificElements.hasOwnProperty("packageName")) { + // this.props.form.setFields({ + // packageName: { + // value: app.packageName + // } + // }); + // } + if (specificElements.hasOwnProperty("version")) { this.props.form.setFields({ version: { @@ -238,10 +246,10 @@ class EditReleaseModal extends React.Component { if (specificElements.hasOwnProperty("url")) { release.url = values.url; } - - if (specificElements.hasOwnProperty("packageName")) { - release.packageName = values.packageName; - } + // + // if (specificElements.hasOwnProperty("packageName")) { + // release.packageName = values.packageName; + // } if (icons.length === 1) { data.append('icon', icons[0].originFileObj); @@ -362,18 +370,18 @@ class EditReleaseModal extends React.Component { )} - {formConfig.specificElements.hasOwnProperty("packageName") && ( - - {getFieldDecorator('packageName', { - rules: [{ - required: true, - message: 'Please input the package name' - }], - })( - - )} - - )} + {/*{formConfig.specificElements.hasOwnProperty("packageName") && (*/} + {/* */} + {/* {getFieldDecorator('packageName', {*/} + {/* rules: [{*/} + {/* required: true,*/} + {/* message: 'Please input the package name'*/} + {/* }],*/} + {/* })(*/} + {/* */} + {/* )}*/} + {/* */} + {/*)}*/} {formConfig.specificElements.hasOwnProperty("url") && ( diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/js/Utils.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/js/Utils.js index 9cbc439bba..2ef4f8bf0f 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/js/Utils.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/js/Utils.js @@ -16,11 +16,12 @@ * under the License. */ -import {message, notification} from "antd"; +import {notification} from "antd"; export const handleApiError = (error, message) => { if (error.hasOwnProperty("response") && error.response.status === 401) { - window.location.href = window.location.origin + '/publisher/login'; + const redirectUrl = encodeURI(window.location.href); + window.location.href = window.location.origin + `/publisher/login?redirect=${redirectUrl}`; } else { notification["error"]({ message: "There was a problem", diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/Login.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/Login.js index 1973099955..63ea79f8ca 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/Login.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/Login.js @@ -99,7 +99,12 @@ class NormalLoginForm extends React.Component { axios.post(window.location.origin+ config.serverConfig.loginUri, request ).then(res=>{ if (res.status === 200) { - window.location = window.location.origin+"/publisher"; + let redirectUrl = window.location.origin+"/publisher"; + const searchParams = new URLSearchParams(window.location.search); + if(searchParams.has("redirect")){ + redirectUrl = searchParams.get("redirect"); + } + window.location = redirectUrl; } }).catch(function (error) { handleApiError(error, "Error occurred while trying to login."); @@ -152,7 +157,7 @@ class NormalLoginForm extends React.Component { )}
Forgot password -
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/Dashboard.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/Dashboard.js index 5cd6ce5de5..044851a503 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/Dashboard.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/Dashboard.js @@ -81,12 +81,12 @@ class Dashboard extends React.Component { > - Public APP + Public App - Enterprise APP + Enterprise App @@ -94,6 +94,11 @@ class Dashboard extends React.Component { Web Clip + + + Custom App + + */} - {app.name}
+ {app.name}
{app.subMethod.toLowerCase()}
{ } else { notification["error"]({ message: "There was a problem", - duration: 0, + duration: 10, description: message, }); }