Skip to content

Commit

Permalink
[Search] Add Legacy App Search Gated Form (elastic#189816)
Browse files Browse the repository at this point in the history
## Summary

This PR adds Gated form and logic when user visits App Search , when
`kibana_uis_enabled == false` and the `role_type` is `owner`. The user
will not be able to able to access any other App Search routes other
than Engines Overview page until this form is submitted.

Also - removes App Search from the search providers so it will no longer
show up in the results.

(note - any migrated clusters will automatically allow access without
the gate on the backend - that is, it will already have set
`kibana_uis_enabled=true`)

Also updates a couple of links and CTA for Workplace Search to be
consistent with new App Search ones.

**Screen Recording:**


https://github.com/user-attachments/assets/8e3d73b3-52d4-4952-bb1e-49219c8cdaed

### Checklist

Delete any items that are not applicable to this PR.

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [x] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [x] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [x] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
3 people committed Aug 20, 2024
1 parent f98ef4c commit 845d275
Show file tree
Hide file tree
Showing 26 changed files with 1,099 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export const DEFAULT_INITIAL_APP_DATA = {
},
appSearch: {
accountId: 'some-id-string',
kibanaUIsEnabled: true,
onboardingComplete: true,
role: {
id: 'account_id:somestring|user_oid:somestring',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

export interface Account {
accountId: string;
kibanaUIsEnabled: boolean;
onboardingComplete: boolean;
role: {
id: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ describe('AppLogic', () => {
},
account: {
accountId: 'some-id-string',
kibanaUIsEnabled: true,
onboardingComplete: true,
role: DEFAULT_INITIAL_APP_DATA.appSearch.role,
},
myRole: {},
showGateForm: false,
};

it('sets values from props', () => {
Expand All @@ -48,6 +50,7 @@ describe('AppLogic', () => {
},
account: {
accountId: 'some-id-string',
kibanaUIsEnabled: true,
onboardingComplete: true,
role: DEFAULT_INITIAL_APP_DATA.appSearch.role,
},
Expand All @@ -60,6 +63,7 @@ describe('AppLogic', () => {
canViewAccountCredentials: true,
// Truncated for brevity - see utils/role/index.test.ts for full output
}),
showGateForm: false,
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ import { ConfiguredLimits, Account, Role } from './types';
import { getRoleAbilities } from './utils/role';

interface AppValues {
configuredLimits: ConfiguredLimits;
account: Account;
showGateForm: boolean;
configuredLimits: ConfiguredLimits;
myRole: Role;
}

interface AppActions {
setOnboardingComplete(): boolean;
}
Expand All @@ -41,6 +43,10 @@ export const AppLogic = kea<MakeLogicType<AppValues, AppActions, Required<Initia
},
],
configuredLimits: [props.configuredLimits.appSearch, {}],
showGateForm: [
props.appSearch.kibanaUIsEnabled === false && props.appSearch.role.roleType === 'owner',
{},
],
}),
selectors: {
myRole: [
Expand Down
Loading

0 comments on commit 845d275

Please sign in to comment.