Skip to content

Commit 779840b

Browse files
committed
Cleanup pass
1 parent 5e2ec69 commit 779840b

6 files changed

Lines changed: 17 additions & 30 deletions

File tree

frontend/src/components/constants.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,9 @@ export const isCloudManagedTagKey = (key: string): boolean =>
3737

3838
/** Returns true if the tag key is a system tag that should be hidden from users. */
3939
export const isSystemTag = (key: string): boolean => key.startsWith('__') || isCloudManagedTagKey(key);
40+
41+
/** User-visible tags (system tags filtered out) as `{ key, value }` entries. */
42+
export const getUserTagEntries = (tags: Record<string, string>): { key: string; value: string }[] =>
43+
Object.entries(tags)
44+
.filter(([k]) => !isSystemTag(k))
45+
.map(([key, value]) => ({ key, value }));

frontend/src/components/pages/rp-connect/pipeline/config-dialog.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,7 @@ export function ConfigDialog({ open, onOpenChange, form, mode }: ConfigDialogPro
226226
<Dialog onOpenChange={onOpenChange} open={open}>
227227
<DialogContent size="lg">
228228
<DialogHeader>
229-
<DialogTitle>
230-
{mode === 'create' ? 'Pipeline settings' : mode === 'view' ? 'Pipeline settings' : 'Edit pipeline settings'}
231-
</DialogTitle>
229+
<DialogTitle>{mode === 'edit' ? 'Edit pipeline settings' : 'Pipeline settings'}</DialogTitle>
232230
</DialogHeader>
233231
<DialogBody>
234232
<Form {...form}>

frontend/src/components/pages/rp-connect/pipeline/index.tsx

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { create } from '@bufbuild/protobuf';
1414
import { ConnectError } from '@connectrpc/connect';
1515
import { zodResolver } from '@hookform/resolvers/zod';
1616
import { useBlocker, useNavigate, useRouter, useSearch } from '@tanstack/react-router';
17-
import { isSystemTag } from 'components/constants';
17+
import { getUserTagEntries, isSystemTag } from 'components/constants';
1818
import { Alert, AlertDescription, AlertTitle } from 'components/redpanda-ui/components/alert';
1919
import { Badge } from 'components/redpanda-ui/components/badge';
2020
import { Banner, BannerClose, BannerContent } from 'components/redpanda-ui/components/banner';
@@ -477,9 +477,7 @@ function EditorSkeleton() {
477477
);
478478
}
479479

480-
// One row in the summary's definition list: an aligned label column and a value
481-
// column that fills the remaining width. Caller renders <InfoRow>s into a
482-
// `grid grid-cols-[max-content_minmax(0,1fr)]` <dl>.
480+
// One row in the summary's definition-list grid: aligned label column + value column.
483481
const InfoRow = ({ label, children }: { label: string; children: ReactNode }) => (
484482
<>
485483
<dt className="font-medium text-muted-foreground text-sm">{label}</dt>
@@ -520,9 +518,7 @@ const TagBadges = ({ tags }: { tags: { key: string; value: string }[] }) =>
520518
const PipelineSummary = ({ pipeline }: { pipeline: Pipeline }) => {
521519
const tasks = cpuToTasks(pipeline.resources?.cpuShares) ?? 0;
522520
const description = pipeline.description?.trim();
523-
const tags = Object.entries(pipeline.tags)
524-
.filter(([k]) => !isSystemTag(k))
525-
.map(([key, value]) => ({ key, value }));
521+
const tags = getUserTagEntries(pipeline.tags);
526522
return (
527523
<div className="flex flex-col gap-4 rounded-lg border px-5 py-4">
528524
<div className="flex items-center justify-between gap-4">
@@ -969,9 +965,7 @@ export default function PipelinePage() {
969965
name: pipeline.displayName,
970966
description: pipeline.description || '',
971967
computeUnits: cpuToTasks(pipeline.resources?.cpuShares) || MIN_TASKS,
972-
tags: Object.entries(pipeline.tags)
973-
.filter(([k]) => !isSystemTag(k))
974-
.map(([key, value]) => ({ key, value })),
968+
tags: getUserTagEntries(pipeline.tags),
975969
});
976970
}
977971
}, [pipeline, mode, form]);

