Modify edit release component to update the release without refreshing

feature/appm-store/pbac
Jayasanka 5 years ago
parent 70310c55fb
commit e07197743a

@ -11,23 +11,22 @@ const {Title, Text, Paragraph} = Typography;
class ReleaseView extends React.Component { class ReleaseView extends React.Component {
render() { render() {
const {app, release} = this.props;
const config = this.props.context; const config = this.props.context;
const app = this.props.app;
const release = (app !== null) ? app.applicationReleases[0] : null;
const {lifecycle, currentLifecycleStatus} = this.props; const {lifecycle, currentLifecycleStatus} = this.props;
if (release == null || lifecycle == null) { if (release == null || lifecycle == null) {
return null; return null;
} }
const {isAppUpdatable, isAppInstallable} = lifecycle[currentLifecycleStatus]; const {isAppUpdatable, isAppInstallable} = lifecycle[currentLifecycleStatus];
console.log(isAppInstallable, isAppUpdatable);
const platform = app.deviceType; const platform = app.deviceType;
const defaultPlatformIcons = config.defaultPlatformIcons; const defaultPlatformIcons = config.defaultPlatformIcons;
let icon = defaultPlatformIcons.default.icon; let icon = defaultPlatformIcons.default.icon;
let color = defaultPlatformIcons.default.color; let color = defaultPlatformIcons.default.color;
let theme = defaultPlatformIcons.default.theme; let theme = defaultPlatformIcons.default.theme;
if (defaultPlatformIcons.hasOwnProperty(platform)) { if (defaultPlatformIcons.hasOwnProperty(platform)) {
icon = defaultPlatformIcons[platform].icon; icon = defaultPlatformIcons[platform].icon;
color = defaultPlatformIcons[platform].color; color = defaultPlatformIcons[platform].color;

@ -231,6 +231,9 @@ class EditReleaseModal extends React.Component {
data data
).then(res => { ).then(res => {
if (res.status === 200) { if (res.status === 200) {
const updatedRelease = res.data.data;
this.setState({ this.setState({
loading: false, loading: false,
visible: false, visible: false,
@ -241,10 +244,9 @@ class EditReleaseModal extends React.Component {
description: description:
"Saved!", "Saved!",
}); });
// console.log(updatedRelease);
window.location.reload(); this.props.updateRelease(updatedRelease);
} }
}).catch((error) => { }).catch((error) => {
if (error.hasOwnProperty("response") && error.response.status === 401) { if (error.hasOwnProperty("response") && error.response.status === 401) {
window.location.href = window.location.origin + '/publisher/login'; window.location.href = window.location.origin + '/publisher/login';

@ -8,8 +8,6 @@ import {withConfigContext} from "../../../../context/ConfigContext";
const {Title} = Typography; const {Title} = Typography;
class Release extends React.Component { class Release extends React.Component {
routes; routes;
@ -135,6 +133,7 @@ class Release extends React.Component {
<Card> <Card>
<ReleaseView <ReleaseView
app={app} app={app}
release={release}
currentLifecycleStatus={currentLifecycleStatus} currentLifecycleStatus={currentLifecycleStatus}
lifecycle={lifecycle} lifecycle={lifecycle}
updateRelease={this.updateRelease} updateRelease={this.updateRelease}

Loading…
Cancel
Save