merge with branch feature/changes-for-script-plugin

This commit is contained in:
Sebastian Sdorra
2019-01-11 13:49:02 +01:00
4 changed files with 44 additions and 30 deletions

View File

@@ -57,6 +57,14 @@ class PrimaryNavigation extends React.Component<Props> {
append("/groups", "/(group|groups)", "primary-navigation.groups", "groups");
append("/config", "/config", "primary-navigation.config", "config");
navigationItems.push(
<ExtensionPoint
name="primary-navigation"
renderAll={true}
props={{links: this.props.links}}
/>
);
this.appendLogout(navigationItems, append);
return navigationItems;

View File

@@ -79,7 +79,7 @@ class App extends Component<Props> {
/>
);
} else {
content = <Main authenticated={authenticated} />;
content = <Main authenticated={authenticated} links={links} />;
}
return (
<div className="App">

View File

@@ -2,6 +2,7 @@
import React from "react";
import { Redirect, Route, Switch, withRouter } from "react-router-dom";
import type {Links} from "@scm-manager/ui-types";
import Overview from "../repos/containers/Overview";
import Users from "../users/containers/Users";
@@ -9,6 +10,8 @@ import Login from "../containers/Login";
import Logout from "../containers/Logout";
import { ProtectedRoute } from "@scm-manager/ui-components";
import { ExtensionPoint } from "@scm-manager/ui-extensions";
import AddUser from "../users/containers/AddUser";
import SingleUser from "../users/containers/SingleUser";
import RepositoryRoot from "../repos/containers/RepositoryRoot";
@@ -22,12 +25,13 @@ import Config from "../config/containers/Config";
import Profile from "./Profile";
type Props = {
authenticated?: boolean
authenticated?: boolean,
links: Links
};
class Main extends React.Component<Props> {
render() {
const { authenticated } = this.props;
const { authenticated, links } = this.props;
return (
<div className="main">
<Switch>
@@ -112,6 +116,12 @@ class Main extends React.Component<Props> {
component={Profile}
authenticated={authenticated}
/>
<ExtensionPoint
name="main.route"
renderAll={true}
props={{authenticated, links}}
/>
</Switch>
</div>
);

View File

@@ -73,43 +73,39 @@ public final class UberClassLoader extends ClassLoader
//~--- methods --------------------------------------------------------------
/**
* Method description
*
*
* @param name
*
* @return
*
* @throws ClassNotFoundException
*/
@Override
protected Class<?> findClass(String name) throws ClassNotFoundException
{
Class<?> clazz = getFromCache(name);
if (clazz == null)
{
for (PluginWrapper plugin : plugins)
{
ClassLoader cl = plugin.getClassLoader();
// load class could be slow, perhaps we should call
// find class via reflection ???
clazz = cl.loadClass(name);
if (clazz != null)
{
cache.put(name, new WeakReference<Class<?>>(clazz));
break;
}
}
if (clazz == null) {
clazz = findClassInPlugins(name);
cache.put(name, new WeakReference<>(clazz));
}
return clazz;
}
private Class<?> findClassInPlugins(String name) throws ClassNotFoundException {
for (PluginWrapper plugin : plugins) {
Class<?> clazz = findClass(plugin.getClassLoader(), name);
if (clazz != null) {
return clazz;
}
}
throw new ClassNotFoundException("could not find class " + name + " in any of the installed plugins");
}
private Class<?> findClass(ClassLoader classLoader, String name) {
try {
// load class could be slow, perhaps we should call
// find class via reflection ???
return classLoader.loadClass(name);
} catch (ClassNotFoundException ex) {
return null;
}
}
/**
* Method description
*