Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Set default pattern based on update_config (dev)
  • Loading branch information
cccs-rs authored Mar 9, 2025
2 parents 0c80efd + 248fa54 commit 2e8b1b6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/components/models/base/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,9 @@ export type UpdateConfig = {
/** Custom delimiter definition */
custom_delimiter?: string;

/** Default pattern for finding signatures*/
default_pattern: string

/** Does the updater produce signatures? */
generates_signatures: boolean;

Expand Down
3 changes: 2 additions & 1 deletion src/components/routes/admin/service_detail/updater.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,8 @@ const ServiceUpdater = ({ service, defaults, setService, setModified }: ServiceU
source={{
...DEFAULT_SOURCE,
update_interval: service.update_config.update_interval_seconds,
default_classification: c12nDef.UNRESTRICTED
default_classification: c12nDef.UNRESTRICTED,
pattern: service.update_config.default_pattern
}}
setOpen={setDialog}
onSave={handleSaveSource}
Expand Down
7 changes: 5 additions & 2 deletions src/components/routes/manage/signature_sources.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -508,9 +508,10 @@ type ServiceDetailProps = {
sources: UpdateConfig['sources'];
generatesSignatures: UpdateConfig['generates_signatures'];
updateIntervalSeconds: UpdateConfig['update_interval_seconds'];
defaultPattern: UpdateConfig['default_pattern']
};

const ServiceDetail = ({ service, sources, generatesSignatures, updateIntervalSeconds }: ServiceDetailProps) => {
const ServiceDetail = ({ service, sources, generatesSignatures, updateIntervalSeconds, defaultPattern }: ServiceDetailProps) => {
const { t } = useTranslation(['manageSignatureSources']);
const theme = useTheme();
const classes = useStyles();
Expand Down Expand Up @@ -571,7 +572,8 @@ const ServiceDetail = ({ service, sources, generatesSignatures, updateIntervalSe
openDrawer(service, {
...DEFAULT_SOURCE,
update_interval: updateIntervalSeconds,
default_classification: c12nDef.UNRESTRICTED
default_classification: c12nDef.UNRESTRICTED,
pattern: defaultPattern
})
}
size="large"
Expand Down Expand Up @@ -698,6 +700,7 @@ export default function SignatureSources() {
sources={sources[key].sources}
generatesSignatures={sources[key].generates_signatures}
updateIntervalSeconds={sources[key].update_interval_seconds}
defaultPattern={sources[key].default_pattern}
/>
))
: [...Array(2)].map((item, i) => (
Expand Down

0 comments on commit 2e8b1b6

Please sign in to comment.