Merge pull request #12765 from influxdata/fix-labels-in-cloud
Remove labels tab and give default org id to new labelspull/12770/head
commit
7381748c47
|
@ -9,7 +9,6 @@ import GetResources, {
|
|||
} from 'src/configuration/components/GetResources'
|
||||
import TabbedPageSection from 'src/shared/components/tabbed_page/TabbedPageSection'
|
||||
import TabbedPage from 'src/shared/components/tabbed_page/TabbedPage'
|
||||
import Labels from 'src/configuration/components/Labels'
|
||||
import Settings from 'src/me/components/account/Settings'
|
||||
import Tokens from 'src/me/components/account/Tokens'
|
||||
import Buckets from 'src/configuration/components/Buckets'
|
||||
|
@ -48,15 +47,6 @@ class ConfigurationPage extends Component<Props> {
|
|||
parentUrl={`/configuration`}
|
||||
activeTabUrl={tab}
|
||||
>
|
||||
<TabbedPageSection
|
||||
id="labels_tab"
|
||||
url="labels_tab"
|
||||
title="Labels"
|
||||
>
|
||||
<GetResources resource={ResourceTypes.Labels}>
|
||||
<Labels />
|
||||
</GetResources>
|
||||
</TabbedPageSection>
|
||||
<TabbedPageSection
|
||||
id="buckets_tab"
|
||||
url="buckets_tab"
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
// Libraries
|
||||
import React, {Component, ChangeEvent} from 'react'
|
||||
import {connect} from 'react-redux'
|
||||
import _ from 'lodash'
|
||||
|
||||
// Components
|
||||
import LabelOverlayForm from 'src/configuration/components/LabelOverlayForm'
|
||||
|
@ -13,8 +15,9 @@ import {EMPTY_LABEL} from 'src/configuration/constants/LabelColors'
|
|||
|
||||
// Decorators
|
||||
import {ErrorHandling} from 'src/shared/decorators/errors'
|
||||
import {AppState} from 'src/types/v2'
|
||||
|
||||
interface Props {
|
||||
interface OwnProps {
|
||||
isVisible: boolean
|
||||
onDismiss: () => void
|
||||
onCreateLabel: (label: ILabel) => void
|
||||
|
@ -22,6 +25,12 @@ interface Props {
|
|||
overrideDefaultName?: string
|
||||
}
|
||||
|
||||
interface StateProps {
|
||||
orgID: string
|
||||
}
|
||||
|
||||
type Props = OwnProps & StateProps
|
||||
|
||||
interface State {
|
||||
label: ILabel
|
||||
colorStatus: ComponentStatus
|
||||
|
@ -93,7 +102,7 @@ class CreateLabelOverlay extends Component<Props, State> {
|
|||
const {onCreateLabel, onDismiss} = this.props
|
||||
|
||||
try {
|
||||
onCreateLabel(this.state.label)
|
||||
onCreateLabel({...this.state.label, orgID: this.props.orgID})
|
||||
// clear form on successful submit
|
||||
this.resetForm()
|
||||
} finally {
|
||||
|
@ -138,4 +147,10 @@ class CreateLabelOverlay extends Component<Props, State> {
|
|||
}
|
||||
}
|
||||
|
||||
export default CreateLabelOverlay
|
||||
const mstp = (state: AppState) => {
|
||||
const {orgs} = state
|
||||
|
||||
return {orgID: _.get(orgs, '0.id', '')}
|
||||
}
|
||||
|
||||
export default connect<StateProps, {}, OwnProps>(mstp)(CreateLabelOverlay)
|
||||
|
|
|
@ -12,6 +12,7 @@ const localState = {
|
|||
},
|
||||
persisted: {autoRefresh: 0, showTemplateControlBar: false},
|
||||
},
|
||||
orgs: [{orgID: 'orgid'}],
|
||||
VERSION: '2.0.0',
|
||||
ranges: [
|
||||
{
|
||||
|
@ -32,10 +33,8 @@ export function renderWithRedux(ui, initialState = s => s) {
|
|||
const seedState = seedStore.getState()
|
||||
const store = configureStore(initialState(seedState), history)
|
||||
|
||||
const provider = <Provider store={store}>{ui}</Provider>
|
||||
|
||||
return {
|
||||
...render(provider),
|
||||
...render(<Provider store={store}>{ui}</Provider>),
|
||||
store,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// Libraries
|
||||
import React, {PureComponent} from 'react'
|
||||
import {withRouter, WithRouterProps} from 'react-router'
|
||||
import _ from 'lodash'
|
||||
|
||||
// Components
|
||||
import {IndexList, ConfirmationButton, Context} from 'src/clockface'
|
||||
|
@ -93,7 +94,7 @@ class BucketRow extends PureComponent<Props & WithRouterProps> {
|
|||
}
|
||||
|
||||
private get organization(): JSX.Element {
|
||||
if (!this.props.params.orgID) {
|
||||
if (!_.get(this.props, 'params.orgID')) {
|
||||
return <IndexList.Cell>{this.props.bucket.organization}</IndexList.Cell>
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
// Libraries
|
||||
import React from 'react'
|
||||
import {renderWithRedux} from 'src/mockState'
|
||||
|
||||
// Components
|
||||
import BucketList from 'src/organizations/components/BucketList'
|
||||
|
||||
// Constants
|
||||
import {buckets} from 'mocks/dummyData'
|
||||
import {DataLoaderType} from 'src/types/v2/dataLoaders'
|
||||
import {withRouterProps} from 'mocks/dummyData'
|
||||
|
||||
const setup = (override?) => {
|
||||
const props = {
|
||||
...withRouterProps,
|
||||
buckets,
|
||||
emptyState: <></>,
|
||||
onUpdateBucket: jest.fn(),
|
||||
onDeleteBucket: jest.fn(),
|
||||
onSetBucketInfo: jest.fn(),
|
||||
onSetDataLoadersType: jest.fn(),
|
||||
dataLoaderType: DataLoaderType.Streaming,
|
||||
...override,
|
||||
}
|
||||
|
||||
const wrapper = renderWithRedux(<BucketList {...props} />)
|
||||
|
||||
return {wrapper}
|
||||
}
|
||||
|
||||
describe('BucketList', () => {
|
||||
describe('rendering', () => {
|
||||
it('renders', () => {
|
||||
const {wrapper} = setup()
|
||||
expect(wrapper).toMatchSnapshot()
|
||||
})
|
||||
})
|
||||
})
|
|
@ -1,217 +0,0 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`BucketList rendering renders 1`] = `
|
||||
Object {
|
||||
"asFragment": [Function],
|
||||
"baseElement": <body>
|
||||
<div>
|
||||
<table
|
||||
class="index-list"
|
||||
>
|
||||
<thead
|
||||
class="index-list--header"
|
||||
>
|
||||
<tr>
|
||||
<th
|
||||
class="index-list--header-cell index-list--align-left"
|
||||
style="width: 40%;"
|
||||
>
|
||||
Name
|
||||
</th>
|
||||
<th
|
||||
class="index-list--header-cell index-list--align-left"
|
||||
style="width: 40%;"
|
||||
>
|
||||
Retention
|
||||
</th>
|
||||
<th
|
||||
class="index-list--header-cell index-list--align-left"
|
||||
style="width: 20%;"
|
||||
>
|
||||
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<p
|
||||
class="error"
|
||||
>
|
||||
An InfluxDB error has occurred. Please report the issue
|
||||
<a
|
||||
href="https://github.com/influxdata/influxdb/issues"
|
||||
>
|
||||
here
|
||||
</a>
|
||||
.
|
||||
</p>
|
||||
</table>
|
||||
<div
|
||||
class="fancy-scroll--container overlay"
|
||||
style="position: relative; overflow: hidden; width: 100%; height: 100%;"
|
||||
>
|
||||
<div
|
||||
class="fancy-scroll--view"
|
||||
style="position: absolute; top: 0px; left: 0px; right: 0px; bottom: 0px; overflow: scroll; margin-right: 0px; margin-bottom: 0px;"
|
||||
>
|
||||
<div
|
||||
class="overlay--transition"
|
||||
data-testid="overlay-children"
|
||||
/>
|
||||
<div
|
||||
class="overlay--mask"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="fancy-scroll--track-h"
|
||||
style="position: absolute; width: 100%; height: 12px; bottom: 0px; left: 0px; padding: 3px; cursor: pointer;"
|
||||
>
|
||||
<div
|
||||
class="fancy-scroll--thumb-h"
|
||||
style="position: relative; display: block; height: 6px; border-radius: 3px;"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="fancy-scroll--track-v"
|
||||
style="position: absolute; width: 12px; height: 100%; top: 0px; right: 0px; padding: 3px; cursor: pointer;"
|
||||
>
|
||||
<div
|
||||
class="fancy-scroll--thumb-v"
|
||||
style="position: relative; display: block; width: 6px; border-radius: 3px;"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
data-testid="data-loader-empty"
|
||||
/>
|
||||
</div>
|
||||
</body>,
|
||||
"container": <div>
|
||||
<table
|
||||
class="index-list"
|
||||
>
|
||||
<thead
|
||||
class="index-list--header"
|
||||
>
|
||||
<tr>
|
||||
<th
|
||||
class="index-list--header-cell index-list--align-left"
|
||||
style="width: 40%;"
|
||||
>
|
||||
Name
|
||||
</th>
|
||||
<th
|
||||
class="index-list--header-cell index-list--align-left"
|
||||
style="width: 40%;"
|
||||
>
|
||||
Retention
|
||||
</th>
|
||||
<th
|
||||
class="index-list--header-cell index-list--align-left"
|
||||
style="width: 20%;"
|
||||
>
|
||||
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<p
|
||||
class="error"
|
||||
>
|
||||
An InfluxDB error has occurred. Please report the issue
|
||||
<a
|
||||
href="https://github.com/influxdata/influxdb/issues"
|
||||
>
|
||||
here
|
||||
</a>
|
||||
.
|
||||
</p>
|
||||
</table>
|
||||
<div
|
||||
class="fancy-scroll--container overlay"
|
||||
style="position: relative; overflow: hidden; width: 100%; height: 100%;"
|
||||
>
|
||||
<div
|
||||
class="fancy-scroll--view"
|
||||
style="position: absolute; top: 0px; left: 0px; right: 0px; bottom: 0px; overflow: scroll; margin-right: 0px; margin-bottom: 0px;"
|
||||
>
|
||||
<div
|
||||
class="overlay--transition"
|
||||
data-testid="overlay-children"
|
||||
/>
|
||||
<div
|
||||
class="overlay--mask"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="fancy-scroll--track-h"
|
||||
style="position: absolute; width: 100%; height: 12px; bottom: 0px; left: 0px; padding: 3px; cursor: pointer;"
|
||||
>
|
||||
<div
|
||||
class="fancy-scroll--thumb-h"
|
||||
style="position: relative; display: block; height: 6px; border-radius: 3px;"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="fancy-scroll--track-v"
|
||||
style="position: absolute; width: 12px; height: 100%; top: 0px; right: 0px; padding: 3px; cursor: pointer;"
|
||||
>
|
||||
<div
|
||||
class="fancy-scroll--thumb-v"
|
||||
style="position: relative; display: block; width: 6px; border-radius: 3px;"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
data-testid="data-loader-empty"
|
||||
/>
|
||||
</div>,
|
||||
"debug": [Function],
|
||||
"getAllByAltText": [Function],
|
||||
"getAllByDisplayValue": [Function],
|
||||
"getAllByLabelText": [Function],
|
||||
"getAllByPlaceholderText": [Function],
|
||||
"getAllByRole": [Function],
|
||||
"getAllBySelectText": [Function],
|
||||
"getAllByTestId": [Function],
|
||||
"getAllByText": [Function],
|
||||
"getAllByTitle": [Function],
|
||||
"getAllByValue": [Function],
|
||||
"getByAltText": [Function],
|
||||
"getByDisplayValue": [Function],
|
||||
"getByLabelText": [Function],
|
||||
"getByPlaceholderText": [Function],
|
||||
"getByRole": [Function],
|
||||
"getBySelectText": [Function],
|
||||
"getByTestId": [Function],
|
||||
"getByText": [Function],
|
||||
"getByTitle": [Function],
|
||||
"getByValue": [Function],
|
||||
"queryAllByAltText": [Function],
|
||||
"queryAllByDisplayValue": [Function],
|
||||
"queryAllByLabelText": [Function],
|
||||
"queryAllByPlaceholderText": [Function],
|
||||
"queryAllByRole": [Function],
|
||||
"queryAllBySelectText": [Function],
|
||||
"queryAllByTestId": [Function],
|
||||
"queryAllByText": [Function],
|
||||
"queryAllByTitle": [Function],
|
||||
"queryAllByValue": [Function],
|
||||
"queryByAltText": [Function],
|
||||
"queryByDisplayValue": [Function],
|
||||
"queryByLabelText": [Function],
|
||||
"queryByPlaceholderText": [Function],
|
||||
"queryByRole": [Function],
|
||||
"queryBySelectText": [Function],
|
||||
"queryByTestId": [Function],
|
||||
"queryByText": [Function],
|
||||
"queryByTitle": [Function],
|
||||
"queryByValue": [Function],
|
||||
"rerender": [Function],
|
||||
"store": Object {
|
||||
"dispatch": [Function],
|
||||
"getState": [Function],
|
||||
"replaceReducer": [Function],
|
||||
"subscribe": [Function],
|
||||
Symbol(observable): [Function],
|
||||
},
|
||||
"unmount": [Function],
|
||||
}
|
||||
`;
|
|
@ -79,17 +79,11 @@ class SideNav extends PureComponent<Props> {
|
|||
/>
|
||||
<NavMenu.Item
|
||||
title="Configuration"
|
||||
link="/configuration/labels_tab"
|
||||
link="/configuration/buckets_tab"
|
||||
icon={IconFont.Wrench}
|
||||
location={location.pathname}
|
||||
highlightPaths={['configuration']}
|
||||
>
|
||||
<NavMenu.SubItem
|
||||
title="Labels"
|
||||
link="/configuration/labels_tab"
|
||||
location={location.pathname}
|
||||
highlightPaths={['labels_tab']}
|
||||
/>
|
||||
<NavMenu.SubItem
|
||||
title="Buckets"
|
||||
link="/configuration/buckets_tab"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Libraries
|
||||
import React from 'react'
|
||||
import {render} from 'react-testing-library'
|
||||
import {renderWithRedux} from 'src/mockState'
|
||||
|
||||
// Components
|
||||
import InlineLabels from 'src/shared/components/inlineLabels/InlineLabels'
|
||||
|
@ -20,7 +20,7 @@ const setup = (override = {}) => {
|
|||
...override,
|
||||
}
|
||||
|
||||
return render(<InlineLabels {...props} />)
|
||||
return renderWithRedux(<InlineLabels {...props} />)
|
||||
}
|
||||
|
||||
describe('Shared.Components.InlineLabels', () => {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Libraries
|
||||
import React from 'react'
|
||||
import {render, fireEvent} from 'react-testing-library'
|
||||
import {fireEvent} from 'react-testing-library'
|
||||
|
||||
// Components
|
||||
import InlineLabelsEditor from 'src/shared/components/inlineLabels/InlineLabelsEditor'
|
||||
|
@ -9,6 +9,8 @@ import InlineLabelsEditor from 'src/shared/components/inlineLabels/InlineLabelsE
|
|||
import {labels} from 'mocks/dummyData'
|
||||
const selectedLabels = [labels[0]]
|
||||
|
||||
import {renderWithRedux} from 'src/mockState'
|
||||
|
||||
const setup = (override = {}) => {
|
||||
const props = {
|
||||
selectedLabels,
|
||||
|
@ -18,7 +20,7 @@ const setup = (override = {}) => {
|
|||
...override,
|
||||
}
|
||||
|
||||
return render(<InlineLabelsEditor {...props} />)
|
||||
return renderWithRedux(<InlineLabelsEditor {...props} />)
|
||||
}
|
||||
|
||||
describe('Shared.Components.InlineLabelsEditor', () => {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Libraries
|
||||
import React from 'react'
|
||||
import {render} from 'react-testing-library'
|
||||
import {renderWithRedux} from 'src/mockState'
|
||||
|
||||
// Components
|
||||
import {TaskCard} from 'src/tasks/components/TaskCard'
|
||||
|
@ -28,7 +28,7 @@ const setup = (override = {}) => {
|
|||
...override,
|
||||
}
|
||||
|
||||
return render(<TaskCard {...props} />)
|
||||
return renderWithRedux(<TaskCard {...props} />)
|
||||
}
|
||||
|
||||
describe('Tasks.Components.TaskCard', () => {
|
||||
|
|
Loading…
Reference in New Issue