Remove origin from configuration file in APPM store

merge-requests/184/head
Jayasanka 5 years ago
parent 62d0a0480a
commit 151ca7d575

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

@ -41,7 +41,7 @@ class AppList extends React.Component {
});
//send request to the invoker
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,
).then(res => {
if (res.status === 200) {
@ -58,7 +58,7 @@ class AppList extends React.Component {
if (error.hasOwnProperty("response") && error.response.status === 401) {
//todo display a popup 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 = window.location.origin+ '/store/login';
} else {
notification["error"]({
message: "There was a problem",

@ -33,7 +33,7 @@ class DetailedRating extends React.Component{
const config = this.props.context;
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 => {
if (res.status === 200) {
let detailedRating = res.data.data;
@ -44,7 +44,7 @@ class DetailedRating extends React.Component{
}).catch(function (error) {
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({
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(
url,
payload,
@ -61,7 +61,7 @@ class ReleaseView extends React.Component {
}).catch((error) => {
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 {
this.setState({
loading: false,

@ -131,7 +131,7 @@ class DeviceInstall extends React.Component {
//send request to the invoker
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 => {
if (res.status === 200) {
@ -148,7 +148,7 @@ class DeviceInstall extends React.Component {
if (error.hasOwnProperty("status") && 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 = window.location.origin+ '/store/login';
} else {
notification["error"]({
message: "There was a problem",

@ -29,7 +29,7 @@ class GroupInstall extends React.Component {
this.setState({data: [], fetching: true});
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 => {
if (res.status === 200) {
@ -49,7 +49,7 @@ class GroupInstall extends React.Component {
}).catch((error) => { console.log(error);
if (error.hasOwnProperty("status") && error.response.status === 401) {
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 {
notification["error"]({
message: "There was a problem",

@ -29,7 +29,7 @@ class RoleInstall extends React.Component {
this.setState({data: [], fetching: true});
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 => {
if (res.status === 200) {
@ -49,7 +49,7 @@ class RoleInstall extends React.Component {
}).catch((error) => { console.log(error);
if (error.hasOwnProperty("status") && error.response.status === 401) {
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 {
notification["error"]({
message: "There was a problem",

@ -31,7 +31,7 @@ class UserInstall extends React.Component {
//send request to the invoker
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 => {
if (res.status === 200) {
@ -51,7 +51,7 @@ class UserInstall extends React.Component {
}).catch((error) => {
if (error.response.hasOwnProperty(status) && error.response.status === 401) {
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 {
notification["error"]({
message: "There was a problem",

@ -54,7 +54,7 @@ class AddReview extends React.Component {
};
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,
).then(res => {
if (res.status === 201) {
@ -86,7 +86,7 @@ class AddReview extends React.Component {
}).catch((error) => {
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 {
this.setState({
loading: false,

@ -26,7 +26,7 @@ class CurrentUsersReview extends React.Component {
const config = this.props.context;
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 => {
if (res.status === 200) {
const data = res.data.data.data;
@ -36,7 +36,7 @@ class CurrentUsersReview extends React.Component {
}).catch((error) => {
if (error.response.hasOwnProperty(status) && error.response.status === 401) {
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 {
notification["error"]({
message: "There was a problem",

@ -32,7 +32,7 @@ class Reviews extends React.Component {
const config = this.props.context;
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}
}).then(res => {
@ -43,7 +43,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 = window.location.origin+ '/store/login';
} else {
notification["error"]({
message: "There was a problem",

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

@ -68,7 +68,7 @@ class EditReview extends React.Component {
};
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,
).then(res => {
if (res.status === 200) {
@ -99,7 +99,7 @@ class EditReview extends React.Component {
}).catch((error) => {
console.log(error);
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 {
this.setState({
loading: false,

@ -9,6 +9,7 @@ const {Text} = Typography;
class Login extends React.Component {
render() {
const config = this.props.context;
return (
<div>
<div className="background">
@ -60,6 +61,7 @@ class NormalLoginForm extends React.Component {
handleSubmit = (e) => {
const thisForm = this;
const config = this.props.context;
console.log(config);
e.preventDefault();
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('&');
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 = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + "/store";
window.location = window.location.origin+ "/store";
}
}).catch(function (error) {
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);

@ -40,7 +40,7 @@ class Release extends React.Component {
//send request to the invoker
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 => {
if (res.status === 200) {
@ -57,7 +57,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 + '/store/login';
window.location.href = window.location.origin+ '/store/login';
} else {
notification["error"]({
message: "There was a problem",

Loading…
Cancel
Save