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