mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-17 10:41:06 +01:00
merge with 2.0.0-m3
This commit is contained in:
@@ -136,7 +136,7 @@ class Configuration extends React.Component<Props, State> {
|
|||||||
className="delete"
|
className="delete"
|
||||||
onClick={() => this.setState({ configChanged: false })}
|
onClick={() => this.setState({ configChanged: false })}
|
||||||
/>
|
/>
|
||||||
{this.props.t("config-form.submit-success-notification")}
|
{this.props.t("config.form.submit-success-notification")}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -167,7 +167,7 @@ class Configuration extends React.Component<Props, State> {
|
|||||||
{this.props.render(renderProps)}
|
{this.props.render(renderProps)}
|
||||||
<hr />
|
<hr />
|
||||||
<SubmitButton
|
<SubmitButton
|
||||||
label={t("config-form.submit")}
|
label={t("config.form.submit")}
|
||||||
disabled={!valid || readOnly}
|
disabled={!valid || readOnly}
|
||||||
loading={modifying}
|
loading={modifying}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -29,20 +29,20 @@ class ConfigurationBinder {
|
|||||||
|
|
||||||
// create NavigationLink with translated label
|
// create NavigationLink with translated label
|
||||||
const ConfigNavLink = translate(this.i18nNamespace)(({t}) => {
|
const ConfigNavLink = translate(this.i18nNamespace)(({t}) => {
|
||||||
return this.navLink("/config" + to, labelI18nKey, t);
|
return this.navLink("/admin/settings" + to, labelI18nKey, t);
|
||||||
});
|
});
|
||||||
|
|
||||||
// bind navigation link to extension point
|
// bind navigation link to extension point
|
||||||
binder.bind("config.navigation", ConfigNavLink, configPredicate);
|
binder.bind("admin.setting", ConfigNavLink, configPredicate);
|
||||||
|
|
||||||
// route for global configuration, passes the link from the index resource to component
|
// route for global configuration, passes the link from the index resource to component
|
||||||
const ConfigRoute = ({ url, links, ...additionalProps }) => {
|
const ConfigRoute = ({ url, links, ...additionalProps }) => {
|
||||||
const link = links[linkName].href;
|
const link = links[linkName].href;
|
||||||
return this.route(url + to, <ConfigurationComponent link={link} {...additionalProps} />);
|
return this.route(url + "/settings" + to, <ConfigurationComponent link={link} {...additionalProps} />);
|
||||||
};
|
};
|
||||||
|
|
||||||
// bind config route to extension point
|
// bind config route to extension point
|
||||||
binder.bind("config.route", ConfigRoute, configPredicate);
|
binder.bind("admin.route", ConfigRoute, configPredicate);
|
||||||
}
|
}
|
||||||
|
|
||||||
bindRepository(to: string, labelI18nKey: string, linkName: string, RepositoryComponent: any) {
|
bindRepository(to: string, labelI18nKey: string, linkName: string, RepositoryComponent: any) {
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ class PrimaryNavigation extends React.Component<Props> {
|
|||||||
"primary-navigation.groups",
|
"primary-navigation.groups",
|
||||||
"groups"
|
"groups"
|
||||||
);
|
);
|
||||||
append("/config", "/config", "primary-navigation.config", "config");
|
append("/admin", "/admin", "primary-navigation.admin", "config");
|
||||||
|
|
||||||
navigationItems.push(
|
navigationItems.push(
|
||||||
<ExtensionPoint
|
<ExtensionPoint
|
||||||
|
|||||||
46
scm-ui/public/locales/de/admin.json
Normal file
46
scm-ui/public/locales/de/admin.json
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"admin": {
|
||||||
|
"menu": {
|
||||||
|
"navigationLabel": "Administrations Navigation",
|
||||||
|
"informationNavLink": "Informationen",
|
||||||
|
"settingsNavLink": "Einstellungen",
|
||||||
|
"generalNavLink": "Generell"
|
||||||
|
},
|
||||||
|
"information": {
|
||||||
|
"currentAppVersion": "Aktuelle Software-Versionsnummer"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"repositoryRole": {
|
||||||
|
"navLink": "Berechtigungsrollen",
|
||||||
|
"title": "Berechtigungsrollen",
|
||||||
|
"errorTitle": "Fehler",
|
||||||
|
"errorSubtitle": "Unbekannter Berechtigungsrollen Fehler",
|
||||||
|
"createSubtitle": "Berechtigungsrolle erstellen",
|
||||||
|
"editSubtitle": "Berechtigungsrolle bearbeiten",
|
||||||
|
"overview": {
|
||||||
|
"title": "Übersicht aller verfügbaren Berechtigungsrollen",
|
||||||
|
"noPermissionRoles": "Keine Berechtigungsrollen gefunden.",
|
||||||
|
"createButton": "Berechtigungsrolle erstellen"
|
||||||
|
},
|
||||||
|
"editButton": "Bearbeiten",
|
||||||
|
"name": "Name",
|
||||||
|
"type": "Typ",
|
||||||
|
"verbs": "Berechtigungen",
|
||||||
|
"system": "System",
|
||||||
|
"form": {
|
||||||
|
"name": "Name",
|
||||||
|
"permissions": "Berechtigungen",
|
||||||
|
"submit": "Speichern"
|
||||||
|
},
|
||||||
|
"delete": {
|
||||||
|
"button": "Delete",
|
||||||
|
"subtitle": "Delete Permission Role",
|
||||||
|
"confirmAlert": {
|
||||||
|
"title": "Delete Permission Role",
|
||||||
|
"message": "Do you really want to delete this permission role? All users who own this role will lose their permissions.",
|
||||||
|
"submit": "Yes",
|
||||||
|
"cancel": "No"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
"users": "Benutzer",
|
"users": "Benutzer",
|
||||||
"logout": "Abmelden",
|
"logout": "Abmelden",
|
||||||
"groups": "Gruppen",
|
"groups": "Gruppen",
|
||||||
"config": "Einstellungen"
|
"admin": "Administration"
|
||||||
},
|
},
|
||||||
"filterEntries": "Einträge filtern",
|
"filterEntries": "Einträge filtern",
|
||||||
"paginator": {
|
"paginator": {
|
||||||
|
|||||||
@@ -1,49 +1,15 @@
|
|||||||
{
|
{
|
||||||
"config": {
|
"config": {
|
||||||
"navigationLabel": "Einstellungs Navigation",
|
"navigationLabel": "Administrations Navigation",
|
||||||
"globalConfigurationNavLink": "Globale Einstellungen",
|
"title": "Globale Einstellungen",
|
||||||
"title": "Einstellungen",
|
|
||||||
"errorTitle": "Fehler",
|
"errorTitle": "Fehler",
|
||||||
"errorSubtitle": "Unbekannter Einstellungen Fehler"
|
"errorSubtitle": "Unbekannter Einstellungen Fehler",
|
||||||
},
|
|
||||||
"repositoryRole": {
|
|
||||||
"navLink": "Berechtigungsrollen",
|
|
||||||
"title": "Berechtigungsrollen",
|
|
||||||
"errorTitle": "Fehler",
|
|
||||||
"errorSubtitle": "Unbekannter Berechtigungsrollen Fehler",
|
|
||||||
"createSubtitle": "Berechtigungsrolle erstellen",
|
|
||||||
"editSubtitle": "Berechtigungsrolle bearbeiten",
|
|
||||||
"overview": {
|
|
||||||
"title": "Übersicht aller verfügbaren Berechtigungsrollen",
|
|
||||||
"noPermissionRoles": "Keine Berechtigungsrollen gefunden.",
|
|
||||||
"createButton": "Berechtigungsrolle erstellen"
|
|
||||||
},
|
|
||||||
"editButton": "Bearbeiten",
|
|
||||||
"name": "Name",
|
|
||||||
"type": "Typ",
|
|
||||||
"verbs": "Berechtigungen",
|
|
||||||
"system": "System",
|
|
||||||
"form": {
|
"form": {
|
||||||
"name": "Name",
|
|
||||||
"permissions": "Berechtigungen",
|
|
||||||
"submit": "Speichern"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"deleteRole" : {
|
|
||||||
"button": "Löschen",
|
|
||||||
"subtitle": "Berechtigungsrolle löschen",
|
|
||||||
"confirmAlert": {
|
|
||||||
"title": "Berechtigungsrolle löschen",
|
|
||||||
"message": "Soll die Berechtigungsrolle wirklich gelöscht werden? Alle Nutzer dieser Rolle verlieren Ihre Berechtigungen.",
|
|
||||||
"submit": "Ja",
|
|
||||||
"cancel": "Nein"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"config-form": {
|
|
||||||
"submit": "Speichern",
|
"submit": "Speichern",
|
||||||
"submit-success-notification": "Einstellungen wurden erfolgreich geändert!",
|
"submit-success-notification": "Einstellungen wurden erfolgreich geändert!",
|
||||||
"no-read-permission-notification": "Hinweis: Es fehlen Berechtigungen zum Lesen der Einstellungen!",
|
"no-read-permission-notification": "Hinweis: Es fehlen Berechtigungen zum Lesen der Einstellungen!",
|
||||||
"no-write-permission-notification": "Hinweis: Es fehlen Berechtigungen zum Bearbeiten der Einstellungen!"
|
"no-write-permission-notification": "Hinweis: Es fehlen Berechtigungen zum Bearbeiten der Einstellungen!"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"proxy-settings": {
|
"proxy-settings": {
|
||||||
"name": "Proxy Einstellungen",
|
"name": "Proxy Einstellungen",
|
||||||
|
|||||||
46
scm-ui/public/locales/en/admin.json
Normal file
46
scm-ui/public/locales/en/admin.json
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"admin": {
|
||||||
|
"menu": {
|
||||||
|
"navigationLabel": "Administration Navigation",
|
||||||
|
"informationNavLink": "Information",
|
||||||
|
"settingsNavLink": "Settings",
|
||||||
|
"generalNavLink": "General"
|
||||||
|
},
|
||||||
|
"information": {
|
||||||
|
"currentAppVersion": "Current Application Version"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"repositoryRole": {
|
||||||
|
"navLink": "Permission Roles",
|
||||||
|
"title": "Permission Roles",
|
||||||
|
"errorTitle": "Error",
|
||||||
|
"errorSubtitle": "Unknown Permission Role Error",
|
||||||
|
"createSubtitle": "Create Permission Role",
|
||||||
|
"editSubtitle": "Edit Permission Role",
|
||||||
|
"overview": {
|
||||||
|
"title": "Overview of all permission roles",
|
||||||
|
"noPermissionRoles": "No permission roles found.",
|
||||||
|
"createButton": "Create Permission Role"
|
||||||
|
},
|
||||||
|
"editButton": "Edit",
|
||||||
|
"name": "Name",
|
||||||
|
"type": "Type",
|
||||||
|
"verbs": "Permissions",
|
||||||
|
"system": "System",
|
||||||
|
"form": {
|
||||||
|
"name": "Name",
|
||||||
|
"permissions": "Permissions",
|
||||||
|
"submit": "Save"
|
||||||
|
},
|
||||||
|
"delete" : {
|
||||||
|
"button": "Löschen",
|
||||||
|
"subtitle": "Berechtigungsrolle löschen",
|
||||||
|
"confirmAlert": {
|
||||||
|
"title": "Berechtigungsrolle löschen",
|
||||||
|
"message": "Soll die Berechtigungsrolle wirklich gelöscht werden? Alle Nutzer dieser Rolle verlieren Ihre Berechtigungen.",
|
||||||
|
"submit": "Ja",
|
||||||
|
"cancel": "Nein"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
"users": "Users",
|
"users": "Users",
|
||||||
"logout": "Logout",
|
"logout": "Logout",
|
||||||
"groups": "Groups",
|
"groups": "Groups",
|
||||||
"config": "Configuration"
|
"admin": "Administration"
|
||||||
},
|
},
|
||||||
"filterEntries": "filter entries",
|
"filterEntries": "filter entries",
|
||||||
"paginator": {
|
"paginator": {
|
||||||
|
|||||||
@@ -1,49 +1,15 @@
|
|||||||
{
|
{
|
||||||
"config": {
|
"config": {
|
||||||
"navigationLabel": "Configuration Navigation",
|
"navigationLabel": "Administration Navigation",
|
||||||
"globalConfigurationNavLink": "Global Configuration",
|
"title": "Global Configuration",
|
||||||
"title": "Configuration",
|
|
||||||
"errorTitle": "Error",
|
"errorTitle": "Error",
|
||||||
"errorSubtitle": "Unknown Config Error"
|
"errorSubtitle": "Unknown Config Error",
|
||||||
},
|
|
||||||
"repositoryRole": {
|
|
||||||
"navLink": "Permission Roles",
|
|
||||||
"title": "Permission Roles",
|
|
||||||
"errorTitle": "Error",
|
|
||||||
"errorSubtitle": "Unknown Permission Role Error",
|
|
||||||
"createSubtitle": "Create Permission Role",
|
|
||||||
"editSubtitle": "Edit Permission Role",
|
|
||||||
"overview": {
|
|
||||||
"title": "Overview of all permission roles",
|
|
||||||
"noPermissionRoles": "No permission roles found.",
|
|
||||||
"createButton": "Create Permission Role"
|
|
||||||
},
|
|
||||||
"editButton": "Edit",
|
|
||||||
"name": "Name",
|
|
||||||
"type": "Type",
|
|
||||||
"verbs": "Permissions",
|
|
||||||
"system": "System",
|
|
||||||
"form": {
|
"form": {
|
||||||
"name": "Name",
|
|
||||||
"permissions": "Permissions",
|
|
||||||
"submit": "Save"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"deleteRole": {
|
|
||||||
"button": "Delete",
|
|
||||||
"subtitle": "Delete Permission Role",
|
|
||||||
"confirmAlert": {
|
|
||||||
"title": "Delete Permission Role",
|
|
||||||
"message": "Do you really want to delete this permission role? All users who own this role will lose their permissions.",
|
|
||||||
"submit": "Yes",
|
|
||||||
"cancel": "No"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"config-form": {
|
|
||||||
"submit": "Submit",
|
"submit": "Submit",
|
||||||
"submit-success-notification": "Configuration changed successfully!",
|
"submit-success-notification": "Configuration changed successfully!",
|
||||||
"no-read-permission-notification": "Please note: You do not have the permission to see the config!",
|
"no-read-permission-notification": "Please note: You do not have the permission to see the config!",
|
||||||
"no-write-permission-notification": "Please note: You do not have the permission to edit the config!"
|
"no-write-permission-notification": "Please note: You do not have the permission to edit the config!"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"proxy-settings": {
|
"proxy-settings": {
|
||||||
"name": "Proxy Settings",
|
"name": "Proxy Settings",
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ class ConfigForm extends React.Component<Props, State> {
|
|||||||
return (
|
return (
|
||||||
<Notification
|
<Notification
|
||||||
type={"danger"}
|
type={"danger"}
|
||||||
children={t("config-form.no-read-permission-notification")}
|
children={t("config.form.no-read-permission-notification")}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -108,7 +108,7 @@ class ConfigForm extends React.Component<Props, State> {
|
|||||||
noPermissionNotification = (
|
noPermissionNotification = (
|
||||||
<Notification
|
<Notification
|
||||||
type={"info"}
|
type={"info"}
|
||||||
children={t("config-form.no-write-permission-notification")}
|
children={t("config.form.no-write-permission-notification")}
|
||||||
onClose={() => this.onClose()}
|
onClose={() => this.onClose()}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
@@ -167,7 +167,7 @@ class ConfigForm extends React.Component<Props, State> {
|
|||||||
<hr />
|
<hr />
|
||||||
<SubmitButton
|
<SubmitButton
|
||||||
loading={loading}
|
loading={loading}
|
||||||
label={t("config-form.submit")}
|
label={t("config.form.submit")}
|
||||||
disabled={
|
disabled={
|
||||||
!configUpdatePermission || this.hasError() || !this.state.changed
|
!configUpdatePermission || this.hasError() || !this.state.changed
|
||||||
}
|
}
|
||||||
@@ -1,14 +1,15 @@
|
|||||||
// @flow
|
// @flow
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { translate } from "react-i18next";
|
import { translate } from "react-i18next";
|
||||||
import { Route, Switch } from "react-router-dom";
|
import {Redirect, Route, Switch} from "react-router-dom";
|
||||||
import { ExtensionPoint } from "@scm-manager/ui-extensions";
|
import { ExtensionPoint } from "@scm-manager/ui-extensions";
|
||||||
import type { History } from "history";
|
import type { History } from "history";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { compose } from "redux";
|
import { compose } from "redux";
|
||||||
import type { Links } from "@scm-manager/ui-types";
|
import type { Links } from "@scm-manager/ui-types";
|
||||||
import { Page, Navigation, NavLink, Section } from "@scm-manager/ui-components";
|
import { Page, Navigation, NavLink, Section, SubNavigation } from "@scm-manager/ui-components";
|
||||||
import { getLinks } from "../../modules/indexResource";
|
import { getLinks } from "../../modules/indexResource";
|
||||||
|
import AdminDetails from "./AdminDetails";
|
||||||
import GlobalConfig from "./GlobalConfig";
|
import GlobalConfig from "./GlobalConfig";
|
||||||
import RepositoryRoles from "../roles/containers/RepositoryRoles";
|
import RepositoryRoles from "../roles/containers/RepositoryRoles";
|
||||||
import SingleRepositoryRole from "../roles/containers/SingleRepositoryRole";
|
import SingleRepositoryRole from "../roles/containers/SingleRepositoryRole";
|
||||||
@@ -23,11 +24,14 @@ type Props = {
|
|||||||
history: History
|
history: History
|
||||||
};
|
};
|
||||||
|
|
||||||
class Config extends React.Component<Props> {
|
class Admin extends React.Component<Props> {
|
||||||
stripEndingSlash = (url: string) => {
|
stripEndingSlash = (url: string) => {
|
||||||
if (url.endsWith("/")) {
|
if (url.endsWith("/")) {
|
||||||
|
if(url.includes("role")) {
|
||||||
return url.substring(0, url.length - 2);
|
return url.substring(0, url.length - 2);
|
||||||
}
|
}
|
||||||
|
return url.substring(0, url.length - 1);
|
||||||
|
}
|
||||||
return url;
|
return url;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -55,7 +59,9 @@ class Config extends React.Component<Props> {
|
|||||||
<div className="columns">
|
<div className="columns">
|
||||||
<div className="column is-three-quarters">
|
<div className="column is-three-quarters">
|
||||||
<Switch>
|
<Switch>
|
||||||
<Route path={url} exact component={GlobalConfig} />
|
<Redirect exact from={url} to={`${url}/info`} />
|
||||||
|
<Route path={`${url}/info`} exact component={AdminDetails} />
|
||||||
|
<Route path={`${url}/settings/general`} exact component={GlobalConfig} />
|
||||||
<Route
|
<Route
|
||||||
path={`${url}/role/:role`}
|
path={`${url}/role/:role`}
|
||||||
render={() => (
|
render={() => (
|
||||||
@@ -86,7 +92,7 @@ class Config extends React.Component<Props> {
|
|||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
<ExtensionPoint
|
<ExtensionPoint
|
||||||
name="config.route"
|
name="admin.route"
|
||||||
props={extensionProps}
|
props={extensionProps}
|
||||||
renderAll={true}
|
renderAll={true}
|
||||||
/>
|
/>
|
||||||
@@ -94,22 +100,38 @@ class Config extends React.Component<Props> {
|
|||||||
</div>
|
</div>
|
||||||
<div className="column is-one-quarter">
|
<div className="column is-one-quarter">
|
||||||
<Navigation>
|
<Navigation>
|
||||||
<Section label={t("config.navigationLabel")}>
|
<Section label={t("admin.menu.navigationLabel")}>
|
||||||
<NavLink
|
<NavLink
|
||||||
to={`${url}`}
|
to={`${url}/info`}
|
||||||
label={t("config.globalConfigurationNavLink")}
|
icon="fas fa-info-circle"
|
||||||
|
label={t("admin.menu.informationNavLink")}
|
||||||
/>
|
/>
|
||||||
<NavLink
|
<NavLink
|
||||||
to={`${url}/roles/`}
|
to={`${url}/roles/`}
|
||||||
|
icon="fas fa-user-shield"
|
||||||
label={t("repositoryRole.navLink")}
|
label={t("repositoryRole.navLink")}
|
||||||
activeWhenMatch={this.matchesRoles}
|
activeWhenMatch={this.matchesRoles}
|
||||||
activeOnlyWhenExact={false}
|
activeOnlyWhenExact={false}
|
||||||
/>
|
/>
|
||||||
<ExtensionPoint
|
<ExtensionPoint
|
||||||
name="config.navigation"
|
name="admin.navigation"
|
||||||
props={extensionProps}
|
props={extensionProps}
|
||||||
renderAll={true}
|
renderAll={true}
|
||||||
/>
|
/>
|
||||||
|
<SubNavigation
|
||||||
|
to={`${url}/settings/general`}
|
||||||
|
label={t("admin.menu.settingsNavLink")}
|
||||||
|
>
|
||||||
|
<NavLink
|
||||||
|
to={`${url}/settings/general`}
|
||||||
|
label={t("admin.menu.generalNavLink")}
|
||||||
|
/>
|
||||||
|
<ExtensionPoint
|
||||||
|
name="admin.setting"
|
||||||
|
props={extensionProps}
|
||||||
|
renderAll={true}
|
||||||
|
/>
|
||||||
|
</SubNavigation>
|
||||||
</Section>
|
</Section>
|
||||||
</Navigation>
|
</Navigation>
|
||||||
</div>
|
</div>
|
||||||
@@ -128,5 +150,5 @@ const mapStateToProps = (state: any) => {
|
|||||||
|
|
||||||
export default compose(
|
export default compose(
|
||||||
connect(mapStateToProps),
|
connect(mapStateToProps),
|
||||||
translate("config")
|
translate("admin")
|
||||||
)(Config);
|
)(Admin);
|
||||||
41
scm-ui/src/admin/containers/AdminDetails.js
Normal file
41
scm-ui/src/admin/containers/AdminDetails.js
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
// @flow
|
||||||
|
import React from "react";
|
||||||
|
import { translate } from "react-i18next";
|
||||||
|
import {Loading, Subtitle} from "@scm-manager/ui-components";
|
||||||
|
import {getAppVersion} from "../../modules/indexResource";
|
||||||
|
import {connect} from "react-redux";
|
||||||
|
import Title from "@scm-manager/ui-components/src/layout/Title";
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
loading: boolean,
|
||||||
|
error: Error,
|
||||||
|
|
||||||
|
version: string,
|
||||||
|
|
||||||
|
// context objects
|
||||||
|
t: string => string
|
||||||
|
};
|
||||||
|
|
||||||
|
class AdminDetails extends React.Component<Props> {
|
||||||
|
render() {
|
||||||
|
const { t, loading } = this.props;
|
||||||
|
|
||||||
|
if (loading) {
|
||||||
|
return <Loading />;
|
||||||
|
}
|
||||||
|
|
||||||
|
return <>
|
||||||
|
<Title title={t("admin.information.currentAppVersion")}/>
|
||||||
|
<Subtitle subtitle={this.props.version}/>
|
||||||
|
</>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const mapStateToProps = (state: any) => {
|
||||||
|
const version = getAppVersion(state);
|
||||||
|
return {
|
||||||
|
version
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export default connect(mapStateToProps)(translate("admin")(AdminDetails));
|
||||||
@@ -80,7 +80,7 @@ class GlobalConfig extends React.Component<Props, State> {
|
|||||||
className="delete"
|
className="delete"
|
||||||
onClick={() => this.setState({ configChanged: false })}
|
onClick={() => this.setState({ configChanged: false })}
|
||||||
/>
|
/>
|
||||||
{this.props.t("config-form.submit-success-notification")}
|
{this.props.t("config.form.submit-success-notification")}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import * as types from "../../modules/types";
|
import * as types from "../../modules/types";
|
||||||
import type { Action, NamespaceStrategies } from "@scm-manager/ui-types";
|
import type { Action, NamespaceStrategies } from "@scm-manager/ui-types";
|
||||||
import { apiClient } from "@scm-manager/ui-components";
|
import { apiClient } from "@scm-manager/ui-components";
|
||||||
@@ -47,4 +47,4 @@ class PermissionRoleDetails extends React.Component<Props> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default translate("config")(PermissionRoleDetails);
|
export default translate("admin")(PermissionRoleDetails);
|
||||||
@@ -35,4 +35,4 @@ class PermissionRoleDetailsTable extends React.Component<Props> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default translate("config")(PermissionRoleDetailsTable);
|
export default translate("admin")(PermissionRoleDetailsTable);
|
||||||
@@ -34,4 +34,4 @@ class PermissionRoleTable extends React.Component<Props> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default translate("config")(PermissionRoleTable);
|
export default translate("admin")(PermissionRoleTable);
|
||||||
@@ -34,4 +34,4 @@ class SystemRoleTag extends React.Component<Props> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default injectSheet(styles)(translate("config")(SystemRoleTag));
|
export default injectSheet(styles)(translate("admin")(SystemRoleTag));
|
||||||
@@ -32,7 +32,7 @@ type Props = {
|
|||||||
class CreateRepositoryRole extends React.Component<Props> {
|
class CreateRepositoryRole extends React.Component<Props> {
|
||||||
repositoryRoleCreated = (role: RepositoryRole) => {
|
repositoryRoleCreated = (role: RepositoryRole) => {
|
||||||
const { history } = this.props;
|
const { history } = this.props;
|
||||||
history.push("/config/role/" + role.name + "/info");
|
history.push("/admin/role/" + role.name + "/info");
|
||||||
};
|
};
|
||||||
|
|
||||||
createRepositoryRole = (role: RepositoryRole) => {
|
createRepositoryRole = (role: RepositoryRole) => {
|
||||||
@@ -85,4 +85,4 @@ const mapDispatchToProps = dispatch => {
|
|||||||
export default connect(
|
export default connect(
|
||||||
mapStateToProps,
|
mapStateToProps,
|
||||||
mapDispatchToProps
|
mapDispatchToProps
|
||||||
)(translate("config")(CreateRepositoryRole));
|
)(translate("admin")(CreateRepositoryRole));
|
||||||
@@ -35,7 +35,7 @@ class DeleteRepositoryRole extends React.Component<Props> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
roleDeleted = () => {
|
roleDeleted = () => {
|
||||||
this.props.history.push("/config/roles/");
|
this.props.history.push("/admin/roles/");
|
||||||
};
|
};
|
||||||
|
|
||||||
deleteRole = () => {
|
deleteRole = () => {
|
||||||
@@ -45,15 +45,15 @@ class DeleteRepositoryRole extends React.Component<Props> {
|
|||||||
confirmDelete = () => {
|
confirmDelete = () => {
|
||||||
const { t } = this.props;
|
const { t } = this.props;
|
||||||
confirmAlert({
|
confirmAlert({
|
||||||
title: t("deleteRole.confirmAlert.title"),
|
title: t("repositoryRole.delete.confirmAlert.title"),
|
||||||
message: t("deleteRole.confirmAlert.message"),
|
message: t("repositoryRole.delete.confirmAlert.message"),
|
||||||
buttons: [
|
buttons: [
|
||||||
{
|
{
|
||||||
label: t("deleteRole.confirmAlert.submit"),
|
label: t("repositoryRole.delete.confirmAlert.submit"),
|
||||||
onClick: () => this.deleteRole()
|
onClick: () => this.deleteRole()
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t("deleteRole.confirmAlert.cancel"),
|
label: t("repositoryRole.delete.confirmAlert.cancel"),
|
||||||
onClick: () => null
|
onClick: () => null
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -74,12 +74,12 @@ class DeleteRepositoryRole extends React.Component<Props> {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Subtitle subtitle={t("deleteRole.subtitle")} />
|
<Subtitle subtitle={t("repositoryRole.delete.subtitle")} />
|
||||||
<div className="columns">
|
<div className="columns">
|
||||||
<div className="column">
|
<div className="column">
|
||||||
<ErrorNotification error={error} />
|
<ErrorNotification error={error} />
|
||||||
<DeleteButton
|
<DeleteButton
|
||||||
label={t("deleteRole.button")}
|
label={t("repositoryRole.delete.button")}
|
||||||
action={action}
|
action={action}
|
||||||
loading={loading}
|
loading={loading}
|
||||||
/>
|
/>
|
||||||
@@ -110,4 +110,4 @@ const mapDispatchToProps = dispatch => {
|
|||||||
export default connect(
|
export default connect(
|
||||||
mapStateToProps,
|
mapStateToProps,
|
||||||
mapDispatchToProps
|
mapDispatchToProps
|
||||||
)(withRouter(translate("config")(DeleteRepositoryRole)));
|
)(withRouter(translate("admin")(DeleteRepositoryRole)));
|
||||||
@@ -29,7 +29,7 @@ type Props = {
|
|||||||
|
|
||||||
class EditRepositoryRole extends React.Component<Props> {
|
class EditRepositoryRole extends React.Component<Props> {
|
||||||
repositoryRoleUpdated = () => {
|
repositoryRoleUpdated = () => {
|
||||||
this.props.history.push("/config/roles/");
|
this.props.history.push("/admin/roles/");
|
||||||
};
|
};
|
||||||
|
|
||||||
updateRepositoryRole = (role: RepositoryRole) => {
|
updateRepositoryRole = (role: RepositoryRole) => {
|
||||||
@@ -78,4 +78,4 @@ const mapDispatchToProps = dispatch => {
|
|||||||
export default connect(
|
export default connect(
|
||||||
mapStateToProps,
|
mapStateToProps,
|
||||||
mapDispatchToProps
|
mapDispatchToProps
|
||||||
)(translate("config")(EditRepositoryRole));
|
)(translate("admin")(EditRepositoryRole));
|
||||||
@@ -169,4 +169,4 @@ const mapDispatchToProps = dispatch => {
|
|||||||
export default connect(
|
export default connect(
|
||||||
mapStateToProps,
|
mapStateToProps,
|
||||||
mapDispatchToProps
|
mapDispatchToProps
|
||||||
)(translate("config")(RepositoryRoleForm));
|
)(translate("admin")(RepositoryRoleForm));
|
||||||
@@ -151,5 +151,5 @@ export default withRouter(
|
|||||||
connect(
|
connect(
|
||||||
mapStateToProps,
|
mapStateToProps,
|
||||||
mapDispatchToProps
|
mapDispatchToProps
|
||||||
)(translate("config")(RepositoryRoles))
|
)(translate("admin")(RepositoryRoles))
|
||||||
);
|
);
|
||||||
@@ -129,5 +129,5 @@ export default withRouter(
|
|||||||
connect(
|
connect(
|
||||||
mapStateToProps,
|
mapStateToProps,
|
||||||
mapDispatchToProps
|
mapDispatchToProps
|
||||||
)(translate("config")(SingleRepositoryRole))
|
)(translate("admin")(SingleRepositoryRole))
|
||||||
);
|
);
|
||||||
@@ -21,7 +21,8 @@ import Groups from "../groups/containers/Groups";
|
|||||||
import SingleGroup from "../groups/containers/SingleGroup";
|
import SingleGroup from "../groups/containers/SingleGroup";
|
||||||
import CreateGroup from "../groups/containers/CreateGroup";
|
import CreateGroup from "../groups/containers/CreateGroup";
|
||||||
|
|
||||||
import Config from "../config/containers/Config";
|
import Admin from "../admin/containers/Admin";
|
||||||
|
|
||||||
import Profile from "./Profile";
|
import Profile from "./Profile";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -112,8 +113,8 @@ class Main extends React.Component<Props> {
|
|||||||
authenticated={authenticated}
|
authenticated={authenticated}
|
||||||
/>
|
/>
|
||||||
<ProtectedRoute
|
<ProtectedRoute
|
||||||
path="/config"
|
path="/admin"
|
||||||
component={Config}
|
component={Admin}
|
||||||
authenticated={authenticated}
|
authenticated={authenticated}
|
||||||
/>
|
/>
|
||||||
<ProtectedRoute
|
<ProtectedRoute
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ import auth from "./modules/auth";
|
|||||||
import pending from "./modules/pending";
|
import pending from "./modules/pending";
|
||||||
import failure from "./modules/failure";
|
import failure from "./modules/failure";
|
||||||
import permissions from "./repos/permissions/modules/permissions";
|
import permissions from "./repos/permissions/modules/permissions";
|
||||||
import config from "./config/modules/config";
|
import config from "./admin/modules/config";
|
||||||
import roles from "./config/roles/modules/roles";
|
import roles from "./admin/roles/modules/roles";
|
||||||
import namespaceStrategies from "./config/modules/namespaceStrategies";
|
import namespaceStrategies from "./admin/modules/namespaceStrategies";
|
||||||
import indexResources from "./modules/indexResource";
|
import indexResources from "./modules/indexResource";
|
||||||
|
|
||||||
import type { BrowserHistory } from "history/createBrowserHistory";
|
import type { BrowserHistory } from "history/createBrowserHistory";
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ export default function reducer(
|
|||||||
case FETCH_INDEXRESOURCES_SUCCESS:
|
case FETCH_INDEXRESOURCES_SUCCESS:
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
|
version: action.payload.version,
|
||||||
links: action.payload._links
|
links: action.payload._links
|
||||||
};
|
};
|
||||||
default:
|
default:
|
||||||
@@ -107,6 +108,10 @@ export function getLinkCollection(state: Object, name: string): Link[] {
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getAppVersion(state: Object) {
|
||||||
|
return state.indexResources.version;
|
||||||
|
}
|
||||||
|
|
||||||
export function getUiPluginsLink(state: Object) {
|
export function getUiPluginsLink(state: Object) {
|
||||||
return getLink(state, "uiPlugins");
|
return getLink(state, "uiPlugins");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import { getRepositoriesLink } from "../../modules/indexResource";
|
|||||||
import {
|
import {
|
||||||
fetchNamespaceStrategiesIfNeeded,
|
fetchNamespaceStrategiesIfNeeded,
|
||||||
getFetchNamespaceStrategiesFailure, getNamespaceStrategies, isFetchNamespaceStrategiesPending
|
getFetchNamespaceStrategiesFailure, getNamespaceStrategies, isFetchNamespaceStrategiesPending
|
||||||
} from "../../config/modules/namespaceStrategies";
|
} from "../../admin/modules/namespaceStrategies";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
repositoryTypes: RepositoryType[],
|
repositoryTypes: RepositoryType[],
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ final class CronExpression {
|
|||||||
|
|
||||||
boolean shouldRun(ZonedDateTime time) {
|
boolean shouldRun(ZonedDateTime time) {
|
||||||
ZonedDateTime now = ZonedDateTime.now(clock);
|
ZonedDateTime now = ZonedDateTime.now(clock);
|
||||||
return time.isBefore(now);
|
return time.isBefore(now) || time.isEqual(now);
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<ZonedDateTime> calculateNextRun() {
|
Optional<ZonedDateTime> calculateNextRun() {
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class CronTask implements Task, Runnable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized void run() {
|
public synchronized void run() {
|
||||||
if (expression.shouldRun(nextRun)) {
|
if (hasNextRun() && expression.shouldRun(nextRun)) {
|
||||||
LOG.debug("execute task {}, because of matching expression {}", name, expression);
|
LOG.debug("execute task {}, because of matching expression {}", name, expression);
|
||||||
runnable.run();
|
runnable.run();
|
||||||
Optional<ZonedDateTime> next = expression.calculateNextRun();
|
Optional<ZonedDateTime> next = expression.calculateNextRun();
|
||||||
@@ -40,6 +40,7 @@ class CronTask implements Task, Runnable {
|
|||||||
nextRun = next.get();
|
nextRun = next.get();
|
||||||
} else {
|
} else {
|
||||||
LOG.debug("cancel task {}, because expression {} has no next execution", name, expression);
|
LOG.debug("cancel task {}, because expression {} has no next execution", name, expression);
|
||||||
|
nextRun = null;
|
||||||
cancel();
|
cancel();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ class CronTaskTest {
|
|||||||
@Test
|
@Test
|
||||||
void shouldCancelWithoutNextRun() {
|
void shouldCancelWithoutNextRun() {
|
||||||
ZonedDateTime time = ZonedDateTime.now();
|
ZonedDateTime time = ZonedDateTime.now();
|
||||||
when(expression.calculateNextRun()).thenAnswer(new FirstTimeAnswer(Optional.of(time), Optional.empty()));
|
when(expression.calculateNextRun()).thenReturn(Optional.of(time), Optional.empty());
|
||||||
when(expression.shouldRun(time)).thenReturn(true);
|
when(expression.shouldRun(time)).thenReturn(true);
|
||||||
|
|
||||||
CronTask task = task();
|
CronTask task = task();
|
||||||
@@ -64,32 +64,26 @@ class CronTaskTest {
|
|||||||
verify(future).cancel(false);
|
verify(future).cancel(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void shouldNotRunAfterCancelHasBeenCalledIfRunIsCalledAgain() {
|
||||||
|
ZonedDateTime time = ZonedDateTime.now();
|
||||||
|
when(expression.calculateNextRun()).thenReturn(Optional.of(time), Optional.empty());
|
||||||
|
when(expression.shouldRun(time)).thenReturn(true);
|
||||||
|
|
||||||
|
CronTask task = task();
|
||||||
|
task.setFuture(future);
|
||||||
|
|
||||||
|
task.run();
|
||||||
|
task.run();
|
||||||
|
|
||||||
|
verify(future).cancel(false);
|
||||||
|
verify(runnable).run();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void shouldNotRun() {
|
void shouldNotRun() {
|
||||||
task().run();
|
task().run();
|
||||||
|
|
||||||
verify(runnable, never()).run();
|
verify(runnable, never()).run();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class FirstTimeAnswer implements Answer<Object> {
|
|
||||||
|
|
||||||
private boolean first = true;
|
|
||||||
private final Object answer;
|
|
||||||
private final Object secondAnswer;
|
|
||||||
|
|
||||||
FirstTimeAnswer(Object answer, Object secondAnswer) {
|
|
||||||
this.answer = answer;
|
|
||||||
this.secondAnswer = secondAnswer;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object answer(InvocationOnMock invocation) {
|
|
||||||
if (first) {
|
|
||||||
first = false;
|
|
||||||
return answer;
|
|
||||||
}
|
|
||||||
return secondAnswer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user