Skip to content

Commit

Permalink
ISPN-16199 Search fixes
Browse files Browse the repository at this point in the history
* Use POST API to send the search query with the body
* Parse corretly Search API Bad Request errors
* Fix pagination
* Retrieve and use total results correctly
  • Loading branch information
karesti committed Jul 12, 2024
1 parent e2b71fb commit 3ea3a30
Show file tree
Hide file tree
Showing 16 changed files with 269 additions and 182 deletions.
2 changes: 1 addition & 1 deletion src/app/CacheManagers/CacheManagers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ const CacheManagers = () => {
<React.Fragment>
<ToolbarItem variant="separator"></ToolbarItem>
<ToolbarItem>
<TracingEnabled enabled={cm.tracing_enabled}/>
<TracingEnabled enabled={cm.tracing_enabled} />
</ToolbarItem>
</React.Fragment>
)}
Expand Down
5 changes: 1 addition & 4 deletions src/app/Caches/Create/CreateCacheWizard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,7 @@ const CreateCacheWizard = (props: { cacheManager: CacheManager; create: boolean
isHidden={!configuration.start.valid || configuration.start.createType == 'edit'}
id={7}
>
<ReviewCacheConfig
setReviewConfig={setReviewConfig}
setContentType={setContentType}
/>
<ReviewCacheConfig setReviewConfig={setReviewConfig} setContentType={setContentType} />
</WizardStep>
</Wizard>
<DownloadCacheModal
Expand Down
5 changes: 1 addition & 4 deletions src/app/Caches/Create/LanguageToggleRadios.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ import { FormGroup, Radio } from '@patternfly/react-core';
import { ConfigDownloadType } from '@services/infinispanRefData';
import { useTranslation } from 'react-i18next';

const LanguageToggleRadios = (props: {
language: ConfigDownloadType;
setLanguage: (ConfigDownloadType) => void;
}) => {
const LanguageToggleRadios = (props: { language: ConfigDownloadType; setLanguage: (ConfigDownloadType) => void }) => {
const { t } = useTranslation();

return (
Expand Down
12 changes: 5 additions & 7 deletions src/app/Caches/Create/ReviewCacheConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ import { ConfigDownloadType } from '@services/infinispanRefData';
import { ConsoleServices } from '@services/ConsoleServices';
import { toCodeEditorLanguage } from '@utils/getLanguage';

const ReviewCacheConfig = (props: {
setReviewConfig: (string) => void;
setContentType: (string) => void;
}) => {
const ReviewCacheConfig = (props: { setReviewConfig: (string) => void; setContentType: (string) => void }) => {
const { configuration } = useCreateCache();
const { t } = useTranslation();
const { theme } = useContext(ThemeContext);
Expand Down Expand Up @@ -41,7 +38,8 @@ const ReviewCacheConfig = (props: {
} else {
setError(r.value.message);
}
}).then(() => setValidate(false));
})
.then(() => setValidate(false));
}
}, [validate]);

Expand All @@ -65,10 +63,10 @@ const ReviewCacheConfig = (props: {
return jsonConfig;
}
if (language == ConfigDownloadType.YAML) {
return yamlConfig;
return yamlConfig;
}
return xmlConfig;
}
};

const displayCacheConfigEditor = () => {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/app/Caches/DetailCache.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ const DetailCache = (props: { cacheName: string }) => {
{cacheManager.tracing_enabled && (
<React.Fragment>
<ToolbarItem>
<TracingEnabled enabled={cache.tracing}/>
<TracingEnabled enabled={cache.tracing} />
</ToolbarItem>
<ToolbarItem variant="separator"></ToolbarItem>
</React.Fragment>
Expand Down
43 changes: 25 additions & 18 deletions src/app/Caches/Entries/CacheEntries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,17 @@ import { SelectSingle } from '@app/Common/SelectSingle';
import { selectOptionProps, selectOptionPropsFromArray } from '@utils/selectOptionPropsCreator';

const CacheEntries = (props: { cacheName: string }) => {
const { cacheEntries, totalEntriesCount, loadingEntries, errorEntries, infoEntries, reloadEntries, getByKey, limit, setLimit } =
useCacheEntries();
const {
cacheEntries,
totalEntriesCount,
loadingEntries,
errorEntries,
infoEntries,
reloadEntries,
getByKey,
limit,
setLimit
} = useCacheEntries();
const { cache } = useCacheDetail();
const { connectedUser } = useConnectedUser();
const { t } = useTranslation();
Expand Down Expand Up @@ -126,30 +135,28 @@ const CacheEntries = (props: { cacheName: string }) => {

const displayActions = (row) => {
if (!ConsoleServices.security().hasCacheConsoleACL(ConsoleACL.WRITE, cache.name, connectedUser)) {
return (
<Td></Td>
);
return <Td></Td>;
}

const actions = [
{
'aria-label': 'editEntryAction',
title: t('caches.entries.action-edit'),
onClick: () => onClickEditEntryButton(row.key, row.keyContentType as ContentType)
},
{
'aria-label': 'deleteEntryAction',
title: t('caches.entries.action-delete'),
onClick: () => onClickDeleteEntryButton(row.key, row.keyContentType as ContentType)
}
]
{
'aria-label': 'editEntryAction',
title: t('caches.entries.action-edit'),
onClick: () => onClickEditEntryButton(row.key, row.keyContentType as ContentType)
},
{
'aria-label': 'deleteEntryAction',
title: t('caches.entries.action-delete'),
onClick: () => onClickDeleteEntryButton(row.key, row.keyContentType as ContentType)
}
];

return (
<Td isActionCell data-cy={`actions-${row.key}`}>
<ActionsColumn items={actions} />
</Td>
);
}
};

const columnNames = {
key: t('caches.entries.column-key'),
Expand Down Expand Up @@ -350,7 +357,7 @@ const CacheEntries = (props: { cacheName: string }) => {
style={{ width: '100px' }}
onSelect={(value) => setLimit(value)}
/>
<Tooltip content={t('caches.entries.pagination-tooltip', {'number' : limit})}>
<Tooltip content={t('caches.entries.pagination-tooltip', { number: limit })}>
<Button variant="plain">
<HelpIcon />
</Button>
Expand Down
Loading

0 comments on commit 3ea3a30

Please sign in to comment.