Skip to content

Commit 3aaf26a

Browse files
authored
feat: insert tweaks (#3985)
1 parent 4945957 commit 3aaf26a

File tree

4 files changed

+81
-56
lines changed

4 files changed

+81
-56
lines changed

src/flows/components/PipeList.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Libraries
2-
import React, {FC, useContext} from 'react'
2+
import React, {FC, Fragment, useContext} from 'react'
33
import {useSelector} from 'react-redux'
44
import ReactGridLayout, {WidthProvider, Layout} from 'react-grid-layout'
55

@@ -133,9 +133,12 @@ const PipeList: FC = () => {
133133
)
134134
}
135135

136-
const _pipes = flow.data.allIDs.map(id => {
137-
return <FlowPipe key={`pipe-${id}`} id={id} />
138-
})
136+
const _pipes = flow.data.allIDs.map(id => (
137+
<Fragment key={`pipe-${id}`}>
138+
<FlowPipe id={id} />
139+
<InsertCellButton id={id} />
140+
</Fragment>
141+
))
139142

140143
return (
141144
<div className="flow" id={flow?.id}>

src/flows/components/panel/FlowPanel.tsx

Lines changed: 48 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import {
1717

1818
// Components
1919
import Handle from 'src/flows/components/panel/Handle'
20-
import InsertCellButton from 'src/flows/components/panel/InsertCellButton'
2120
import FlowPanelTitle from 'src/flows/components/panel/FlowPanelTitle'
2221
import {MenuButton} from 'src/flows/components/Sidebar'
2322

@@ -155,61 +154,58 @@ const FlowPanel: FC<Props> = ({
155154
}
156155

157156
return (
158-
<>
159-
<div className={panelClassName} id={id}>
160-
<div className="flow-panel--header">
161-
<div className="flow-panel--node-wrapper">
162-
<div className="flow-panel--node" />
163-
</div>
164-
{title}
165-
{!flow.readOnly && (
166-
<>
167-
<div className="flow-panel--hover-control">{controls}</div>
168-
<div className="flow-panel--persistent-control">
169-
{persistentControls}
170-
<FeatureFlag name="flow-debug-queries">
171-
<SquareButton
172-
icon={IconFont.BookCode}
173-
onClick={() => printMap(id)}
174-
color={ComponentColor.Default}
175-
titleText="Debug Notebook Queries"
176-
className="flows-config-panel-button"
177-
/>
178-
</FeatureFlag>
179-
{isVisible && showPreviewButton && (
180-
<Button
181-
onClick={() => queryDependents(id)}
182-
icon={IconFont.Play}
183-
text="Run"
184-
/>
185-
)}
186-
<MenuButton id={id} />
187-
</div>
188-
</>
189-
)}
157+
<div className={panelClassName} id={id}>
158+
<div className="flow-panel--header">
159+
<div className="flow-panel--node-wrapper">
160+
<div className="flow-panel--node" />
190161
</div>
191-
{isVisible && (
192-
<div
193-
className="flow-panel--body"
194-
ref={bodyRef}
195-
style={resizes ? {height: `${size}px`} : {}}
196-
>
197-
{children}
198-
</div>
162+
{title}
163+
{!flow.readOnly && (
164+
<>
165+
<div className="flow-panel--hover-control">{controls}</div>
166+
<div className="flow-panel--persistent-control">
167+
{persistentControls}
168+
<FeatureFlag name="flow-debug-queries">
169+
<SquareButton
170+
icon={IconFont.BookCode}
171+
onClick={() => printMap(id)}
172+
color={ComponentColor.Default}
173+
titleText="Debug Notebook Queries"
174+
className="flows-config-panel-button"
175+
/>
176+
</FeatureFlag>
177+
{isVisible && showPreviewButton && (
178+
<Button
179+
onClick={() => queryDependents(id)}
180+
icon={IconFont.Play}
181+
text="Run"
182+
/>
183+
)}
184+
<MenuButton id={id} />
185+
</div>
186+
</>
199187
)}
200-
<div className="flow-panel--footer">
201-
<div></div>
202-
{isVisible && resizes && (
203-
<Handle
204-
dragRef={handleRef}
205-
onStartDrag={handleMouseDown}
206-
dragging={isDragging === 2}
207-
/>
208-
)}
188+
</div>
189+
{isVisible && (
190+
<div
191+
className="flow-panel--body"
192+
ref={bodyRef}
193+
style={resizes ? {height: `${size}px`} : {}}
194+
>
195+
{children}
209196
</div>
197+
)}
198+
<div className="flow-panel--footer">
199+
<div></div>
200+
{isVisible && resizes && (
201+
<Handle
202+
dragRef={handleRef}
203+
onStartDrag={handleMouseDown}
204+
dragging={isDragging === 2}
205+
/>
206+
)}
210207
</div>
211-
{!flow.readOnly && <InsertCellButton id={id} />}
212-
</>
208+
</div>
213209
)
214210
}
215211

src/flows/components/panel/InsertCellButton.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
@import '@influxdata/clockface/dist/variables.scss';
22
@import '~src/flows/FlowVariables.scss';
33

4+
$cf-radius-lg: $cf-radius + 4px;
5+
46
.flow-divider {
57
position: relative;
68
width: 100%;
@@ -110,6 +112,12 @@
110112
flex-direction: column;
111113
align-items: center;
112114
font-size: 14px;
115+
116+
&.always-on {
117+
margin: 32px auto 60px;
118+
border-radius: $cf-radius-lg;
119+
background-color: $flow-panel--bg;
120+
}
113121
}
114122

115123
.insert-cell-menu--title {

src/flows/components/panel/InsertCellButton.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {FlowContext} from 'src/flows/context/flow.current'
1919

2020
// Utils
2121
import {event} from 'src/cloud/utils/reporting'
22+
import {isFlagEnabled} from 'src/shared/utils/featureFlag'
2223

2324
// Styles
2425
import 'src/flows/components/panel/InsertCellButton.scss'
@@ -51,6 +52,23 @@ const InsertCellButton: FC<Props> = ({id}) => {
5152
dividerRef.current.classList.remove('flow-divider__popped')
5253
}
5354

55+
if (
56+
isFlagEnabled('showLastInsert') &&
57+
index === flow.data.allIDs.length - 1
58+
) {
59+
return (
60+
<FlexBox
61+
direction={FlexDirection.Column}
62+
alignItems={AlignItems.Stretch}
63+
margin={ComponentSize.Small}
64+
className="insert-cell-menu always-on"
65+
>
66+
<p className="insert-cell-menu--title">Add Another Cell</p>
67+
<AddButtons index={index} />
68+
</FlexBox>
69+
)
70+
}
71+
5472
return (
5573
<div className="flow-divider" ref={dividerRef}>
5674
<SquareButton

0 commit comments

Comments
 (0)