Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Init discover resources inside the discover component #39166

Merged
merged 1 commit into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,21 @@ import {
ResourceKind,
} from 'teleport/Discover/Shared';
import {
BASE_RESOURCES,
getResourcePretitle,
RESOURCES,
} from 'teleport/Discover/SelectResource/resources';
import AddApp from 'teleport/Apps/AddApp';
import { useUser } from 'teleport/User/UserContext';
import { storageService } from 'teleport/services/storageService';
import cfg from 'teleport/config';

import { resourceKindToPreferredResource } from 'teleport/Discover/Shared/ResourceKind';

import { getMarketingTermMatches } from './getMarketingTermMatches';
import { DiscoverIcon } from './icons';

import { PrioritizedResources, SearchResource } from './types';
import { SAML_APPLICATIONS } from './resourcesE';

import type { ResourceSpec } from './types';

Expand All @@ -73,6 +75,9 @@ export function SelectResource({ onSelect }: SelectResourceProps) {
const [resources, setResources] = useState<ResourceSpec[]>([]);
const [defaultResources, setDefaultResources] = useState<ResourceSpec[]>([]);
const [showApp, setShowApp] = useState(false);
const RESOURCES = !cfg.isEnterprise
? BASE_RESOURCES
: [...BASE_RESOURCES, ...SAML_APPLICATIONS];

function onSearch(s: string, customList?: ResourceSpec[]) {
const list = customList || defaultResources;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { Platform } from 'design/platform';
import { assertUnreachable } from 'shared/utils/assertUnreachable';

import { DiscoverEventResource } from 'teleport/services/userEvent';
import cfg from 'teleport/config';

import { ResourceKind } from '../Shared/ResourceKind';

Expand All @@ -37,7 +36,6 @@ import {
ResourceSpec,
ServerLocation,
} from './types';
import { SAML_APPLICATIONS } from './resourcesE';

const baseServerKeywords = 'server node';
const awsKeywords = 'aws amazon ';
Expand Down Expand Up @@ -151,7 +149,7 @@ export const KUBERNETES: ResourceSpec[] = [
},
];

const BASE_RESOURCES: ResourceSpec[] = [
export const BASE_RESOURCES: ResourceSpec[] = [
...APPLICATIONS,
...KUBERNETES,
...WINDOWS_DESKTOPS,
Expand All @@ -161,10 +159,6 @@ const BASE_RESOURCES: ResourceSpec[] = [
...DATABASES_UNGUIDED_DOC,
];

export const RESOURCES = !cfg.isEnterprise
? BASE_RESOURCES
: [...BASE_RESOURCES, ...SAML_APPLICATIONS];

export function getResourcePretitle(r: ResourceSpec) {
if (!r) {
return {};
Expand Down
Loading