Merge branch 'application-mgt-new' into 'application-mgt-new'

Fix retired app loading issue in APPM UI

See merge request entgra/carbon-device-mgt!188
feature/appm-store/pbac
Dharmakeerthi Lasantha 5 years ago
commit b3eaa6ae28

@ -55,7 +55,7 @@ class AppDetailsDrawer extends React.Component {
super(props); super(props);
this.state = { this.state = {
loading: false, loading: false,
name: null, name: "",
description: null, description: null,
globalCategories: [], globalCategories: [],
globalTags: [], globalTags: [],
@ -406,6 +406,36 @@ class AppDetailsDrawer extends React.Component {
if (app == null) { if (app == null) {
return null; return null;
} }
let avatar = null;
if (app.applicationReleases.length === 0) {
const avatarLetter = name.charAt(0).toUpperCase();
avatar = (
<Avatar shape="square"
size={100}
style={{
marginBottom: 10,
borderRadius: "28%",
backgroundColor: pSBC(0.50, config.theme.primaryColor)
}}>
{avatarLetter}
</Avatar>
);
} else {
avatar = (
<img
style={{
marginBottom: 10,
width: 100,
borderRadius: "28%",
border: "1px solid #ddd"
}}
src={app.applicationReleases[0].iconPath}
/>
)
}
return ( return (
<div> <div>
<Drawer <Drawer
@ -417,15 +447,7 @@ class AppDetailsDrawer extends React.Component {
> >
<Spin spinning={loading} delay={500}> <Spin spinning={loading} delay={500}>
<div style={{textAlign: "center"}}> <div style={{textAlign: "center"}}>
<img {avatar}
style={{
marginBottom: 10,
width: 100,
borderRadius: "28%",
border: "1px solid #ddd"
}}
src={app.applicationReleases[0].iconPath}
/>
<Title editable={{onChange: this.handleNameSave}} level={2}>{name}</Title> <Title editable={{onChange: this.handleNameSave}} level={2}>{name}</Title>
</div> </div>
@ -436,8 +458,8 @@ class AppDetailsDrawer extends React.Component {
{(app.type === "ENTERPRISE") && ( {(app.type === "ENTERPRISE") && (
<Link to={`/publisher/apps/${app.id}/add-release`}><Button htmlType="button" size="small">Add <Link to={`/publisher/apps/${app.id}/add-release`}><Button htmlType="button" size="small">Add
new release</Button></Link>)} new release</Button></Link>)}
<br/>
<List <List
style={{paddingTop: 16}}
grid={{gutter: 16, column: 2}} grid={{gutter: 16, column: 2}}
dataSource={app.applicationReleases} dataSource={app.applicationReleases}
renderItem={release => ( renderItem={release => (
@ -596,8 +618,8 @@ class AppDetailsDrawer extends React.Component {
)} )}
<Divider dashed={true}/> <Divider dashed={true}/>
{app.applicationReleases.length > 0 && (
<DetailedRating type="app" uuid={app.applicationReleases[0].uuid}/> <DetailedRating type="app" uuid={app.applicationReleases[0].uuid}/>)}
</Spin> </Spin>
</Drawer> </Drawer>
</div> </div>

@ -12,8 +12,22 @@ const columns = [
title: '', title: '',
dataIndex: 'name', dataIndex: 'name',
render: (name, row) => { render: (name, row) => {
return ( let avatar = null;
<div> if (row.applicationReleases.length === 0) {
const avatarLetter = name.charAt(0).toUpperCase();
avatar = (
<Avatar shape="square" size="large"
style={{
marginRight: 20,
borderRadius: "28%",
border: "1px solid #ddd",
backgroundColor: pSBC(0.50, config.theme.primaryColor)
}}>
{avatarLetter}
</Avatar>
);
} else {
avatar = (
<Avatar shape="square" size="large" <Avatar shape="square" size="large"
style={{ style={{
marginRight: 20, marginRight: 20,
@ -22,6 +36,12 @@ const columns = [
}} }}
src={row.applicationReleases[0].iconPath} src={row.applicationReleases[0].iconPath}
/> />
)
}
return (
<div>
{avatar}
{name} {name}
</div>); </div>);
} }
@ -132,7 +152,6 @@ class AppsTable extends React.Component {
axios.post( axios.post(
window.location.origin + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications", window.location.origin + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications",
data, data,
).then(res => { ).then(res => {
if (res.status === 200) { if (res.status === 200) {
const data = res.data.data; const data = res.data.data;

@ -68,7 +68,7 @@ class ReleaseView extends React.Component {
icon="shop" icon="shop"
disabled={this.props.currentLifecycleStatus !== "PUBLISHED"} disabled={this.props.currentLifecycleStatus !== "PUBLISHED"}
onClick={() => { onClick={() => {
window.open("https://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + "/store/" + app.deviceType + "/apps/" + release.uuid) window.open(window.location.origin+ "/store/" + app.deviceType + "/apps/" + release.uuid)
}}> }}>
Open in store Open in store
</Button> </Button>

@ -235,7 +235,7 @@ class NewAppDetailsForm extends React.Component {
</Select> </Select>
)} )}
</Form.Item> </Form.Item>
//todo implement add meta data {/* //todo implement add meta data */}
{/*<Form.Item {...formItemLayout} label="Meta Data">*/} {/*<Form.Item {...formItemLayout} label="Meta Data">*/}
{/*<InputGroup>*/} {/*<InputGroup>*/}
{/*<Row gutter={8}>*/} {/*<Row gutter={8}>*/}

Loading…
Cancel
Save