Skip to content

Commit

Permalink
revert some of the changes that were reverte.
Browse files Browse the repository at this point in the history
  • Loading branch information
ciyer committed Aug 28, 2024
1 parent 7b89dd8 commit 6a6393c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import { Offcanvas, OffcanvasBody } from "reactstrap";
import { CredentialMoreInfo } from "../../../project/components/cloudStorage/CloudStorageItem";
import { CLOUD_STORAGE_SAVED_SECRET_DISPLAY_VALUE } from "../../../project/components/cloudStorage/projectCloudStorage.constants";
import { getCredentialFieldDefinitions } from "../../../project/utils/projectCloudStorage.utils";
import { useGetStoragesV2ByStorageIdSecretsQuery } from "../../../projectsV2/api/projectV2.enhanced-api";
import type { CloudStorageGetV2Read } from "../../../projectsV2/api/storagesV2.api";
import { storageSecretNameToFieldName } from "../../../secrets/secrets.utils";
import { DataSourceActions } from "./DataSourceDisplay";
Expand All @@ -46,9 +45,7 @@ export function DataSourceView({
const anySensitiveField = Object.keys(storageDefinition.configuration).some(
(key) => sensitiveFields.includes(key)
);
const { data: storageSecrets } = useGetStoragesV2ByStorageIdSecretsQuery({
storageId: storage.storage.storage_id,
});
const storageSecrets = storage.secrets;
const savedCredentialFields =
storageSecrets?.reduce((acc: Record<string, string>, s) => {
acc[storageSecretNameToFieldName(s)] = s.name;
Expand Down
9 changes: 7 additions & 2 deletions client/src/features/sessionsV2/SessionStartPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,11 @@ import {
storageDefinitionFromConfig,
} from "../project/utils/projectCloudStorage.utils";
import type { Project } from "../projectsV2/api/projectV2.api";
import { useGetProjectsByNamespaceAndSlugQuery } from "../projectsV2/api/projectV2.enhanced-api";
import { usePostStoragesV2SecretsForSessionLaunchMutation } from "../projectsV2/api/projectV2.enhanced-api";
import {
projectV2Api,
useGetProjectsByNamespaceAndSlugQuery,
usePostStoragesV2SecretsForSessionLaunchMutation,
} from "../projectsV2/api/projectV2.enhanced-api";
import { storageSecretNameToFieldName } from "../secrets/secrets.utils";
import { useStartRenku2SessionMutation } from "../session/sessions.api";
import type { CloudStorageConfiguration } from "./CloudStorageSecretsModal";
Expand Down Expand Up @@ -152,6 +155,8 @@ function SaveCloudStorage({
dispatch(
startSessionOptionsV2Slice.actions.setCloudStorage(cloudStorageConfigs)
);
// After all the changes have been made, indicate that the storages need to be reloaded
dispatch(projectV2Api.util.invalidateTags(["Storages"]));
}
}, [
dispatch,
Expand Down
14 changes: 5 additions & 9 deletions tests/cypress/e2e/projectV2DataSourceCredentials.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ describe("Set up data sources with credentials", () => {

cy.getDataCy("data-storage-name").should("contain.text", "example-storage");
cy.getDataCy("data-storage-name").click();
cy.wait("@getCloudStorageSecrets");
cy.getDataCy("data-source-title").should("contain.text", "example-storage");
cy.getDataCy("access_key_id-value").should("contain.text", "<sensitive>");
cy.getDataCy("data-source-view-back-button").click();
Expand Down Expand Up @@ -156,7 +155,6 @@ describe("Set up data sources with credentials", () => {
cy.wait("@getCloudStorageV2");
cy.getDataCy("data-storage-name").should("contain.text", "example-storage");
cy.getDataCy("data-storage-name").click();
cy.wait("@getCloudStorageSecrets2");
cy.getDataCy("data-source-title").should("contain.text", "example-storage");
cy.getDataCy("access_key_id-value").should(
"contain.text",
Expand Down Expand Up @@ -191,7 +189,6 @@ describe("Set up data sources with credentials", () => {
// Credentials should not yet be stored
cy.getDataCy("data-storage-name").should("contain.text", "example-storage");
cy.getDataCy("data-storage-name").click();
cy.wait("@getCloudStorageSecrets");
cy.getDataCy("data-source-title").should("contain.text", "example-storage");
cy.getDataCy("access_key_id-value").should("contain.text", "<sensitive>");
cy.getDataCy("data-source-view-back-button").click();
Expand Down Expand Up @@ -241,7 +238,6 @@ describe("Set up data sources with credentials", () => {
// Credentials should be stored
cy.getDataCy("data-storage-name").should("contain.text", "example-storage");
cy.getDataCy("data-storage-name").click();
cy.wait("@getCloudStorageSecrets2");
cy.getDataCy("data-source-title").should("contain.text", "example-storage");
cy.getDataCy("access_key_id-value").should(
"contain.text",
Expand Down Expand Up @@ -292,7 +288,6 @@ describe("Set up data sources with credentials", () => {
// Credentials should be stored
cy.getDataCy("data-storage-name").should("contain.text", "example-storage");
cy.getDataCy("data-storage-name").click();
cy.wait("@getCloudStorageSecrets");
cy.getDataCy("data-source-title").should("contain.text", "example-storage");
cy.getDataCy("secret_access_key-value").should(
"contain.text",
Expand Down Expand Up @@ -343,7 +338,6 @@ describe("Set up data sources with credentials", () => {
// Credentials should be stored
cy.getDataCy("data-storage-name").should("contain.text", "example-storage");
cy.getDataCy("data-storage-name").click();
cy.wait("@getCloudStorageSecrets");
cy.getDataCy("data-source-title").should("contain.text", "example-storage");
cy.getDataCy("secret_access_key-value").should(
"contain.text",
Expand Down Expand Up @@ -382,6 +376,11 @@ describe("Set up data sources with credentials", () => {
},
],
})
.cloudStorage({
isV2: true,
fixture: "cloudStorage/cloud-storage-with-secrets-values-full.json",
name: "getCloudStorageV2",
})
.cloudStorageSecrets({
fixture: "cloudStorage/cloud-storage-secrets.json",
});
Expand All @@ -402,7 +401,6 @@ describe("Set up data sources with credentials", () => {
// Credentials should be stored
cy.getDataCy("data-storage-name").should("contain.text", "example-storage");
cy.getDataCy("data-storage-name").click();
cy.wait("@getCloudStorageSecrets");
cy.getDataCy("data-source-title").should("contain.text", "example-storage");
cy.getDataCy("access_key_id-value").should(
"contain.text",
Expand Down Expand Up @@ -435,7 +433,6 @@ describe("Set up data sources with credentials", () => {
// Credentials should be stored
cy.getDataCy("data-storage-name").should("contain.text", "example-storage");
cy.getDataCy("data-storage-name").click();
cy.wait("@getCloudStorageSecrets");
cy.getDataCy("data-source-title").should("contain.text", "example-storage");
cy.getDataCy("secret_access_key-value").should(
"contain.text",
Expand All @@ -462,7 +459,6 @@ describe("Set up data sources with credentials", () => {
// Credentials should be changed
cy.getDataCy("data-storage-name").should("contain.text", "example-storage");
cy.getDataCy("data-storage-name").click();
cy.wait("@getCloudStorageSecrets");
cy.getDataCy("data-source-title").should("contain.text", "example-storage");
cy.getDataCy("access_key_id-value").should("contain.text", "<sensitive>");
cy.getDataCy("data-source-view-back-button").click();
Expand Down

0 comments on commit 6a6393c

Please sign in to comment.