mirror of
https://github.com/logto-io/logto.git
synced 2025-04-07 23:01:25 -05:00
feat(console): hide m2m and third-party app in the empty app list guide (#5331)
* feat(console): hide m2m and third-party app in the empty app list guide hide m2m and third-party app in the empty app status guide * fix(test): fix integration tests fix integration tests
This commit is contained in:
parent
904081cb48
commit
873ef1ebd0
3 changed files with 24 additions and 4 deletions
packages
console/src/pages/Applications/components/GuideLibrary
integration-tests/src/tests/console/applications
|
@ -50,6 +50,17 @@ function GuideLibrary({ className, hasCardBorder, hasCardButton }: Props) {
|
|||
[getFilteredAppGuideMetadata, keyword, filterCategories]
|
||||
);
|
||||
|
||||
// Only show third party app and machine to machine app in create modal. Hide them by default in the empty app guide page.
|
||||
const fullApplicationCategories = useMemo(() => {
|
||||
if (isApplicationCreateModal) {
|
||||
return allAppGuideCategories;
|
||||
}
|
||||
|
||||
return allAppGuideCategories.filter(
|
||||
(category) => category !== thirdPartyAppCategory && category !== 'MachineToMachine'
|
||||
);
|
||||
}, [isApplicationCreateModal]);
|
||||
|
||||
const onClickGuide = useCallback((data: SelectedGuide) => {
|
||||
setShowCreateForm(true);
|
||||
setSelectedGuide(data);
|
||||
|
@ -138,7 +149,7 @@ function GuideLibrary({ className, hasCardBorder, hasCardButton }: Props) {
|
|||
className={styles.protectedAppCard}
|
||||
/>
|
||||
)}
|
||||
{(filterCategories.length > 0 ? filterCategories : allAppGuideCategories).map(
|
||||
{(filterCategories.length > 0 ? filterCategories : fullApplicationCategories).map(
|
||||
(category) =>
|
||||
structuredMetadata[category].length > 0 && (
|
||||
<GuideCardGroup
|
||||
|
|
|
@ -12,9 +12,18 @@ import { expectNavigation } from '#src/utils.js';
|
|||
|
||||
import { frameworkGroupLabels, type ApplicationCase } from './constants.js';
|
||||
|
||||
export const expectFrameworksInGroup = async (page: Page, groupSelector: string) => {
|
||||
export const expectFrameworksInGroup = async (
|
||||
page: Page,
|
||||
groupSelector: string,
|
||||
isTablePlaceHolder = false
|
||||
) => {
|
||||
/* eslint-disable no-await-in-loop */
|
||||
for (const groupLabel of frameworkGroupLabels) {
|
||||
// Expect the framework group to be visible, Third-party and Machine-to-machine are not visible in table placeholder
|
||||
for (const groupLabel of isTablePlaceHolder
|
||||
? frameworkGroupLabels.filter(
|
||||
(label) => label !== 'Third-party' && label !== 'Machine-to-machine'
|
||||
)
|
||||
: frameworkGroupLabels) {
|
||||
const frameGroup = await expect(page).toMatchElement(groupSelector, {
|
||||
text: groupLabel,
|
||||
});
|
||||
|
|
|
@ -54,7 +54,7 @@ describe('applications', () => {
|
|||
{ text: 'Select a framework or tutorial', timeout: 2000 }
|
||||
);
|
||||
|
||||
await expectFrameworksInGroup(page, 'div[class$=guideGroup]:has(>label)');
|
||||
await expectFrameworksInGroup(page, 'div[class$=guideGroup]:has(>label)', true);
|
||||
});
|
||||
|
||||
it('create the initial application from the table placeholder', async () => {
|
||||
|
|
Loading…
Add table
Reference in a new issue