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-14913 Create cache configuration #369

Merged
merged 2 commits into from
Jul 12, 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
7 changes: 4 additions & 3 deletions cypress/e2e/cache-create-wizard.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,19 +99,20 @@ describe('Cache Creation Wizard', () => {

//Verify before submitting and downloading file
cy.contains('super-cache');
cy.get('[data-cy=downloadModal]').click();
cy.get('[data-cy=downloadButton]').click();
cy.wait(2000);
var downloadedFile = cy.readFile('./cypress/downloads/super-cache.json');
downloadedFile.should('exist');
downloadedFile.its('distributed-cache.mode').should('eq', 'SYNC');

cy.get('#downloadType').click();
cy.get('[data-cy=downloadModal]').click();
cy.get('#XML').click();
cy.get('[data-cy=downloadButton]').click();
downloadedFile = cy.readFile('./cypress/downloads/super-cache.xml');
downloadedFile.should('exist');

cy.get('#downloadType').click();
cy.get('[data-cy=downloadModal]').click();
cy.get('#YAML').click();
cy.get('[data-cy=downloadButton]').click();
downloadedFile = cy.readFile('./cypress/downloads/super-cache.yaml');
Expand Down
1 change: 1 addition & 0 deletions cypress/e2e/rbac_func.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ describe('RBAC Functionlity Tests', () => {
cy.get('[data-cy=createCacheButton]').should('exist');
} else {
cy.get('[data-cy=createCacheButton]').should('not.exist');
cy.get('[data-cy=createCacheConfigButton]').should('exist');
}
cy.get('[data-cy=showTemplatesButton]').should('exist');
cy.get('[data-cy=cachesTable]').should('exist');
Expand Down
2 changes: 1 addition & 1 deletion run-server-for-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ EXISTING_SERVER_PATH="${EXISTING_SERVER_PATH}"
#Base directory where the server should be downloaded
BASE_DIR="server"
#The version of the server is either set as an environment variable or is the latest dev version
SERVER_VERSION="${SERVER_VERSION:-"15.0.0.Dev01"}"
SERVER_VERSION="${SERVER_VERSION:-"15.0.0.Dev02"}"
#Root path from there the infinispan server should be downloaded
ZIP_ROOT="http://downloads.jboss.org/infinispan"
#If this environment variable is provided then it is used for downloading the server;
Expand Down
86 changes: 68 additions & 18 deletions src/app/CacheManagers/CacheTableDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ const CacheTableDisplay = (props: { cmName: string; setCachesCount: (count: numb

const isAdmin = ConsoleServices.security().hasConsoleACL(ConsoleACL.ADMIN, connectedUser);
const isCreator = ConsoleServices.security().hasConsoleACL(ConsoleACL.CREATE, connectedUser);
const canCreateCache = ConsoleServices.security().hasConsoleACL(ConsoleACL.CREATE, connectedUser);

const [cachesPagination, setCachesPagination] = useState({
page: 1,
Expand Down Expand Up @@ -345,7 +346,11 @@ const CacheTableDisplay = (props: { cmName: string; setCachesCount: (count: numb

const displayCacheType = (cacheType) => {
const labelColor = displayUtils.cacheTypeColor(cacheType);
return <Label color={labelColor} data-cy={'type-' + cacheType}>{cacheType}</Label>;
return (
<Label color={labelColor} data-cy={'type-' + cacheType}>
{cacheType}
</Label>
);
};

const displayCacheStatus = (cacheInfo: CacheInfo) => {
Expand Down Expand Up @@ -418,31 +423,29 @@ const CacheTableDisplay = (props: { cmName: string; setCachesCount: (count: numb
};

const createCacheButtonHelper = (isEmptyPage?: boolean) => {
const pathName = canCreateCache ? '/container/caches/create' : '/setup';
const emptyPageButtonProp = { style: { marginTop: global_spacer_xl.value } };
const normalPageButtonProps = { style: { marginLeft: global_spacer_sm.value } };
return (
<Link
to={{
pathname: '/container/caches/create',
pathname: pathName,
search: location.search
}}
>
<Button
variant={ButtonVariant.primary}
aria-label="create-cache-button-helper"
data-cy="createCacheButton"
data-cy={canCreateCache ? 'createCacheButton' : 'createCacheConfigButton'}
{...(isEmptyPage ? emptyPageButtonProp : normalPageButtonProps)}
>
{t('cache-managers.create-cache-button')}
{canCreateCache ? t('cache-managers.create-cache-button') : 'Create cache configuration'}
</Button>
</Link>
);
};

const buildCreateCacheButton = () => {
if (!ConsoleServices.security().hasConsoleACL(ConsoleACL.CREATE, connectedUser)) {
return;
}
return (
<React.Fragment>
<ToolbarItem>{createCacheButtonHelper()}</ToolbarItem>
Expand Down Expand Up @@ -506,49 +509,96 @@ const CacheTableDisplay = (props: { cmName: string; setCachesCount: (count: numb
<MenuContent>
<MenuList>
<MenuGroup label={t('cache-managers.cache-filter-type-label')}>
<MenuItem hasCheck isSelected={selectedCacheType.includes(CacheType.Local)} itemId="Local" data-cy="localType">
<MenuItem
hasCheck
isSelected={selectedCacheType.includes(CacheType.Local)}
itemId="Local"
data-cy="localType"
>
{t('cache-managers.mode-local')}
</MenuItem>
<MenuItem hasCheck isSelected={selectedCacheType.includes(CacheType.Replicated)} itemId="Replicated" data-cy="replicatedType">
<MenuItem
hasCheck
isSelected={selectedCacheType.includes(CacheType.Replicated)}
itemId="Replicated"
data-cy="replicatedType"
>
{t('cache-managers.mode-repl')}
</MenuItem>
<MenuItem hasCheck isSelected={selectedCacheType.includes(CacheType.Distributed)} itemId="Distributed" data-cy="distributedType">
<MenuItem
hasCheck
isSelected={selectedCacheType.includes(CacheType.Distributed)}
itemId="Distributed"
data-cy="distributedType"
>
{t('cache-managers.mode-dist')}
</MenuItem>
<MenuItem hasCheck isSelected={selectedCacheType.includes(CacheType.Invalidated)} itemId="Invalidated" data-cy="invalidatedType">
<MenuItem
hasCheck
isSelected={selectedCacheType.includes(CacheType.Invalidated)}
itemId="Invalidated"
data-cy="invalidatedType"
>
{t('cache-managers.mode-invalid')}
</MenuItem>
</MenuGroup>
<MenuGroup label={t('cache-managers.cache-filter-feature-label')}>
<MenuItem hasCheck isSelected={selectedCacheFeature.includes(CacheFeature.BOUNDED)} itemId="Bounded" data-cy="boundedFeature">
<MenuItem
hasCheck
isSelected={selectedCacheFeature.includes(CacheFeature.BOUNDED)}
itemId="Bounded"
data-cy="boundedFeature"
>
{t('cache-managers.cache-filter-feature-bounded')}
</MenuItem>
<MenuItem hasCheck isSelected={selectedCacheFeature.includes(CacheFeature.INDEXED)} itemId="Indexed" data-cy="indexedFeature">
<MenuItem
hasCheck
isSelected={selectedCacheFeature.includes(CacheFeature.INDEXED)}
itemId="Indexed"
data-cy="indexedFeature"
>
{t('cache-managers.cache-filter-feature-indexed')}
</MenuItem>
<MenuItem
hasCheck
isSelected={selectedCacheFeature.includes(CacheFeature.PERSISTENCE)}
itemId="Persistence" data-cy="persistenceFeature"
itemId="Persistence"
data-cy="persistenceFeature"
>
{t('cache-managers.cache-filter-feature-persistent')}
</MenuItem>
<MenuItem
hasCheck
isSelected={selectedCacheFeature.includes(CacheFeature.TRANSACTIONAL)}
itemId="Transactional" data-cy="transactionalFeature"
itemId="Transactional"
data-cy="transactionalFeature"
>
{t('cache-managers.cache-filter-feature-trans')}
</MenuItem>
<MenuItem hasCheck isSelected={selectedCacheFeature.includes(CacheFeature.SECURED)} itemId="Authorization" data-cy="authorizationFeature">
<MenuItem
hasCheck
isSelected={selectedCacheFeature.includes(CacheFeature.SECURED)}
itemId="Authorization"
data-cy="authorizationFeature"
>
{t('cache-managers.cache-filter-feature-secure')}
</MenuItem>
<MenuItem hasCheck isSelected={selectedCacheFeature.includes(CacheFeature.BACKUPS)} itemId="Backups" data-cy="backupsFeature">
<MenuItem
hasCheck
isSelected={selectedCacheFeature.includes(CacheFeature.BACKUPS)}
itemId="Backups"
data-cy="backupsFeature"
>
{t('cache-managers.cache-filter-feature-xsite')}
</MenuItem>
</MenuGroup>
<MenuGroup label={t('cache-managers.cache-filter-status-label')}>
<MenuItem hasCheck isSelected={selectedCacheStatus.includes(CacheStatus.IGNORED)} itemId="Hidden" data-cy="hiddenStatus">
<MenuItem
hasCheck
isSelected={selectedCacheStatus.includes(CacheStatus.IGNORED)}
itemId="Hidden"
data-cy="hiddenStatus"
>
{t('cache-managers.cache-filter-status-ignored')}
</MenuItem>
</MenuGroup>
Expand Down
Loading