Skip to content

Commit

Permalink
add new test
Browse files Browse the repository at this point in the history
Signed-off-by: Qxisylolo <[email protected]>
  • Loading branch information
Qxisylolo committed Nov 1, 2024
1 parent a7d032b commit 20f4ba9
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 21 deletions.
34 changes: 22 additions & 12 deletions config/opensearch_dashboards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,25 @@
#server.name: "your-hostname"

# The URLs of the OpenSearch instances to use for all your queries.
#opensearch.hosts: ["http://localhost:9200"]

savedObjects.permission.enabled: true
server.host: '0.0.0.0'
opensearch.hosts: ['https://localhost:9200']
opensearch.ssl.verificationMode: none
opensearch.username: 'admin'
opensearch.password: 'myStrongPassword123!'
opensearch.requestHeadersWhitelist: [authorization, securitytenant]
# opensearch_security.multitenancy.enabled: false
# opensearch_security.multitenancy.tenants.preferred: ['Private', 'Global']
# opensearch_security.readonly_mode.roles: ['kibana_read_only']
# opensearch_security.cookie.secure: false
workspace.enabled: true
opensearch.ignoreVersionMismatch: true
opensearchDashboards.dashboardAdmin.users: ['admin']
data_source.enabled: true
uiSettings:
overrides:
'home:useNewHomePage': true
# assistant.chat.enabled: true
# OpenSearch Dashboards uses an index in OpenSearch to store saved searches, visualizations and
# dashboards. OpenSearch Dashboards creates a new index if the index doesn't already exist.
#opensearchDashboards.index: ".opensearch_dashboards"
Expand Down Expand Up @@ -325,7 +342,7 @@
# "none": The data source is readonly for all users.
# "dashboard_admin": The data source can only be managed by dashboard admin.
# "all": The data source can be managed by all users. Default to "all".
# data_source_management.manageableBy: "all"
# data_source.manageableBy: "all"

# Set the backend roles in groups, whoever has the backend roles defined in this config will be regard as dataSourceAdmin.
# DataSource Admin will have the access to all the data source saved objects inside OpenSearch Dashboards by api.
Expand Down Expand Up @@ -363,15 +380,8 @@
# This publishes the Application Usage and UI Metrics into the saved object, which can be accessed by /api/stats?extended=true&legacy=true&exclude_usage=false
# usageCollection.uiMetric.enabled: false

# Set the value to true to enable enhancements for the data plugin
# data.enhancements.enabled: false

# Set the value to true to enable dynamic config service to obtain configs from a config store. By default, it's disabled
# dynamic_config_service.enabled: false

# Set the backend roles in groups or users, whoever has the backend roles or exactly match the user ids defined in this config will be regard as dashboard admin.
# Dashboard admin will have the access to all the workspaces(workspace.enabled: true) and objects inside OpenSearch Dashboards.
# The default config is [], and no one will be dashboard admin.
# If the user config is set to wildcard ["*"], anyone will be dashboard admin.
# opensearchDashboards.dashboardAdmin.groups: ["dashboard_admin"]
# opensearchDashboards.dashboardAdmin.users: ["dashboard_admin"]
# opensearchDashboards.dashboardAdmin.users: ['dashboard_admin']
# opensearchDashboards.dashboardAdmin.users: ['a'] set user is not admin
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"dashboarding"
],
"private": true,
"version": "3.0.0",
"version": "2.15.0",
"branch": "main",
"types": "./opensearch_dashboards.d.ts",
"tsdocMetadata": "./build/tsdoc-metadata.json",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -568,12 +568,12 @@ describe('SavedObjectsTable', () => {
});

describe('delete', () => {
it('should show a confirm modal', async () => {
it('should show a confirm modal with correct icons and tooltips', async () => {
const component = shallowRender();

const mockSelectedSavedObjects = [
{ id: '1', type: 'index-pattern' },
{ id: '3', type: 'dashboard' },
{ id: '1', type: 'config', meta: { icon: 'configApp' } },
{ id: '3', type: 'dashboard', meta: { icon: 'dashboardApp' } },
] as SavedObjectWithMetadata[];

// Ensure all promises resolve
Expand All @@ -590,6 +590,17 @@ describe('SavedObjectsTable', () => {
expect(component.find('EuiModalHeader')).toMatchSnapshot();
expect(component.find('EuiModalFooter')).toMatchSnapshot();
expect(component.find('Delete assets')).toMatchSnapshot();

const table = component.find('EuiInMemoryTable');
const columns = table.prop('columns');

const typeField = columns.find((col) => col.field === 'type');
mockSelectedSavedObjects.forEach((savedObject) => {
const renderedContent = typeField.render(savedObject.type, savedObject);
expect(renderedContent.props.content).toBe(savedObject.type);
const iconElement = renderedContent.props.children;
expect(iconElement.props.type).toBe(savedObject.meta.icon || 'apps');
});
});

it('should delete selected objects', async () => {
Expand Down

0 comments on commit 20f4ba9

Please sign in to comment.