frontend/src/components/pages/rp-connect/pipeline/list.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {
2323
useReactTable,
2424
} from '@tanstack/react-table';
2525
import type { ComponentName } from 'assets/connectors/component-logo-map';
26-
import { isSystemTag } from 'components/constants';
26+
import { getUserTagEntries } from 'components/constants';
2727
import { Badge } from 'components/redpanda-ui/components/badge';
2828
import { BadgeGroup } from 'components/redpanda-ui/components/badge-group';
2929
import { Button } from 'components/redpanda-ui/components/button';
@@ -88,9 +88,7 @@ type Pipeline = {
8888

8989
const transformAPIPipeline = (apiPipeline: APIPipeline): Pipeline => {
9090
const { inputs, processors, outputs } = parseConfigComponents(apiPipeline.configYaml);
91-
const tags = Object.entries(apiPipeline.tags)
92-
.filter(([k]) => !isSystemTag(k))
93-
.map(([key, value]) => ({ key, value }));
91+
const tags = getUserTagEntries(apiPipeline.tags);
9492
return {
9593
id: apiPipeline.id,
9694
name: apiPipeline.displayName,

frontend/src/components/pages/rp-connect/pipeline/toolbar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ type ButtonConfigFactoryParams = {
8181
isStopPending: boolean;
8282
};
8383

84-
export function pipelineStateToVariant(state?: Pipeline_State): { variant: StatusBadgeVariant; pulsing: boolean } {
84+
function pipelineStateToVariant(state?: Pipeline_State): { variant: StatusBadgeVariant; pulsing: boolean } {
8585
switch (state) {
8686
case PipelineState.RUNNING:
8787
return { variant: 'success', pulsing: true };

frontend/src/components/ui/secret/quick-add-secrets.tsx

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import type { ConnectError } from '@connectrpc/connect';
1616
import { zodResolver } from '@hookform/resolvers/zod';
1717
import { Alert, AlertDescription, AlertTitle } from 'components/redpanda-ui/components/alert';
1818
import { Button } from 'components/redpanda-ui/components/button';
19-
import { Card, CardContent, CardHeader, CardTitle, CardVariant } from 'components/redpanda-ui/components/card';
19+
import { Card, CardContent, CardHeader, CardTitle } from 'components/redpanda-ui/components/card';
2020
import { Field, FieldDescription, FieldError, FieldLabel } from 'components/redpanda-ui/components/field';
2121
import { Input } from 'components/redpanda-ui/components/input';
2222
import { Text } from 'components/redpanda-ui/components/typography';
@@ -40,12 +40,10 @@ type QuickAddSecretsProps = {
4040
requiredSecrets: string[];
4141
existingSecrets: string[];
4242
scopes: Scope[];
43-
defaultValues?: Record<string, string>;
4443
onSecretsCreated?: (secretNames: string[]) => void;
4544
enableNewSecrets?: boolean;
4645
onError?: (errors: string[]) => void;
4746
onUpdateEditorContent?: (oldName: string, newName: string) => void;
48-
cardVariant?: CardVariant;
4947
// Seeds the editable "Secret name" input; the user can still override it.
5048
defaultNewSecretName?: string;
5149
// Renders the form(s) bare (no Card chrome) for use inside a host surface.
@@ -80,12 +78,10 @@ export const QuickAddSecrets: React.FC<QuickAddSecretsProps> = ({
8078
requiredSecrets,
8179
existingSecrets,
8280
scopes,
83-
defaultValues = {},
8481
onSecretsCreated,
8582
enableNewSecrets = false,
8683
onError,
8784
onUpdateEditorContent,
88-
cardVariant = 'elevated',
8985
defaultNewSecretName,
9086
inline = false,
9187
}) => {
@@ -129,12 +125,7 @@ export const QuickAddSecrets: React.FC<QuickAddSecretsProps> = ({
129125

130126
const form = useForm<SecretFormData>({
131127
resolver: zodResolver(SecretFormSchema),
132-
defaultValues: Object.fromEntries(
133-
missingSecrets.map((normalizedName) => {
134-
const originalName = missingSecretsMap.get(normalizedName) || normalizedName;
135-
return [normalizedName, { value: defaultValues[originalName] || defaultValues[normalizedName] || '' }];
136-
})
137-
),
128+
defaultValues: Object.fromEntries(missingSecrets.map((normalizedName) => [normalizedName, { value: '' }])),
138129
});
139130

140131
const newSecretForm = useForm<NewSecretFormData>({
@@ -416,7 +407,7 @@ export const QuickAddSecrets: React.FC<QuickAddSecretsProps> = ({
416407
(inline ? (
417408
<div className="space-y-4">{requiredSecretsForm}</div>
418409
) : (
419-
<Card size="full" variant={cardVariant}>
410+
<Card size="full" variant="elevated">
420411
<CardHeader>
421412
<CardTitle className="flex items-center gap-2">
422413
<Key className="h-4 w-4" />

0 commit comments

Comments
 (0)