Fix links on landing page
parent
57a8339a2b
commit
dc10dcabb6
|
@ -31,7 +31,7 @@ import {dashboardCreateFailed} from 'src/shared/copy/notifications'
|
|||
|
||||
// Types
|
||||
import {Notification} from 'src/types/notifications'
|
||||
import {Links, Dashboard, AppState} from 'src/types'
|
||||
import {Dashboard, AppState} from 'src/types'
|
||||
|
||||
// Decorators
|
||||
import {ErrorHandling} from 'src/shared/decorators/errors'
|
||||
|
@ -45,7 +45,6 @@ interface DispatchProps {
|
|||
}
|
||||
|
||||
interface StateProps {
|
||||
links: Links
|
||||
dashboards: Dashboard[]
|
||||
}
|
||||
|
||||
|
@ -199,12 +198,10 @@ class DashboardIndex extends PureComponent<Props, State> {
|
|||
const mstp = (state: AppState): StateProps => {
|
||||
const {
|
||||
dashboards: {list: dashboards},
|
||||
links,
|
||||
} = state
|
||||
|
||||
return {
|
||||
dashboards,
|
||||
links,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,21 +1,25 @@
|
|||
// Libraries
|
||||
import React, {PureComponent} from 'react'
|
||||
import {Link} from 'react-router'
|
||||
import {connect} from 'react-redux'
|
||||
|
||||
// Components
|
||||
import {EmptyState} from '@influxdata/clockface'
|
||||
|
||||
// Types
|
||||
import {Dashboard} from 'src/types'
|
||||
import {Dashboard, Organization, AppState} from 'src/types'
|
||||
import {ComponentSize} from '@influxdata/clockface'
|
||||
|
||||
interface Props {
|
||||
interface StateProps {
|
||||
dashboards: Dashboard[]
|
||||
org: Organization
|
||||
}
|
||||
|
||||
export default class UserDashboardList extends PureComponent<Props> {
|
||||
type Props = StateProps
|
||||
|
||||
class DashboardList extends PureComponent<Props> {
|
||||
public render() {
|
||||
const {dashboards} = this.props
|
||||
const {dashboards, org} = this.props
|
||||
|
||||
if (this.isEmpty) {
|
||||
return (
|
||||
|
@ -30,14 +34,25 @@ export default class UserDashboardList extends PureComponent<Props> {
|
|||
<ul className="link-list">
|
||||
{dashboards.map(({id, name}) => (
|
||||
<li key={id}>
|
||||
<Link to={`/dashboards/${id}`}>{name}</Link>
|
||||
<Link to={`/orgs/${org.id}/dashboards/${id}`}>{name}</Link>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
private get isEmpty(): boolean {
|
||||
return !this.props.dashboards.length
|
||||
}
|
||||
}
|
||||
|
||||
const mstp = ({dashboards, orgs: {org}}: AppState): StateProps => ({
|
||||
dashboards: dashboards.list,
|
||||
org,
|
||||
})
|
||||
|
||||
export default connect<StateProps, {}, {}>(
|
||||
mstp,
|
||||
null
|
||||
)(DashboardList)
|
||||
|
|
|
@ -5,12 +5,8 @@ import {Link} from 'react-router'
|
|||
// Components
|
||||
import Support from 'src/me/components/Support'
|
||||
import LogoutButton from 'src/me/components/LogoutButton'
|
||||
import OrgsList from 'src/me/components/OrgsList'
|
||||
import DashboardsList from 'src/me/components/DashboardsList'
|
||||
import ResourceFetcher from 'src/shared/components/resource_fetcher'
|
||||
import {
|
||||
SpinnerContainer,
|
||||
TechnoSpinner,
|
||||
Panel,
|
||||
ComponentSpacer,
|
||||
FlexDirection,
|
||||
|
@ -18,22 +14,17 @@ import {
|
|||
AlignItems,
|
||||
} from '@influxdata/clockface'
|
||||
import VersionInfo from 'src/shared/components/VersionInfo'
|
||||
import CloudExclude from 'src/shared/components/cloud/CloudExclude'
|
||||
|
||||
// APIs
|
||||
import {getDashboards} from 'src/organizations/apis'
|
||||
import {client} from 'src/utils/api'
|
||||
|
||||
// Types
|
||||
import {Dashboard, AppState} from 'src/types'
|
||||
import {Organization} from '@influxdata/influx'
|
||||
import {AppState} from 'src/types'
|
||||
import GetResources, {
|
||||
ResourceTypes,
|
||||
} from 'src/configuration/components/GetResources'
|
||||
|
||||
interface Props {
|
||||
me: AppState['me']
|
||||
}
|
||||
|
||||
const getOrganizations = () => client.organizations.getAll()
|
||||
|
||||
class ResourceLists extends PureComponent<Props> {
|
||||
public render() {
|
||||
return (
|
||||
|
@ -55,36 +46,12 @@ class ResourceLists extends PureComponent<Props> {
|
|||
</ul>
|
||||
</Panel.Body>
|
||||
</Panel>
|
||||
<CloudExclude>
|
||||
<Panel>
|
||||
<Panel.Header title="Organizations" />
|
||||
<Panel.Body>
|
||||
<ResourceFetcher<Organization[]> fetcher={getOrganizations}>
|
||||
{(orgs, loading) => (
|
||||
<SpinnerContainer
|
||||
loading={loading}
|
||||
spinnerComponent={<TechnoSpinner diameterPixels={50} />}
|
||||
>
|
||||
<OrgsList orgs={orgs} />
|
||||
</SpinnerContainer>
|
||||
)}
|
||||
</ResourceFetcher>
|
||||
</Panel.Body>
|
||||
</Panel>
|
||||
</CloudExclude>
|
||||
<Panel>
|
||||
<Panel.Header title="Dashboards" />
|
||||
<Panel.Body>
|
||||
<ResourceFetcher<Dashboard[]> fetcher={getDashboards}>
|
||||
{(dashboards, loading) => (
|
||||
<SpinnerContainer
|
||||
loading={loading}
|
||||
spinnerComponent={<TechnoSpinner diameterPixels={50} />}
|
||||
>
|
||||
<DashboardsList dashboards={dashboards} />
|
||||
</SpinnerContainer>
|
||||
)}
|
||||
</ResourceFetcher>
|
||||
<GetResources resource={ResourceTypes.Dashboards}>
|
||||
<DashboardsList />
|
||||
</GetResources>
|
||||
</Panel.Body>
|
||||
</Panel>
|
||||
<Panel>
|
||||
|
|
Loading…
Reference in New Issue