-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Dashboard][Content Editor] Edit title, description, and tags from dashboard listing page #161399
Merged
Merged
Changes from 20 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
b6dd4b3
Add content editor to dashboard listing
cqliu1 c66ff63
Added content editor validator
cqliu1 2acffbb
Remove unused prop
cqliu1 2c40659
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine c1b63c9
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine 24af52e
Fix references
cqliu1 7d85ade
Added content editor functional test
cqliu1 551d805
Change to iInCircle icon
cqliu1 02fef98
Add tooltip in read only mode
cqliu1 37fb3e2
Add dashboard listing test
cqliu1 6ff19a6
Fix ts errors
cqliu1 37a6f59
Fix jest test
cqliu1 a7482ee
Move string to strings file
cqliu1 d5fb094
[CI] Auto-commit changed files from 'node scripts/precommit_hook.js -…
kibanamachine 45c9328
Fix warning string
cqliu1 77fbc67
Merge branch 'dashboard/save-from-listing-page' of https://github.com…
cqliu1 07dbbc8
Merge branch 'main' of https://github.com/elastic/kibana into dashboa…
cqliu1 2aa567e
Merge branch 'main' into dashboard/save-from-listing-page
cqliu1 8676fcd
Merge branch 'main' into dashboard/save-from-listing-page
cqliu1 211058a
Merge branch 'main' into dashboard/save-from-listing-page
cqliu1 a8a24a3
Fix dashboard_listing test
cqliu1 50df486
Remove exclusive suite
cqliu1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
...ugins/dashboard/public/services/dashboard_content_management/lib/update_dashboard_meta.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { DashboardContainerInput } from '../../../../common'; | ||
import { DashboardStartDependencies } from '../../../plugin'; | ||
import { DASHBOARD_CONTENT_ID } from '../../../dashboard_constants'; | ||
import { DashboardCrudTypes } from '../../../../common/content_management'; | ||
import { findDashboardsByIds } from './find_dashboards'; | ||
import { DashboardContentManagementRequiredServices } from '../types'; | ||
|
||
type UpdateDashboardMetaProps = Pick< | ||
DashboardContainerInput, | ||
'id' | 'title' | 'description' | 'tags' | ||
>; | ||
interface UpdateDashboardMetaDependencies { | ||
contentManagement: DashboardStartDependencies['contentManagement']; | ||
savedObjectsTagging: DashboardContentManagementRequiredServices['savedObjectsTagging']; | ||
embeddable: DashboardContentManagementRequiredServices['embeddable']; | ||
} | ||
|
||
export const updateDashboardMeta = async ( | ||
{ id, title, description = '', tags }: UpdateDashboardMetaProps, | ||
{ contentManagement, savedObjectsTagging, embeddable }: UpdateDashboardMetaDependencies | ||
) => { | ||
const [dashboard] = await findDashboardsByIds(contentManagement, [id]); | ||
if (dashboard.status === 'error') { | ||
return; | ||
} | ||
|
||
const references = | ||
savedObjectsTagging.updateTagsReferences && tags.length | ||
? savedObjectsTagging.updateTagsReferences(dashboard.references, tags) | ||
: dashboard.references; | ||
|
||
await contentManagement.client.update< | ||
DashboardCrudTypes['UpdateIn'], | ||
DashboardCrudTypes['UpdateOut'] | ||
>({ | ||
contentTypeId: DASHBOARD_CONTENT_ID, | ||
id, | ||
data: { title, description }, | ||
options: { references }, | ||
}); | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@elastic/kibana-data-discovery I believe this is the only line under your ownership that needs review. I made this a
Partial
type because updates allow for partial saved object attributesThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM, but @mattkime can you do the final approval since you're most familiar with this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll take a look in a bit. At first glance this should be fine but I need to refresh my memory. I started out overly strict with the idea we could loosen things if needed.