-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3524 from wazuh/feat/3507-configuration-viewer-of…
…fice365 Module Office 365 configuration viewer
- Loading branch information
Showing
16 changed files
with
3,026 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...ement/components/management/configuration/office365/__snapshots__/office365.test.tsx.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`WzConfigurationOffice365 component renders correctly to match the snapshot 1`] = ` | ||
<ContextProvider | ||
value={ | ||
Object { | ||
"store": Object { | ||
"clearActions": [Function], | ||
"dispatch": [Function], | ||
"getActions": [Function], | ||
"getState": [Function], | ||
"replaceReducer": [Function], | ||
"subscribe": [Function], | ||
}, | ||
"subscription": Subscription { | ||
"handleChangeWrapper": [Function], | ||
"listeners": Object { | ||
"notify": [Function], | ||
}, | ||
"onStateChange": [Function], | ||
"parentSub": undefined, | ||
"store": Object { | ||
"clearActions": [Function], | ||
"dispatch": [Function], | ||
"getActions": [Function], | ||
"getState": [Function], | ||
"replaceReducer": [Function], | ||
"subscribe": [Function], | ||
}, | ||
"unsubscribe": null, | ||
}, | ||
} | ||
} | ||
> | ||
<Connect(WithLoading(Component)) | ||
agent={ | ||
Object { | ||
"id": "000", | ||
} | ||
} | ||
currentConfig="master-test-node" | ||
updateBadge={[Function]} | ||
updateConfigurationSection={[Function]} | ||
/> | ||
</ContextProvider> | ||
`; |
56 changes: 56 additions & 0 deletions
56
...ts/management/configuration/office365/components/SubscriptionTab/SubscriptionTab.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Wazuh app - React Test component SubscriptionTab | ||
* Copyright (C) 2015-2021 Wazuh, Inc. | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Find more information about this on the LICENSE file. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { SubscriptionTab } from './SubscriptionTab'; | ||
import { mount } from 'enzyme'; | ||
|
||
jest.mock( | ||
'../../../../../../../../../../../../kibana/node_modules/@elastic/eui/lib/services/accessibility/html_id_generator', | ||
() => ({ | ||
htmlIdGenerator: () => () => 'htmlId', | ||
}) | ||
); | ||
|
||
describe('SubscriptionTab component', () => { | ||
it('renders correctly to match the snapshot', () => { | ||
const wodleConfiguration = { | ||
office365: { | ||
enabled: 'yes', | ||
only_future_events: 'yes', | ||
interval: 600, | ||
curl_max_size: 1024, | ||
api_auth: [ | ||
{ | ||
tenant_id: 'your_tenant_id_test', | ||
client_id: 'your_client_id_test', | ||
client_secret: 'your_secret_test', | ||
}, | ||
], | ||
subscriptions: [ | ||
'Audit.AzureActiveDirectory', | ||
'Audit.Exchange', | ||
'Audit.SharePoint', | ||
'Audit.General', | ||
'DLP.All', | ||
], | ||
}, | ||
}; | ||
const agent = { id: '000' }; | ||
|
||
const wrapper = mount( | ||
<SubscriptionTab wodleConfiguration={wodleConfiguration} agent={agent} /> | ||
); | ||
|
||
expect(wrapper).toMatchSnapshot(); | ||
}); | ||
}); |
39 changes: 39 additions & 0 deletions
39
...ponents/management/configuration/office365/components/SubscriptionTab/SubscriptionTab.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Wazuh app - React component SubscriptionTab | ||
* Copyright (C) 2015-2021 Wazuh, Inc. | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Find more information about this on the LICENSE file. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { EuiBasicTable } from '@elastic/eui'; | ||
import WzConfigurationSettingsTabSelector from '../../../util-components/configuration-settings-tab-selector'; | ||
import { HELP_LINKS, OFFICE_365 } from '../../constants'; | ||
|
||
export type SubscriptionTabProps = { | ||
agent: { id: string }; | ||
wodleConfiguration: any; | ||
}; | ||
|
||
export const SubscriptionTab = ({ agent, wodleConfiguration }: SubscriptionTabProps) => { | ||
const columns = [{ field: 'subscription', name: 'Name' }]; | ||
|
||
return ( | ||
<WzConfigurationSettingsTabSelector | ||
title="Subscriptions list" | ||
currentConfig={wodleConfiguration} | ||
minusHeight={agent.id === '000' ? 370 : 320} | ||
helpLinks={HELP_LINKS} | ||
> | ||
<EuiBasicTable | ||
columns={columns} | ||
items={wodleConfiguration[OFFICE_365].subscriptions.map((item) => ({ subscription: item }))} | ||
/> | ||
</WzConfigurationSettingsTabSelector> | ||
); | ||
}; |
Oops, something went wrong.