change 401 redirection in APPM publisher Ui

feature/appm-store/pbac
Jayasanka 6 years ago
parent 92fd8a62be
commit a9de6af5f7

@ -4,6 +4,7 @@
"value": "lightBaseTheme" "value": "lightBaseTheme"
}, },
"serverConfig": { "serverConfig": {
"protocol": "https",
"hostname": "localhost", "hostname": "localhost",
"httpsPort": "9443", "httpsPort": "9443",
"invokerUri": "/api/application-mgt-handler/v1.0/invoke", "invokerUri": "/api/application-mgt-handler/v1.0/invoke",

@ -30,7 +30,7 @@ class DetailedRating extends React.Component{
getData = (uuid)=>{ getData = (uuid)=>{
const request = "method=get&content-type=application/json&payload={}&api-endpoint=/application-mgt-store/v1.0/reviews/"+uuid+"/rating"; const request = "method=get&content-type=application/json&payload={}&api-endpoint=/application-mgt-store/v1.0/reviews/"+uuid+"/rating";
return axios.post('https://' + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request return axios.post(config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
).then(res => { ).then(res => {
if (res.status === 200) { if (res.status === 200) {
let detailedRating = res.data.data; let detailedRating = res.data.data;
@ -41,7 +41,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 = 'https://localhost:9443/store/login'; window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/publisher/login';
} }
}); });
}; };

@ -120,7 +120,7 @@ class ConnectedAppsTable 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('&');
console.log(request); console.log(request);
axios.post('https://' + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request axios.post(config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
).then(res => { ).then(res => {
if (res.status === 200) { if (res.status === 200) {
let apps = []; let apps = [];
@ -143,7 +143,7 @@ class ConnectedAppsTable extends React.Component {
}).catch((error) => { }).catch((error) => {
if (error.response.status === 401) { if (error.response.status === 401) {
message.error('You are not logged in'); message.error('You are not logged in');
window.location.href = 'https://localhost:9443/publisher/login'; window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/publisher/login';
} else { } else {
message.error('Something went wrong... :('); message.error('Something went wrong... :(');
} }

@ -21,7 +21,7 @@ class ManageCategories extends React.Component {
componentDidMount() { componentDidMount() {
const request = "method=get&content-type=application/json&payload={}&api-endpoint=/application-mgt-publisher/v1.0/applications/categories"; const request = "method=get&content-type=application/json&payload={}&api-endpoint=/application-mgt-publisher/v1.0/applications/categories";
axios.post('https://' + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request axios.post(config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
).then(res => { ).then(res => {
if (res.status === 200) { if (res.status === 200) {
let categories = JSON.parse(res.data.data); let categories = JSON.parse(res.data.data);
@ -33,7 +33,7 @@ class ManageCategories extends React.Component {
}).catch((error) => { }).catch((error) => {
if (error.response.status === 401) { if (error.response.status === 401) {
window.location.href = 'https://localhost:9443/publisher/login'; window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/publisher/login';
} else { } else {
message.warning('Something went wrong'); message.warning('Something went wrong');
@ -56,7 +56,7 @@ class ManageCategories extends React.Component {
loading: true loading: true
}); });
const request = "method=delete&content-type=application/json&payload={}&api-endpoint=/application-mgt-publisher/v1.0/admin/applications/categories/" + id; const request = "method=delete&content-type=application/json&payload={}&api-endpoint=/application-mgt-publisher/v1.0/admin/applications/categories/" + id;
axios.post('https://' + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request axios.post(config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
).then(res => { ).then(res => {
if (res.status === 200) { if (res.status === 200) {
notification["success"]({ notification["success"]({
@ -83,7 +83,7 @@ class ManageCategories 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 = 'https://localhost:9443/publisher/login'; window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/publisher/login';
} else { } else {
message.warning('Something went wrong'); message.warning('Something went wrong');
} }
@ -198,7 +198,7 @@ class ManageCategories extends React.Component {
const dataArray = JSON.stringify(tempElements.map(category => category.categoryName)); const dataArray = JSON.stringify(tempElements.map(category => category.categoryName));
const request = "method=post&content-type=application/json&payload=" + dataArray + "&api-endpoint=/application-mgt-publisher/v1.0/admin/applications/categories"; const request = "method=post&content-type=application/json&payload=" + dataArray + "&api-endpoint=/application-mgt-publisher/v1.0/admin/applications/categories";
axios.post('https://' + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request axios.post(config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
).then(res => { ).then(res => {
if (res.status === 200) { if (res.status === 200) {
notification["success"]({ notification["success"]({
@ -220,7 +220,7 @@ class ManageCategories 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 = 'https://localhost:9443/publisher/login'; window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/publisher/login';
} else { } else {
message.warning('Something went wrong'); message.warning('Something went wrong');
} }
@ -259,7 +259,7 @@ class ManageCategories extends React.Component {
isEditModalVisible: false, isEditModalVisible: false,
}); });
const request = "method=put&content-type=application/json&payload={}&api-endpoint=/application-mgt-publisher/v1.0/admin/applications/categories/rename?from="+currentlyEditingId+"%26to="+editingValue; const request = "method=put&content-type=application/json&payload={}&api-endpoint=/application-mgt-publisher/v1.0/admin/applications/categories/rename?from="+currentlyEditingId+"%26to="+editingValue;
axios.post('https://' + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request axios.post(config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
).then(res => { ).then(res => {
if (res.status === 200) { if (res.status === 200) {
notification["success"]({ notification["success"]({
@ -280,7 +280,7 @@ class ManageCategories 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 = 'https://localhost:9443/publisher/login'; window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/publisher/login';
} else { } else {
message.warning('Something went wrong'); message.warning('Something went wrong');
} }

@ -21,7 +21,7 @@ class ManageTags extends React.Component {
componentDidMount() { componentDidMount() {
const request = "method=get&content-type=application/json&payload={}&api-endpoint=/application-mgt-publisher/v1.0/applications/tags"; const request = "method=get&content-type=application/json&payload={}&api-endpoint=/application-mgt-publisher/v1.0/applications/tags";
axios.post('https://' + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request axios.post(config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
).then(res => { ).then(res => {
if (res.status === 200) { if (res.status === 200) {
let categories = JSON.parse(res.data.data); let categories = JSON.parse(res.data.data);
@ -33,7 +33,7 @@ class ManageTags extends React.Component {
}).catch((error) => { }).catch((error) => {
if (error.response.status === 401) { if (error.response.status === 401) {
window.location.href = 'https://localhost:9443/publisher/login'; window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/publisher/login';
} else { } else {
message.warning('Something went wrong'); message.warning('Something went wrong');
@ -56,7 +56,7 @@ class ManageTags extends React.Component {
loading: true loading: true
}); });
const request = "method=delete&content-type=application/json&payload={}&api-endpoint=/application-mgt-publisher/v1.0/admin/applications/categories/" + id; const request = "method=delete&content-type=application/json&payload={}&api-endpoint=/application-mgt-publisher/v1.0/admin/applications/categories/" + id;
axios.post('https://' + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request axios.post(config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
).then(res => { ).then(res => {
if (res.status === 200) { if (res.status === 200) {
notification["success"]({ notification["success"]({
@ -81,7 +81,7 @@ class ManageTags 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 = 'https://localhost:9443/publisher/login'; window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/publisher/login';
} else { } else {
message.warning('Something went wrong'); message.warning('Something went wrong');
} }
@ -196,7 +196,7 @@ class ManageTags extends React.Component {
const dataArray = JSON.stringify(tempElements.map(category => category.categoryName)); const dataArray = JSON.stringify(tempElements.map(category => category.categoryName));
const request = "method=post&content-type=application/json&payload=" + dataArray + "&api-endpoint=/application-mgt-publisher/v1.0/admin/applications/categories"; const request = "method=post&content-type=application/json&payload=" + dataArray + "&api-endpoint=/application-mgt-publisher/v1.0/admin/applications/categories";
axios.post('https://' + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request axios.post(config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
).then(res => { ).then(res => {
if (res.status === 200) { if (res.status === 200) {
notification["success"]({ notification["success"]({
@ -218,7 +218,7 @@ class ManageTags 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 = 'https://localhost:9443/publisher/login'; window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/publisher/login';
} else { } else {
message.warning('Something went wrong'); message.warning('Something went wrong');
} }
@ -257,7 +257,7 @@ class ManageTags extends React.Component {
isEditModalVisible: false, isEditModalVisible: false,
}); });
const request = "method=put&content-type=application/json&payload={}&api-endpoint=/application-mgt-publisher/v1.0/admin/applications/categories?from="+currentlyEditingId+"%26to="+editingValue; const request = "method=put&content-type=application/json&payload={}&api-endpoint=/application-mgt-publisher/v1.0/admin/applications/categories?from="+currentlyEditingId+"%26to="+editingValue;
axios.post('https://' + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request axios.post(config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
).then(res => { ).then(res => {
if (res.status === 200) { if (res.status === 200) {
notification["success"]({ notification["success"]({
@ -278,7 +278,7 @@ class ManageTags 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 = 'https://localhost:9443/publisher/login'; window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/publisher/login';
} else { } else {
message.warning('Something went wrong'); message.warning('Something went wrong');
} }

@ -6,7 +6,7 @@ export const getApps = () => dispatch => {
const request = "method=post&content-type=application/json&payload={}&api-endpoint=/application-mgt-publisher/v1.0/applications"; const request = "method=post&content-type=application/json&payload={}&api-endpoint=/application-mgt-publisher/v1.0/applications";
return axios.post('https://' + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request return axios.post(config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
).then(res => { ).then(res => {
if (res.status === 200) { if (res.status === 200) {
let apps = []; let apps = [];
@ -19,7 +19,7 @@ export const getApps = () => dispatch => {
}).catch(function (error) { }).catch(function (error) {
if (error.response.status === 401) { if (error.response.status === 401) {
window.location.href = 'https://localhost:9443/publisher/login'; window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/publisher/login';
} }
}); });
@ -29,7 +29,7 @@ export const getRelease = (uuid) => dispatch => {
const request = "method=get&content-type=application/json&payload={}&api-endpoint=/application-mgt-publisher/v1.0/applications/release/" + uuid; const request = "method=get&content-type=application/json&payload={}&api-endpoint=/application-mgt-publisher/v1.0/applications/release/" + uuid;
return axios.post('https://' + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request return axios.post(config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
).then(res => { ).then(res => {
if (res.status === 200) { if (res.status === 200) {
let release = res.data.data; let release = res.data.data;
@ -38,7 +38,7 @@ export const getRelease = (uuid) => dispatch => {
}).catch(function (error) { }).catch(function (error) {
if (error.response.status === 401) { if (error.response.status === 401) {
window.location.href = 'https://localhost:9443/publisher/login'; window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/publisher/login';
} }
}); });
@ -73,7 +73,7 @@ export const closeLifecycleModal = () => dispatch => {
export const getLifecycle = () => dispatch => { export const getLifecycle = () => dispatch => {
const request = "method=get&content-type=application/json&payload={}&api-endpoint=/application-mgt-publisher/v1.0/applications/lifecycle-config"; const request = "method=get&content-type=application/json&payload={}&api-endpoint=/application-mgt-publisher/v1.0/applications/lifecycle-config";
return axios.post('https://' + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request return axios.post(config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
).then(res => { ).then(res => {
if (res.status === 200) { if (res.status === 200) {
let lifecycle = res.data.data; let lifecycle = res.data.data;
@ -82,7 +82,7 @@ export const getLifecycle = () => dispatch => {
}).catch(function (error) { }).catch(function (error) {
if (error.response.status === 401) { if (error.response.status === 401) {
window.location.href = 'https://localhost:9443/publisher/login'; window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/publisher/login';
} }
}); });
}; };
@ -97,7 +97,7 @@ export const updateLifecycleState = (uuid, nextState, reason) => dispatch => {
const request = "method=post&content-type=application/json&payload=" + JSON.stringify(payload) + "&api-endpoint=/application-mgt-publisher/v1.0/applications/life-cycle/" + uuid; const request = "method=post&content-type=application/json&payload=" + JSON.stringify(payload) + "&api-endpoint=/application-mgt-publisher/v1.0/applications/life-cycle/" + uuid;
return axios.post('https://' + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request return axios.post(config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
).then(res => { ).then(res => {
if (res.status === 201) { if (res.status === 201) {
let release = res.data.data; let release = res.data.data;
@ -111,7 +111,7 @@ export const updateLifecycleState = (uuid, nextState, reason) => dispatch => {
}).catch(function (error) { }).catch(function (error) {
if (error.response.status === 401) { if (error.response.status === 401) {
window.location.href = 'https://localhost:9443/publisher/login'; window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/publisher/login';
} else if (error.response.status === 500) { } else if (error.response.status === 500) {
alert("error"); alert("error");
dispatch({ dispatch({

@ -59,7 +59,7 @@ class NormalLoginForm extends React.Component {
}); });
console.log('Received values of form: ', values); console.log('Received values of form: ', values);
let data = "username=" + values.username + "&password=" + values.password + "&platform=publisher"; let data = "username=" + values.username + "&password=" + values.password + "&platform=publisher";
axios.post('https://'+config.serverConfig.hostname+':'+config.serverConfig.httpsPort+config.serverConfig.loginUri, data axios.post(config.serverConfig.protocol + "://"+config.serverConfig.hostname+':'+config.serverConfig.httpsPort+config.serverConfig.loginUri, data
).then(res => { ).then(res => {
if (res.status === 200) { if (res.status === 200) {
window.location = res.data.url; window.location = res.data.url;

Loading…
Cancel
Save