Improve schedule install/ uninstall component's UI in APPM store

merge-requests/303/head
Jayasanka 5 years ago
parent b21de79151
commit 6d16259aaf

@ -35,6 +35,10 @@ class ReleaseView extends React.Component {
}
}
componentDidMount() {
console.log("mounted: Release view");
}
render() {
const {app, release} = this.props;
const config = this.props.context;

@ -17,7 +17,7 @@
*/
import React from "react";
import {Divider, Row, Col, Typography, Button, Rate, notification} from "antd";
import {Divider, Row, Col, Typography, Button, Dropdown, notification, Menu, Icon} from "antd";
import "../../../App.css";
import ImgViewer from "../../apps/release/images/ImgViewer";
import StarRatings from "react-star-ratings";
@ -89,13 +89,6 @@ class ReleaseView extends React.Component {
});
};
showAppInstallModal = () => {
this.setState({
appInstallModalVisible: true
});
};
closeAppOperationModal = () => {
this.setState({
appInstallModalVisible: false,
@ -103,10 +96,16 @@ class ReleaseView extends React.Component {
});
};
showAppUninstallModal = () => {
handleSubscribeClick = (e) => {
if (e.key === "install") {
this.setState({
appUninstallModalVisible: true
});
appInstallModalVisible: true // display app install modal
})
} else if (e.key === "uninstall") {
this.setState({
appUninstallModalVisible: true // display app uninstall modal
})
}
};
render() {
@ -119,6 +118,13 @@ class ReleaseView extends React.Component {
} catch (e) {
}
const menu = (
<Menu onClick={this.handleSubscribeClick}>
<Menu.Item key="install">Install</Menu.Item>
<Menu.Item key="uninstall">Uninstall</Menu.Item>
</Menu>
);
return (
<div>
@ -152,17 +158,14 @@ class ReleaseView extends React.Component {
/>
</Col>
<Col xl={8} md={10} sm={24} xs={24} style={{float: "right"}}>
<div>
<Button.Group style={{float: "right"}}>
<Button onClick={this.showAppInstallModal} loading={this.state.loading}
htmlType="button" type="primary" icon="download">Install</Button>
</Button.Group>
</div>
<div>
<Button.Group style={{float: "right",marginRight:'3%'}}>
<Button onClick={this.showAppUninstallModal} loading={this.state.loading}
htmlType="button" type="primary" icon="delete">UnInstall</Button>
</Button.Group>
<div style={{
textAlign: "right"
}}>
<Dropdown overlay={menu}>
<Button type="primary">
Subscribe <Icon type="down"/>
</Button>
</Dropdown>
</div>
</Col>
</Row>

@ -17,7 +17,7 @@
*/
import React from "react";
import {Button, DatePicker} from "antd";
import {Button, DatePicker, Checkbox} from "antd";
class InstallModalFooter extends React.Component {
constructor(props) {
@ -34,24 +34,19 @@ class InstallModalFooter extends React.Component{
});
};
showScheduledInstall = ()=>{
toggleScheduledInstall = () => {
this.setState({
isScheduledInstallVisible: true
})
};
hideScheduledInstall = ()=>{
this.setState({
isScheduledInstallVisible: false
isScheduledInstallVisible: !this.state.isScheduledInstallVisible
})
};
triggerInstallOperation = () => {
this.props.operation();
};
triggerScheduledInstallOperation = () =>{
const {scheduledTime} =this.state;
const {scheduledTime, isScheduledInstallVisible} = this.state;
if (isScheduledInstallVisible && scheduledTime != null) {
this.props.operation(scheduledTime);
} else {
this.props.operation();
}
};
render() {
@ -60,38 +55,30 @@ class InstallModalFooter extends React.Component{
return (
<div>
<div style={{
textAlign: "right",
display: (!isScheduledInstallVisible)?'block':'none'
textAlign: "right"
}}>
<Button style={{margin: 5}} disabled={disabled} htmlType="button" type="primary"
onClick={this.triggerInstallOperation}>
{type}
</Button>
<Button style={{margin: 5}} disabled={disabled} htmlType="button"
onClick={this.showScheduledInstall}>
Scheduled {type}
</Button>
<div style={{margin: 8}}>
<Checkbox checked={this.state.isScheduledInstallVisible} onChange={this.toggleScheduledInstall}>
Schedule {type}
</Checkbox>
</div>
<div style={{
textAlign: "right",
display: (isScheduledInstallVisible)?'block':'none'
<span style={{
display: (isScheduledInstallVisible) ? 'inline' : 'none'
}}>
<DatePicker showTime
placeholder="Select Time"
format="YYYY-MM-DDTHH:mm"
onChange={this.onDateTimeChange}/>
<Button disabled={scheduledTime == null}
style={{margin: 5}}
</span>
<Button style={{margin: 5}}
disabled={disabled || (isScheduledInstallVisible && scheduledTime == null)}
htmlType="button"
type="primary"
onClick={this.triggerScheduledInstallOperation}>
Schedule
</Button>
<Button style={{margin: 5}} htmlType="button"
onClick={this.hideScheduledInstall}>
Cancel
onClick={this.triggerInstallOperation}>
{type}
</Button>
</div>
</div>
);
}

Loading…
Cancel
Save