use new plugin bundle format

This commit is contained in:
Sebastian Sdorra
2019-10-07 17:06:00 +02:00
parent c05798e254
commit 6e99182b4e
22 changed files with 1239 additions and 3183 deletions

View File

@@ -3,6 +3,7 @@ import * as React from "react";
import { apiClient, Loading } from "@scm-manager/ui-components";
import { getUiPluginsLink } from "../modules/indexResource";
import { connect } from "react-redux";
import loadBundle from "./loadBundle";
type Props = {
loaded: boolean,
@@ -73,30 +74,11 @@ class PluginLoader extends React.Component<Props, State> {
const promises = [];
for (let bundle of plugin.bundles) {
promises.push(this.loadBundle(bundle));
promises.push(loadBundle(bundle));
}
return Promise.all(promises);
};
loadBundle = (bundle: string) => {
return fetch(bundle, {
credentials: "same-origin",
headers: {
Cache: "no-cache",
// identify the request as ajax request
"X-Requested-With": "XMLHttpRequest"
}
})
.then(response => {
return response.text();
})
.then(script => {
// TODO is this safe???
// eslint-disable-next-line no-eval
eval(script); // NOSONAR
});
};
render() {
const { loaded } = this.props;
const { message } = this.state;