@@ -67,13 +67,19 @@ export class NavbarComponent extends Component<
6767 if ( props . isReadOnly ) {
6868 return ;
6969 }
70+
7071 this . template = createTemplate (
7172 `<div class="inline-flex items-center content-center">
7273 <button class="${ navBarPrimaryIconButton } "><span class="${ navBarIconButtonInnerElement } icon-add"></span></button>
7374 <button class="${ navBarIconButton } "><span class="${ navBarIconButtonInnerElement } icon-fit_screen"></span></button>
7475 <button class="${ navBarIconButton } "><span class="${ navBarIconButtonInnerElement } icon-delete"></span></button>
7576 <div></div>
76- <button class="${ navBarButton } ">Import</button><select type="select" name="example-flows" class="p-2 m-2 relative max-w-[220px]">
77+ <button class="${ navBarButton } ">Import</button>
78+ ${
79+ props . hideFlowPresets
80+ ? ''
81+ : `
82+ <select type="select" name="example-flows" class="p-2 m-2 relative max-w-[220px]">
7783 <option value="">Select example flow</option>
7884 <option value="counter-flow.json">Counter</option>
7985 <option value="basic-condition.json">Basic condition</option>
@@ -89,7 +95,8 @@ export class NavbarComponent extends Component<
8995 <option value="kmeans.json">K-Means clustering</option>
9096 <option value="kmeans-csv-file.json">K-Means clustering of a CSV file</option>
9197 <option value="openai-chat.json">Open AI Chat Completion API</option>
92- </select>
98+ </select>`
99+ }
93100 <children></children>
94101 </div>`
95102 ) ;
@@ -113,8 +120,10 @@ export class NavbarComponent extends Component<
113120 this . deleteButton = this . centerButton ?. nextSibling as HTMLButtonElement ;
114121 this . exportButton = this . deleteButton ?. nextSibling as HTMLButtonElement ;
115122 this . importButton = this . exportButton ?. nextSibling as HTMLButtonElement ;
116- this . selectExampleFlow = this . importButton
117- ?. nextSibling as HTMLSelectElement ;
123+ if ( ! this . props . hideFlowPresets ) {
124+ this . selectExampleFlow = this . importButton
125+ ?. nextSibling as HTMLSelectElement ;
126+ }
118127 // this.importScriptButton = this.importButton
119128 // ?.nextSibling as HTMLButtonElement;
120129
@@ -123,7 +132,7 @@ export class NavbarComponent extends Component<
123132 this . deleteButton . addEventListener ( 'click' , this . onClickDelete ) ;
124133 //this.exportButton.addEventListener('click', this.onClickExport);
125134 this . importButton . addEventListener ( 'click' , this . onClickImport ) ;
126- this . selectExampleFlow . addEventListener (
135+ this . selectExampleFlow ? .addEventListener (
127136 'change' ,
128137 this . onClickImportExample
129138 ) ;
@@ -159,9 +168,11 @@ export class NavbarComponent extends Component<
159168 this . centerButton ,
160169 this . deleteButton ,
161170 this . exportButton ,
162- this . importButton ,
163- this . selectExampleFlow
171+ this . importButton
164172 ) ;
173+ if ( this . selectExampleFlow ) {
174+ this . renderList . push ( this . selectExampleFlow ) ;
175+ }
165176 // this.childRoot = this.element.firstChild as HTMLElement;
166177 // this.renderList.push(this.childRoot);
167178 this . rootElement . append ( this . element ) ;
@@ -617,5 +628,6 @@ export const NavbarComponents = (props: AppNavComponentsProps<NodeInfo>) => {
617628 showPopup : props . showPopup ,
618629 executeCommand : props . executeCommand ,
619630 isReadOnly : props . isReadOnly ,
631+ hideFlowPresets : props . hideFlowPresets ,
620632 } ) ;
621633} ;
0 commit comments