|
|
@ -42,7 +42,8 @@ class NewAppDetailsForm extends React.Component {
|
|
|
|
categories: [],
|
|
|
|
categories: [],
|
|
|
|
tags: [],
|
|
|
|
tags: [],
|
|
|
|
deviceTypes:[]
|
|
|
|
deviceTypes:[]
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -146,18 +147,31 @@ class NewAppDetailsForm extends React.Component {
|
|
|
|
|
|
|
|
|
|
|
|
getDeviceTypes = () => {
|
|
|
|
getDeviceTypes = () => {
|
|
|
|
const config = this.props.context;
|
|
|
|
const config = this.props.context;
|
|
|
|
|
|
|
|
const {formConfig} = this.props;
|
|
|
|
|
|
|
|
console.log("test");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
axios.get(
|
|
|
|
axios.get(
|
|
|
|
window.location.origin + config.serverConfig.invoker.uri + config.serverConfig.invoker.deviceMgt + "/device-types"
|
|
|
|
window.location.origin + config.serverConfig.invoker.uri + config.serverConfig.invoker.deviceMgt + "/device-types"
|
|
|
|
).then(res => {
|
|
|
|
).then(res => {
|
|
|
|
if (res.status === 200) {
|
|
|
|
if (res.status === 200) {
|
|
|
|
const deviceTypes = JSON.parse(res.data.data);
|
|
|
|
const allDeviceTypes = JSON.parse(res.data.data);
|
|
|
|
|
|
|
|
const whitelistedDeviceTypes = config.installationTypes[formConfig.installationType].deviceTypes;
|
|
|
|
|
|
|
|
const allowedDeviceTypes = [];
|
|
|
|
|
|
|
|
allDeviceTypes.forEach(deviceType=>{
|
|
|
|
|
|
|
|
if(whitelistedDeviceTypes.includes(deviceType.name)){
|
|
|
|
|
|
|
|
allowedDeviceTypes.push(deviceType);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
deviceTypes,
|
|
|
|
deviceTypes: allowedDeviceTypes,
|
|
|
|
loading: false,
|
|
|
|
loading: false,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}).catch((error) => {
|
|
|
|
}).catch((error) => {
|
|
|
|
|
|
|
|
console.log(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';
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -179,6 +193,7 @@ class NewAppDetailsForm extends React.Component {
|
|
|
|
const {categories, tags, deviceTypes} = this.state;
|
|
|
|
const {categories, tags, deviceTypes} = this.state;
|
|
|
|
const {getFieldDecorator} = this.props.form;
|
|
|
|
const {getFieldDecorator} = this.props.form;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
<Row>
|
|
|
|
<Row>
|
|
|
|