Skip to content

Commit 1e9b63e

Browse files
author
Gene Hynson
authored
fix(notebooks): presentation, nav tree bugs, share warning (#3221)
1 parent af3f79d commit 1e9b63e

File tree

9 files changed

+48
-45
lines changed

9 files changed

+48
-45
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@
158158
},
159159
"dependencies": {
160160
"@docsearch/react": "^3.0.0-alpha.37",
161-
"@influxdata/clockface": "^3.1.5",
161+
"@influxdata/clockface": "^3.1.6",
162162
"@influxdata/flux": "^0.5.1",
163163
"@influxdata/flux-lsp-browser": "^0.5.53",
164164
"@influxdata/giraffe": "^2.20.0",

src/flows/components/FromTemplatePage.tsx

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
hydrate,
1515
} from 'src/flows/context/flow.list'
1616
import {FlowProvider, FlowContext} from 'src/flows/context/flow.current'
17+
import {AppSettingProvider} from 'src/shared/contexts/app'
1718
import QueryProvider from 'src/shared/contexts/query'
1819
import {FlowPage} from 'src/flows/components/FlowPage'
1920
import {isFlagEnabled} from 'src/shared/utils/featureFlag'
@@ -85,24 +86,26 @@ const FromTemplatePage: FC = () => {
8586
if (isFlagEnabled('ephemeralNotebook')) {
8687
return (
8788
<AppWrapper>
88-
<Notifications />
89-
<TooltipPortal />
90-
<NotesPortal />
91-
<OverlayProviderComp>
92-
<OverlayController />
93-
</OverlayProviderComp>
94-
<EngagementLink />
95-
<TreeNav />
96-
<QueryProvider>
97-
<FlowListProvider>
98-
<FlowProvider>
99-
<Switch>
100-
<Route path="/notebook/from/*" component={Template} />
101-
<Route component={NotFound} />
102-
</Switch>
103-
</FlowProvider>
104-
</FlowListProvider>
105-
</QueryProvider>
89+
<AppSettingProvider>
90+
<Notifications />
91+
<TooltipPortal />
92+
<NotesPortal />
93+
<OverlayProviderComp>
94+
<OverlayController />
95+
</OverlayProviderComp>
96+
<EngagementLink />
97+
<TreeNav />
98+
<QueryProvider>
99+
<FlowListProvider>
100+
<FlowProvider>
101+
<Switch>
102+
<Route path="/notebook/from/*" component={Template} />
103+
<Route component={NotFound} />
104+
</Switch>
105+
</FlowProvider>
106+
</FlowListProvider>
107+
</QueryProvider>
108+
</AppSettingProvider>
106109
</AppWrapper>
107110
)
108111
}

src/flows/components/header/Submit.scss

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,10 @@
88
.submit-btn span {
99
margin-right: 0.6em;
1010
}
11+
12+
.warning-icon {
13+
color: $c-thunder;
14+
&:hover {
15+
color: $c-pineapple;
16+
}
17+
}

src/flows/components/header/index.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
ComponentColor,
1616
ComponentStatus,
1717
Dropdown,
18+
ErrorTooltip,
1819
} from '@influxdata/clockface'
1920
import TimeZoneDropdown from 'src/shared/components/TimeZoneDropdown'
2021
import TimeRangeDropdown from 'src/flows/components/header/TimeRangeDropdown'
@@ -247,6 +248,11 @@ const FlowHeader: FC = () => {
247248
)}
248249
style={{width: '250px', flex: '0 0 250px'}}
249250
/>
251+
<ErrorTooltip
252+
className="warning-icon"
253+
tooltipContents="By sharing this link, your org may incur charges when a user visits the page and the query is run."
254+
tooltipStyle={{width: '250px'}}
255+
/>
250256
<SquareButton
251257
icon={IconFont.Checkmark_New}
252258
onClick={generateLink}

src/flows/style.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ $cf-radius-lg: $cf-radius + 4px;
7474
}
7575

