File tree Expand file tree Collapse file tree 8 files changed +59
-9
lines changed Expand file tree Collapse file tree 8 files changed +59
-9
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import {
2323 PersistanceContext ,
2424 DEFAULT_FLUX_EDITOR_TEXT ,
2525 DEFAULT_SQL_EDITOR_TEXT ,
26+ DEFAULT_INFLUXQL_EDITOR_TEXT ,
2627} from 'src/dataExplorer/context/persistance'
2728
2829// Components
@@ -59,8 +60,15 @@ const FluxMonacoEditor = lazy(
5960
6061const fakeNotify = notify
6162
62- const isDefaultText = text => {
63- return text == DEFAULT_FLUX_EDITOR_TEXT || text == DEFAULT_SQL_EDITOR_TEXT
63+ const isDefaultText = ( text : string ) => {
64+ return (
65+ [
66+ DEFAULT_FLUX_EDITOR_TEXT ,
67+ DEFAULT_SQL_EDITOR_TEXT ,
68+ DEFAULT_INFLUXQL_EDITOR_TEXT ,
69+ ] . filter ( ( defaultEditorText : string ) => text === defaultEditorText ) . length >
70+ 0
71+ )
6472}
6573
6674const ResultsPane : FC = ( ) => {
Original file line number Diff line number Diff line change @@ -51,8 +51,15 @@ const SchemaBrowserHeading: FC = () => {
5151 return null
5252 }
5353
54- const label =
55- resource ?. language === LanguageType . SQL ? 'SQL Sync' : 'Flux Sync'
54+ let label : string = 'Flux Sync'
55+ switch ( resource ?. language ) {
56+ case LanguageType . SQL :
57+ label = 'SQL Sync'
58+ break
59+ case LanguageType . INFLUXQL :
60+ label = 'InfluxQL Sync'
61+ break
62+ }
5663
5764 return (
5865 < FlexBox
Original file line number Diff line number Diff line change @@ -160,6 +160,21 @@ const ScriptQueryBuilder: FC = () => {
160160 { option }
161161 </ Dropdown . Item >
162162 ) ) }
163+ { isFlagEnabled ( 'influxqlUI' ) ? (
164+ < Dropdown . Item
165+ className = { `script-dropdown__${ LanguageType . INFLUXQL } ` }
166+ key = { LanguageType . INFLUXQL }
167+ onClick = { ( ) =>
168+ handleSelectDropdown ( LanguageType . INFLUXQL )
169+ }
170+ selected = {
171+ resource ?. language === LanguageType . INFLUXQL
172+ }
173+ testID = { `script-dropdown__${ LanguageType . INFLUXQL } ` }
174+ >
175+ { LanguageType . INFLUXQL }
176+ </ Dropdown . Item >
177+ ) : null }
163178 </ Dropdown . Menu >
164179 ) }
165180 button = { ( active , onClick ) => (
Original file line number Diff line number Diff line change @@ -114,13 +114,18 @@ const Sidebar: FC = () => {
114114 </ FlexBox . Child >
115115 )
116116
117+ const shouldNotShowSidebar =
118+ [ LanguageType . SQL , LanguageType . INFLUXQL ] . filter (
119+ ( language : LanguageType ) => resource ?. language === language
120+ ) . length > 0
121+
117122 return (
118123 < FlexBox
119124 direction = { FlexDirection . Column }
120125 justifyContent = { JustifyContent . FlexStart }
121126 className = "container-right-side-bar"
122127 >
123- { isIoxOrg && resource ?. language === LanguageType . SQL ? null : (
128+ { isIoxOrg && shouldNotShowSidebar ? null : (
124129 < >
125130 { resultOptions }
126131 { fluxLibrary }
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import {
1313 PersistanceProvider ,
1414 DEFAULT_FLUX_EDITOR_TEXT ,
1515 DEFAULT_SQL_EDITOR_TEXT ,
16+ DEFAULT_INFLUXQL_EDITOR_TEXT ,
1617} from 'src/dataExplorer/context/persistance'
1718import { LanguageType } from 'src/dataExplorer/components/resources'
1819import { getLanguage } from 'src/dataExplorer/shared/utils'
@@ -42,8 +43,13 @@ const Template: FC = () => {
4243 const language = getLanguage ( )
4344 let flux = DEFAULT_FLUX_EDITOR_TEXT
4445
45- if ( language === LanguageType . SQL ) {
46- flux = DEFAULT_SQL_EDITOR_TEXT
46+ switch ( language ) {
47+ case LanguageType . SQL :
48+ flux = DEFAULT_SQL_EDITOR_TEXT
49+ break
50+ case LanguageType . INFLUXQL :
51+ flux = DEFAULT_INFLUXQL_EDITOR_TEXT
52+ break
4753 }
4854
4955 setLoading ( RemoteDataState . Loading )
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ export const SCRIPT_EDITOR_PARAMS = '?fluxScriptEditor'
77export enum LanguageType {
88 FLUX = 'flux' ,
99 SQL = 'sql' ,
10+ INFLUXQL = 'influxql' ,
1011}
1112export interface ResourceConnectedQuery < T > {
1213 type : ResourceType
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import {CLOUD} from 'src/shared/constants'
44import {
55 DEFAULT_FLUX_EDITOR_TEXT ,
66 DEFAULT_SQL_EDITOR_TEXT ,
7+ DEFAULT_INFLUXQL_EDITOR_TEXT ,
78} from 'src/dataExplorer/context/persistance'
89import { LanguageType } from 'src/dataExplorer/components/resources'
910import { getLanguage } from 'src/dataExplorer/shared/utils'
@@ -25,8 +26,13 @@ export const scriptResourceRegistration = () => {
2526 const language = getLanguage ( )
2627 let flux = DEFAULT_FLUX_EDITOR_TEXT
2728
28- if ( language === LanguageType . SQL ) {
29- flux = DEFAULT_SQL_EDITOR_TEXT
29+ switch ( language ) {
30+ case LanguageType . SQL :
31+ flux = DEFAULT_SQL_EDITOR_TEXT
32+ break
33+ case LanguageType . INFLUXQL :
34+ flux = DEFAULT_INFLUXQL_EDITOR_TEXT
35+ break
3036 }
3137
3238 return Promise . resolve ( {
Original file line number Diff line number Diff line change @@ -110,6 +110,8 @@ export const DEFAULT_SELECTION: CompositionSelection = {
110110export const DEFAULT_FLUX_EDITOR_TEXT =
111111 '// Start by selecting data from the schema browser or typing flux here'
112112export const DEFAULT_SQL_EDITOR_TEXT = '/* Start by typing SQL here */'
113+ export const DEFAULT_INFLUXQL_EDITOR_TEXT =
114+ '/* Start by typing InfluxQL here */'
113115
114116const DEFAULT_CONTEXT = {
115117 hasChanged : false ,
You can’t perform that action at this time.
0 commit comments