Change error messages in publisher

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

@ -1,5 +1,5 @@
import React from "react"; import React from "react";
import {Row, Typography, Icon} from "antd"; import {Row, Typography, Icon, message} from "antd";
import StarRatings from "react-star-ratings"; import StarRatings from "react-star-ratings";
import "./DetailedRating.css"; import "./DetailedRating.css";
import config from "../../../../public/conf/config.json"; import config from "../../../../public/conf/config.json";
@ -41,8 +41,10 @@ class DetailedRating extends React.Component{
} }
}).catch(function (error) { }).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'; 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 = () => { getCategories = () => {
axios.get( axios.get(
config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/categories", config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/categories"
{ ).then(res => {
headers: {'X-Platform': config.serverConfig.platform}
}).then(res => {
if (res.status === 200) { if (res.status === 200) {
const categories = JSON.parse(res.data.data); const categories = JSON.parse(res.data.data);
@ -115,10 +113,10 @@ class AppDetailsDrawer extends React.Component {
} }
}).catch((error) => { }).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'; 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 while trying to load app details... :(');
} }
this.setState({ this.setState({
@ -129,10 +127,8 @@ class AppDetailsDrawer extends React.Component {
getTags = () => { getTags = () => {
axios.get( axios.get(
config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/tags", config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/tags"
{ ).then(res => {
headers: {'X-Platform': config.serverConfig.platform}
}).then(res => {
if (res.status === 200) { if (res.status === 200) {
const tags = JSON.parse(res.data.data); const tags = JSON.parse(res.data.data);
@ -152,10 +148,10 @@ class AppDetailsDrawer extends React.Component {
} }
}).catch((error) => { }).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'; 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 when trying to load tags.');
} }
this.setState({ this.setState({
@ -172,14 +168,12 @@ class AppDetailsDrawer extends React.Component {
const data = {name: name}; const data = {name: name};
axios.put( axios.put(
config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/" + id, config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/" + id,
data, data
{
headers: {'X-Platform': config.serverConfig.platform}
}
).then(res => { ).then(res => {
if (res.status === 200) { if (res.status === 200) {
notification["success"]({ notification["success"]({
message: 'Saved!' message: 'Saved!',
description: 'App name updated successfully!'
}); });
this.setState({ this.setState({
loading: false, loading: false,
@ -192,7 +186,7 @@ class AppDetailsDrawer extends React.Component {
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 + '/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 when trying to save the app name... :(');
} }
this.setState({loading: false}); this.setState({loading: false});
@ -231,7 +225,6 @@ class AppDetailsDrawer extends React.Component {
}); });
}; };
// handle description change // handle description change
handleCategoryChange = (temporaryCategories) => { handleCategoryChange = (temporaryCategories) => {
this.setState({temporaryCategories}) this.setState({temporaryCategories})
@ -250,14 +243,12 @@ class AppDetailsDrawer extends React.Component {
const data = {categories: temporaryCategories}; const data = {categories: temporaryCategories};
axios.put( axios.put(
config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/" + id, config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/" + id,
data, data
{
headers: {'X-Platform': config.serverConfig.platform}
}
).then(res => { ).then(res => {
if (res.status === 200) { if (res.status === 200) {
notification["success"]({ notification["success"]({
message: 'Saved!' message: 'Saved!',
description: 'App categories updated successfully!'
}); });
this.setState({ this.setState({
loading: false, loading: false,
@ -271,7 +262,7 @@ class AppDetailsDrawer extends React.Component {
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 + '/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 when trying to updating categories');
} }
this.setState({loading: false}); this.setState({loading: false});
@ -297,7 +288,7 @@ class AppDetailsDrawer extends React.Component {
this.setState({temporaryTags}) this.setState({temporaryTags})
}; };
// change app categories // change app tags
handleTagsSave = () => { handleTagsSave = () => {
const {id} = this.props.app; const {id} = this.props.app;
const {temporaryTags, tags} = this.state; const {temporaryTags, tags} = this.state;
@ -311,14 +302,12 @@ class AppDetailsDrawer extends React.Component {
const data = {tags: temporaryTags}; const data = {tags: temporaryTags};
axios.put( axios.put(
config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/" + id, config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/" + id,
data, data
{
headers: {'X-Platform': config.serverConfig.platform}
}
).then(res => { ).then(res => {
if (res.status === 200) { if (res.status === 200) {
notification["success"]({ notification["success"]({
message: 'Saved!' message: 'Saved!',
description: 'App tags updated successfully!'
}); });
this.setState({ this.setState({
loading: false, loading: false,
@ -331,7 +320,7 @@ class AppDetailsDrawer extends React.Component {
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 + '/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 when trying to update tags');
} }
this.setState({loading: false}); this.setState({loading: false});
@ -349,14 +338,12 @@ class AppDetailsDrawer extends React.Component {
const data = {description: temporaryDescription}; const data = {description: temporaryDescription};
axios.put( axios.put(
config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/" + id, config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/" + id,
data, data
{
headers: {'X-Platform': config.serverConfig.platform}
}
).then(res => { ).then(res => {
if (res.status === 200) { if (res.status === 200) {
notification["success"]({ notification["success"]({
message: 'Saved!' message: 'Saved!',
description: 'App description updated successfully!'
}); });
this.setState({ this.setState({
loading: false, loading: false,
@ -526,7 +513,8 @@ class AppDetailsDrawer extends React.Component {
<span>{ <span>{
categories.map(category => { categories.map(category => {
return ( 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} {category}
</Tag> </Tag>
); );

@ -1,10 +1,10 @@
import React from "react"; 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 axios from "axios";
import config from "../../../../public/conf/config.json"; import config from "../../../../public/conf/config.json";
const {Option} = Select; const {Option} = Select;
const {Title, Text} = Typography; const {Title} = Typography;
class FiltersForm extends React.Component { class FiltersForm extends React.Component {
@ -49,10 +49,8 @@ class FiltersForm extends React.Component {
getCategories = () => { getCategories = () => {
axios.get( axios.get(
config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/categories", config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/categories"
{ ).then(res => {
headers: {'X-Platform': config.serverConfig.platform}
}).then(res => {
if (res.status === 200) { if (res.status === 200) {
let categories = JSON.parse(res.data.data); let categories = JSON.parse(res.data.data);
this.setState({ this.setState({
@ -62,10 +60,10 @@ class FiltersForm extends React.Component {
} }
}).catch((error) => { }).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'; 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 while trying to load categories... :(');
} }
this.setState({ this.setState({
@ -76,10 +74,8 @@ class FiltersForm extends React.Component {
getTags = () => { getTags = () => {
axios.get( axios.get(
config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/tags", config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/tags"
{ ).then(res => {
headers: {'X-Platform': config.serverConfig.platform}
}).then(res => {
if (res.status === 200) { if (res.status === 200) {
let tags = JSON.parse(res.data.data); let tags = JSON.parse(res.data.data);
this.setState({ this.setState({
@ -89,10 +85,10 @@ class FiltersForm extends React.Component {
} }
}).catch((error) => { }).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'; 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 when trying to load tags');
} }
this.setState({ this.setState({
@ -104,10 +100,8 @@ class FiltersForm extends React.Component {
getDeviceTypes = () => { getDeviceTypes = () => {
axios.get( axios.get(
config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.deviceMgt + "/device-types", config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.deviceMgt + "/device-types"
{ ).then(res => {
headers: {'X-Platform': config.serverConfig.platform}
}).then(res => {
if (res.status === 200) { if (res.status === 200) {
const deviceTypes = JSON.parse(res.data.data); const deviceTypes = JSON.parse(res.data.data);
this.setState({ this.setState({
@ -117,10 +111,10 @@ class FiltersForm extends React.Component {
} }
}).catch((error) => { }).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'; 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 when trying to load device types');
} }
this.setState({ this.setState({

@ -1,5 +1,5 @@
import React from "react"; 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 axios from "axios";
import pSBC from 'shade-blend-color'; import pSBC from 'shade-blend-color';
import config from "../../../../../public/conf/config.json"; import config from "../../../../../public/conf/config.json";
@ -155,7 +155,7 @@ class AppsTable extends React.Component {
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+'/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 while trying to load apps... :(');
} }
this.setState({loading: false}); this.setState({loading: false});

@ -55,10 +55,9 @@ class LifeCycle extends React.Component {
fetchData = () => { fetchData = () => {
axios.get(config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/lifecycle-config", 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 => {
}).then(res => {
if (res.status === 200) { if (res.status === 200) {
const lifecycle = res.data.data; const lifecycle = res.data.data;
this.setState({ this.setState({
@ -69,6 +68,8 @@ class LifeCycle extends React.Component {
}).catch(function (error) { }).catch(function (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 + '/publisher/login'; 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, 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, axios.post(
data, 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 => {
}).then(res => {
if (res.status === 201) { if (res.status === 201) {
this.setState({ this.setState({
isReasonModalVisible: false, isReasonModalVisible: false,
@ -133,7 +133,7 @@ class LifeCycle extends React.Component {
notification["error"]({ notification["error"]({
message: "Error", message: "Error",
description: description:
"Something went wrong", "Something went wrong when trying to add lifecycle",
}); });
} }
this.setState({ this.setState({

@ -31,20 +31,18 @@ class Reviews extends React.Component {
const {uuid, type} = this.props; const {uuid, type} = this.props;
axios.get( axios.get(
config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri +config.serverConfig.invoker.publisher+"/admin/reviews/"+type+"/"+uuid, config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/admin/reviews/" + type + "/" + uuid
{ ).then(res => {
headers: {'X-Platform': config.serverConfig.platform}
}).then(res => {
if (res.status === 200) { if (res.status === 200) {
let reviews = res.data.data.data; let reviews = res.data.data.data;
callback(reviews); callback(reviews);
} }
}).catch(function (error) { }).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'; 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 when trying to load reviews');
} }
}); });

@ -33,7 +33,7 @@ class ManageCategories extends React.Component {
} }
}).catch((error) => { }).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'; 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');
@ -80,11 +80,11 @@ class ManageCategories extends React.Component {
} }
}).catch((error) => { }).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'); message.error('You are not logged in');
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/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 when trying to load categories');
} }
this.setState({ this.setState({
loading: false loading: false
@ -219,11 +219,11 @@ class ManageCategories extends React.Component {
} }
}).catch((error) => { }).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'); message.error('You are not logged in');
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/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 when trying to add categories');
} }
this.setState({ this.setState({
loading: false loading: false
@ -281,11 +281,11 @@ class ManageCategories extends React.Component {
} }
}).catch((error) => { }).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'); message.error('You are not logged in');
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/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 when trying to delete the category');
} }
this.setState({ this.setState({
loading: false, loading: false,

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

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

@ -1,12 +1,15 @@
import axios from "axios"; import axios from "axios";
import ActionTypes from "../constants/ActionTypes"; import ActionTypes from "../constants/ActionTypes";
import config from "../../../public/conf/config.json"; import config from "../../../public/conf/config.json";
import {message} from "antd";
export const getApps = () => dispatch => { 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(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 => { ).then(res => {
if (res.status === 200) { if (res.status === 200) {
let apps = []; let apps = [];
@ -18,8 +21,10 @@ export const getApps = () => dispatch => {
} }
}).catch(function (error) { }).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'; 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; 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 => { ).then(res => {
if (res.status === 200) { if (res.status === 200) {
let release = res.data.data; let release = res.data.data;
@ -37,8 +43,10 @@ export const getRelease = (uuid) => dispatch => {
} }
}).catch(function (error) { }).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'; 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 => { 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(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 => { ).then(res => {
if (res.status === 200) { if (res.status === 200) {
let lifecycle = res.data.data; let lifecycle = res.data.data;
@ -81,8 +90,10 @@ export const getLifecycle = () => dispatch => {
} }
}).catch(function (error) { }).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'; 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; 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 => { ).then(res => {
if (res.status === 201) { if (res.status === 201) {
let release = res.data.data; let release = res.data.data;
@ -110,7 +122,7 @@ export const updateLifecycleState = (uuid, nextState, reason) => dispatch => {
} }
}).catch(function (error) { }).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'; 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");

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

Loading…
Cancel
Save