search by name fix | new colors from hsl | only kinds with list verb in search

This commit is contained in:
typescreep
2025-09-28 19:29:43 +03:00
parent adae7e6767
commit c66ff4a398
5 changed files with 22 additions and 45 deletions

View File

@@ -35,7 +35,6 @@ type TTableApiBuiltinProps = {
apiGroup?: string // api
apiVersion?: string // api
typeName: string
specificName?: string
labels?: string[]
fields?: string[]
limit: string | null
@@ -51,7 +50,6 @@ export const TableApiBuiltin: FC<TTableApiBuiltinProps> = ({
apiGroup,
apiVersion,
typeName,
specificName,
labels,
fields,
limit,
@@ -159,7 +157,6 @@ export const TableApiBuiltin: FC<TTableApiBuiltinProps> = ({
clusterName: cluster,
namespace,
typeName,
specificName,
labels,
fields,
limit,
@@ -176,7 +173,6 @@ export const TableApiBuiltin: FC<TTableApiBuiltinProps> = ({
apiGroup: apiGroup || '',
apiVersion: apiVersion || '',
typeName,
specificName,
labels,
fields,
limit,
@@ -239,7 +235,7 @@ export const TableApiBuiltin: FC<TTableApiBuiltinProps> = ({
cluster={cluster}
theme={theme}
baseprefix={inside ? `${baseprefix}/inside` : baseprefix}
dataItems={getDataItems({ resourceType, dataBuiltin, dataApi, isSingle: !!specificName })}
dataItems={getDataItems({ resourceType, dataBuiltin, dataApi })}
dataForControls={{
cluster,
syntheticProject: params.syntheticProject,

View File

@@ -4,22 +4,11 @@ export const getDataItems = ({
resourceType,
dataBuiltin,
dataApi,
isSingle,
}: {
resourceType: 'builtin' | 'api'
dataBuiltin?: TBuiltinResources
dataApi?: TApiResources
isSingle?: boolean
}): TJSON[] => {
if (isSingle) {
if (resourceType === 'builtin') {
return dataBuiltin ? [dataBuiltin] : []
}
if (resourceType === 'api') {
return dataApi ? [dataApi] : []
}
}
return resourceType === 'builtin' ? dataBuiltin?.items || [] : dataApi?.items || []
}

View File

@@ -240,22 +240,24 @@ export const Search: FC = () => {
},
}}
>
{watchedKinds?.map(item => (
<Fragment key={item}>
<Spacer $space={20} $samespace />
<SearchEntry
kindsWithVersion={kindsWithVersion}
form={form}
constants={{
FIELD_NAME,
}}
resource={item}
name={watchedName}
labels={watchedLabels}
fields={watchedFields}
/>
</Fragment>
))}
{watchedKinds?.map(item => {
const fields = [...(watchedFields || []), ...(watchedName ? [`metadata.name=${watchedName}`] : [])]
return (
<Fragment key={item}>
<Spacer $space={20} $samespace />
<SearchEntry
kindsWithVersion={kindsWithVersion}
form={form}
constants={{
FIELD_NAME,
}}
resource={item}
labels={watchedLabels}
fields={fields.length ? fields : undefined}
/>
</Fragment>
)
})}
</ConfigProvider>
<Spacer $space={20} $samespace />
</Styled.OverflowContainer>

View File

@@ -19,7 +19,6 @@ import { Styled } from './styled'
type TSearchEntryProps = {
resource: string
name?: string
labels?: string[]
fields?: string[]
form: FormInstance
@@ -29,15 +28,7 @@ type TSearchEntryProps = {
kindsWithVersion: TKindWithVersion[]
}
export const SearchEntry: FC<TSearchEntryProps> = ({
resource,
name,
labels,
fields,
form,
constants,
kindsWithVersion,
}) => {
export const SearchEntry: FC<TSearchEntryProps> = ({ resource, labels, fields, form, constants, kindsWithVersion }) => {
const { namespace, syntheticProject } = useParams()
const [searchParams] = useSearchParams()
const { token } = antdtheme.useToken()
@@ -96,7 +87,6 @@ export const SearchEntry: FC<TSearchEntryProps> = ({
apiGroup={apiGroup.length > 0 ? apiGroup : undefined}
apiVersion={apiGroup.length > 0 ? apiVersion : undefined}
typeName={typeName}
specificName={name?.length ? name : undefined}
labels={labels?.length ? labels : undefined}
fields={fields?.length ? fields : undefined}
limit={searchParams.get('limit')}

View File

@@ -16,11 +16,11 @@ export const SearchPage: FC<TSearchPageProps> = ({ forcedTheme }) => {
const possibleProject = syntheticProject && namespace ? syntheticProject : namespace
const possibleInstance = syntheticProject && namespace ? namespace : undefined
const sidebarId = `${getSidebarIdPrefix({ instance: !!syntheticProject, project: !!namespace })}seach-page`
const sidebarId = `${getSidebarIdPrefix({ instance: !!syntheticProject, project: !!namespace })}search-page`
const breadcrumbsId = `${getBreadcrumbsIdPrefix({
instance: !!syntheticProject,
project: !!namespace,
})}seach-page`
})}search-page`
return (
<BaseTemplate