[Security][Features] Adds subtext option to Kibana feature and sub-feature controls (#147709)

## Summary
- [x] Allow plugins to configure a description subtext underneath kibana
features
- [x] Allow plugins to configure a description subtext underneath kibana
subfeatures
- [x] Adjusts subfeature form UI so privilege buttons have fullwidth,
adjusts padding/margins
- [x] Adds unit tests

# Screen Shots
<img width="752" alt="image"
src="https://user-images.githubusercontent.com/56409205/211621510-83769516-4a04-4442-8d96-92f5b6708a45.png">


Privilege button group before

![image](https://user-images.githubusercontent.com/56409205/208610978-557d1881-f222-4a29-9ae3-d60baf34e1ac.png)

Privilege button group after
<img width="666" alt="image"
src="https://user-images.githubusercontent.com/56409205/211621622-36b7a388-f1f5-4cb4-810d-48adbf7f0155.png">


Example to test:
1. In `x-pack/plugins/security_solution/server/features.ts` before
`privilegeGroups` on line 254, add `description: 'some subfeature
description here'` and before `management` on line 551, add
`description: 'some feature description here'`.
3. Stack Management > Roles > edit Kibana Privileges > Security >
Security see descriptions show up underneath Security and underneath
Endpoint List sub feature
This commit is contained in:
Candace Park 2023-01-17 14:25:19 -08:00 committed by GitHub
parent 83a1904491
commit 28ba652c3d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 257 additions and 31 deletions

View file

@ -32,6 +32,11 @@ export interface KibanaFeatureConfig {
*/
name: string;
/**
* An optional description that will appear as subtext underneath the feature name
*/
description?: string;
/**
* The category for this feature.
* This will be used to organize the list of features for display within the
@ -156,6 +161,10 @@ export class KibanaFeature {
return this.config.name;
}
public get description() {
return this.config.description;
}
public get order() {
return this.config.order;
}

View file

@ -29,6 +29,11 @@ export interface SubFeatureConfig {
/** Collection of privilege groups */
privilegeGroups: readonly SubFeaturePrivilegeGroupConfig[];
/**
* An optional description that will appear as subtext underneath the sub-feature name
*/
description?: string;
}
/**
@ -105,6 +110,10 @@ export class SubFeature {
return this.config.requireAllSpaces ?? false;
}
public get description() {
return this.config.description || '';
}
public toRaw() {
return { ...this.config };
}