Remove origin from configuration file in APPM store

4.x.x
Jayasanka 5 years ago
parent 62d0a0480a
commit 151ca7d575

@ -6,9 +6,6 @@
"primaryColor": "rgb(24, 144, 255)" "primaryColor": "rgb(24, 144, 255)"
}, },
"serverConfig": { "serverConfig": {
"protocol": "https",
"hostname": "localhost",
"httpsPort": "9443",
"invokerUri": "/ui-request-handler/invoke/application-mgt-store/v1.0", "invokerUri": "/ui-request-handler/invoke/application-mgt-store/v1.0",
"invoker": { "invoker": {
"uri": "/store-ui-request-handler/invoke", "uri": "/store-ui-request-handler/invoke",

@ -41,7 +41,7 @@ class AppList extends React.Component {
}); });
//send request to the invoker //send request to the invoker
axios.post( axios.post(
config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.store + "/applications/", window.location.origin+ config.serverConfig.invoker.uri + config.serverConfig.invoker.store + "/applications/",
payload, payload,
).then(res => { ).then(res => {
if (res.status === 200) { if (res.status === 200) {
@ -58,7 +58,7 @@ class AppList extends React.Component {
if (error.hasOwnProperty("response") && error.response.status === 401) { if (error.hasOwnProperty("response") && error.response.status === 401) {
//todo display a popup with error //todo display a popup with error
message.error('You are not logged in'); message.error('You are not logged in');
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + '/store/login'; window.location.href = window.location.origin+ '/store/login';
} else { } else {
notification["error"]({ notification["error"]({
message: "There was a problem", message: "There was a problem",

@ -33,7 +33,7 @@ class DetailedRating extends React.Component{
const config = this.props.context; const config = this.props.context;
return axios.get( return axios.get(
config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri +config.serverConfig.invoker.store+"/reviews/"+uuid+"/"+type+"-rating", window.location.origin+ config.serverConfig.invoker.uri +config.serverConfig.invoker.store+"/reviews/"+uuid+"/"+type+"-rating",
).then(res => { ).then(res => {
if (res.status === 200) { if (res.status === 200) {
let detailedRating = res.data.data; let detailedRating = res.data.data;
@ -44,7 +44,7 @@ class DetailedRating extends React.Component{
}).catch(function (error) { }).catch(function (error) {
if (error.response.status === 401) { if (error.response.status === 401) {
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/publisher/login'; window.location.href = window.location.origin+'/publisher/login';
} }
}); });
}; };

@ -29,7 +29,7 @@ class ReleaseView extends React.Component {
this.setState({ this.setState({
loading: true, loading: true,
}); });
const url = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.store + "/subscription/" + uuid + "/" + type + "/install"; const url = window.location.origin+ config.serverConfig.invoker.uri + config.serverConfig.invoker.store + "/subscription/" + uuid + "/" + type + "/install";
axios.post( axios.post(
url, url,
payload, payload,
@ -61,7 +61,7 @@ class ReleaseView extends React.Component {
}).catch((error) => { }).catch((error) => {
if (error.response.status === 401) { if (error.response.status === 401) {
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + '/store/login'; window.location.href = window.location.origin+ '/store/login';
} else { } else {
this.setState({ this.setState({
loading: false, loading: false,

@ -131,7 +131,7 @@ class DeviceInstall extends React.Component {
//send request to the invoker //send request to the invoker
axios.get( axios.get(
config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.deviceMgt+"/devices?" + encodedExtraParams, window.location.origin+ config.serverConfig.invoker.uri + config.serverConfig.invoker.deviceMgt+"/devices?" + encodedExtraParams,
).then(res => { ).then(res => {
if (res.status === 200) { if (res.status === 200) {
@ -148,7 +148,7 @@ class DeviceInstall extends React.Component {
if (error.hasOwnProperty("status") && error.response.status === 401) { if (error.hasOwnProperty("status") && error.response.status === 401) {
//todo display a popop with error //todo display a popop with error
message.error('You are not logged in'); message.error('You are not logged in');
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + '/store/login'; window.location.href = window.location.origin+ '/store/login';
} else { } else {
notification["error"]({ notification["error"]({
message: "There was a problem", message: "There was a problem",

@ -29,7 +29,7 @@ class GroupInstall extends React.Component {
this.setState({data: [], fetching: true}); this.setState({data: [], fetching: true});
axios.post( axios.post(
config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.deviceMgt+"/groups?name=" + value, window.location.origin+ config.serverConfig.invoker.uri + config.serverConfig.invoker.deviceMgt+"/groups?name=" + value,
).then(res => { ).then(res => {
if (res.status === 200) { if (res.status === 200) {
@ -49,7 +49,7 @@ class GroupInstall extends React.Component {
}).catch((error) => { console.log(error); }).catch((error) => { console.log(error);
if (error.hasOwnProperty("status") && error.response.status === 401) { if (error.hasOwnProperty("status") && error.response.status === 401) {
message.error('You are not logged in'); message.error('You are not logged in');
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/store/login'; window.location.href = window.location.origin+'/store/login';
} else { } else {
notification["error"]({ notification["error"]({
message: "There was a problem", message: "There was a problem",

@ -29,7 +29,7 @@ class RoleInstall extends React.Component {
this.setState({data: [], fetching: true}); this.setState({data: [], fetching: true});
axios.get( axios.get(
config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.deviceMgt+"/roles?filter=" + value, window.location.origin+ config.serverConfig.invoker.uri + config.serverConfig.invoker.deviceMgt+"/roles?filter=" + value,
).then(res => { ).then(res => {
if (res.status === 200) { if (res.status === 200) {
@ -49,7 +49,7 @@ class RoleInstall extends React.Component {
}).catch((error) => { console.log(error); }).catch((error) => { console.log(error);
if (error.hasOwnProperty("status") && error.response.status === 401) { if (error.hasOwnProperty("status") && error.response.status === 401) {
message.error('You are not logged in'); message.error('You are not logged in');
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/store/login'; window.location.href = window.location.origin+'/store/login';
} else { } else {
notification["error"]({ notification["error"]({
message: "There was a problem", message: "There was a problem",

@ -31,7 +31,7 @@ class UserInstall extends React.Component {
//send request to the invoker //send request to the invoker
axios.get( axios.get(
config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.deviceMgt+"/users/search?username=" + value, window.location.origin+ config.serverConfig.invoker.uri + config.serverConfig.invoker.deviceMgt+"/users/search?username=" + value,
).then(res => { ).then(res => {
if (res.status === 200) { if (res.status === 200) {
@ -51,7 +51,7 @@ class UserInstall extends React.Component {
}).catch((error) => { }).catch((error) => {
if (error.response.hasOwnProperty(status) && error.response.status === 401) { if (error.response.hasOwnProperty(status) && error.response.status === 401) {
message.error('You are not logged in'); message.error('You are not logged in');
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + '/store/login'; window.location.href = window.location.origin+ '/store/login';
} else { } else {
notification["error"]({ notification["error"]({
message: "There was a problem", message: "There was a problem",

@ -54,7 +54,7 @@ class AddReview extends React.Component {
}; };
axios.post( axios.post(
config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.store + "/reviews/" + uuid, window.location.origin+ config.serverConfig.invoker.uri + config.serverConfig.invoker.store + "/reviews/" + uuid,
payload, payload,
).then(res => { ).then(res => {
if (res.status === 201) { if (res.status === 201) {
@ -86,7 +86,7 @@ class AddReview extends React.Component {
}).catch((error) => { }).catch((error) => {
if (error.response.status === 401) { if (error.response.status === 401) {
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + '/store/login'; window.location.href = window.location.origin+ '/store/login';
} else { } else {
this.setState({ this.setState({
loading: false, loading: false,

@ -26,7 +26,7 @@ class CurrentUsersReview extends React.Component {
const config = this.props.context; const config = this.props.context;
axios.get( axios.get(
config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.store + "/reviews/app/user/" + uuid, window.location.origin+ config.serverConfig.invoker.uri + config.serverConfig.invoker.store + "/reviews/app/user/" + uuid,
).then(res => { ).then(res => {
if (res.status === 200) { if (res.status === 200) {
const data = res.data.data.data; const data = res.data.data.data;
@ -36,7 +36,7 @@ class CurrentUsersReview extends React.Component {
}).catch((error) => { }).catch((error) => {
if (error.response.hasOwnProperty(status) && error.response.status === 401) { if (error.response.hasOwnProperty(status) && error.response.status === 401) {
message.error('You are not logged in'); message.error('You are not logged in');
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + '/store/login'; window.location.href = window.location.origin+ '/store/login';
} else { } else {
notification["error"]({ notification["error"]({
message: "There was a problem", message: "There was a problem",

@ -32,7 +32,7 @@ class Reviews extends React.Component {
const config = this.props.context; const config = this.props.context;
axios.get( axios.get(
config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri +config.serverConfig.invoker.store+"/reviews/"+type+"/"+uuid, window.location.origin+ config.serverConfig.invoker.uri +config.serverConfig.invoker.store+"/reviews/"+type+"/"+uuid,
{ {
headers: {'X-Platform': config.serverConfig.platform} headers: {'X-Platform': config.serverConfig.platform}
}).then(res => { }).then(res => {
@ -43,7 +43,7 @@ class Reviews extends React.Component {
}).catch(function (error) { }).catch(function (error) {
if (error.response.status === 401) { if (error.response.status === 401) {
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + '/store/login'; window.location.href = window.location.origin+ '/store/login';
} else { } else {
notification["error"]({ notification["error"]({
message: "There was a problem", message: "There was a problem",

@ -40,8 +40,7 @@ class SingleReview extends React.Component {
const {id} = this.state.review; const {id} = this.state.review;
const config = this.props.context; const config = this.props.context;
let url = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + let url =window.location.origin+ config.serverConfig.invoker.uri + config.serverConfig.invoker.store;
config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.store;
// call as an admin api if the review is not a personal review // call as an admin api if the review is not a personal review
if (!this.props.isPersonalReview) { if (!this.props.isPersonalReview) {
@ -63,7 +62,7 @@ class SingleReview extends React.Component {
}).catch((error) => { }).catch((error) => {
console.log(error); console.log(error);
if (error.hasOwnProperty("response") && error.response.status === 401) { if (error.hasOwnProperty("response") && error.response.status === 401) {
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + '/store/login'; window.location.href = window.location.origin+ '/store/login';
} else { } else {
notification["error"]({ notification["error"]({
message: "There was a problem", message: "There was a problem",

@ -68,7 +68,7 @@ class EditReview extends React.Component {
}; };
axios.put( axios.put(
config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.store + "/reviews/" + uuid+"/"+id, window.location.origin+ config.serverConfig.invoker.uri + config.serverConfig.invoker.store + "/reviews/" + uuid+"/"+id,
payload, payload,
).then(res => { ).then(res => {
if (res.status === 200) { if (res.status === 200) {
@ -99,7 +99,7 @@ class EditReview extends React.Component {
}).catch((error) => { }).catch((error) => {
console.log(error); console.log(error);
if (error.hasOwnProperty("response") && error.response.status === 401) { if (error.hasOwnProperty("response") && error.response.status === 401) {
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + '/store/login'; window.location.href = window.location.origin+ '/store/login';
} else { } else {
this.setState({ this.setState({
loading: false, loading: false,

@ -9,6 +9,7 @@ const {Text} = Typography;
class Login extends React.Component { class Login extends React.Component {
render() { render() {
const config = this.props.context;
return ( return (
<div> <div>
<div className="background"> <div className="background">
@ -60,6 +61,7 @@ class NormalLoginForm extends React.Component {
handleSubmit = (e) => { handleSubmit = (e) => {
const thisForm = this; const thisForm = this;
const config = this.props.context; const config = this.props.context;
console.log(config);
e.preventDefault(); e.preventDefault();
this.props.form.validateFields((err, values) => { this.props.form.validateFields((err, values) => {
@ -78,10 +80,10 @@ class NormalLoginForm extends React.Component {
const request = Object.keys(parameters).map(key => key + '=' + parameters[key]).join('&'); 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 => { ).then(res => {
if (res.status === 200) { if (res.status === 200) {
window.location = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + "/store"; window.location = window.location.origin+ "/store";
} }
}).catch(function (error) { }).catch(function (error) {
if (error.response.status === 400) { if (error.response.status === 400) {
@ -146,6 +148,6 @@ class NormalLoginForm extends React.Component {
} }
} }
const WrappedNormalLoginForm = Form.create({name: 'normal_login'})(NormalLoginForm); const WrappedNormalLoginForm = withConfigContext(Form.create({name: 'normal_login'})(NormalLoginForm));
export default withConfigContext(Login); export default withConfigContext(Login);

@ -40,7 +40,7 @@ class Release extends React.Component {
//send request to the invoker //send request to the invoker
axios.get( axios.get(
config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.store+"/applications/"+uuid, window.location.origin+ config.serverConfig.invoker.uri + config.serverConfig.invoker.store+"/applications/"+uuid,
).then(res => { ).then(res => {
if (res.status === 200) { if (res.status === 200) {
@ -57,7 +57,7 @@ class Release extends React.Component {
if (error.hasOwnProperty("response") && error.response.status === 401) { if (error.hasOwnProperty("response") && error.response.status === 401) {
//todo display a popop with error //todo display a popop with error
message.error('You are not logged in'); message.error('You are not logged in');
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + '/store/login'; window.location.href = window.location.origin+ '/store/login';
} else { } else {
notification["error"]({ notification["error"]({
message: "There was a problem", message: "There was a problem",

Loading…
Cancel
Save