chore: make enum singular and move selector into dir

pull/15029/head
Andrew Watkins 2019-09-06 14:40:09 -07:00
parent f58b39bc55
commit e5b2f8c11f
34 changed files with 98 additions and 113 deletions

View File

@ -24,7 +24,7 @@ import {
// Types
import {AlertHistoryType} from 'src/types'
import GetResources, {ResourceTypes} from 'src/shared/components/GetResources'
import GetResources, {ResourceType} from 'src/shared/components/GetResources'
interface Props {
params: {orgID: string}
@ -45,9 +45,9 @@ const AlertHistoryIndex: FC<Props> = ({params: {orgID}}) => {
historyType === 'statuses' ? STATUS_FIELDS : NOTIFICATION_FIELDS
return (
<GetResources resource={ResourceTypes.Checks}>
<GetResources resource={ResourceTypes.NotificationEndpoints}>
<GetResources resource={ResourceTypes.NotificationRules}>
<GetResources resource={ResourceType.Checks}>
<GetResources resource={ResourceType.NotificationEndpoints}>
<GetResources resource={ResourceType.NotificationRules}>
<EventViewer loadRows={loadRows} initialState={getInitialState()}>
{props => (
<Page

View File

@ -8,9 +8,9 @@ import PageTitleWithOrg from 'src/shared/components/PageTitleWithOrg'
import ChecksColumn from 'src/alerting/components/ChecksColumn'
import RulesColumn from 'src/alerting/components/notifications/RulesColumn'
import EndpointsColumn from 'src/alerting/components/EndpointsColumn'
import GetResources, {ResourceTypes} from 'src/shared/components/GetResources'
import GetAssetLimits from 'src/cloud/components/GetAssetLimits'
import AssetLimitAlert from 'src/cloud/components/AssetLimitAlert'
import GetResources, {ResourceType} from 'src/shared/components/GetResources'
// Utils
import {pageTitleSuffixer} from 'src/shared/utils/pageTitles'
@ -43,7 +43,7 @@ const AlertingIndex: FunctionComponent<StateProps> = ({
<Page.Header.Right />
</Page.Header>
<Page.Contents fullWidth={false} scrollable={false}>
<GetResources resource={ResourceTypes.Labels}>
<GetResources resource={ResourceType.Labels}>
<GetAssetLimits>
<AssetLimitAlert
resourceName={limitedResources}
@ -53,19 +53,17 @@ const AlertingIndex: FunctionComponent<StateProps> = ({
<Grid className="alerting-index">
<GridRow testID="grid--row">
<GridColumn widthLG={4} widthMD={4} widthSM={4} widthXS={12}>
<GetResources resource={ResourceTypes.Checks}>
<GetResources resource={ResourceType.Checks}>
<ChecksColumn />
</GetResources>
</GridColumn>
<GridColumn widthLG={4} widthMD={4} widthSM={4} widthXS={12}>
<GetResources
resource={ResourceTypes.NotificationEndpoints}
>
<GetResources resource={ResourceType.NotificationEndpoints}>
<EndpointsColumn />
</GetResources>
</GridColumn>
<GridColumn widthLG={4} widthMD={4} widthSM={4} widthXS={12}>
<GetResources resource={ResourceTypes.NotificationRules}>
<GetResources resource={ResourceType.NotificationRules}>
<RulesColumn />
</GetResources>
</GridColumn>

View File

@ -5,12 +5,10 @@ import {connect} from 'react-redux'
// Utils
import {formatOrgRoute} from 'src/shared/utils/formatOrgRoute'
// Selectors
import {getCheckIDs} from 'src/alerting/reducers/checks'
import {getResourceIDs} from 'src/alerting/selectors'
// Types
import {StatusRow, NotificationRow, AppState} from 'src/types'
import {StatusRow, NotificationRow, AppState, ResourceType} from 'src/types'
interface OwnProps {
row: StatusRow | NotificationRow
@ -41,7 +39,7 @@ const CheckTableField: FC<Props> = ({row: {checkName, checkID}, checkIDs}) => {
const mstp = (state: AppState) => {
return {
checkIDs: getCheckIDs(state.checks),
checkIDs: getResourceIDs(state, ResourceType.Checks),
}
}

View File

@ -3,14 +3,12 @@ import React, {FC} from 'react'
import {Link} from 'react-router'
import {connect} from 'react-redux'
// Reducers
import {getEndpointIDs} from 'src/alerting/reducers/notifications/endpoints'
// Utils
import {formatOrgRoute} from 'src/shared/utils/formatOrgRoute'
import {getResourceIDs} from 'src/alerting/selectors'
// Types
import {NotificationRow, AppState} from 'src/types'
import {NotificationRow, AppState, ResourceType} from 'src/types'
interface OwnProps {
row: NotificationRow
@ -45,7 +43,7 @@ const NotificationEndpointTableField: FC<Props> = ({
const mstp = (state: AppState) => {
return {
endpointIDs: getEndpointIDs(state.endpoints),
endpointIDs: getResourceIDs(state, ResourceType.NotificationEndpoints),
}
}

View File

@ -5,12 +5,10 @@ import {connect} from 'react-redux'
// Utils
import {formatOrgRoute} from 'src/shared/utils/formatOrgRoute'
// Selectors
import {getRuleIDs} from 'src/alerting/reducers/notifications/rules'
import {getResourceIDs} from 'src/alerting/selectors'
// Types
import {NotificationRow, AppState} from 'src/types'
import {NotificationRow, AppState, ResourceType} from 'src/types'
interface OwnProps {
row: NotificationRow
@ -36,6 +34,7 @@ const NotificationRuleTableField: FC<Props> = ({
</div>
)
}
const href = formatOrgRoute(`/alerting/rules/${notificationRuleID}/edit`)
return <Link to={href}>{notificationRuleName}</Link>
@ -43,7 +42,7 @@ const NotificationRuleTableField: FC<Props> = ({
const mstp = (state: AppState) => {
return {
ruleIDs: getRuleIDs(state.rules),
ruleIDs: getResourceIDs(state, ResourceType.NotificationRules),
}
}
export default connect<StateProps>(mstp)(NotificationRuleTableField)

View File

@ -66,7 +66,3 @@ export default (
return
}
})
export const getCheckIDs = (state: ChecksState): {[x: string]: boolean} => {
return state.list.reduce((acc, check) => ({...acc, [check.id]: true}), {})
}

View File

@ -75,12 +75,3 @@ export default (
}
}
})
export const getEndpointIDs = (
state: NotificationEndpointsState
): {[x: string]: boolean} => {
return state.list.reduce(
(acc, endpoint) => ({...acc, [endpoint.id]: true}),
{}
)
}

View File

@ -75,9 +75,3 @@ export default (
return
}
})
export const getRuleIDs = (
state: NotificationRulesState
): {[x: string]: boolean} => {
return state.list.reduce((acc, rule) => ({...acc, [rule.id]: true}), {})
}

View File

@ -1,6 +1,16 @@
import {AppState, Check} from 'src/types'
import {AppState, Check, ResourceType} from 'src/types'
export const getCheck = (state: AppState, id: string): Check => {
const checksList = state.checks.list
return checksList.find(c => c.id === id)
}
export const getResourceIDs = (
state: AppState,
resource: ResourceType
): {[x: string]: boolean} => {
return state[resource].list.reduce(
(acc, endpoint) => ({...acc, [endpoint.id]: true}),
{}
)
}

View File

@ -19,7 +19,7 @@ import {
Form,
} from '@influxdata/clockface'
import BucketsSelector from 'src/authorizations/components/BucketsSelector'
import GetResources, {ResourceTypes} from 'src/shared/components/GetResources'
import GetResources, {ResourceType} from 'src/shared/components/GetResources'
// Utils
import {
@ -99,7 +99,7 @@ class BucketsTokenOverlay extends PureComponent<Props, State> {
/>
</Form.Element>
<Form.Element label="">
<GetResources resource={ResourceTypes.Buckets}>
<GetResources resource={ResourceType.Buckets}>
<Grid.Row>
<Grid.Column
widthXS={Columns.Twelve}

View File

@ -7,7 +7,7 @@ import {Page} from '@influxdata/clockface'
import {ErrorHandling} from 'src/shared/decorators/errors'
import LoadDataTabbedPage from 'src/settings/components/LoadDataTabbedPage'
import LoadDataHeader from 'src/settings/components/LoadDataHeader'
import GetResources, {ResourceTypes} from 'src/shared/components/GetResources'
import GetResources, {ResourceType} from 'src/shared/components/GetResources'
import TokensTab from 'src/authorizations/components/TokensTab'
// Utils
@ -30,7 +30,7 @@ class TokensIndex extends Component<StateProps> {
<Page titleTag={pageTitleSuffixer(['Tokens', 'Load Data'])}>
<LoadDataHeader />
<LoadDataTabbedPage activeTab="tokens" orgID={org.id}>
<GetResources resource={ResourceTypes.Authorizations}>
<GetResources resource={ResourceType.Authorizations}>
<TokensTab />
</GetResources>
</LoadDataTabbedPage>

View File

@ -7,7 +7,7 @@ import {ErrorHandling} from 'src/shared/decorators/errors'
import LoadDataTabbedPage from 'src/settings/components/LoadDataTabbedPage'
import LoadDataHeader from 'src/settings/components/LoadDataHeader'
import BucketsTab from 'src/buckets/components/BucketsTab'
import GetResources, {ResourceTypes} from 'src/shared/components/GetResources'
import GetResources, {ResourceType} from 'src/shared/components/GetResources'
import GetAssetLimits from 'src/cloud/components/GetAssetLimits'
import LimitChecker from 'src/cloud/components/LimitChecker'
import RateLimitAlert from 'src/cloud/components/RateLimitAlert'
@ -58,8 +58,8 @@ class BucketsIndex extends Component<StateProps> {
)}
</FlexBox>
<LoadDataTabbedPage activeTab="buckets" orgID={org.id}>
<GetResources resource={ResourceTypes.Buckets}>
<GetResources resource={ResourceTypes.Telegrafs}>
<GetResources resource={ResourceType.Buckets}>
<GetResources resource={ResourceType.Telegrafs}>
<GetAssetLimits>
<BucketsTab />
</GetAssetLimits>

View File

@ -13,7 +13,7 @@ import SearchWidget from 'src/shared/components/search_widget/SearchWidget'
import AddResourceDropdown from 'src/shared/components/AddResourceDropdown'
import PageTitleWithOrg from 'src/shared/components/PageTitleWithOrg'
import GetAssetLimits from 'src/cloud/components/GetAssetLimits'
import GetResources, {ResourceTypes} from 'src/shared/components/GetResources'
import GetResources, {ResourceType} from 'src/shared/components/GetResources'
import AssetLimitAlert from 'src/cloud/components/AssetLimitAlert'
// Utils
@ -93,8 +93,8 @@ class DashboardIndex extends PureComponent<Props, State> {
</Page.Header.Right>
</Page.Header>
<Page.Contents fullWidth={false} scrollable={true}>
<GetResources resource={ResourceTypes.Dashboards}>
<GetResources resource={ResourceTypes.Labels}>
<GetResources resource={ResourceType.Dashboards}>
<GetResources resource={ResourceType.Labels}>
<GetAssetLimits>
<AssetLimitAlert
resourceName="dashboards"

View File

@ -8,7 +8,7 @@ import SaveAsButton from 'src/dataExplorer/components/SaveAsButton'
import VisOptionsButton from 'src/timeMachine/components/VisOptionsButton'
import ViewTypeDropdown from 'src/timeMachine/components/view_options/ViewTypeDropdown'
import PageTitleWithOrg from 'src/shared/components/PageTitleWithOrg'
import GetResources, {ResourceTypes} from 'src/shared/components/GetResources'
import GetResources, {ResourceType} from 'src/shared/components/GetResources'
import TimeZoneDropdown from 'src/shared/components/TimeZoneDropdown'
import DeleteDataButton from 'src/dataExplorer/components/DeleteDataButton'
@ -19,7 +19,7 @@ const DataExplorerPage: SFC = ({children}) => {
return (
<Page titleTag={pageTitleSuffixer(['Data Explorer'])}>
{children}
<GetResources resource={ResourceTypes.Variables}>
<GetResources resource={ResourceType.Variables}>
<Page.Header fullWidth={true}>
<Page.Header.Left>
<PageTitleWithOrg title="Data Explorer" />

View File

@ -7,7 +7,7 @@ import {get} from 'lodash'
// Components
import DeleteDataForm from 'src/shared/components/DeleteDataForm/DeleteDataForm'
import GetResources, {ResourceTypes} from 'src/shared/components/GetResources'
import GetResources, {ResourceType} from 'src/shared/components/GetResources'
// Utils
import {getActiveTimeMachine, getActiveQuery} from 'src/timeMachine/selectors'
@ -46,7 +46,7 @@ const DeleteDataOverlay: FunctionComponent<StateProps & WithRouterProps> = ({
<Overlay.Container maxWidth={600}>
<Overlay.Header title="Delete Data" onDismiss={handleDismiss} />
<Overlay.Body>
<GetResources resource={ResourceTypes.Buckets}>
<GetResources resource={ResourceType.Buckets}>
<DeleteDataForm
initialBucketName={selectedBucketName}
initialTimeRange={selectedTimeRange}

View File

@ -8,7 +8,7 @@ import SettingsTabbedPage from 'src/settings/components/SettingsTabbedPage'
import SettingsHeader from 'src/settings/components/SettingsHeader'
import {Page} from '@influxdata/clockface'
import LabelsTab from 'src/labels/components/LabelsTab'
import GetResources, {ResourceTypes} from 'src/shared/components/GetResources'
import GetResources, {ResourceType} from 'src/shared/components/GetResources'
// Utils
import {pageTitleSuffixer} from 'src/shared/utils/pageTitles'
@ -30,7 +30,7 @@ class LabelsIndex extends PureComponent<StateProps> {
<Page titleTag={pageTitleSuffixer(['Labels', 'Settings'])}>
<SettingsHeader />
<SettingsTabbedPage activeTab="labels" orgID={org.id}>
<GetResources resource={ResourceTypes.Labels}>
<GetResources resource={ResourceType.Labels}>
<LabelsTab />
</GetResources>
</SettingsTabbedPage>

View File

@ -16,7 +16,7 @@ import VersionInfo from 'src/shared/components/VersionInfo'
// Types
import {AppState} from 'src/types'
import GetResources, {ResourceTypes} from 'src/shared/components/GetResources'
import GetResources, {ResourceType} from 'src/shared/components/GetResources'
interface Props {
me: AppState['me']
@ -42,7 +42,7 @@ class ResourceLists extends PureComponent<Props> {
<Panel.Title>Dashboards</Panel.Title>
</Panel.Header>
<Panel.Body>
<GetResources resource={ResourceTypes.Dashboards}>
<GetResources resource={ResourceType.Dashboards}>
<DashboardsList />
</GetResources>
</Panel.Body>

View File

@ -15,7 +15,7 @@ import {getUsers, addNewMember} from 'src/members/actions'
import {UsersMap} from 'src/members/reducers'
import {User} from '@influxdata/influx'
import {AppState, RemoteDataState} from 'src/types'
import GetResources, {ResourceTypes} from 'src/shared/components/GetResources'
import GetResources, {ResourceType} from 'src/shared/components/GetResources'
interface StateProps {
status: RemoteDataState
@ -51,7 +51,7 @@ class AddMembersOverlay extends PureComponent<Props, State> {
const {selectedUserIDs, searchTerm, selectedMembers} = this.state
return (
<GetResources resource={ResourceTypes.Users}>
<GetResources resource={ResourceType.Users}>
<Overlay visible={true}>
<Overlay.Container maxWidth={720}>
<Overlay.Header title="Add Member" onDismiss={this.handleDismiss} />

View File

@ -7,7 +7,7 @@ import {ErrorHandling} from 'src/shared/decorators/errors'
import SettingsTabbedPage from 'src/settings/components/SettingsTabbedPage'
import SettingsHeader from 'src/settings/components/SettingsHeader'
import {Page} from '@influxdata/clockface'
import GetResources, {ResourceTypes} from 'src/shared/components/GetResources'
import GetResources, {ResourceType} from 'src/shared/components/GetResources'
import Members from 'src/members/components/Members'
// Utils
@ -36,7 +36,7 @@ class MembersIndex extends Component<Props> {
<Page titleTag={pageTitleSuffixer(['Members', 'Settings'])}>
<SettingsHeader />
<SettingsTabbedPage activeTab="members" orgID={org.id}>
<GetResources resource={ResourceTypes.Members}>
<GetResources resource={ResourceType.Members}>
<Members />
</GetResources>
</SettingsTabbedPage>

View File

@ -6,7 +6,7 @@ import {connect} from 'react-redux'
import {Page} from '@influxdata/clockface'
import LoadDataHeader from 'src/settings/components/LoadDataHeader'
import LoadDataTabbedPage from 'src/settings/components/LoadDataTabbedPage'
import GetResources, {ResourceTypes} from 'src/shared/components/GetResources'
import GetResources, {ResourceType} from 'src/shared/components/GetResources'
import Scrapers from 'src/scrapers/components/Scrapers'
// Utils
@ -32,8 +32,8 @@ class ScrapersIndex extends Component<StateProps> {
<Page titleTag={pageTitleSuffixer(['Scrapers', 'Load Data'])}>
<LoadDataHeader />
<LoadDataTabbedPage activeTab="scrapers" orgID={org.id}>
<GetResources resource={ResourceTypes.Scrapers}>
<GetResources resource={ResourceTypes.Buckets}>
<GetResources resource={ResourceType.Scrapers}>
<GetResources resource={ResourceType.Buckets}>
<Scrapers orgName={org.name} />
</GetResources>
</GetResources>

View File

@ -77,12 +77,12 @@ interface DispatchProps {
}
interface PassedProps {
resource: ResourceTypes
resource: ResourceType
}
type Props = StateProps & DispatchProps & PassedProps
export enum ResourceTypes {
export enum ResourceType {
Labels = 'labels',
Buckets = 'buckets',
Telegrafs = 'telegrafs',
@ -103,59 +103,59 @@ export enum ResourceTypes {
class GetResources extends PureComponent<Props, StateProps> {
public async componentDidMount() {
switch (this.props.resource) {
case ResourceTypes.Dashboards: {
case ResourceType.Dashboards: {
return await this.props.getDashboards()
}
case ResourceTypes.Labels: {
case ResourceType.Labels: {
return await this.props.getLabels()
}
case ResourceTypes.Buckets: {
case ResourceType.Buckets: {
return await this.props.getBuckets()
}
case ResourceTypes.Telegrafs: {
case ResourceType.Telegrafs: {
return await this.props.getTelegrafs()
}
case ResourceTypes.Scrapers: {
case ResourceType.Scrapers: {
return await this.props.getScrapers()
}
case ResourceTypes.Variables: {
case ResourceType.Variables: {
return await this.props.getVariables()
}
case ResourceTypes.Tasks: {
case ResourceType.Tasks: {
return await this.props.getTasks()
}
case ResourceTypes.Authorizations: {
case ResourceType.Authorizations: {
return await this.props.getAuthorizations()
}
case ResourceTypes.Templates: {
case ResourceType.Templates: {
return await this.props.getTemplates()
}
case ResourceTypes.Members: {
case ResourceType.Members: {
return await this.props.getMembers()
}
case ResourceTypes.Users: {
case ResourceType.Users: {
return await this.props.getUsers()
}
case ResourceTypes.Checks: {
case ResourceType.Checks: {
return await this.props.getChecks()
}
case ResourceTypes.NotificationRules: {
case ResourceType.NotificationRules: {
return await this.props.getNotificationRules()
}
case ResourceTypes.NotificationEndpoints: {
case ResourceType.NotificationEndpoints: {
return await this.props.getEndpoints()
}

View File

@ -6,7 +6,7 @@ import React, {PureComponent, ChangeEvent} from 'react'
import {Form, Radio, Input, Button, FlexBox, Grid} from '@influxdata/clockface'
import TaskScheduleFormField from 'src/tasks/components/TaskScheduleFormField'
import TaskOptionsBucketDropdown from 'src/tasks/components/TasksOptionsBucketDropdown'
import GetResources, {ResourceTypes} from 'src/shared/components/GetResources'
import GetResources, {ResourceType} from 'src/shared/components/GetResources'
// Types
import {
@ -140,7 +140,7 @@ export default class TaskForm extends PureComponent<Props, State> {
{isInOverlay && (
<Grid.Column widthXS={Columns.Six}>
<Form.Element label="Output Bucket">
<GetResources resource={ResourceTypes.Buckets}>
<GetResources resource={ResourceType.Buckets}>
<TaskOptionsBucketDropdown
selectedBucketName={toBucketName}
onChangeBucketName={onChangeToBucketName}

View File

@ -27,7 +27,7 @@ import {
RemoteDataState,
TaskTemplate,
} from 'src/types'
import GetResources, {ResourceTypes} from 'src/shared/components/GetResources'
import GetResources, {ResourceType} from 'src/shared/components/GetResources'
interface StateProps {
templates: TemplateSummary[]
@ -59,7 +59,7 @@ class TaskImportFromTemplateOverlay extends PureComponent<
render() {
return (
<GetResources resource={ResourceTypes.Templates}>
<GetResources resource={ResourceType.Templates}>
<Overlay visible={true}>
<Overlay.Container maxWidth={900}>
<Overlay.Header

View File

@ -10,7 +10,7 @@ import {Page} from '@influxdata/clockface'
import {ErrorHandling} from 'src/shared/decorators/errors'
import FilterList from 'src/shared/components/Filter'
import SearchWidget from 'src/shared/components/search_widget/SearchWidget'
import GetResources, {ResourceTypes} from 'src/shared/components/GetResources'
import GetResources, {ResourceType} from 'src/shared/components/GetResources'
import GetAssetLimits from 'src/cloud/components/GetAssetLimits'
import AssetLimitAlert from 'src/cloud/components/AssetLimitAlert'
@ -130,8 +130,8 @@ class TasksPage extends PureComponent<Props, State> {
limitStatus={limitStatus}
/>
<Page.Contents fullWidth={false} scrollable={true}>
<GetResources resource={ResourceTypes.Tasks}>
<GetResources resource={ResourceTypes.Labels}>
<GetResources resource={ResourceType.Tasks}>
<GetResources resource={ResourceType.Labels}>
<GetAssetLimits>
<AssetLimitAlert
resourceName="tasks"

View File

@ -12,7 +12,7 @@ import CollectorList from 'src/telegrafs/components/CollectorList'
import TelegrafExplainer from 'src/telegrafs/components/TelegrafExplainer'
import FilterList from 'src/shared/components/Filter'
import NoBucketsWarning from 'src/buckets/components/NoBucketsWarning'
import GetResources, {ResourceTypes} from 'src/shared/components/GetResources'
import GetResources, {ResourceType} from 'src/shared/components/GetResources'
// Actions
import {setBucketInfo} from 'src/dataLoaders/actions/steps'
@ -112,7 +112,7 @@ class Collectors extends PureComponent<Props, State> {
widthSM={Columns.Eight}
widthMD={Columns.Ten}
>
<GetResources resource={ResourceTypes.Labels}>
<GetResources resource={ResourceType.Labels}>
<FilterList<Telegraf>
searchTerm={searchTerm}
searchKeys={['plugins.0.config.bucket', 'labels[].name']}

View File

@ -8,7 +8,7 @@ import {withRouter, WithRouterProps} from 'react-router'
import {ErrorHandling} from 'src/shared/decorators/errors'
import WizardOverlay from 'src/clockface/components/wizard/WizardOverlay'
import TelegrafInstructions from 'src/dataLoaders/components/verifyStep/TelegrafInstructions'
import GetResources, {ResourceTypes} from 'src/shared/components/GetResources'
import GetResources, {ResourceType} from 'src/shared/components/GetResources'
// Constants
import {TOKEN_LABEL} from 'src/labels/constants'
@ -30,7 +30,7 @@ export class TelegrafInstructionsOverlay extends PureComponent<
> {
public render() {
return (
<GetResources resource={ResourceTypes.Authorizations}>
<GetResources resource={ResourceType.Authorizations}>
<WizardOverlay
title="Telegraf Setup Instructions"
onDismiss={this.handleDismiss}

View File

@ -7,7 +7,7 @@ import {ErrorHandling} from 'src/shared/decorators/errors'
import LoadDataTabbedPage from 'src/settings/components/LoadDataTabbedPage'
import LoadDataHeader from 'src/settings/components/LoadDataHeader'
import Collectors from 'src/telegrafs/components/Collectors'
import GetResources, {ResourceTypes} from 'src/shared/components/GetResources'
import GetResources, {ResourceType} from 'src/shared/components/GetResources'
import LimitChecker from 'src/cloud/components/LimitChecker'
import RateLimitAlert from 'src/cloud/components/RateLimitAlert'
import {
@ -57,8 +57,8 @@ class TelegrafsPage extends PureComponent<StateProps> {
)}
</FlexBox>
<LoadDataTabbedPage activeTab="telegrafs" orgID={org.id}>
<GetResources resource={ResourceTypes.Buckets}>
<GetResources resource={ResourceTypes.Telegrafs}>
<GetResources resource={ResourceType.Buckets}>
<GetResources resource={ResourceType.Telegrafs}>
<Collectors />
</GetResources>
</GetResources>

View File

@ -9,7 +9,7 @@ import TemplatesList from 'src/templates/components/TemplatesList'
import StaticTemplatesList from 'src/templates/components/StaticTemplatesList'
import {ErrorHandling} from 'src/shared/decorators/errors'
import SearchWidget from 'src/shared/components/search_widget/SearchWidget'
import GetResources, {ResourceTypes} from 'src/shared/components/GetResources'
import GetResources, {ResourceType} from 'src/shared/components/GetResources'
import SettingsTabbedPageHeader from 'src/settings/components/SettingsTabbedPageHeader'
// Types
@ -154,7 +154,7 @@ class TemplatesPage extends PureComponent<Props, State> {
if (activeTab === 'user-templates') {
return (
<GetResources resource={ResourceTypes.Labels}>
<GetResources resource={ResourceType.Labels}>
<FilterList<TemplateSummary>
searchTerm={searchTerm}
searchKeys={['meta.name', 'labels[].name']}

View File

@ -31,7 +31,7 @@ import {
RemoteDataState,
DashboardTemplate,
} from 'src/types'
import GetResources, {ResourceTypes} from 'src/shared/components/GetResources'
import GetResources, {ResourceType} from 'src/shared/components/GetResources'
interface StateProps {
templates: TemplateSummary[]
@ -67,7 +67,7 @@ class DashboardImportFromTemplateOverlay extends PureComponent<
render() {
return (
<GetResources resource={ResourceTypes.Templates}>
<GetResources resource={ResourceType.Templates}>
<Overlay visible={true}>
<Overlay.Container maxWidth={900}>
<Overlay.Header

View File

@ -14,7 +14,7 @@ import {pageTitleSuffixer} from 'src/shared/utils/pageTitles'
// Types
import {AppState, Organization} from 'src/types'
import GetResources, {ResourceTypes} from 'src/shared/components/GetResources'
import GetResources, {ResourceType} from 'src/shared/components/GetResources'
interface StateProps {
org: Organization
@ -31,7 +31,7 @@ class TemplatesIndex extends Component<Props> {
<Page titleTag={pageTitleSuffixer(['Templates', 'Settings'])}>
<SettingsHeader />
<SettingsTabbedPage activeTab="templates" orgID={org.id}>
<GetResources resource={ResourceTypes.Templates}>
<GetResources resource={ResourceType.Templates}>
<TemplatesPage onImport={this.handleImport} />
</GetResources>
</SettingsTabbedPage>

View File

@ -33,3 +33,4 @@ export * from './timeZones'
export * from './alerting'
export * from './auth'
export * from './cloud'
export {ResourceType} from 'src/shared/components/GetResources'

View File

@ -12,7 +12,7 @@ import {createVariable} from 'src/variables/actions'
// Components
import {Overlay} from '@influxdata/clockface'
import VariableForm from 'src/variables/components/VariableForm'
import GetResources, {ResourceTypes} from 'src/shared/components/GetResources'
import GetResources, {ResourceType} from 'src/shared/components/GetResources'
// Types
import {AppState} from 'src/types'
@ -33,7 +33,7 @@ class CreateVariableOverlay extends PureComponent<Props> {
const {onCreateVariable, variables} = this.props
return (
<GetResources resource={ResourceTypes.Variables}>
<GetResources resource={ResourceType.Variables}>
<Overlay visible={true}>
<Overlay.Container maxWidth={1000}>
<Overlay.Header

View File

@ -15,7 +15,7 @@ import TabbedPageHeader from 'src/shared/components/tabbed_page/TabbedPageHeader
import VariableList from 'src/variables/components/VariableList'
import FilterList from 'src/shared/components/Filter'
import AddResourceDropdown from 'src/shared/components/AddResourceDropdown'
import GetResources, {ResourceTypes} from 'src/shared/components/GetResources'
import GetResources, {ResourceType} from 'src/shared/components/GetResources'
import {Sort} from '@influxdata/clockface'
// Types
@ -73,7 +73,7 @@ class VariablesTab extends PureComponent<Props, State> {
onSelectNew={this.handleOpenCreateOverlay}
/>
</TabbedPageHeader>
<GetResources resource={ResourceTypes.Labels}>
<GetResources resource={ResourceType.Labels}>
<FilterList<Variable>
searchTerm={searchTerm}
searchKeys={['name', 'labels[].name']}

View File

@ -8,7 +8,7 @@ import SettingsTabbedPage from 'src/settings/components/SettingsTabbedPage'
import SettingsHeader from 'src/settings/components/SettingsHeader'
import {Page} from '@influxdata/clockface'
import VariablesTab from 'src/variables/components/VariablesTab'
import GetResources, {ResourceTypes} from 'src/shared/components/GetResources'
import GetResources, {ResourceType} from 'src/shared/components/GetResources'
// Utils
import {pageTitleSuffixer} from 'src/shared/utils/pageTitles'
@ -30,7 +30,7 @@ class VariablesIndex extends Component<StateProps> {
<Page titleTag={pageTitleSuffixer(['Variables', 'Settings'])}>
<SettingsHeader />
<SettingsTabbedPage activeTab="variables" orgID={org.id}>
<GetResources resource={ResourceTypes.Variables}>
<GetResources resource={ResourceType.Variables}>
<VariablesTab />
</GetResources>
</SettingsTabbedPage>