mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Authentication UI: Remove auth settings (#67647)
This commit is contained in:
parent
f9fd15c01e
commit
93b461bd96
@ -11,7 +11,7 @@ import { StoreState } from 'app/types';
|
|||||||
import ConfigureAuthCTA from './components/ConfigureAuthCTA';
|
import ConfigureAuthCTA from './components/ConfigureAuthCTA';
|
||||||
import { ProviderCard } from './components/ProviderCard';
|
import { ProviderCard } from './components/ProviderCard';
|
||||||
import { loadSettings } from './state/actions';
|
import { loadSettings } from './state/actions';
|
||||||
import { filterAuthSettings, getProviderUrl } from './utils';
|
import { getProviderUrl } from './utils';
|
||||||
|
|
||||||
import { getRegisteredAuthProviders } from '.';
|
import { getRegisteredAuthProviders } from '.';
|
||||||
|
|
||||||
@ -20,9 +20,8 @@ interface OwnProps {}
|
|||||||
export type Props = OwnProps & ConnectedProps<typeof connector>;
|
export type Props = OwnProps & ConnectedProps<typeof connector>;
|
||||||
|
|
||||||
function mapStateToProps(state: StoreState) {
|
function mapStateToProps(state: StoreState) {
|
||||||
const { settings, isLoading, providerStatuses } = state.authConfig;
|
const { isLoading, providerStatuses } = state.authConfig;
|
||||||
return {
|
return {
|
||||||
settings,
|
|
||||||
isLoading,
|
isLoading,
|
||||||
providerStatuses,
|
providerStatuses,
|
||||||
};
|
};
|
||||||
@ -34,12 +33,7 @@ const mapDispatchToProps = {
|
|||||||
|
|
||||||
const connector = connect(mapStateToProps, mapDispatchToProps);
|
const connector = connect(mapStateToProps, mapDispatchToProps);
|
||||||
|
|
||||||
export const AuthConfigPageUnconnected = ({
|
export const AuthConfigPageUnconnected = ({ providerStatuses, isLoading, loadSettings }: Props): JSX.Element => {
|
||||||
settings,
|
|
||||||
providerStatuses,
|
|
||||||
isLoading,
|
|
||||||
loadSettings,
|
|
||||||
}: Props): JSX.Element => {
|
|
||||||
const styles = useStyles2(getStyles);
|
const styles = useStyles2(getStyles);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -54,7 +48,6 @@ export const AuthConfigPageUnconnected = ({
|
|||||||
const availableProviders = authProviders.filter(
|
const availableProviders = authProviders.filter(
|
||||||
(p) => !providerStatuses[p.id]?.enabled && !providerStatuses[p.id]?.configured
|
(p) => !providerStatuses[p.id]?.enabled && !providerStatuses[p.id]?.configured
|
||||||
);
|
);
|
||||||
const authSettings = filterAuthSettings(settings);
|
|
||||||
const firstAvailableProvider = availableProviders?.length ? availableProviders[0] : null;
|
const firstAvailableProvider = availableProviders?.length ? availableProviders[0] : null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -100,29 +93,6 @@ export const AuthConfigPageUnconnected = ({
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{!isEmpty(authSettings) && (
|
|
||||||
<div className={styles.settingsSection}>
|
|
||||||
<h3>Settings</h3>
|
|
||||||
<table className="filter-table">
|
|
||||||
<tbody>
|
|
||||||
{Object.entries(authSettings).map(([sectionName, sectionSettings], i) => (
|
|
||||||
<React.Fragment key={`section-${i}`}>
|
|
||||||
<tr>
|
|
||||||
<td className="admin-settings-section">{sectionName}</td>
|
|
||||||
<td />
|
|
||||||
</tr>
|
|
||||||
{Object.entries(sectionSettings).map(([settingName, settingValue], j) => (
|
|
||||||
<tr key={`property-${j}`}>
|
|
||||||
<td className={styles.settingName}>{settingName}</td>
|
|
||||||
<td className={styles.settingName}>{settingValue}</td>
|
|
||||||
</tr>
|
|
||||||
))}
|
|
||||||
</React.Fragment>
|
|
||||||
))}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</Page.Contents>
|
</Page.Contents>
|
||||||
</Page>
|
</Page>
|
||||||
);
|
);
|
||||||
|
@ -1,15 +1,6 @@
|
|||||||
import { Settings } from 'app/types';
|
|
||||||
|
|
||||||
import { BASE_PATH } from './constants';
|
import { BASE_PATH } from './constants';
|
||||||
import { AuthProviderInfo } from './types';
|
import { AuthProviderInfo } from './types';
|
||||||
|
|
||||||
export function filterAuthSettings(settings: Settings) {
|
|
||||||
const authSettings: Settings = Object.fromEntries(
|
|
||||||
Object.entries(settings).filter(([sectionName]) => sectionName === 'auth')
|
|
||||||
);
|
|
||||||
return authSettings;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getProviderUrl(provider: AuthProviderInfo) {
|
export function getProviderUrl(provider: AuthProviderInfo) {
|
||||||
return BASE_PATH + (provider.configPath || provider.id);
|
return BASE_PATH + (provider.configPath || provider.id);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user