Skip to content

Commit

Permalink
feat(entities-plugins): support service-protection plugin (#1796)
Browse files Browse the repository at this point in the history
  • Loading branch information
Leopoldthecoder authored Nov 19, 2024
1 parent fa3d80d commit 05cc7f6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -693,10 +693,10 @@ const buildFormSchema = (parentKey: string, response: Record<string, any>, initi
// pass the referenceable flag from elements to the parent
initialFormSchema[field].referenceable = elements.referenceable
if ((elements.type === 'string' || elements.type === 'integer') && !elements.one_of) {
if (['string', 'integer', 'number'].includes(elements.type) && !elements.one_of) {
const { id, help, label, hint, values, referenceable } = initialFormSchema[field]
const { inputAttributes, ...overrides } = JSON.parse(JSON.stringify(ArrayInputFieldSchema))
inputAttributes.type = elements.type === 'integer' ? 'number' : 'text'
inputAttributes.type = elements.type === 'string' ? 'text' : 'number'
initialFormSchema[field] = { id, help, label, hint, values, referenceable, inputAttributes, ...overrides }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,13 @@ export const PLUGIN_METADATA: Record<string, Omit<PluginMetaData<I18nMessageSour
nameKey: 'plugins.meta.confluent.name',
scope: [PluginScope.GLOBAL, PluginScope.SERVICE, PluginScope.ROUTE, PluginScope.CONSUMER],
},
'service-protection': {
descriptionKey: 'plugins.meta.service-protection.description',
group: PluginGroup.TRAFFIC_CONTROL,
isEnterprise: true,
nameKey: 'plugins.meta.service-protection.name',
scope: [PluginScope.GLOBAL, PluginScope.SERVICE],
},
}

/**
Expand Down
4 changes: 4 additions & 0 deletions packages/entities/entities-plugins/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,10 @@
"confluent": {
"name": "Confluent",
"description": "Streamlines integration with Confluent Cloud and transforms requests into messages published to a Confluent topic."
},
"service-protection": {
"name": "Service Protection",
"description": "Prevent abuse and protect services with absolute limits on the number of requests reaching the service."
}
},
"fields": {
Expand Down

0 comments on commit 05cc7f6

Please sign in to comment.