mirror of
https://github.com/grafana/grafana.git
synced 2024-11-28 03:34:15 -06:00
DatasourceList: Fixes using sub path on datasources URL (#59597)
This commit is contained in:
parent
70dd5b42ce
commit
bf541ee3d1
@ -1,5 +1,6 @@
|
||||
import React from 'react';
|
||||
|
||||
import { config } from '@grafana/runtime';
|
||||
import { LinkButton } from '@grafana/ui';
|
||||
import { contextSrv } from 'app/core/core';
|
||||
import { AccessControlAction } from 'app/types';
|
||||
@ -11,7 +12,7 @@ export function DataSourceAddButton(): JSX.Element | null {
|
||||
const dataSourcesRoutes = useDataSourcesRoutes();
|
||||
|
||||
return canCreateDataSource ? (
|
||||
<LinkButton icon="plus" href={dataSourcesRoutes.New}>
|
||||
<LinkButton icon="plus" href={config.appSubUrl + dataSourcesRoutes.New}>
|
||||
Add new data source
|
||||
</LinkButton>
|
||||
) : null;
|
||||
|
@ -2,6 +2,7 @@ import { css } from '@emotion/css';
|
||||
import React from 'react';
|
||||
|
||||
import { DataSourceSettings, GrafanaTheme2 } from '@grafana/data';
|
||||
import { config } from '@grafana/runtime';
|
||||
import { LinkButton, Card, Tag, useStyles2 } from '@grafana/ui';
|
||||
import EmptyListCTA from 'app/core/components/EmptyListCTA/EmptyListCTA';
|
||||
import PageLoader from 'app/core/components/PageLoader/PageLoader';
|
||||
@ -71,9 +72,10 @@ export function DataSourcesListView({ dataSources, dataSourcesCount, isLoading,
|
||||
{/* List */}
|
||||
<ul className={styles.list}>
|
||||
{dataSources.map((dataSource) => {
|
||||
const dsLink = config.appSubUrl + dataSourcesRoutes.Edit.replace(/:uid/gi, dataSource.uid);
|
||||
return (
|
||||
<li key={dataSource.uid}>
|
||||
<Card href={dataSourcesRoutes.Edit.replace(/:uid/gi, dataSource.uid)}>
|
||||
<Card href={dsLink}>
|
||||
<Card.Heading>{dataSource.name}</Card.Heading>
|
||||
<Card.Figure>
|
||||
<img src={dataSource.typeLogoUrl} alt="" height="40px" width="40px" className={styles.logo} />
|
||||
@ -86,7 +88,7 @@ export function DataSourcesListView({ dataSources, dataSourcesCount, isLoading,
|
||||
]}
|
||||
</Card.Meta>
|
||||
<Card.Tags>
|
||||
<LinkButton icon="apps" fill="outline" variant="secondary" href="/dashboard/new">
|
||||
<LinkButton icon="apps" fill="outline" variant="secondary" href={config.appSubUrl + '/dashboard/new'}>
|
||||
Build a Dashboard
|
||||
</LinkButton>
|
||||
{canExploreDataSources && (
|
||||
|
Loading…
Reference in New Issue
Block a user