fix(striker-ui-api): swap key-value of flag bundles in manage alerts

main
Tsu-ba-me 11 months ago
parent 6288a52d99
commit 08c0d09d08
  1. 42
      striker-ui-api/src/lib/execManageAlerts.ts

@ -5,29 +5,33 @@ import { SERVER_PATHS } from './consts';
import { stdoutVar } from './shell'; import { stdoutVar } from './shell';
const MAP_TO_FLAG_BUNDLE = { const MAP_TO_FLAG_BUNDLE: {
'alert-overrides': Record<keyof AlertOverrideRequestBody | 'uuid', string>;
'mail-servers': Record<keyof MailServerRequestBody | 'uuid', string>;
recipients: Record<keyof MailRecipientRequestBody | 'uuid', string>;
} = {
'alert-overrides': { 'alert-overrides': {
'--alert-override-alert-level': 'level', hostUuid: '--alert-override-host-uuid',
'--alert-override-host-uuid': 'hostUuid', level: '--alert-override-alert-level',
'--alert-override-recipient-uuid': 'recipientUuid', mailRecipientUuid: '--alert-override-recipient-uuid',
'--alert-override-uuid': 'uuid', uuid: '--alert-override-uuid',
}, },
'mail-servers': { 'mail-servers': {
'--mail-server-address': 'address', address: '--mail-server-address',
'--mail-server-authentication': 'authentication', authentication: '--mail-server-authentication',
'--mail-server-helo-domain': 'heloDomain', heloDomain: '--mail-server-helo-domain',
'--mail-server-password': 'password', password: '--mail-server-password',
'--mail-server-port': 'port', port: '--mail-server-port',
'--mail-server-security': 'security', security: '--mail-server-security',
'--mail-server-username': 'username', username: '--mail-server-username',
'--mail-server-uuid': 'uuid', uuid: '--mail-server-uuid',
}, },
recipients: { recipients: {
'--recipient-email': 'email', email: '--recipient-email',
'--recipient-language': 'language', language: '--recipient-language',
'--recipient-level': 'level', level: '--recipient-level',
'--recipient-name': 'name', name: '--recipient-name',
'--recipient-uuid': 'uuid', uuid: '--recipient-uuid',
}, },
}; };
@ -51,7 +55,7 @@ export const execManageAlerts = (
const commandArgs: string[] = Object.entries( const commandArgs: string[] = Object.entries(
MAP_TO_FLAG_BUNDLE[entities], MAP_TO_FLAG_BUNDLE[entities],
).reduce( ).reduce(
(previous, [flag, key]) => { (previous, [key, flag]) => {
const value = shallow[key]; const value = shallow[key];
if (value) { if (value) {

Loading…
Cancel
Save