Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ISPN-15125 Display correctly metrics when no entries and admin #411

Merged
merged 1 commit into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions cypress/e2e/rbac_func.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ describe('RBAC Functionlity Tests', () => {
checkSecuredCacheDetailsView(true, false, false, 'monitor', 'indexed-cache');
checkNotOwnSecuredCache('super-cache');
checkNonSecuredCacheDetailView(true, false);
cy.login(monitorUserName, Cypress.env('password'), '/cache/default');
checkNoEntriesTabView(false);
});

it('successfully logins and performs actions with observer user', () => {
Expand All @@ -31,6 +33,8 @@ describe('RBAC Functionlity Tests', () => {
//Go to tasks (@TODO at the moment for observer no tasks are shown, add after fix)
checkSchemasPageView(false);
checkCountersPageView();
cy.login(observerUserName, Cypress.env('password'), '/cache/default');
checkNoEntriesTabView(false);
});

it('successfully logins and performs actions with application user', () => {
Expand All @@ -45,6 +49,8 @@ describe('RBAC Functionlity Tests', () => {
//Go to tasks (@TODO at the moment for observer no tasks are shown, add after fix)
checkSchemasPageView(false);
checkCountersPageView();
cy.login(applicationUserName, Cypress.env('password'), '/cache/default');
checkNoEntriesTabView(false);
});

it('successfully logins and performs actions with deployer user', () => {
Expand All @@ -59,6 +65,8 @@ describe('RBAC Functionlity Tests', () => {
//Go to tasks (@TODO at the moment for observer no tasks are shown, add after fix)
checkSchemasPageView(true);
checkCountersPageView();
cy.login(deployerUserName, Cypress.env('password'), '/cache/default');
checkNoEntriesTabView(false);
});

it('successfully logins and performs actions with admin user', () => {
Expand All @@ -74,6 +82,8 @@ describe('RBAC Functionlity Tests', () => {
checkSchemasPageView(true);
checkCountersPageView();
checkTasksPage();
cy.login(Cypress.env('username'), Cypress.env('password'), '/cache/default');
checkNoEntriesTabView(true);
});

function checkDataContainerView(isMonitor, isDeployer, isAdmin, isSuperAdmin) {
Expand Down Expand Up @@ -192,6 +202,25 @@ describe('RBAC Functionlity Tests', () => {
cy.contains(/cacheName$/).should('not.exist');
}

function checkNoEntriesTabView(isSuperAdmin) {
// nobody sees manage metrics tab for default cache
cy.get('[data-cy=manageEntriesTab]').should('not.exist');
cy.get('[data-cy=cacheMetricsTab]').should('exist');
if (isSuperAdmin) {
cy.get('[data-cy=cacheConfigurationTab]').should('exist');
// config tab is visible
cy.contains('JSON').should('exist');
cy.get('[data-cy=cacheMetricsTab]').click();
cy.contains('Data access').should('exist');
} else {
// no config tab
cy.get('[data-cy=cacheConfigurationTab]').should('not.exist');
// metrics tab is visible
cy.contains('Data access').should('exist');
}

}

function checkNonSecuredCacheDetailView(isMonitor, isSuperAdmin) {
//Checking actions on non-secured cache
cy.get('[data-cy=detailButton-indexed-cache-no-auth]').click();
Expand Down
60 changes: 30 additions & 30 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "infinispan-console",
"version": "14.0.7",
"version": "14.0.13",
"description": "The console for Infinispan/Red Hat Data Grid",
"main": "index.js",
"repository": "https://github.com/infinispan/infinispan-console.git",
Expand Down
23 changes: 21 additions & 2 deletions src/app/CacheManagers/CacheTableDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
Select,
SelectGroup,
SelectOption,
SelectVariant,
SelectVariant, Spinner,
Text,
TextContent,
TextVariants,
Expand Down Expand Up @@ -287,7 +287,26 @@ const CacheTableDisplay = (props: { cmName: string; setCachesCount: (count: numb
disableActions: boolean;
}[];

if (currentPageCaches.length == 0 || loadingCaches || errorCaches != '') {
if (loadingCaches) {
currentRows = [
{
heightAuto: true,
disableActions: true,
cells: [
{
props: { colSpan: 5 },
title: (
<Bullseye>
<EmptyState variant={EmptyStateVariant.small}>
<EmptyStateBody><Spinner size={"lg"}/></EmptyStateBody>
</EmptyState>
</Bullseye>
)
}
]
}
];
} else if (currentPageCaches.length == 0 || errorCaches != '') {
currentRows = [
{
heightAuto: true,
Expand Down
Loading
Loading