+
+ key={selectKey} // Force re-render when data changes
+ className="min-w-[300px]"
+ triggerClassName="max-h-8 w-full overflow-hidden"
+ searchInputClassName="max-h-8"
+ triggerTooltip={t('graphPanel.graphLabels.selectTooltip')}
+ fetcher={fetchData}
+ renderOption={(item) => (
+
+ {item}
+
+ )}
+ getOptionValue={(item) => item}
+ getDisplayValue={(item) => (
+
+ {item}
+
+ )}
+ notFound={{t('graphPanel.graphLabels.noLabels')}
}
+ ariaLabel={t('graphPanel.graphLabels.label')}
+ placeholder={t('graphPanel.graphLabels.placeholder')}
+ searchPlaceholder={t('graphPanel.graphLabels.placeholder')}
+ noResultsMessage={t('graphPanel.graphLabels.noLabels')}
+ value={label !== null ? label : '*'}
+ onChange={(newLabel) => {
+ const currentLabel = useSettingsStore.getState().queryLabel;
- // select the last item means query all
- if (newLabel === '...') {
- newLabel = '*';
- }
+ // select the last item means query all
+ if (newLabel === '...') {
+ newLabel = '*';
+ }
- // Handle reselecting the same label
- if (newLabel === currentLabel && newLabel !== '*') {
- newLabel = '*';
- }
+ // Handle reselecting the same label
+ if (newLabel === currentLabel && newLabel !== '*') {
+ newLabel = '*';
+ }
- // Add selected label to search history (except for special cases)
- if (newLabel && newLabel !== '*' && newLabel !== '...' && newLabel.trim() !== '') {
- SearchHistoryManager.addToHistory(newLabel);
- }
+ // Add selected label to search history (except for special cases)
+ if (newLabel && newLabel !== '*' && newLabel !== '...' && newLabel.trim() !== '') {
+ SearchHistoryManager.addToHistory(newLabel);
+ }
- // Reset graphDataFetchAttempted flag to ensure data fetch is triggered
- useGraphStore.getState().setGraphDataFetchAttempted(false);
+ // Reset graphDataFetchAttempted flag to ensure data fetch is triggered
+ useGraphStore.getState().setGraphDataFetchAttempted(false);
- // Update the label to trigger data loading
- useSettingsStore.getState().setQueryLabel(newLabel);
- }}
- clearable={false} // Prevent clearing value on reselect
- debounceTime={500}
- />
+ // Update the label to trigger data loading
+ useSettingsStore.getState().setQueryLabel(newLabel);
+ }}
+ clearable={false} // Prevent clearing value on reselect
+ debounceTime={500}
+ />
+
)
}