Skip to content

Commit

Permalink
feat(ui): remove treenav flag (#17581)
Browse files Browse the repository at this point in the history
* refactor(ui): remove treeNav feature flag

* chore(ui): remove unused components

* chore(ui): remove unused routes from settings

* chore(ui): update changelog

* fix(ui): repair login e2e test

* fix(ui): repair tasks navigation e2e test

* fix(ui): repair query builder navigation test

* fix(tenants): remove portion of test

@AlirieGray mentioned I should make this change to match her PR #17474
  • Loading branch information
alexpaxton authored Apr 7, 2020
1 parent e989443 commit 0677b88
Show file tree
Hide file tree
Showing 18 changed files with 62 additions and 874 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
### Features

1. [17490](https://github.com/influxdata/influxdb/pull/17490): `influx config -`, to switch back to previous activated configuration
1. [17581](https://github.com/influxdata/influxdb/pull/17581): Introduce new navigation menu

### Bug Fixes

Expand Down
10 changes: 0 additions & 10 deletions testing/tenant.go
Original file line number Diff line number Diff line change
Expand Up @@ -443,16 +443,6 @@ func Create(t *testing.T, init func(*testing.T, TenantFields) (influxdb.TenantSe
if err != nil {
t.Fatal(err)
}
// TODO(affo): this shouldn't be needed.
// This URM should not be created.
want = append(want, &influxdb.UserResourceMapping{
UserID: u.ID,
UserType: userType,
MappingType: influxdb.UserMappingType,
ResourceType: influxdb.BucketsResourceType,
ResourceID: b.ID,
})
sort.Sort(urmByResourceID(want))
sort.Sort(urmByResourceID(urms))
if diff := cmp.Diff(want, urms); diff != "" {
t.Errorf("unexpected urms -want/+got:\n\t%s", diff)
Expand Down
2 changes: 1 addition & 1 deletion ui/cypress/e2e/login.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('The Login Page', () => {
cy.getByInputName('password').type(user.password)
cy.get('button[type=submit]').click()

cy.getByTestID('nav-menu').should('exist')
cy.getByTestID('tree-nav').should('exist')
})

describe('login failure', () => {
Expand Down
4 changes: 2 additions & 2 deletions ui/cypress/e2e/queryBuilder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ describe('The Query Builder', () => {

// force a click on the hidden dashboard nav item (cypress can't do the hover)
// i assure you i spent a nonzero amount of time trying to do this the way a user would
cy.getByTestID('nav-menu_dashboard').click({force: true})
cy.getByTestID('nav-item-dashboards').click()

cy.contains('Basic Ole Dashboard').click()
cy.getByTestID('cell-context--toggle').click()
Expand All @@ -78,7 +78,7 @@ describe('The Query Builder', () => {
cy.contains('Submit').click()
cy.getByTestID('save-cell--button').click()

cy.getByTestID('nav-menu_dashboard').click({force: true})
cy.getByTestID('nav-item-dashboards').click()

cy.contains('Basic Ole Dashboard').click()
cy.getByTestID('cell-context--toggle').click()
Expand Down
5 changes: 4 additions & 1 deletion ui/cypress/e2e/tasks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,10 @@ http.post(
// verify that it is the correct data
cy.getByInputValue(secondTask)

cy.get('div.cf-nav--item.active').click()
cy.get('.cf-tree-nav--item__active').within(() => {
// Get the element that has a click handler within the nav item
cy.get('.cf-tree-nav--item-block').click()
})
// navigate back to the first one to verify that the name is correct
cy.getByTestID('task-card--name')
.contains(firstTask)
Expand Down
38 changes: 11 additions & 27 deletions ui/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,10 @@ import classnames from 'classnames'
// Components
import {AppWrapper} from '@influxdata/clockface'
import TreeNav from 'src/pageLayout/containers/TreeNav'
import Nav from 'src/pageLayout/containers/Nav'
import TooltipPortal from 'src/portals/TooltipPortal'
import NotesPortal from 'src/portals/NotesPortal'
import Notifications from 'src/shared/components/notifications/Notifications'
import OverlayController from 'src/overlays/components/OverlayController'
import {FeatureFlag} from 'src/shared/utils/featureFlag'
import CloudNav from 'src/pageLayout/components/CloudNav'
import CloudOnly from 'src/shared/components/cloud/CloudOnly'

// Types
import {AppState, CurrentPage, Theme} from 'src/types'
Expand All @@ -41,29 +37,17 @@ const App: SFC<Props> = ({
})

return (
<>
<FeatureFlag name="treeNav" equals={false}>
<CloudOnly>
<CloudNav />
</CloudOnly>
</FeatureFlag>
<AppWrapper
presentationMode={inPresentationMode}
className={appWrapperClass}
>
<Notifications />
<TooltipPortal />
<NotesPortal />
<OverlayController />
<FeatureFlag name="treeNav">
<TreeNav />
</FeatureFlag>
<FeatureFlag name="treeNav" equals={false}>
<Nav />
</FeatureFlag>
{children}
</AppWrapper>
</>
<AppWrapper
presentationMode={inPresentationMode}
className={appWrapperClass}
>
<Notifications />
<TooltipPortal />
<NotesPortal />
<OverlayController />
<TreeNav />
{children}
</AppWrapper>
)
}

Expand Down
53 changes: 15 additions & 38 deletions ui/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -362,36 +362,7 @@ class Root extends PureComponent {
</Route>
</Route>
<Route path="settings">
{CLOUD ? (
<IndexRoute component={VariablesIndex} />
) : (
<>
<IndexRoute component={MembersIndex} />
<Route
path="members"
component={MembersIndex}
/>
</>
)}

<Route path="templates" component={TemplatesIndex}>
<Route
path="import"
component={TemplateImportOverlay}
/>
<Route
path=":id/export"
component={TemplateExportOverlay}
/>
<Route
path=":id/view"
component={TemplateViewOverlay}
/>
<Route
path=":id/static/view"
component={StaticTemplateViewOverlay}
/>
</Route>
<IndexRoute component={VariablesIndex} />
<Route path="variables" component={VariablesIndex}>
<Route
path="import"
Expand All @@ -414,19 +385,25 @@ class Root extends PureComponent {
component={UpdateVariableOverlay}
/>
</Route>
<Route path="labels" component={LabelsIndex} />
<Route path="about" component={OrgProfilePage}>
<Route path="templates" component={TemplatesIndex}>
<Route
path="rename"
component={RenameOrgOverlay}
path="import"
component={TemplateImportOverlay}
/>
<Route
path=":id/export"
component={TemplateExportOverlay}
/>
</Route>
<Route path="profile" component={OrgProfilePage}>
<Route
path="rename"
component={RenameOrgOverlay}
path=":id/view"
component={TemplateViewOverlay}
/>
<Route
path=":id/static/view"
component={StaticTemplateViewOverlay}
/>
</Route>
<Route path="labels" component={LabelsIndex} />
</Route>
<Route path="alerting" component={AlertingIndex}>
<Route
Expand Down
31 changes: 8 additions & 23 deletions ui/src/members/containers/MembersIndex.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,9 @@ import {connect} from 'react-redux'
import {ErrorHandling} from 'src/shared/decorators/errors'
import OrgTabbedPage from 'src/organizations/components/OrgTabbedPage'
import OrgHeader from 'src/organizations/components/OrgHeader'
import SettingsTabbedPage from 'src/settings/components/SettingsTabbedPage'
import SettingsHeader from 'src/settings/components/SettingsHeader'
import {Page} from '@influxdata/clockface'
import GetResources from 'src/resources/components/GetResources'
import Members from 'src/members/components/Members'
import {FeatureFlag} from 'src/shared/utils/featureFlag'

// Utils
import {pageTitleSuffixer} from 'src/shared/utils/pageTitles'
Expand All @@ -37,26 +34,14 @@ class MembersIndex extends Component<Props> {

return (
<>
<FeatureFlag name="treeNav">
<Page titleTag={pageTitleSuffixer(['Members', 'Organization'])}>
<OrgHeader />
<OrgTabbedPage activeTab="members" orgID={org.id}>
<GetResources resources={[ResourceType.Members]}>
<Members />
</GetResources>
</OrgTabbedPage>
</Page>
</FeatureFlag>
<FeatureFlag name="treeNav" equals={false}>
<Page titleTag={pageTitleSuffixer(['Members', 'Settings'])}>
<SettingsHeader />
<SettingsTabbedPage activeTab="members" orgID={org.id}>
<GetResources resources={[ResourceType.Members]}>
<Members />
</GetResources>
</SettingsTabbedPage>
</Page>
</FeatureFlag>
<Page titleTag={pageTitleSuffixer(['Members', 'Organization'])}>
<OrgHeader />
<OrgTabbedPage activeTab="members" orgID={org.id}>
<GetResources resources={[ResourceType.Members]}>
<Members />
</GetResources>
</OrgTabbedPage>
</Page>
{children}
</>
)
Expand Down
43 changes: 12 additions & 31 deletions ui/src/organizations/containers/OrgProfilePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ import {connect} from 'react-redux'
import {ErrorHandling} from 'src/shared/decorators/errors'
import OrgTabbedPage from 'src/organizations/components/OrgTabbedPage'
import OrgHeader from 'src/organizations/components/OrgHeader'
import SettingsTabbedPage from 'src/settings/components/SettingsTabbedPage'
import SettingsHeader from 'src/settings/components/SettingsHeader'
import {Grid, Columns, Page} from '@influxdata/clockface'
import {FeatureFlag} from 'src/shared/utils/featureFlag'

// Utils
import {pageTitleSuffixer} from 'src/shared/utils/pageTitles'
Expand All @@ -30,34 +27,18 @@ class OrgProfilePage extends Component<StateProps> {

return (
<>
<FeatureFlag name="treeNav">
<Page titleTag={pageTitleSuffixer(['About', 'Organization'])}>
<OrgHeader />
<OrgTabbedPage activeTab="about" orgID={org.id}>
<Grid>
<Grid.Row>
<Grid.Column widthXS={Columns.Twelve} widthSM={Columns.Six}>
<OrgProfileTab />
</Grid.Column>
</Grid.Row>
</Grid>
</OrgTabbedPage>
</Page>
</FeatureFlag>
<FeatureFlag name="treeNav" equals={false}>
<Page titleTag={pageTitleSuffixer(['About', 'Settings'])}>
<SettingsHeader />
<SettingsTabbedPage activeTab="about" orgID={org.id}>
<Grid>
<Grid.Row>
<Grid.Column widthXS={Columns.Twelve} widthSM={Columns.Six}>
<OrgProfileTab />
</Grid.Column>
</Grid.Row>
</Grid>
</SettingsTabbedPage>
</Page>
</FeatureFlag>
<Page titleTag={pageTitleSuffixer(['About', 'Organization'])}>
<OrgHeader />
<OrgTabbedPage activeTab="about" orgID={org.id}>
<Grid>
<Grid.Row>
<Grid.Column widthXS={Columns.Twelve} widthSM={Columns.Six}>
<OrgProfileTab />
</Grid.Column>
</Grid.Row>
</Grid>
</OrgTabbedPage>
</Page>
{children}
</>
)
Expand Down
Loading

0 comments on commit 0677b88

Please sign in to comment.