@@ -57,6 +58,7 @@ class NormalLoginForm extends React.Component {
}
handleSubmit = (e) => {
+ const config = this.props.context;
const thisForm = this;
e.preventDefault();
this.props.form.validateFields((err, values) => {
@@ -75,10 +77,10 @@ class NormalLoginForm extends React.Component {
const request = Object.keys(parameters).map(key => key + '=' + parameters[key]).join('&');
- axios.post(config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.loginUri, request
+ axios.post(window.location.origin+ config.serverConfig.loginUri, request
).then(res=>{
if (res.status === 200) {
- window.location = res.data.url;
+ window.location = window.location.origin+"publisher";
}
}).catch(function (error) {
if (error.hasOwnProperty("response") && error.response.status === 400) {
@@ -151,6 +153,6 @@ class NormalLoginForm extends React.Component {
}
}
-const WrappedNormalLoginForm = Form.create({name: 'normal_login'})(NormalLoginForm);
+const WrappedNormalLoginForm = Form.create({name: 'normal_login'})(withConfigContext(NormalLoginForm));
-export default Login;
+export default withConfigContext(Login);
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 ec1ae9affd..61b3975d71 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
@@ -4,7 +4,7 @@ import {Switch, Link} from "react-router-dom";
import RouteWithSubRoutes from "../../components/RouteWithSubRoutes"
import {Redirect} from 'react-router'
import "../../App.css";
-import config from "../../../public/conf/config.json";
+import {withConfigContext} from "../../context/ConfigContext";
const {Header, Content, Footer} = Layout;
const {SubMenu} = Menu;
@@ -15,7 +15,7 @@ class Dashboard extends React.Component {
this.state = {
routes: props.routes
};
-
+ const config = this.props.context;
this.Logo = config.theme.logo;
}
@@ -73,4 +73,4 @@ class Dashboard extends React.Component {
}
}
-export default Dashboard;
+export default withConfigContext(Dashboard);
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/apps/Apps-old.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/apps/Apps-old.js
deleted file mode 100644
index 1ba489a6ac..0000000000
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/apps/Apps-old.js
+++ /dev/null
@@ -1,60 +0,0 @@
-import React from "react";
-import "antd/dist/antd.css";
-import {PageHeader, Typography,Input, Button, Row, Col} from "antd";
-import AppList from "../../../components/apps/AppList";
-// import ReleaseModal from "../../../components/apps/ReleaseModal";
-
-const Search = Input.Search;
-
-const routes = [
- {
- path: 'index',
- breadcrumbName: 'Publisher',
- },
- {
- path: 'first',
- breadcrumbName: 'Dashboard',
- },
- {
- path: 'second',
- breadcrumbName: 'Apps',
- },
-];
-
-
-class Apps extends React.Component {
- routes;
- constructor(props) {
- super(props);
- this.routes = props.routes;
-
- }
-
- render() {
- return (
-
-
-
-
-
- console.log(value)}
- style={{ width: 200}}
- />
-
-
-
- {/*
*/}
-
-
-
-
-
- );
- }
-}
-
-export default Apps;
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/apps/Apps.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/apps/Apps.js
index 9c6848d5f8..b982ecf2f7 100644
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/apps/Apps.js
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/apps/Apps.js
@@ -1,25 +1,6 @@
import React from "react";
-import {PageHeader, Typography,Input, Button, Row, Col} from "antd";
import ListApps from "../../../components/apps/list-apps/ListApps";
-const Search = Input.Search;
-
-const routes = [
- {
- path: 'index',
- breadcrumbName: 'Publisher',
- },
- {
- path: 'first',
- breadcrumbName: 'Dashboard',
- },
- {
- path: 'second',
- breadcrumbName: 'Apps',
- },
-];
-
-
class Apps extends React.Component {
routes;
constructor(props) {
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 e987994df3..a4a739a06d 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
@@ -2,9 +2,9 @@ import React from "react";
import '../../../../App.css';
import {Typography, Row, Col, message, Card, notification} 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/LifeCycle";
+import {withConfigContext} from "../../../../context/ConfigContext";
const {Title} = Typography;
@@ -43,10 +43,11 @@ class Release extends React.Component {
};
fetchData = (uuid) => {
+ const config = this.props.context;
//send request to the invoker
axios.get(
- config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/release/"+ uuid,
+ window.location.origin+ config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/release/"+ uuid,
).then(res => {
if (res.status === 200) {
const app = res.data.data;
@@ -65,7 +66,7 @@ class Release extends React.Component {
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 + '/publisher/login';
+ window.location.href = window.location.origin+ '/publisher/login';
} else {
notification["error"]({
message: "There was a problem",
@@ -112,4 +113,4 @@ class Release extends React.Component {
}
}
-export default Release;
+export default withConfigContext(Release);