opensearch-project / OpenSearch-Dashboards

📊 Open source visualization dashboards for OpenSearch.
https://opensearch.org/docs/latest/dashboards/index/
Apache License 2.0
1.67k stars 871 forks source link

[BUG] Can create multiple Data Source using the same Data Source Name through API #6823

Open zhyuanqi opened 4 months ago

zhyuanqi commented 4 months ago

Describe the bug

Can create multiple Data Source using the same Data Source Name through API. Then we can have a few datasource with the same name

To Reproduce Steps to reproduce the behavior:

  1. Create data source use API. In our case, we use cy.request.

    cy.request({
    method: "POST",
      url: `${BASE_PATH}/api/saved_objects/data-source`,
      headers: {
          osd-xsrf": true,
      },
      body: {
          attributes: {
             title: "testDataSource",
            endpoint: Cypress.env("dataSourceEndpoint"),
        auth: {
            type: "token_exchange",
            credentials: {
                region: Cypress.env("dataSourceRegion"),
                roleARN: Cypress.env("dataSourceRoleArn"),
                service: getDataSourceServiceName(),
            },
       },
    },
    },
  2. We can create several dataSource with the same name

    Screenshot 2024-05-23 at 12 02 27 PM
  3. You will see odd behavior in selector as well.

    Screenshot 2024-05-23 at 12 02 16 PM

Expected behavior The API behavior should be consistent as UI behavior. The datasource cannot have the same name

OpenSearch Version OS_2.13

Dashboards Version OS_2.13

Plugins

Please list all plugins currently enabled.

Screenshots

If applicable, add screenshots to help explain your problem.

Host/Environment (please complete the following information):

Additional context

Add any other context about the problem here.

BionIT commented 4 months ago

Hi @zhyuanqi, are you working on this issue and should it be done for 2.15 ?