Skip to content

Commit

Permalink
[cloud dagit] Add optional nav tabs parameter for settings root page (#…
Browse files Browse the repository at this point in the history
…7892)

* [cloud dagit] Add optional nav tabs parameter for settings root page

* remove memo
  • Loading branch information
benpankow committed May 13, 2022
1 parent 272b250 commit 91b6c0f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions js_modules/dagit/packages/core/src/app/ContentRoot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import {Route, Switch} from 'react-router-dom';

const InstanceRoot = React.lazy(() => import('../instance/InstanceRoot'));
const SettingsRoot = React.lazy(() => import('../app/SettingsRoot'));
const UserSettingsRoot = React.lazy(() => import('./UserSettingsRoot'));
const WorkspaceRoot = React.lazy(() => import('../workspace/WorkspaceRoot'));
const FallthroughRoot = React.lazy(() => import('./FallthroughRoot'));

Expand All @@ -20,7 +20,7 @@ export const ContentRoot = React.memo(() => (
</Route>
<Route path="/settings">
<React.Suspense fallback={<div />}>
<SettingsRoot />
<UserSettingsRoot />
</React.Suspense>
</Route>
<Route path="*">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import {
ButtonLink,
Checkbox,
Colors,
Heading,
MetadataTable,
PageHeader,
Heading,
Subheading,
} from '@dagster-io/ui';
import * as React from 'react';
Expand All @@ -18,7 +18,10 @@ import {SHORTCUTS_STORAGE_KEY} from './ShortcutHandler';
import {TimezoneSelect} from './time/TimezoneSelect';
import {automaticLabel} from './time/browserTimezone';

const SettingsRoot = () => {
export interface SettingsRootProps {
tabs?: React.ReactNode;
}
const UserSettingsRoot: React.FC<SettingsRootProps> = ({tabs}) => {
useDocumentTitle('User settings');

const [flags, setFlags] = React.useState<FeatureFlag[]>(() => getFeatureFlags());
Expand Down Expand Up @@ -54,7 +57,7 @@ const SettingsRoot = () => {

return (
<div style={{height: '100vh', overflowY: 'auto'}}>
<PageHeader title={<Heading>User settings</Heading>} />
<PageHeader title={<Heading>User settings</Heading>} tabs={tabs} />
<Box padding={{vertical: 16, horizontal: 24}}>
<Box padding={{bottom: 8}}>
<Subheading>Preferences</Subheading>
Expand Down Expand Up @@ -150,4 +153,4 @@ const SettingsRoot = () => {

// Imported via React.lazy, which requires a default export.
// eslint-disable-next-line import/no-default-export
export default SettingsRoot;
export default UserSettingsRoot;

0 comments on commit 91b6c0f

Please sign in to comment.