|
|
@ -24,17 +24,23 @@ import {withConfigContext} from "../../context/ConfigContext";
|
|
|
|
import {handleApiError} from "../../js/Utils";
|
|
|
|
import {handleApiError} from "../../js/Utils";
|
|
|
|
import NewAppUploadForm from "../new-app/subForms/NewAppUploadForm";
|
|
|
|
import NewAppUploadForm from "../new-app/subForms/NewAppUploadForm";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const formConfig = {
|
|
|
|
|
|
|
|
specificElements: {
|
|
|
|
|
|
|
|
binaryFile: {
|
|
|
|
|
|
|
|
required: true
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class AddNewReleaseFormComponent extends React.Component {
|
|
|
|
class AddNewReleaseFormComponent extends React.Component {
|
|
|
|
|
|
|
|
|
|
|
|
constructor(props) {
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
super(props);
|
|
|
|
this.state = {
|
|
|
|
this.state = {
|
|
|
|
loading: false,
|
|
|
|
loading: false,
|
|
|
|
isFree: true,
|
|
|
|
|
|
|
|
supportedOsVersions: [],
|
|
|
|
supportedOsVersions: [],
|
|
|
|
application: null,
|
|
|
|
application: null,
|
|
|
|
release: null,
|
|
|
|
release: null,
|
|
|
|
isError: false,
|
|
|
|
|
|
|
|
deviceType: null
|
|
|
|
deviceType: null
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -68,20 +74,18 @@ class AddNewReleaseFormComponent extends React.Component {
|
|
|
|
const config = this.props.context;
|
|
|
|
const config = this.props.context;
|
|
|
|
const {appId, deviceType} = this.props;
|
|
|
|
const {appId, deviceType} = this.props;
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
loading: true,
|
|
|
|
loading: true
|
|
|
|
isError: false
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
const {data, release} = releaseData;
|
|
|
|
const {data, release} = releaseData;
|
|
|
|
const {formConfig} = this.props;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const json = JSON.stringify(release);
|
|
|
|
const json = JSON.stringify(release);
|
|
|
|
const blob = new Blob([json], {
|
|
|
|
const blob = new Blob([json], {
|
|
|
|
type: 'application/json'
|
|
|
|
type: 'application/json'
|
|
|
|
});
|
|
|
|
});
|
|
|
|
data.append(formConfig.jsonPayloadName, blob);
|
|
|
|
data.append("applicationRelease", blob);
|
|
|
|
|
|
|
|
|
|
|
|
const url = window.location.origin + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher +
|
|
|
|
const url = window.location.origin + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher +
|
|
|
|
"/applications/" + deviceType + formConfig.endpoint + "/" + appId;
|
|
|
|
"/applications/" + deviceType + "/ent-app/" + appId;
|
|
|
|
axios.post(
|
|
|
|
axios.post(
|
|
|
|
url,
|
|
|
|
url,
|
|
|
|
data
|
|
|
|
data
|
|
|
@ -101,15 +105,13 @@ class AddNewReleaseFormComponent extends React.Component {
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
loading: false,
|
|
|
|
loading: false
|
|
|
|
isError: true,
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}).catch((error) => {
|
|
|
|
}).catch((error) => {
|
|
|
|
handleApiError(error, "Sorry, we were unable to complete your request.");
|
|
|
|
handleApiError(error, "Sorry, we were unable to complete your request.");
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
loading: false,
|
|
|
|
loading: false
|
|
|
|
isError: true,
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
@ -121,11 +123,10 @@ class AddNewReleaseFormComponent extends React.Component {
|
|
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
render() {
|
|
|
|
const {loading, supportedOsVersions} = this.state;
|
|
|
|
const {loading, supportedOsVersions} = this.state;
|
|
|
|
const {formConfig} = this.props;
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
<Spin tip="Uploading..." spinning={loading}>
|
|
|
|
<Spin tip="Uploading..." spinning={loading}>
|
|
|
|
<Card>
|
|
|
|
<Card style={{ width: "65%", marginLeft: "18%" }}>
|
|
|
|
<NewAppUploadForm
|
|
|
|
<NewAppUploadForm
|
|
|
|
formConfig={formConfig}
|
|
|
|
formConfig={formConfig}
|
|
|
|
supportedOsVersions={supportedOsVersions}
|
|
|
|
supportedOsVersions={supportedOsVersions}
|
|
|
|