7676
.presentation-panel {
77+
overflow: auto;
7778
display: flex;
7879
height: 100%;
7980
flex-direction: column;

src/pageLayout/constants/navigationHierarchy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export const generateNavItems = (): NavItem[] => {
106106
label: PROJECT_NAME_PLURAL,
107107
shortLabel: PROJECT_NAME_SHORT,
108108
link: `${orgPrefix}/${PROJECT_NAME_PLURAL.toLowerCase()}`,
109-
activeKeywords: [PROJECT_NAME_PLURAL.toLowerCase()],
109+
activeKeywords: [PROJECT_NAME_PLURAL.toLowerCase(), 'notebook/from'],
110110
},
111111
{
112112
id: 'dashboards',

src/pageLayout/utils/index.test.ts

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ describe('pageLayout.utils.getNavItemActivation', () => {
2121
getNavItemActivation([HOMEPAGE_PATHNAME, 'account'], pathname)
2222
).toEqual(true)
2323

24-
pathname = '/orgs/3491cbaef55b4559/some-path'
24+
pathname = '/orgs/3491cbaef55b4559/not-a-path'
2525
expect(
2626
getNavItemActivation([HOMEPAGE_PATHNAME, 'account'], pathname)
2727
).toEqual(false)
@@ -31,7 +31,7 @@ describe('pageLayout.utils.getNavItemActivation', () => {
3131
false
3232
)
3333

34-
pathname = '/new/meme/reviews'
34+
pathname = '/new/superb/reviews'
3535
expect(
3636
getNavItemActivation([HOMEPAGE_PATHNAME, 'account'], pathname)
3737
).toEqual(false)
@@ -72,19 +72,7 @@ describe('pageLayout.utils.getNavItemActivation', () => {
7272
true
7373
)
7474

75-
given = 'telegrafs'
76-
expect(getNavItemActivation([given], `${base}/${given}${given}`)).toEqual(
77-
false
78-
)
79-
80-
given = 'scrapers'
81-
expect(
82-
getNavItemActivation([given], `${base}/${given}${given}${given}`)
83-
).toEqual(false)
84-
85-
given = 'tokens'
86-
expect(getNavItemActivation([given], `${base}////////${given}`)).toEqual(
87-
true
88-
)
75+
given = 'notebook/from'
76+
expect(getNavItemActivation([given], `${base}${given}`)).toEqual(true)
8977
})
9078
})

src/pageLayout/utils/index.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@ export const getNavItemActivation = (
55
keywords: string[],
66
location: string
77
): boolean => {
8-
const ignoreOrgAndOrgID = 3
9-
const parentPath = location.split('/').slice(ignoreOrgAndOrgID)
10-
if (!parentPath.length) {
11-
parentPath.push(HOMEPAGE_PATHNAME)
8+
if (location.split('/').length <= 3) {
9+
location = HOMEPAGE_PATHNAME
1210
}
13-
return keywords.some(path => parentPath.includes(path))
11+
return keywords.some(path => location.includes(path))
1412
}

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -855,10 +855,10 @@
855855
"@docsearch/css" "3.0.0-alpha.37"
856856
algoliasearch "^4.0.0"
857857

858-
"@influxdata/clockface@^3.1.5":
859-
version "3.1.5"
860-
resolved "https://registry.yarnpkg.com/@influxdata/clockface/-/clockface-3.1.5.tgz#d3a073351f35905e8aa937d66189a702a4055521"
861-
integrity sha512-A2twQYz50XVU7zTVtkEGN5VghSdsyEbF1HbuiDt8ecyI1si7x2j853eHiMtZgeXCoDxAqkhp4ifys/3Vz2rJng==
858+
"@influxdata/clockface@^3.1.6":
859+
version "3.1.6"
860+
resolved "https://registry.yarnpkg.com/@influxdata/clockface/-/clockface-3.1.6.tgz#3e86dcf100816048a7282c835d42f70e2a642bff"
861+
integrity sha512-Rq8iwozupCFrsmAg5cTwF1EhS4Hog8yNoCE2p2EwICRlPef2RArN+rqDYj+k0tljUv8WUHaL0jvcV/Mf7s9UZA==
862862

863863
"@influxdata/flux-lsp-browser@^0.5.53":
864864
version "0.5.53"

0 commit comments

Comments
 (0)