Skip to content

Commit

Permalink
Support multi datasources on service accounts page (#1870)
Browse files Browse the repository at this point in the history
* Add selector on service accounts page

Signed-off-by: Derek Ho <dxho@amazon.com>

* Lint

Signed-off-by: Derek Ho <dxho@amazon.com>

* Fix test for service accounts

Signed-off-by: Derek Ho <dxho@amazon.com>

---------

Signed-off-by: Derek Ho <dxho@amazon.com>
  • Loading branch information
derek-ho authored Apr 4, 2024
1 parent d8d1c85 commit 0a57e75
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions public/apps/configuration/panels/service-account-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ import { ExternalLink, tableItemsUIProps, truncatedListView } from '../utils/dis
import { getUserList, InternalUsersListing } from '../utils/internal-user-list-utils';
import { showTableStatusMessage } from '../utils/loading-spinner-utils';
import { buildHashUrl } from '../utils/url-builder';
import { LocalCluster } from '../app-router';
import { SecurityPluginTopNavMenu } from '../top-nav-menu';

export function dictView(items: Dictionary<string>) {
if (isEmpty(items)) {
Expand Down Expand Up @@ -159,6 +161,12 @@ export function ServiceAccountList(props: AppDependencies) {

return (
<>
<SecurityPluginTopNavMenu
{...props}
dataSourcePickerReadOnly={true}
setDataSource={() => {}}
selectedDataSource={LocalCluster}
/>
<EuiPageHeader>
<EuiTitle size="l">
<h1>Service accounts</h1>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,16 @@ describe('Multi-datasources enabled', () => {
cy.get('[data-test-subj="dataSourceViewContextMenuHeaderLink"]').should('be.disabled');
});

it('Checks Service Accounts Tab', () => {
// Datasource is locked to local cluster for service accounts tab
cy.visit('http://localhost:5601/app/security-dashboards-plugin#/serviceAccounts');
cy.get('[data-test-subj="dataSourceViewContextMenuHeaderLink"]').should(
'contain',
'Local cluster'
);
cy.get('[data-test-subj="dataSourceViewContextMenuHeaderLink"]').should('be.disabled');
});

it('Checks Audit Logs Tab', () => {
cy.visit('http://localhost:5601/app/security-dashboards-plugin#/auditLogging');
cy.get('[data-test-subj="general-settings"]').should('exist');
Expand Down

0 comments on commit 0a57e75

Please sign in to comment.