diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/LifeCycle/index.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/LifeCycle/index.js index fc815d61f0..5660802b5a 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/LifeCycle/index.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/LifeCycle/index.js @@ -77,6 +77,7 @@ class LifeCycle extends React.Component { current: 0, lifecycleSteps: [], lifeCycleStates: [], + isPublished: false, }; } @@ -91,6 +92,10 @@ class LifeCycle extends React.Component { lifecycleSteps, }); this.getLifeCycleHistory(); + + this.setState({ + isPublished: this.checkReleaseLifeCycleStatus(), + }); } componentDidUpdate(prevProps, prevState, snapshot) { @@ -204,26 +209,18 @@ class LifeCycle extends React.Component { state or not and assigned a boolean value to disable the publish button if an app release is already published */ - checkReleaseLifeCycleStatus = (proceedingStates, lifecycleState) => { + checkReleaseLifeCycleStatus = () => { if (typeof this.props.appReleases !== 'undefined') { - const currentAppUUID = this.props.uuid; let appReleases = this.props.appReleases.fullAppDetails; - let appRelease; - let isPublished; for (let i = 0; i < appReleases.length; i++) { - appRelease = appReleases[i]; if ( - currentAppUUID !== appRelease.uuid && - appRelease.currentStatus === 'PUBLISHED' && - proceedingStates.includes('PUBLISHED') && - lifecycleState === 'PUBLISHED' + this.props.uuid !== appReleases[i].uuid && + appReleases[i].currentStatus === 'PUBLISHED' ) { - isPublished = true; - return isPublished; + return true; } } - isPublished = false; - return isPublished; + return false; } return false; }; @@ -278,13 +275,11 @@ class LifeCycle extends React.Component {

{step.text}

{proceedingStates.map(lifecycleState => { return ( - // eslint-disable-next-line react/jsx-key this.showReasonModal(lifecycleState) }