[Files] Files management (#144425)

## Summary

Files management UI that rounds out the files MVP. This is UI is
intended to be progressively enhanced and provides a way for system
administrators get some insight and manage the files created and stored
in Kibana.

## To reviewers

* This is UI for retrieval and deletion of files (the R+D of CRUD)
* Creating and deleting tags to be supported in a future version
* This UI is intended to form part of the broader content management
experience
* We use the `TableListView` component as far as possible

## How to test

1. Start Kibana with `yarn start --run-examples`
2. Go to the "Developer Examples" from the left nav menu
3. Go to the "Files example" plugin
4. Click the "Upload file" button, upload a few different image types
(PNG, JPG and WEBP)
5. Go to "Stack management" > "Files"
6. Behold your files in the management UI
7. (Bonus) check that the UI and API `GET /api/files/find`, `GET
/api/files/metrics` and `DELETE /api/files/blobs` are not accessible to
non-admin or appropriately privileged users (i.e., those with "Files
management" access).

## List of functionality

 - [x] List all saved objects (scoped to admin)
 - [x] Is able to bulk-delete files
 - [x] Shows basic storage diagnostics
 - [x] Is able to search and filter files

## Screenshots

<details>
<summary>screenshots</summary>

<img width="1545" alt="Screenshot 2022-11-08 at 13 56 54"
src="https://user-images.githubusercontent.com/8155004/200570783-cfefdbf3-c5ff-4ece-ba24-48a455fcca75.png">

<img width="910" alt="Screenshot 2022-11-10 at 12 52 35"
src="https://user-images.githubusercontent.com/8155004/201083812-bc9f25f5-b423-43a6-9229-5e2a4cdd943a.png">

<img width="451" alt="Screenshot 2022-11-10 at 12 37 07"
src="https://user-images.githubusercontent.com/8155004/201081039-832a1980-684c-4abb-bb05-0c7c6a849d4d.png">

<img width="959" alt="Screenshot 2022-11-08 at 13 57 15"
src="https://user-images.githubusercontent.com/8155004/200570797-f122cff5-7043-4e01-9b51-d5663c1b26d6.png">

<img width="500" alt="Screenshot 2022-11-08 at 13 57 38"
src="https://user-images.githubusercontent.com/8155004/200570801-35cdbd99-0256-4dee-9f78-2f6ad853305f.png">

</details>

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Jean-Louis Leysens 2022-11-17 13:53:31 +01:00 committed by GitHub
parent 759fb032f7
commit a166fba83d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
45 changed files with 1031 additions and 59 deletions

View file

@ -165,6 +165,10 @@ Array [
"id": "indexPatterns",
"subFeatures": undefined,
},
Object {
"id": "filesManagement",
"subFeatures": undefined,
},
Object {
"id": "savedObjectsManagement",
"subFeatures": undefined,
@ -449,6 +453,10 @@ Array [
"id": "indexPatterns",
"subFeatures": undefined,
},
Object {
"id": "filesManagement",
"subFeatures": undefined,
},
Object {
"id": "savedObjectsManagement",
"subFeatures": undefined,
@ -759,6 +767,57 @@ Array [
]
`;
exports[`buildOSSFeatures with a basic license returns the filesManagement feature augmented with appropriate sub feature privileges 1`] = `
Array [
Object {
"privilege": Object {
"api": Array [
"files:manageFiles",
],
"app": Array [
"kibana",
],
"management": Object {
"kibana": Array [
"filesManagement",
],
},
"savedObject": Object {
"all": Array [
"files",
],
"read": Array [],
},
"ui": Array [],
},
"privilegeId": "all",
},
Object {
"privilege": Object {
"api": Array [
"files:manageFiles",
],
"app": Array [
"kibana",
],
"management": Object {
"kibana": Array [
"filesManagement",
],
},
"savedObject": Object {
"all": Array [],
"read": Array [
"files",
],
},
"ui": Array [],
},
"privilegeId": "read",
},
]
`;
exports[`buildOSSFeatures with a basic license returns the indexPatterns feature augmented with appropriate sub feature privileges 1`] = `
Array [
Object {
@ -1267,6 +1326,57 @@ Array [
]
`;
exports[`buildOSSFeatures with a enterprise license returns the filesManagement feature augmented with appropriate sub feature privileges 1`] = `
Array [
Object {
"privilege": Object {
"api": Array [
"files:manageFiles",
],
"app": Array [
"kibana",
],
"management": Object {
"kibana": Array [
"filesManagement",
],
},
"savedObject": Object {
"all": Array [
"files",
],
"read": Array [],
},
"ui": Array [],
},
"privilegeId": "all",
},
Object {
"privilege": Object {
"api": Array [
"files:manageFiles",
],
"app": Array [
"kibana",
],
"management": Object {
"kibana": Array [
"filesManagement",
],
},
"savedObject": Object {
"all": Array [],
"read": Array [
"files",
],
},
"ui": Array [],
},
"privilegeId": "read",
},
]
`;
exports[`buildOSSFeatures with a enterprise license returns the indexPatterns feature augmented with appropriate sub feature privileges 1`] = `
Array [
Object {

View file

@ -422,6 +422,45 @@ export const buildOSSFeatures = ({
},
},
},
{
id: 'filesManagement',
name: i18n.translate('xpack.features.filesManagementFeatureName', {
defaultMessage: 'Files Management',
}),
order: 1600,
category: DEFAULT_APP_CATEGORIES.management,
app: ['kibana'],
catalogue: [],
management: {
kibana: ['filesManagement'],
},
privileges: {
all: {
app: ['kibana'],
management: {
kibana: ['filesManagement'],
},
savedObject: {
all: ['files'],
read: [],
},
ui: [],
api: ['files:manageFiles'],
},
read: {
app: ['kibana'],
management: {
kibana: ['filesManagement'],
},
savedObject: {
all: [],
read: ['files'],
},
ui: [],
api: ['files:manageFiles'],
},
},
},
{
id: 'savedObjectsManagement',
name: i18n.translate('xpack.features.savedObjectsManagementFeatureName', {

View file

@ -66,6 +66,7 @@ describe('Features Plugin', () => {
"dev_tools",
"advancedSettings",
"indexPatterns",
"filesManagement",
"savedObjectsManagement",
]
`);