Skip to content

Commit

Permalink
ISPN-14835 Use BASIC when url contains user and password
Browse files Browse the repository at this point in the history
  • Loading branch information
karesti committed May 16, 2023
1 parent daec25a commit 5560767
Show file tree
Hide file tree
Showing 28 changed files with 115 additions and 85 deletions.
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:-"14.0.6.Final"}"
SERVER_VERSION="${SERVER_VERSION:-"15.0.0.Dev01"}"
#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
2 changes: 1 addition & 1 deletion src/__tests__/views/About.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('About page', () => {

expect(getByText('Infinispan Corona 1.9')).toBeTruthy();

expect(getByRole('img', { name: /Logo$/})).toBeInTheDocument();
expect(getByRole('img', { name: /Logo$/ })).toBeInTheDocument();

fireEvent.click(getByRole('button', { name: 'Close Dialog' }));

Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/views/counters/AddDeltaCounter.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ describe('Add a delta', () => {
);
expect(screen.queryByRole('modal')).toBeDefined();
expect(screen.queryAllByRole('button')).toHaveLength(3);

const submitButton = screen.getByRole('button', { name: 'Confirm' });
fireEvent.click(submitButton);

expect(screen.getByText('cache-managers.counters.modal-delta-helper-invalid')).toBeTruthy();
expect(closeModalCalls).toBe(0);
expect(onAddDeltaCalls).toBe(0);
Expand Down
57 changes: 18 additions & 39 deletions src/__tests__/views/counters/CreateCounter.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@ mockedCounterHook.useCreateCounter.mockImplementation(() => {
describe('Create a counter', () => {
test('not render the dialog if the modal is closed', () => {
renderWithRouter(
<CreateCounter
submitModal={() => submitModalCalls++}
isModalOpen={false}
closeModal={() => closeModalCalls++}
/>
<CreateCounter submitModal={() => submitModalCalls++} isModalOpen={false} closeModal={() => closeModalCalls++} />
);
expect(screen.queryByRole('modal')).toBeNull();
expect(closeModalCalls).toBe(0);
Expand All @@ -39,15 +35,11 @@ describe('Create a counter', () => {

test('render the dialog and submit with empty values', () => {
renderWithRouter(
<CreateCounter
submitModal={() => submitModalCalls++}
isModalOpen={true}
closeModal={() => closeModalCalls++}
/>
<CreateCounter submitModal={() => submitModalCalls++} isModalOpen={true} closeModal={() => closeModalCalls++} />
);
expect(screen.queryByRole('modal')).toBeDefined();
expect(screen.queryAllByRole('button')).toHaveLength(5);

//Submiting empty form
const submitButton = screen.getByRole('button', { name: 'Create' });
fireEvent.click(submitButton);
Expand All @@ -59,20 +51,16 @@ describe('Create a counter', () => {

test('render the dialog and submit with filled name', () => {
renderWithRouter(
<CreateCounter
submitModal={() => submitModalCalls++}
isModalOpen={true}
closeModal={() => closeModalCalls++}
/>
<CreateCounter submitModal={() => submitModalCalls++} isModalOpen={true} closeModal={() => closeModalCalls++} />
);
expect(screen.queryByRole('modal')).toBeDefined();
expect(screen.queryAllByRole('button')).toHaveLength(5);

const submitButton = screen.getByRole('button', { name: 'Create' });
expect(onCreateCounterCalls).toBe(0);
//Submiting form with name filled
const nameInput = screen.getByLabelText('counter-name-input');
fireEvent.change(nameInput, {target: {value: 'TestCounter'}});
fireEvent.change(nameInput, { target: { value: 'TestCounter' } });
fireEvent.click(submitButton);

expect(closeModalCalls).toBe(1);
Expand All @@ -83,26 +71,22 @@ describe('Create a counter', () => {

test('render the dialog and submit with invalid values', () => {
renderWithRouter(
<CreateCounter
submitModal={() => submitModalCalls++}
isModalOpen={true}
closeModal={() => closeModalCalls++}
/>
<CreateCounter submitModal={() => submitModalCalls++} isModalOpen={true} closeModal={() => closeModalCalls++} />
);
expect(screen.queryByRole('modal')).toBeDefined();
expect(screen.queryAllByRole('button')).toHaveLength(5);

const submitButton = screen.getByRole('button', { name: 'Create' });

//Submiting form with name filled
const nameInput = screen.getByLabelText('counter-name-input');
fireEvent.change(nameInput, {target: {value: 'TestCounter1'}});
fireEvent.change(nameInput, { target: { value: 'TestCounter1' } });
const initialValueInput = screen.getByLabelText('initial-value-input');
fireEvent.change(initialValueInput, {target: {value: '5'}});
fireEvent.change(initialValueInput, { target: { value: '5' } });
const lowerBoundInput = screen.getByLabelText('lower-bound-input');
fireEvent.change(lowerBoundInput, {target: {value: '5'}});
fireEvent.change(lowerBoundInput, { target: { value: '5' } });
const upperBoundInput = screen.getByLabelText('upper-bound-input');
fireEvent.change(upperBoundInput, {target: {value: '5'}});
fireEvent.change(upperBoundInput, { target: { value: '5' } });
fireEvent.click(submitButton);
expect(screen.getByText('cache-managers.counters.modal-initial-value-invalid')).toBeTruthy();
expect(screen.getByText('cache-managers.counters.modal-lower-bound-invalid')).toBeTruthy();
Expand All @@ -114,32 +98,27 @@ describe('Create a counter', () => {

test('render the dialog and submit with valid values', () => {
renderWithRouter(
<CreateCounter
submitModal={() => submitModalCalls++}
isModalOpen={true}
closeModal={() => closeModalCalls++}
/>
<CreateCounter submitModal={() => submitModalCalls++} isModalOpen={true} closeModal={() => closeModalCalls++} />
);
expect(screen.queryByRole('modal')).toBeDefined();
expect(screen.queryAllByRole('button')).toHaveLength(5);

const submitButton = screen.getByRole('button', { name: 'Create' });

//Submiting form with name filled
const nameInput = screen.getByLabelText('counter-name-input');
fireEvent.change(nameInput, {target: {value: 'TestCounter1'}});
fireEvent.change(nameInput, { target: { value: 'TestCounter1' } });
const initialValueInput = screen.getByLabelText('initial-value-input');
fireEvent.change(initialValueInput, {target: {value: '5'}});
fireEvent.change(initialValueInput, { target: { value: '5' } });
const lowerBoundInput = screen.getByLabelText('lower-bound-input');
fireEvent.change(lowerBoundInput, {target: {value: '0'}});
fireEvent.change(lowerBoundInput, { target: { value: '0' } });
const upperBoundInput = screen.getByLabelText('upper-bound-input');
fireEvent.change(upperBoundInput, {target: {value: '10'}});
fireEvent.change(upperBoundInput, { target: { value: '10' } });
fireEvent.click(submitButton);

expect(closeModalCalls).toBe(1);
expect(onCreateCounterCalls).toBe(1);
expect(submitModalCalls).toBe(1);
expect(screen.queryByRole('modal')).toBeNull();
});

});
6 changes: 3 additions & 3 deletions src/app/AppLayout/AppLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const AppLayout: React.FunctionComponent<IAppLayout> = ({ init, children }) => {
const [isWelcomePage, setIsWelcomePage] = useState(ConsoleServices.isWelcomePage());
const logoProps = {
target: '_self',
onClick: () => history.push('/')
onClick: () => history.push('/' + history.location.search)
};

const { t } = useTranslation();
Expand Down Expand Up @@ -87,7 +87,7 @@ const AppLayout: React.FunctionComponent<IAppLayout> = ({ init, children }) => {
const Logo = (
<Flex alignItems={{ default: 'alignItemsCenter' }}>
<FlexItem style={{ marginTop: global_spacer_sm.value }}>
<Link to={'/'}>
<Link to={{ pathname: '/', search: location.search }}>
<Brand src={icon} alt={t('layout.console-name')} widths={{ default: '150px' }}>
<source srcSet={icon} />
</Brand>
Expand Down Expand Up @@ -179,7 +179,7 @@ const AppLayout: React.FunctionComponent<IAppLayout> = ({ init, children }) => {
<NavItem key={`${route.label}-${idx}`} id={`${route.label}-${idx}`}>
<NavLink
exact
to={route.path}
to={route.path + history.location.search}
activeClassName="pf-m-current"
isActive={(match, location) => {
if (match) {
Expand Down
6 changes: 4 additions & 2 deletions src/app/CacheManagers/CacheTableDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ const CacheTableDisplay = (props: { cmName: string; setCachesCount: (count: numb
<Link
data-cy={`detailLink-${cacheInfo.name}`}
key={cacheInfo.name}
to={'/cache/' + encodeURIComponent(cacheInfo.name)}
to={{ pathname: '/cache/' + encodeURIComponent(cacheInfo.name), search: location.search }}
>
{cacheDetailAccess}
</Link>
Expand Down Expand Up @@ -517,7 +517,8 @@ const CacheTableDisplay = (props: { cmName: string; setCachesCount: (count: numb
<ToolbarItem style={{ marginRight: global_spacer_sm.value }}>
<Link
to={{
pathname: '/container/caches/create'
pathname: '/container/caches/create',
search: location.search
}}
>
<Button variant={ButtonVariant.primary} aria-label="create-cache-button" data-cy="createCacheButton">
Expand All @@ -534,6 +535,7 @@ const CacheTableDisplay = (props: { cmName: string; setCachesCount: (count: numb
<Link
to={{
pathname: '/container/' + props.cmName + '/configurations/',
search: location.search,
state: {
cmName: props.cmName
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/CacheManagers/CounterTableDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ const CounterTableDisplay = (props: { setCountersCount: (number) => void; isVisi
<React.Fragment>
<ToolbarItem variant={ToolbarItemVariant.separator}></ToolbarItem>
<ToolbarItem>
<Button onClick={() => setIsCreateCounter(!isCreateCounter)} data-cy='createCounterButton'>
<Button onClick={() => setIsCreateCounter(!isCreateCounter)} data-cy="createCounterButton">
{t('cache-managers.counters.modal-create-title')}
</Button>
</ToolbarItem>
Expand Down
4 changes: 2 additions & 2 deletions src/app/Caches/Create/CreateCacheWizard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const CreateCacheWizard = (props: { cacheManager: CacheManager; create: boolean
const history = useHistory();

const closeWizard = () => {
history.push('/');
history.push('/' + history.location.search);
};

useEffect(() => {
Expand Down Expand Up @@ -366,7 +366,7 @@ const CreateCacheWizard = (props: { cacheManager: CacheManager; create: boolean
createCacheCall
.then((actionResponse) => {
if (actionResponse.success) {
history.push('/');
history.push('/' + history.location.search);
}
return actionResponse;
})
Expand Down
3 changes: 2 additions & 1 deletion src/app/Caches/DataAccessChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ const DataAccessChart = (props: { stats: CacheStats }) => {
</CardTitle>
<CardBody>
<div style={{ width: '100%', height: '480px' }}>
<ChartDonut data-cy='data-access-chart'
<ChartDonut
data-cy="data-access-chart"
width={600}
height={400}
constrainToVisibleArea={true}
Expand Down
3 changes: 2 additions & 1 deletion src/app/Caches/DataDistributionChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ const DataDistributionChart = (props: { cacheName: string }) => {
ariaDesc={t('caches.cache-metrics.data-distribution')}
ariaTitle={t('caches.cache-metrics.data-distribution')}
containerComponent={
<ChartVoronoiContainer data-cy='data-distribution-chart'
<ChartVoronoiContainer
data-cy="data-distribution-chart"
labels={({ datum }) =>
datum.y !== 0
? `${datum.y}`
Expand Down
9 changes: 6 additions & 3 deletions src/app/Caches/DetailCache.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ const DetailCache = (props: { cacheName: string }) => {
<EmptyStatePrimary>
<Link
to={{
pathname: '/'
pathname: '/',
search: location.search
}}
>
<Button variant={ButtonVariant.secondary}>Back</Button>
Expand Down Expand Up @@ -214,7 +215,8 @@ const DetailCache = (props: { cacheName: string }) => {
<ToolbarItem>
<Link
to={{
pathname: encodeURIComponent(cacheName) + '/backups'
pathname: encodeURIComponent(cacheName) + '/backups',
search: location.search
}}
>
<Button variant={ButtonVariant.link}>Manage</Button>
Expand Down Expand Up @@ -254,7 +256,8 @@ const DetailCache = (props: { cacheName: string }) => {
<FlexItem>
<Link
to={{
pathname: encodeURIComponent(cacheName) + '/indexing'
pathname: encodeURIComponent(cacheName) + '/indexing',
search: location.search
}}
>
<Button data-cy="manageIndexesLink" variant={ButtonVariant.link}>
Expand Down
4 changes: 2 additions & 2 deletions src/app/Caches/Query/ClearQueryMetrics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ const ClearQueryMetrics = (props: { cacheName: string; isModalOpen: boolean; clo
onClose={props.closeModal}
aria-label={t('caches.query.modal-clear-query-stats-label')}
actions={[
<Button data-cy='confirmButton' key="confirm" variant={ButtonVariant.danger} onClick={onClickDeleteButton}>
<Button data-cy="confirmButton" key="confirm" variant={ButtonVariant.danger} onClick={onClickDeleteButton}>
{t('caches.query.modal-button-query-clear-stats')}
</Button>,
<Button data-cy='cancelButton' key="cancel" variant="link" onClick={props.closeModal}>
<Button data-cy="cancelButton" key="cancel" variant="link" onClick={props.closeModal}>
{t('caches.query.modal-button-cancel')}
</Button>
]}
Expand Down
6 changes: 5 additions & 1 deletion src/app/Caches/Query/QueryMetrics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,11 @@ const QueryMetrics = (props: { cacheName: string }) => {

return (
<LevelItem>
<Button data-cy='clearQueryMetricsButton' variant={ButtonVariant.danger} onClick={() => setClearMetricsModalOpen(true)}>
<Button
data-cy="clearQueryMetricsButton"
variant={ButtonVariant.danger}
onClick={() => setClearMetricsModalOpen(true)}
>
{t('caches.query.button-clear-query-stats')}
</Button>
<ClearQueryMetrics
Expand Down
6 changes: 4 additions & 2 deletions src/app/Common/DataContainerBreadcrumb.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const DataContainerBreadcrumb = (props: { currentPage: string; cacheName?: strin
<BreadcrumbItem data-cy="cacheNameLink">
<Link
to={{
pathname: '/cache/' + encodeURIComponent(props.cacheName)
pathname: '/cache/' + encodeURIComponent(props.cacheName),
search: location.search
}}
>
{props.cacheName}
Expand All @@ -25,7 +26,8 @@ const DataContainerBreadcrumb = (props: { currentPage: string; cacheName?: strin
<BreadcrumbItem data-cy="dataContainerLink">
<Link
to={{
pathname: '/'
pathname: '/',
search: location.search
}}
>
Data container
Expand Down
16 changes: 14 additions & 2 deletions src/app/Counters/AddDeltaCounter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,22 @@ const AddDeltaCounter = (props: {
aria-label={t('cache-managers.counters.modal-delta-title')}
disableFocusTrap={true}
actions={[
<Button key={'Confirm'} aria-label={'Confirm'} variant={ButtonVariant.danger} onClick={handleSubmit} data-cy="confirmAddDeltaButton">
<Button
key={'Confirm'}
aria-label={'Confirm'}
variant={ButtonVariant.danger}
onClick={handleSubmit}
data-cy="confirmAddDeltaButton"
>
{t('cache-managers.counters.modal-confirm-button')}
</Button>,
<Button key={'Cancel'} aria-label={'Cancel'} variant={ButtonVariant.link} onClick={props.closeModal} data-cy="cancelAddDeltaButton">
<Button
key={'Cancel'}
aria-label={'Cancel'}
variant={ButtonVariant.link}
onClick={props.closeModal}
data-cy="cancelAddDeltaButton"
>
{t('cache-managers.counters.modal-cancel-button')}
</Button>
]}
Expand Down
2 changes: 1 addition & 1 deletion src/app/Counters/CreateCounter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ const CreateCounter = (props: { isModalOpen: boolean; submitModal: () => void; c
<PopoverHelp
name="storage"
label={t('cache-managers.counters.modal-storage')}
content={t('cache-managers.counters.modal-storage-tooltip',{ brandname: brandname })}
content={t('cache-managers.counters.modal-storage-tooltip', { brandname: brandname })}
/>
}
>
Expand Down
10 changes: 8 additions & 2 deletions src/app/Counters/DeleteCounter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const DeleteCounter = (props: {
disableFocusTrap={true}
actions={[
<Button
data-cy="deleteCounterButton"
data-cy="deleteCounterButton"
key={t('cache-managers.counters.modal-confirm-button')}
aria-label={'Confirm'}
variant={ButtonVariant.danger}
Expand All @@ -42,7 +42,13 @@ const DeleteCounter = (props: {
>
{t('cache-managers.counters.delete-action')}
</Button>,
<Button key={'Cancel'} aria-label={'Cancel'} variant={ButtonVariant.link} onClick={props.closeModal} data-cy="cancelCounterDeleteButton">
<Button
key={'Cancel'}
aria-label={'Cancel'}
variant={ButtonVariant.link}
onClick={props.closeModal}
data-cy="cancelCounterDeleteButton"
>
{t('cache-managers.counters.modal-cancel-button')}
</Button>
]}
Expand Down

0 comments on commit 5560767

Please sign in to comment.