Complete step form in add new app

feature/appm-store/pbac
Jayasanka 5 years ago
parent 673a87b970
commit da5556064d

@ -142,8 +142,7 @@ class AddNewAppFormComponent extends React.Component {
{!isError && (<Result
status="success"
title="Successfully created the application!"
subTitle="Order number: 2017182818828182881 Cloud server configuration takes 1-5 minutes, please wait."
title="Application created successfully!"
extra={[
<Button type="primary" key="console"
onClick={() => this.props.history.push('/publisher/apps')}>

@ -234,24 +234,24 @@ class NewAppDetailsForm extends React.Component {
</Select>
)}
</Form.Item>
<Form.Item {...formItemLayout} label="Meta Data">
<InputGroup>
<Row gutter={8}>
<Col span={10}>
<Input placeholder="Key"/>
</Col>
<Col span={12}>
<Input placeholder="value"/>
</Col>
<Col span={2}>
<Button type="dashed" shape="circle" icon="plus"/>
</Col>
</Row>
</InputGroup>
</Form.Item>
{/*<Form.Item {...formItemLayout} label="Meta Data">*/}
{/*<InputGroup>*/}
{/*<Row gutter={8}>*/}
{/*<Col span={10}>*/}
{/*<Input placeholder="Key"/>*/}
{/*</Col>*/}
{/*<Col span={12}>*/}
{/*<Input placeholder="value"/>*/}
{/*</Col>*/}
{/*<Col span={2}>*/}
{/*<Button type="dashed" shape="circle" icon="plus"/>*/}
{/*</Col>*/}
{/*</Row>*/}
{/*</InputGroup>*/}
{/*</Form.Item>*/}
<Form.Item style={{float: "right"}}>
<Button type="primary" htmlType="submit">
Submit
Next
</Button>
</Form.Item>
</Form>

@ -23,7 +23,8 @@ class NewAppUploadForm extends React.Component {
screenshots: [],
loading: false,
binaryFiles: [],
application: null
application: null,
isFree: true
}
}
@ -45,7 +46,9 @@ class NewAppUploadForm extends React.Component {
loading: true
});
const {name, description, categories, tags, price, isSharedWithAllTenants, binaryFile, icon, screenshots, releaseDescription, releaseType} = values;
console.log(values);
const {price, isSharedWithAllTenants, binaryFile, icon, screenshots, releaseDescription, releaseType} = values;
//add release data
const release = {
@ -91,10 +94,17 @@ class NewAppUploadForm extends React.Component {
handleScreenshotChange = ({fileList}) => this.setState({screenshots: fileList});
handlePriceTypeChange = (value) => {
this.setState({
isFree: (value === 'free')
})
};
render() {
const {formConfig} = this.props;
const {getFieldDecorator} = this.props.form;
const {icons, screenshots, binaryFiles} = this.state;
const {icons, screenshots, binaryFiles, isFree} = this.state;
return (
@ -245,14 +255,32 @@ class NewAppUploadForm extends React.Component {
)}
</Form.Item>
<Form.Item {...formItemLayout} label="Price Type">
{getFieldDecorator('select', {
rules: [{required: true, message: 'Please select price Type'}],
})(
<Select
placeholder="Please select a price type"
onChange={this.handlePriceTypeChange}>
<Option value="free">Free</Option>
<Option value="paid">Paid</Option>
</Select>,
)}
</Form.Item>
<Form.Item {...formItemLayout} label="Price">
{getFieldDecorator('price', {
rules: [{
required: false
required: !isFree
}],
})(
<InputNumber
defaultValue={1000}
disabled={isFree}
options={{
initialValue: 1
}}
min={0}
max={10000}
formatter={value => `$ ${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')}
parser={value => value.replace(/\$\s?|(,*)/g, '')}
/>

Loading…
Cancel
Save