Change error messages in publisher

feature/appm-store/pbac
Jayasanka 5 years ago
parent e5e7dc5bcc
commit a5f75df99a

@ -1,5 +1,5 @@
import React from "react";
import {Row, Typography, Icon} from "antd";
import {Row, Typography, Icon, message} from "antd";
import StarRatings from "react-star-ratings";
import "./DetailedRating.css";
import config from "../../../../public/conf/config.json";
@ -41,8 +41,10 @@ class DetailedRating extends React.Component{
}
}).catch(function (error) {
if (error.response.status === 401) {
if (error.hasOwnProperty("response") && error.response.status === 401) {
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/publisher/login';
} else {
message.error('Something went wrong while trying to load rating for the release... :(');
}
});
};

@ -92,10 +92,8 @@ class AppDetailsDrawer extends React.Component {
getCategories = () => {
axios.get(
config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/categories",
{
headers: {'X-Platform': config.serverConfig.platform}
}).then(res => {
config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/categories"
).then(res => {
if (res.status === 200) {
const categories = JSON.parse(res.data.data);
@ -115,10 +113,10 @@ class AppDetailsDrawer extends React.Component {
}
}).catch((error) => {
if (error.response.status === 401) {
if (error.hasOwnProperty("response") && error.response.status === 401) {
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + '/publisher/login';
} else {
message.warning('Something went wrong');
message.warning('Something went wrong while trying to load app details... :(');
}
this.setState({
@ -129,10 +127,8 @@ class AppDetailsDrawer extends React.Component {
getTags = () => {
axios.get(
config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/tags",
{
headers: {'X-Platform': config.serverConfig.platform}
}).then(res => {
config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/tags"
).then(res => {
if (res.status === 200) {
const tags = JSON.parse(res.data.data);
@ -152,10 +148,10 @@ class AppDetailsDrawer extends React.Component {
}
}).catch((error) => {
if (error.response.status === 401) {
if (error.hasOwnProperty("response") && error.response.status === 401) {
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + '/publisher/login';
} else {
message.warning('Something went wrong');
message.warning('Something went wrong when trying to load tags.');
}
this.setState({
@ -172,14 +168,12 @@ class AppDetailsDrawer extends React.Component {
const data = {name: name};
axios.put(
config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/" + id,
data,
{
headers: {'X-Platform': config.serverConfig.platform}
}
data
).then(res => {
if (res.status === 200) {
notification["success"]({
message: 'Saved!'
message: 'Saved!',
description: 'App name updated successfully!'
});
this.setState({
loading: false,
@ -192,7 +186,7 @@ class AppDetailsDrawer extends React.Component {
message.error('You are not logged in');
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + '/publisher/login';
} else {
message.error('Something went wrong... :(');
message.error('Something went wrong when trying to save the app name... :(');
}
this.setState({loading: false});
@ -231,7 +225,6 @@ class AppDetailsDrawer extends React.Component {
});
};
// handle description change
handleCategoryChange = (temporaryCategories) => {
this.setState({temporaryCategories})
@ -250,14 +243,12 @@ class AppDetailsDrawer extends React.Component {
const data = {categories: temporaryCategories};
axios.put(
config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/" + id,
data,
{
headers: {'X-Platform': config.serverConfig.platform}
}
data
).then(res => {
if (res.status === 200) {
notification["success"]({
message: 'Saved!'
message: 'Saved!',
description: 'App categories updated successfully!'
});
this.setState({
loading: false,
@ -271,7 +262,7 @@ class AppDetailsDrawer extends React.Component {
message.error('You are not logged in');
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + '/publisher/login';
} else {
message.error('Something went wrong... :(');
message.error('Something went wrong when trying to updating categories');
}
this.setState({loading: false});
@ -297,7 +288,7 @@ class AppDetailsDrawer extends React.Component {
this.setState({temporaryTags})
};
// change app categories
// change app tags
handleTagsSave = () => {
const {id} = this.props.app;
const {temporaryTags, tags} = this.state;
@ -311,14 +302,12 @@ class AppDetailsDrawer extends React.Component {
const data = {tags: temporaryTags};
axios.put(
config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/" + id,
data,
{
headers: {'X-Platform': config.serverConfig.platform}
}
data
).then(res => {
if (res.status === 200) {
notification["success"]({
message: 'Saved!'
message: 'Saved!',
description: 'App tags updated successfully!'
});
this.setState({
loading: false,
@ -331,7 +320,7 @@ class AppDetailsDrawer extends React.Component {
message.error('You are not logged in');
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + '/publisher/login';
} else {
message.error('Something went wrong... :(');
message.error('Something went wrong when trying to update tags');
}
this.setState({loading: false});
@ -349,14 +338,12 @@ class AppDetailsDrawer extends React.Component {
const data = {description: temporaryDescription};
axios.put(
config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/" + id,
data,
{
headers: {'X-Platform': config.serverConfig.platform}
}
data
).then(res => {
if (res.status === 200) {
notification["success"]({
message: 'Saved!'
message: 'Saved!',
description: 'App description updated successfully!'
});
this.setState({
loading: false,
@ -526,7 +513,8 @@ class AppDetailsDrawer extends React.Component {
<span>{
categories.map(category => {
return (
<Tag color={pSBC ( 0.30, config.theme.primaryColor )} key={category} style={{marginBottom: 5}}>
<Tag color={pSBC(0.30, config.theme.primaryColor)} key={category}
style={{marginBottom: 5}}>
{category}
</Tag>
);

@ -1,10 +1,10 @@
import React from "react";
import {Avatar, Card, Col, Row, Table, Typography, Input, Divider, Icon, Select, Button, Form, message, Radio} from "antd";
import {Card, Col, Row,Typography, Input, Divider, Icon, Select, Button, Form, message, Radio} from "antd";
import axios from "axios";
import config from "../../../../public/conf/config.json";
const {Option} = Select;
const {Title, Text} = Typography;
const {Title} = Typography;
class FiltersForm extends React.Component {
@ -49,10 +49,8 @@ class FiltersForm extends React.Component {
getCategories = () => {
axios.get(
config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/categories",
{
headers: {'X-Platform': config.serverConfig.platform}
}).then(res => {
config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/categories"
).then(res => {
if (res.status === 200) {
let categories = JSON.parse(res.data.data);
this.setState({
@ -62,10 +60,10 @@ class FiltersForm extends React.Component {
}
}).catch((error) => {
if (error.response.status === 401) {
if (error.hasOwnProperty("response") && error.response.status === 401) {
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + '/publisher/login';
} else {
message.warning('Something went wrong');
message.warning('Something went wrong while trying to load categories... :(');
}
this.setState({
@ -76,10 +74,8 @@ class FiltersForm extends React.Component {
getTags = () => {
axios.get(
config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/tags",
{
headers: {'X-Platform': config.serverConfig.platform}
}).then(res => {
config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/tags"
).then(res => {
if (res.status === 200) {
let tags = JSON.parse(res.data.data);
this.setState({
@ -89,10 +85,10 @@ class FiltersForm extends React.Component {
}
}).catch((error) => {
if (error.response.status === 401) {
if (error.hasOwnProperty("response") && error.response.status === 401) {
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + '/publisher/login';
} else {
message.warning('Something went wrong');
message.warning('Something went wrong when trying to load tags');
}
this.setState({
@ -104,10 +100,8 @@ class FiltersForm extends React.Component {
getDeviceTypes = () => {
axios.get(
config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.deviceMgt + "/device-types",
{
headers: {'X-Platform': config.serverConfig.platform}
}).then(res => {
config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.deviceMgt + "/device-types"
).then(res => {
if (res.status === 200) {
const deviceTypes = JSON.parse(res.data.data);
this.setState({
@ -117,10 +111,10 @@ class FiltersForm extends React.Component {
}
}).catch((error) => {
if (error.response.status === 401) {
if (error.hasOwnProperty("response") && error.response.status === 401) {
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + '/publisher/login';
} else {
message.warning('Something went wrong');
message.warning('Something went wrong when trying to load device types');
}
this.setState({

@ -1,5 +1,5 @@
import React from "react";
import {Avatar, Card, Col, Row, Table, Typography, Tag, Icon, message} from "antd";
import {Avatar, Table, Tag, Icon, message} from "antd";
import axios from "axios";
import pSBC from 'shade-blend-color';
import config from "../../../../../public/conf/config.json";
@ -155,7 +155,7 @@ class AppsTable extends React.Component {
message.error('You are not logged in');
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/publisher/login';
} else {
message.error('Something went wrong... :(');
message.error('Something went wrong while trying to load apps... :(');
}
this.setState({loading: false});

@ -55,10 +55,9 @@ class LifeCycle extends React.Component {
fetchData = () => {
axios.get(config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/lifecycle-config",
{
headers: {'X-Platform': config.serverConfig.platform}
}).then(res => {
axios.get(
config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/lifecycle-config"
).then(res => {
if (res.status === 200) {
const lifecycle = res.data.data;
this.setState({
@ -69,6 +68,8 @@ class LifeCycle extends React.Component {
}).catch(function (error) {
if (error.hasOwnProperty("response") && error.response.status === 401) {
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + '/publisher/login';
} else {
message.error('Something went wrong when trying to load lifecycle configuration');
}
});
};
@ -105,11 +106,10 @@ class LifeCycle extends React.Component {
isConfirmButtonLoading: true,
});
axios.post(config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/life-cycle/" + uuid,
data,
{
headers: {'X-Platform': config.serverConfig.platform}
}).then(res => {
axios.post(
config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/life-cycle/" + uuid,
data
).then(res => {
if (res.status === 201) {
this.setState({
isReasonModalVisible: false,
@ -133,7 +133,7 @@ class LifeCycle extends React.Component {
notification["error"]({
message: "Error",
description:
"Something went wrong",
"Something went wrong when trying to add lifecycle",
});
}
this.setState({

@ -31,20 +31,18 @@ class Reviews extends React.Component {
const {uuid, type} = this.props;
axios.get(
config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri +config.serverConfig.invoker.publisher+"/admin/reviews/"+type+"/"+uuid,
{
headers: {'X-Platform': config.serverConfig.platform}
}).then(res => {
config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/admin/reviews/" + type + "/" + uuid
).then(res => {
if (res.status === 200) {
let reviews = res.data.data.data;
callback(reviews);
}
}).catch(function (error) {
if (error.response.status === 401) {
if (error.hasOwnProperty("response") && error.response.status === 401) {
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + '/publisher/login';
} else {
message.warning('Something went wrong');
message.warning('Something went wrong when trying to load reviews');
}
});

@ -33,7 +33,7 @@ class ManageCategories extends React.Component {
}
}).catch((error) => {
if (error.response.status === 401) {
if (error.hasOwnProperty("response") && error.response.status === 401) {
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/publisher/login';
} else {
message.warning('Something went wrong');
@ -80,11 +80,11 @@ class ManageCategories extends React.Component {
}
}).catch((error) => {
if (error.response.hasOwnProperty("status") && error.response.status === 401) {
if (error.hasOwnProperty("response") && error.response.status === 401) {
message.error('You are not logged in');
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/publisher/login';
} else {
message.warning('Something went wrong');
message.warning('Something went wrong when trying to load categories');
}
this.setState({
loading: false
@ -219,11 +219,11 @@ class ManageCategories extends React.Component {
}
}).catch((error) => {
if (error.response.hasOwnProperty("status") && error.response.status === 401) {
if (error.hasOwnProperty("response") && error.response.status === 401) {
message.error('You are not logged in');
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/publisher/login';
} else {
message.warning('Something went wrong');
message.warning('Something went wrong when trying to add categories');
}
this.setState({
loading: false
@ -281,11 +281,11 @@ class ManageCategories extends React.Component {
}
}).catch((error) => {
if (error.response.hasOwnProperty("status") && error.response.status === 401) {
if (error.hasOwnProperty("response") && error.response.status === 401) {
message.error('You are not logged in');
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/publisher/login';
} else {
message.warning('Something went wrong');
message.warning('Something went wrong when trying to delete the category');
}
this.setState({
loading: false,

@ -32,10 +32,10 @@ class ManageTags extends React.Component {
}
}).catch((error) => {
if (error.response.status === 401) {
if (error.hasOwnProperty("response") && error.response.status === 401) {
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/publisher/login';
} else {
message.warning('Something went wrong');
message.warning('Something went wrong when trying to load tags');
}
this.setState({
@ -58,10 +58,8 @@ class ManageTags extends React.Component {
});
axios.delete(
config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri +config.serverConfig.invoker.publisher+"/admin/applications/tags/"+id,
{
headers: {'X-Platform': config.serverConfig.platform}
}).then(res => {
config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri +config.serverConfig.invoker.publisher+"/admin/applications/tags/"+id
).then(res => {
if (res.status === 200) {
notification["success"]({
message: "Done!",
@ -82,11 +80,11 @@ class ManageTags extends React.Component {
}
}).catch((error) => {
if (error.response.hasOwnProperty("status") && error.response.status === 401) {
if (error.hasOwnProperty("response") && error.response.status === 401) {
message.error('You are not logged in');
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/publisher/login';
} else {
message.warning('Something went wrong');
message.warning('Something went wrong when trying to delete the tag');
}
this.setState({
loading: false
@ -219,11 +217,11 @@ class ManageTags extends React.Component {
}
}).catch((error) => {
if (error.response.hasOwnProperty("status") && error.response.status === 401) {
if (error.hasOwnProperty("response") && error.response.status === 401) {
message.error('You are not logged in');
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/publisher/login';
} else {
message.warning('Something went wrong');
message.warning('Something went wrong when trying to delete tag');
}
this.setState({
loading: false
@ -281,11 +279,11 @@ class ManageTags extends React.Component {
}
}).catch((error) => {
if (error.response.hasOwnProperty("status") && error.response.status === 401) {
if (error.hasOwnProperty("response") && error.response.status === 401) {
message.error('You are not logged in');
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/publisher/login';
} else {
message.warning('Something went wrong');
message.warning('Something went wrong when trying to edit tag');
}
this.setState({
loading: false,

@ -54,10 +54,8 @@ class AddNewAppFormComponent extends React.Component {
getCategories = () => {
axios.get(
config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/categories",
{
headers: {'X-Platform': config.serverConfig.platform}
}).then(res => {
config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/categories"
).then(res => {
if (res.status === 200) {
let categories = JSON.parse(res.data.data);
this.setState({
@ -67,10 +65,10 @@ class AddNewAppFormComponent extends React.Component {
}
}).catch((error) => {
if (error.response.status === 401) {
if (error.hasOwnProperty("response") && error.response.status === 401) {
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + '/publisher/login';
} else {
message.warning('Something went wrong');
message.warning('Something went wrong when trying to load categories');
}
this.setState({
@ -81,10 +79,8 @@ class AddNewAppFormComponent extends React.Component {
getTags = () => {
axios.get(
config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/tags",
{
headers: {'X-Platform': config.serverConfig.platform}
}).then(res => {
config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/tags"
).then(res => {
if (res.status === 200) {
let tags = JSON.parse(res.data.data);
this.setState({
@ -94,10 +90,10 @@ class AddNewAppFormComponent extends React.Component {
}
}).catch((error) => {
if (error.response.status === 401) {
if (error.hasOwnProperty("response") && error.response.status === 401) {
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + '/publisher/login';
} else {
message.warning('Something went wrong');
message.warning('Something went wrong when trying to load tags');
}
this.setState({
@ -209,7 +205,7 @@ class AddNewAppFormComponent extends React.Component {
}
}).catch((error) => {
if (error.response.status === 401) {
if (error.hasOwnProperty("response") && error.response.status === 401) {
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + '/publisher/login';
} else {
notification["error"]({

@ -1,12 +1,15 @@
import axios from "axios";
import ActionTypes from "../constants/ActionTypes";
import config from "../../../public/conf/config.json";
import {message} from "antd";
export const getApps = () => dispatch => {
const request = "method=post&content-type=application/json&payload={}&api-endpoint=/application-mgt-publisher/v1.0/applications";
return axios.post(config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri +config.serverConfig.invoker.publisher, request
return axios.post(
config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri +config.serverConfig.invoker.publisher,
request
).then(res => {
if (res.status === 200) {
let apps = [];
@ -18,8 +21,10 @@ export const getApps = () => dispatch => {
}
}).catch(function (error) {
if (error.response.status === 401) {
if (error.hasOwnProperty("response") && error.response.status === 401) {
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/publisher/login';
} else {
message.error('Something went wrong when trying to load applications... :(');
}
});
@ -29,7 +34,8 @@ export const getRelease = (uuid) => dispatch => {
const request = "method=get&content-type=application/json&payload={}&api-endpoint=/application-mgt-publisher/v1.0/applications/release/" + uuid;
return axios.post(config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri +config.serverConfig.invoker.publisher, request
return axios.post(
config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri +config.serverConfig.invoker.publisher, request
).then(res => {
if (res.status === 200) {
let release = res.data.data;
@ -37,8 +43,10 @@ export const getRelease = (uuid) => dispatch => {
}
}).catch(function (error) {
if (error.response.status === 401) {
if (error.hasOwnProperty("response") && error.response.status === 401) {
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/publisher/login';
} else {
message.error('Something went wrong... :(');
}
});
@ -73,7 +81,8 @@ export const closeLifecycleModal = () => dispatch => {
export const getLifecycle = () => dispatch => {
const request = "method=get&content-type=application/json&payload={}&api-endpoint=/application-mgt-publisher/v1.0/applications/lifecycle-config";
return axios.post(config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri +config.serverConfig.invoker.publisher, request
return axios.post(
config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri +config.serverConfig.invoker.publisher, request
).then(res => {
if (res.status === 200) {
let lifecycle = res.data.data;
@ -81,8 +90,10 @@ export const getLifecycle = () => dispatch => {
}
}).catch(function (error) {
if (error.response.status === 401) {
if (error.hasOwnProperty("response") && error.response.status === 401) {
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/publisher/login';
} else {
message.error('Something went wrong... :(');
}
});
};
@ -97,7 +108,8 @@ 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;
return axios.post(config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri +config.serverConfig.invoker.publisher, request
return axios.post(
config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri +config.serverConfig.invoker.publisher, request
).then(res => {
if (res.status === 201) {
let release = res.data.data;
@ -110,7 +122,7 @@ export const updateLifecycleState = (uuid, nextState, reason) => dispatch => {
}
}).catch(function (error) {
if (error.response.status === 401) {
if (error.hasOwnProperty("response") && error.response.status === 401) {
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/publisher/login';
} else if (error.response.status === 500) {
alert("error");

@ -1,5 +1,5 @@
import React from "react";
import {Typography, Row, Col, Form, Icon, Input, Button, Checkbox} from 'antd';
import {Typography, Row, Col, Form, Icon, Input, Button, Checkbox, message} from 'antd';
import './Login.css';
import axios from 'axios';
import config from "../../public/conf/config.json";
@ -12,14 +12,11 @@ class Login extends React.Component {
render() {
return (
<div>
<div
className="background"
>
<div className="background">
</div>
<div className="content">
<Row>
<Col xs={3} sm={3} md={10}>
</Col>
<Col xs={18} sm={18} md={4}>
<Row style={{marginBottom: 20}}>
@ -35,7 +32,6 @@ class Login extends React.Component {
</Row>
<Title level={2}>Login</Title>
<WrappedNormalLoginForm/>
</Col>
</Row>
<Row>
@ -80,17 +76,21 @@ 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
).then(res => {
).then(res=>{
if (res.status === 200) {
window.location = res.data.url;
}
}).catch(function (error) {
if (error.response.status === 400) {
if (error.hasOwnProperty("response") && error.response.status === 400) {
thisForm.setState({
inValid: true,
loading: false
inValid: true
});
} else {
message.error('Something went wrong when trying to login... :(');
}
thisForm.setState({
loading: false
});
});
}
@ -111,7 +111,7 @@ class NormalLoginForm extends React.Component {
<Form onSubmit={this.handleSubmit} className="login-form">
<Form.Item>
{getFieldDecorator('username', {
rules: [{required: true, message: 'Please input your username!'}],
rules: [{required: true, message: 'Please enter your username'}],
})(
<Input style={{height: 32}} prefix={<Icon type="user" style={{color: 'rgba(0,0,0,.25)'}}/>}
placeholder="Username"/>
@ -119,7 +119,7 @@ class NormalLoginForm extends React.Component {
</Form.Item>
<Form.Item>
{getFieldDecorator('password', {
rules: [{required: true, message: 'Please input your Password!'}],
rules: [{required: true, message: 'Please enter your password'}],
})(
<Input style={{height: 32}}
prefix={<Icon type="lock" style={{color: 'rgba(0,0,0,.25)'}}/>} type="password"

@ -47,9 +47,6 @@ 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.publisher + "/applications/release/"+ uuid,
{
headers: {'X-Platform': config.serverConfig.platform}
}
).then(res => {
if (res.status === 200) {
const app = res.data.data;
@ -70,7 +67,7 @@ class Release extends React.Component {
message.error('You are not logged in');
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + '/publisher/login';
} else {
message.error('Something went wrong... :(');
message.error('Something went wrong when trying to load the release... :(');
}
this.setState({loading: false});

Loading…
Cancel
Save