Skip to content

Commit 6072631

Browse files
committed
frontend: Integrate Activity launch for search results in GlobalSearchContent
1 parent 25b0232 commit 6072631

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

frontend/src/components/globalSearch/GlobalSearchContent.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,12 @@ import StatefulSet from '../../lib/k8s/statefulSet';
4949
import { createRouteURL, getDefaultRoutes } from '../../lib/router';
5050
import { getClusterPrefixedPath } from '../../lib/util';
5151
import { useTypedSelector } from '../../redux/hooks';
52+
import { Activity } from '../activity/Activity';
5253
import { ADVANCED_SEARCH_QUERY_KEY } from '../advancedSearch/AdvancedSearch';
5354
import { ThemePreview } from '../App/Settings/ThemePreview';
5455
import { setTheme, useAppThemes } from '../App/themeSlice';
56+
import { KubeObjectDetails } from '../resourceMap/details/KubeNodeDetails';
57+
import { KubeIcon } from '../resourceMap/kubeIcon/KubeIcon';
5558
import { Delayed } from './Delayed';
5659
import { useLocalStorageState } from './useLocalStorageState';
5760
import { useRecent } from './useRecent';
@@ -158,6 +161,7 @@ export function GlobalSearchContent({
158161
const [query, setQuery] = useState(defaultValue ?? '');
159162
const clusters = useClustersConf() ?? {};
160163
const selectedClusters = useSelectedClusters();
164+
const drawerEnabled = useTypedSelector(state => state.drawerMode.isDetailDrawerEnabled);
161165

162166
const [recent, bump] = useRecent('search-recent-items');
163167

@@ -177,7 +181,18 @@ export function GlobalSearchContent({
177181
name: item.metadata.name,
178182
namespace: item.metadata.namespace,
179183
});
180-
history.push(url);
184+
185+
if (drawerEnabled) {
186+
Activity.launch({
187+
id: item.metadata.uid,
188+
content: <KubeObjectDetails resource={item} />,
189+
location: 'split-right',
190+
title: item.kind + ': ' + item.metadata.name,
191+
icon: <KubeIcon kind={item.kind} width="100%" height="100%" />,
192+
});
193+
} else {
194+
history.push(url);
195+
}
181196
}),
182197
[resources, isMap, location.search]
183198
);

0 commit comments

Comments
 (0)