File tree Expand file tree Collapse file tree 3 files changed +31
-7
lines changed
flows/pipes/RawFluxEditor Expand file tree Collapse file tree 3 files changed +31
-7
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ describe('DataExplorer', () => {
6060 cy . getByTestID ( 'flux--microsecond--inject' ) . click ( )
6161
6262 getTimeMachineText ( ) . then ( text => {
63- const expected = 'import "date" |> date.microsecond(t: )'
63+ const expected = 'import "date" date.microsecond(t: )'
6464 cy . fluxEqual ( text , expected ) . should ( 'be.true' )
6565 } )
6666 } )
Original file line number Diff line number Diff line change @@ -76,10 +76,17 @@ const Query: FC<PipeProp> = ({Context}) => {
7676 const injectIntoEditor = useCallback (
7777 ( fn ) : void => {
7878 let text = ''
79- if ( fn . name === 'from' || fn . name === 'union' ) {
80- text = `${ fn . example } `
79+ if ( CLOUD && isFlagEnabled ( 'fluxDynamicDocs' ) ) {
80+ // only fluxTypes with <- sign require a pipe forward sign
81+ text = fn . fluxType . startsWith ( '<-' , 1 )
82+ ? ` |> ${ fn . example } `
83+ : `${ fn . example } `
8184 } else {
82- text = ` |> ${ fn . example } `
85+ if ( fn . name === 'from' || fn . name === 'union' ) {
86+ text = `${ fn . example } `
87+ } else {
88+ text = ` |> ${ fn . example } `
89+ }
8390 }
8491
8592 const getHeader = fn => {
@@ -88,7 +95,11 @@ const Query: FC<PipeProp> = ({Context}) => {
8895 // universe packages are loaded by deafult. Don't need import statement
8996 if ( fn . package && fn . package !== 'universe' ) {
9097 importStatement = `import "${ fn . package } "`
91- if ( isFlagEnabled ( 'fluxDynamicDocs' ) && fn . path . includes ( '/' ) ) {
98+ if (
99+ CLOUD &&
100+ isFlagEnabled ( 'fluxDynamicDocs' ) &&
101+ fn . path . includes ( '/' )
102+ ) {
92103 importStatement = `import "${ fn . path } "`
93104 }
94105 }
Original file line number Diff line number Diff line change @@ -104,9 +104,22 @@ const TimeMachineFluxEditor: FC = () => {
104104
105105 let text = ''
106106 if ( shouldInsertOnNextLine ) {
107- text = `\n |> ${ func . example } `
107+ if ( CLOUD && isFlagEnabled ( 'fluxDynamicDocs' ) ) {
108+ // only fluxTypes with <- sign require a pipe forward sign
109+ text = func . fluxType . startsWith ( '<-' , 1 )
110+ ? `\n |> ${ func . example } `
111+ : `\n ${ func . example } `
112+ } else {
113+ text = `\n |> ${ func . example } `
114+ }
108115 } else {
109- text = ` |> ${ func . example } \n`
116+ if ( CLOUD && isFlagEnabled ( 'fluxDynamicDocs' ) ) {
117+ text = func . fluxType . startsWith ( '<-' , 1 )
118+ ? ` |> ${ func . example } \n`
119+ : ` ${ func . example } \n`
120+ } else {
121+ text = ` |> ${ func . example } \n`
122+ }
110123 }
111124
112125 if ( functionRequiresNewLine ( func . name ) ) {
You can’t perform that action at this time.
0 commit comments