-
Notifications
You must be signed in to change notification settings - Fork 917
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
Add new advanced settings for vis augmenter #3961
Add new advanced settings for vis augmenter #3961
Conversation
Signed-off-by: Ashish Agrawal <[email protected]>
Codecov Report
@@ Coverage Diff @@
## feature/feature-anywhere #3961 +/- ##
============================================================
- Coverage 66.53% 66.52% -0.02%
============================================================
Files 3245 3246 +1
Lines 62475 62514 +39
Branches 9645 9650 +5
============================================================
+ Hits 41569 41585 +16
- Misses 18598 18619 +21
- Partials 2308 2310 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
|
src/plugins/visualizations/public/embeddable/create_vis_embeddable_from_object.ts
Outdated
Show resolved
Hide resolved
Signed-off-by: Ashish Agrawal <[email protected]>
Signed-off-by: Ashish Agrawal <[email protected]>
Signed-off-by: Ashish Agrawal <[email protected]>
Signed-off-by: Ashish Agrawal <[email protected]>
Signed-off-by: Ashish Agrawal <[email protected]>
Signed-off-by: Ashish Agrawal <[email protected]>
const savedAugmentVisLoader = createSavedAugmentVisLoader({ | ||
savedObjectsClient: core.savedObjects.client, | ||
indexPatterns: data.indexPatterns, | ||
search: data.search, | ||
chrome: core.chrome, | ||
overlays: core.overlays, | ||
}); | ||
setSavedAugmentVisLoader(savedAugmentVisLoader); |
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.
We will still need this - why have you removed?
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.
brought it back
…ect/OpenSearch-Dashboards into anywhere-settings
Signed-off-by: Ashish Agrawal <[email protected]>
src/plugins/visualizations/public/embeddable/create_vis_embeddable_from_object.ts
Outdated
Show resolved
Hide resolved
src/plugins/visualizations/public/embeddable/create_vis_embeddable_from_object.ts
Outdated
Show resolved
Hide resolved
Signed-off-by: Ashish Agrawal <[email protected]>
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.
LGTM!
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.
LGTM!
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.
Cool, it's nice to see this all coming together.
# opensearchDashboards.survey.url: "https://survey.opensearch.org" | ||
|
||
# Set the value of this setting to false to disable plugin augmentation on Dashboard |
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 don't think we're consistent in this file, but I prefer the form of L232-234; because we provide the commented out default value, the instructions should be about setting it to the non-default:
# Set the value of this setting to false to disable plugin augmentation on Dashboard | |
# Set the value of this setting to true to enable plugin augmentation on Dashboard visualizations |
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.
Oh, I see the default is intended to be true. In that case, keep the text and change the commented value.
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 followed the standard of the other settings and the commented value should be false based on that.
if (!isAugmentationEnabled) { | ||
throw new Error( | ||
'Visualization augmentation is disabled, please enable visualization:enablePluginAugmentation.' |
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.
Out of scope and unrelated to feature anywhere - but ideally we'd make it easy for these types of configuration errors to directly deep link to the relevant setting. I'll open an issue or add to our existing issue about error handling.
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.
added to #1625 (comment)
`Cannot associate the plugin resource to the visualization due to the limit of the max | ||
amount of associated plugin resources (${maxAssociatedCount}) with | ||
${savedObjectsForThisVisualization.length} associated to the visualization` |
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.
Do we want this error message to indicate that visualization:enablePluginAugmentation.maxPluginObjects
is actually a user-configurable setting?
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.
The change looks good. The coverage can be added in a followup PR, but calling it out here since it can affect merge to main.
import { | ||
PLUGIN_AUGMENTATION_ENABLE_SETTING, | ||
PLUGIN_AUGMENTATION_MAX_OBJECTS_SETTING, | ||
} from '../../../common/constants'; | ||
|
||
/** | ||
* Create an augment vis saved object given an object that | ||
* implements the ISavedAugmentVis interface | ||
*/ | ||
export const createAugmentVisSavedObject = async (AugmentVis: ISavedAugmentVis): Promise<any> => { |
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.
Can you add unit tests here?
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.
Will follow up in another pr
// Checks if the global yaml setting for enabling plugin augmentation is disabled. | ||
// If it is disabled, remove the settings as we would not want to show these to the | ||
// user due to it being disabled at the cluster level. | ||
if (isAugmentationEnabled) { |
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.
This is actually pretty neat that you are relying on the missing UI settings to disable it in the plugin. Calling it out in the comment here will be really helpful in the future though since it may not be obvious that you are doing it this way and its anon standard pattern in the repo.
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.
Will follow up in another pr with the tests
id: this.id, | ||
}); | ||
try { | ||
const augmentVisSavedObjs = await getAugmentVisSavedObjs( |
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.
There seem to be a bunch of coverage failures here too.
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.
Will follow up in another pr
Description
Issues Resolved
#3361
Check List
yarn test:jest
yarn test:jest_integration
yarn test:ftr