fix: edit ds button was disabled due to no user perm in ds object (#25235)

This commit is contained in:
Aman Agarwal 2023-07-11 13:30:32 +05:30 committed by GitHub
parent 546843ebd6
commit fe59f0196e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,23 @@
import * as _ from "../../../../support/Objects/ObjectsCore";
const { agHelper, apiPage, dataSources } = _;
let dsName: any;
describe("Bug 25148 - Edit Datasource button was disabled on Authentication tab of Api action", () => {
it("1. Checking if the Edit datasource button is enabled or not", () => {
dataSources.NavigateToDSCreateNew();
agHelper.GenerateUUID();
cy.get("@guid").then((uid) => {
dsName = "AuthAPI " + uid;
dataSources.CreatePlugIn("Authenticated API");
agHelper.RenameWithInPane(dsName, false);
dataSources.FillAuthAPIUrl();
dataSources.SaveDatasource();
apiPage.CreateApi("API" + uid, "GET", true);
apiPage.SelectPaneTab("Authentication");
agHelper.AssertElementEnabledDisabled(apiPage._saveAsDS, 0, false);
// Last one if present on the authentication tab.
agHelper.AssertElementEnabledDisabled(apiPage._saveAsDS, 1, false);
});
});
});

View File

@ -149,6 +149,10 @@ const mapStateToProps = (state: AppState, ownProps: any): ReduxStateProps => {
datasourceFromDataSourceList.datasourceStorages[
currentEnvironment
].datasourceId;
// Adding user permissions for datasource from datasourceFromDataSourceList
datasourceMerged.userPermissions =
datasourceFromDataSourceList.userPermissions || [];
}
}