mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-09 15:05:44 +01:00
fIX config error if link is missing
This commit is contained in:
@@ -9,7 +9,8 @@
|
||||
"config-form": {
|
||||
"submit": "Speichern",
|
||||
"submit-success-notification": "Einstellungen wurden erfolgreich geändert!",
|
||||
"no-permission-notification": "Hinweis: Es fehlen Berechtigungen zum Bearbeiten 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!"
|
||||
},
|
||||
"proxy-settings": {
|
||||
"name": "Proxy Einstellungen",
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
"config-form": {
|
||||
"submit": "Submit",
|
||||
"submit-success-notification": "Configuration changed successfully!",
|
||||
"no-permission-notification": "Please note: You do not have the permission to edit 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!"
|
||||
},
|
||||
"proxy-settings": {
|
||||
"name": "Proxy Settings",
|
||||
|
||||
@@ -14,6 +14,7 @@ type Props = {
|
||||
config?: Config,
|
||||
loading?: boolean,
|
||||
t: string => string,
|
||||
configReadPermission: boolean,
|
||||
configUpdatePermission: boolean
|
||||
};
|
||||
|
||||
@@ -84,16 +85,30 @@ class ConfigForm extends React.Component<Props, State> {
|
||||
};
|
||||
|
||||
render() {
|
||||
const { loading, t, configUpdatePermission } = this.props;
|
||||
const {
|
||||
loading,
|
||||
t,
|
||||
configReadPermission,
|
||||
configUpdatePermission
|
||||
} = this.props;
|
||||
const config = this.state.config;
|
||||
|
||||
let noPermissionNotification = null;
|
||||
|
||||
if (!configReadPermission) {
|
||||
return (
|
||||
<Notification
|
||||
type={"danger"}
|
||||
children={t("config-form.no-read-permission-notification")}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
if (this.state.showNotification) {
|
||||
noPermissionNotification = (
|
||||
<Notification
|
||||
type={"info"}
|
||||
children={t("config-form.no-permission-notification")}
|
||||
children={t("config-form.no-write-permission-notification")}
|
||||
onClose={() => this.onClose()}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
// @flow
|
||||
import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import {
|
||||
Title,
|
||||
Loading,
|
||||
ErrorNotification
|
||||
} from "@scm-manager/ui-components";
|
||||
import { Title, Loading, ErrorNotification } from "@scm-manager/ui-components";
|
||||
import {
|
||||
fetchConfig,
|
||||
getFetchConfigFailure,
|
||||
@@ -39,6 +35,7 @@ type Props = {
|
||||
};
|
||||
|
||||
type State = {
|
||||
configReadPermission: boolean,
|
||||
configChanged: boolean
|
||||
};
|
||||
|
||||
@@ -47,13 +44,18 @@ class GlobalConfig extends React.Component<Props, State> {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
configReadPermission: true,
|
||||
configChanged: false
|
||||
};
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.props.configReset();
|
||||
if (this.props.configLink) {
|
||||
this.props.fetchConfig(this.props.configLink);
|
||||
} else {
|
||||
this.setState({configReadPermission: false});
|
||||
}
|
||||
}
|
||||
|
||||
modifyConfig = (config: Config) => {
|
||||
@@ -102,6 +104,7 @@ class GlobalConfig extends React.Component<Props, State> {
|
||||
|
||||
renderContent = () => {
|
||||
const { error, loading, config, configUpdatePermission } = this.props;
|
||||
const { configReadPermission } = this.state;
|
||||
if (!error) {
|
||||
return (
|
||||
<>
|
||||
@@ -111,6 +114,7 @@ class GlobalConfig extends React.Component<Props, State> {
|
||||
config={config}
|
||||
loading={loading}
|
||||
configUpdatePermission={configUpdatePermission}
|
||||
configReadPermission={configReadPermission}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user