Merged 2.0.0-m3

This commit is contained in:
Philipp Czora
2018-11-23 16:25:12 +01:00
111 changed files with 2400 additions and 3541 deletions

View File

@@ -27,13 +27,32 @@ type Props = {
t: string => string
};
class Index extends Component<Props> {
type State = {
pluginsLoaded: boolean
};
class Index extends Component<Props, State> {
constructor(props: Props) {
super(props);
this.state = {
pluginsLoaded: false
};
}
componentDidMount() {
this.props.fetchIndexResources();
}
pluginLoaderCallback = () => {
this.setState({
pluginsLoaded: true
});
};
render() {
const { indexResources, loading, error, t } = this.props;
const { pluginsLoaded } = this.state;
if (error) {
return (
@@ -47,7 +66,7 @@ class Index extends Component<Props> {
return <Loading />;
} else {
return (
<PluginLoader>
<PluginLoader loaded={ pluginsLoaded } callback={ this.pluginLoaderCallback }>
<App />
</PluginLoader>
);

View File

@@ -5,12 +5,13 @@ import { getUiPluginsLink } from "../modules/indexResource";
import { connect } from "react-redux";
type Props = {
loaded: boolean,
children: React.Node,
link: string
link: string,
callback: () => void
};
type State = {
finished: boolean,
message: string
};
@@ -23,17 +24,19 @@ class PluginLoader extends React.Component<Props, State> {
constructor(props: Props) {
super(props);
this.state = {
finished: false,
message: "booting"
};
}
componentDidMount() {
this.setState({
message: "loading plugin information"
});
this.getPlugins(this.props.link);
const { loaded } = this.props;
if (!loaded) {
this.setState({
message: "loading plugin information"
});
this.getPlugins(this.props.link);
}
}
getPlugins = (link: string): Promise<any> => {
@@ -43,11 +46,7 @@ class PluginLoader extends React.Component<Props, State> {
.then(JSON.parse)
.then(pluginCollection => pluginCollection._embedded.plugins)
.then(this.loadPlugins)
.then(() => {
this.setState({
finished: true
});
});
.then(this.props.callback);
};
loadPlugins = (plugins: Plugin[]) => {
@@ -87,8 +86,9 @@ class PluginLoader extends React.Component<Props, State> {
};
render() {
const { message, finished } = this.state;
if (finished) {
const { loaded } = this.props;
const { message } = this.state;
if (loaded) {
return <div>{this.props.children}</div>;
}
return <Loading message={message} />;

View File

@@ -15,11 +15,14 @@ i18n
.init({
fallbackLng: "en",
// try to load only "en" and not "en_US"
load: "languageOnly",
// have a common namespace used around the full app
ns: ["commons"],
defaultNS: "commons",
debug: true,
debug: false,
interpolation: {
escapeValue: false // not needed for react!!

View File

@@ -124,7 +124,7 @@ class RepositoryForm extends React.Component<Props, State> {
const { repositoryTypes, t } = this.props;
const repository = this.state.repository;
return (
<div>
<>
<InputField
label={t("repository.name")}
onChange={this.handleNameChange}
@@ -140,7 +140,7 @@ class RepositoryForm extends React.Component<Props, State> {
options={this.createSelectOptions(repositoryTypes)}
helpText={t("help.typeHelpText")}
/>
</div>
</>
);
}

View File

@@ -35,6 +35,7 @@ import PermissionsNavLink from "../components/PermissionsNavLink";
import Sources from "../sources/containers/Sources";
import RepositoryNavLink from "../components/RepositoryNavLink";
import { getRepositoriesLink } from "../../modules/indexResource";
import {ExtensionPoint} from '@scm-manager/ui-extensions';
type Props = {
namespace: string,
@@ -104,6 +105,12 @@ class RepositoryRoot extends React.Component<Props> {
}
const url = this.matchedUrl();
const extensionProps = {
repository,
url
};
return (
<Page title={repository.namespace + "/" + repository.name}>
<div className="columns">
@@ -165,6 +172,10 @@ class RepositoryRoot extends React.Component<Props> {
/>
)}
/>
<ExtensionPoint name="repository.route"
props={extensionProps}
renderAll={true}
/>
</Switch>
</div>
<div className="column">
@@ -186,11 +197,15 @@ class RepositoryRoot extends React.Component<Props> {
label={t("repository-root.sources")}
activeOnlyWhenExact={false}
/>
<EditNavLink repository={repository} editUrl={`${url}/edit`} />
<ExtensionPoint name="repository.navigation"
props={extensionProps}
renderAll={true}
/>
<PermissionsNavLink
permissionUrl={`${url}/permissions`}
repository={repository}
/>
<EditNavLink repository={repository} editUrl={`${url}/edit`} />
</Section>
<Section label={t("repository-root.actions-label")}>
<DeleteNavAction repository={repository} delete={this.delete} />

View File

@@ -38,7 +38,7 @@ class UserForm extends React.Component<Props, State> {
mail: "",
password: "",
admin: false,
active: false,
active: true,
_links: {}
},
mailValidationError: false,
@@ -73,7 +73,8 @@ class UserForm extends React.Component<Props, State> {
this.state.passwordConfirmationError ||
this.state.displayNameValidationError ||
this.isFalsy(user.name) ||
this.isFalsy(user.displayName)
this.isFalsy(user.displayName) ||
this.isFalsy(user.mail)
);
};