|
|
@ -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>
|
|
|
|
);
|
|
|
|
);
|
|
|
|