mirror of
https://github.com/grafana/grafana.git
synced 2024-11-30 20:54:22 -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 React from 'react';
|
||||||
|
|
||||||
|
import { config } from '@grafana/runtime';
|
||||||
import { LinkButton } from '@grafana/ui';
|
import { LinkButton } from '@grafana/ui';
|
||||||
import { contextSrv } from 'app/core/core';
|
import { contextSrv } from 'app/core/core';
|
||||||
import { AccessControlAction } from 'app/types';
|
import { AccessControlAction } from 'app/types';
|
||||||
@ -11,7 +12,7 @@ export function DataSourceAddButton(): JSX.Element | null {
|
|||||||
const dataSourcesRoutes = useDataSourcesRoutes();
|
const dataSourcesRoutes = useDataSourcesRoutes();
|
||||||
|
|
||||||
return canCreateDataSource ? (
|
return canCreateDataSource ? (
|
||||||
<LinkButton icon="plus" href={dataSourcesRoutes.New}>
|
<LinkButton icon="plus" href={config.appSubUrl + dataSourcesRoutes.New}>
|
||||||
Add new data source
|
Add new data source
|
||||||
</LinkButton>
|
</LinkButton>
|
||||||
) : null;
|
) : null;
|
||||||
|
@ -2,6 +2,7 @@ import { css } from '@emotion/css';
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { DataSourceSettings, GrafanaTheme2 } from '@grafana/data';
|
import { DataSourceSettings, GrafanaTheme2 } from '@grafana/data';
|
||||||
|
import { config } from '@grafana/runtime';
|
||||||
import { LinkButton, Card, Tag, useStyles2 } from '@grafana/ui';
|
import { LinkButton, Card, Tag, useStyles2 } from '@grafana/ui';
|
||||||
import EmptyListCTA from 'app/core/components/EmptyListCTA/EmptyListCTA';
|
import EmptyListCTA from 'app/core/components/EmptyListCTA/EmptyListCTA';
|
||||||
import PageLoader from 'app/core/components/PageLoader/PageLoader';
|
import PageLoader from 'app/core/components/PageLoader/PageLoader';
|
||||||
@ -71,9 +72,10 @@ export function DataSourcesListView({ dataSources, dataSourcesCount, isLoading,
|
|||||||
{/* List */}
|
{/* List */}
|
||||||
<ul className={styles.list}>
|
<ul className={styles.list}>
|
||||||
{dataSources.map((dataSource) => {
|
{dataSources.map((dataSource) => {
|
||||||
|
const dsLink = config.appSubUrl + dataSourcesRoutes.Edit.replace(/:uid/gi, dataSource.uid);
|
||||||
return (
|
return (
|
||||||
<li key={dataSource.uid}>
|
<li key={dataSource.uid}>
|
||||||
<Card href={dataSourcesRoutes.Edit.replace(/:uid/gi, dataSource.uid)}>
|
<Card href={dsLink}>
|
||||||
<Card.Heading>{dataSource.name}</Card.Heading>
|
<Card.Heading>{dataSource.name}</Card.Heading>
|
||||||
<Card.Figure>
|
<Card.Figure>
|
||||||
<img src={dataSource.typeLogoUrl} alt="" height="40px" width="40px" className={styles.logo} />
|
<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.Meta>
|
||||||
<Card.Tags>
|
<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
|
Build a Dashboard
|
||||||
</LinkButton>
|
</LinkButton>
|
||||||
{canExploreDataSources && (
|
{canExploreDataSources && (
|
||||||
|
Loading…
Reference in New Issue
Block a user