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

PeerDB: For queues, move sync interval to advanced, default 10 mins #1672

Merged
merged 6 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
44 changes: 32 additions & 12 deletions ui/app/mirrors/create/cdc/cdc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,32 @@ export default function CDCConfigForm({
};

const normalSettings = useMemo(() => {
return settings.filter((setting) => setting.advanced != true);
}, [settings]);
return settings!.filter(
(setting) =>
!(
(IsQueuePeer(mirrorConfig.destination?.type) &&
setting.advanced === 'queue') ||
setting.advanced === true
)
);
}, [settings, mirrorConfig.destination?.type]);

const advancedSettings = useMemo(() => {
return settings.filter((setting) => setting.advanced == true);
}, [settings]);
return settings!
.map((setting) => {
if (
IsQueuePeer(mirrorConfig.destination?.type) &&
setting.advanced === 'queue'
) {
setting.stateHandler(600, setter);
return { ...setting, default: 600 };
}
if (setting.advanced === true) {
return setting;
}
})
.filter((setting) => setting !== undefined);
}, [settings, mirrorConfig.destination?.type, setter]);

const paramDisplayCondition = (setting: MirrorSetting) => {
const label = setting.label.toLowerCase();
Expand Down Expand Up @@ -91,15 +111,15 @@ export default function CDCConfigForm({
if (mirrorConfig.source != undefined && mirrorConfig.destination != undefined)
return (
<>
{normalSettings.map((setting, id) => {
{normalSettings!.map((setting, id) => {
return (
paramDisplayCondition(setting) && (
paramDisplayCondition(setting!) && (
<CDCField
key={id}
handleChange={handleChange}
setting={setting}
setting={setting!}
options={
setting.label === 'Publication Name'
setting?.label === 'Publication Name'
? publications
: undefined
}
Expand Down Expand Up @@ -128,13 +148,13 @@ export default function CDCConfigForm({
</Button>

{show &&
advancedSettings.map((setting, id) => {
advancedSettings!.map((setting, id) => {
return (
paramDisplayCondition(setting) && (
paramDisplayCondition(setting!) && (
<CDCField
key={setting.label}
key={setting?.label}
handleChange={handleChange}
setting={setting}
setting={setting!}
/>
)
);
Expand Down
1 change: 1 addition & 0 deletions ui/app/mirrors/create/helpers/cdc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export const cdcSettings: MirrorSetting[] = [
type: 'number',
default: '60',
required: true,
advanced: 'queue',
},
{
label: 'Publication Name',
Expand Down
3 changes: 2 additions & 1 deletion ui/app/mirrors/create/helpers/common.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { FlowConnectionConfigs, TypeSystem } from '@/grpc_generated/flow';

export type AdvancedSettingType = boolean | 'queue';
Amogh-Bharadwaj marked this conversation as resolved.
Show resolved Hide resolved
export interface MirrorSetting {
label: string;
stateHandler: (value: any, setter: any) => void;
Expand All @@ -8,7 +9,7 @@ export interface MirrorSetting {
tips?: string;
helpfulLink?: string;
default?: string | number | boolean;
advanced?: boolean; // whether it should come under an 'Advanced' section
advanced?: AdvancedSettingType; // whether it should come under an 'Advanced' section
command?: string;
}

Expand Down
Loading