From d1302e9ae7c55e32a8182581d3377985945a106c Mon Sep 17 00:00:00 2001 From: d064310 Date: Wed, 8 May 2024 06:07:19 +0200 Subject: [PATCH] object-storage: fix rails routes --- .../admin/shared_object_storage.js | 32 +++++++++---------- .../object_storage/application_controller.rb | 11 ------- .../widgets/app/hooks/useActions.js | 12 +++---- plugins/object_storage/config/routes.rb | 2 +- 4 files changed, 22 insertions(+), 35 deletions(-) diff --git a/e2e/cypress/integration/admin/shared_object_storage.js b/e2e/cypress/integration/admin/shared_object_storage.js index 63eabd6420..ca44722f80 100644 --- a/e2e/cypress/integration/admin/shared_object_storage.js +++ b/e2e/cypress/integration/admin/shared_object_storage.js @@ -8,7 +8,7 @@ describe("shared object storage", () => { }) it("open object storage and check create container button", () => { - cy.visit(`/${Cypress.env("TEST_DOMAIN")}/admin/object-storage/`) + cy.visit(`/${Cypress.env("TEST_DOMAIN")}/admin/object-storage/swift/`) cy.contains("[data-test=page-title]", "Object Storage") cy.contains("a", "Create container").click() cy.contains( @@ -18,7 +18,7 @@ describe("shared object storage", () => { }) it("open object storage and check capabilities dialog", () => { - cy.visit(`/${Cypress.env("TEST_DOMAIN")}/admin/object-storage/`) + cy.visit(`/${Cypress.env("TEST_DOMAIN")}/admin/object-storage/swift/`) cy.contains("[data-test=page-title]", "Object Storage") cy.get("i.fa-info-circle").click() cy.contains("Capabilities") @@ -28,7 +28,7 @@ describe("shared object storage", () => { cy.visit( `/${Cypress.env( "TEST_DOMAIN" - )}/admin/object-storage/containers/elektra-test/access-control` + )}/admin/object-storage/swift/containers/elektra-test/access-control` ) // eslint-disable-next-line cypress/no-unnecessary-waiting cy.wait(3000) @@ -47,7 +47,7 @@ describe("shared object storage", () => { cy.visit( `/${Cypress.env( "TEST_DOMAIN" - )}/admin/object-storage/containers/elektra-test/properties` + )}/admin/object-storage/swift/containers/elektra-test/properties` ) cy.get('[data-test="metaDataKey_0"]').type("{selectAll}footestkey") cy.get('[data-test="metaDataValue_0"]').type("{selectAll}footestvalue") @@ -57,7 +57,7 @@ describe("shared object storage", () => { cy.visit( `/${Cypress.env( "TEST_DOMAIN" - )}/admin/object-storage/containers/elektra-test/properties` + )}/admin/object-storage/swift/containers/elektra-test/properties` ) // check value and delete cy.get('[data-test="metaDataValue_0"]') @@ -72,7 +72,7 @@ describe("shared object storage", () => { }) it("open object storage and elektra-test container and check action buttons", () => { - cy.visit(`/${Cypress.env("TEST_DOMAIN")}/admin/object-storage/`) + cy.visit(`/${Cypress.env("TEST_DOMAIN")}/admin/object-storage/swift/`) cy.contains("[data-test=page-title]", "Object Storage") cy.contains("a", "elektra-test").click() cy.contains("a", "Create folder").click() @@ -87,7 +87,7 @@ describe("shared object storage", () => { cy.visit( `/${Cypress.env( "TEST_DOMAIN" - )}/admin/object-storage/containers/elektra-test/objects/X18kPQ%3D%3D/amiga.jpg/show` + )}/admin/object-storage/swift/containers/elektra-test/objects/X18kPQ%3D%3D/amiga.jpg/show` ) cy.get('[data-test="metaDataKey_0"]').type("{selectAll}footestkey") cy.get('[data-test="metaDataValue_0"]').type("{selectAll}footestvalue") @@ -97,7 +97,7 @@ describe("shared object storage", () => { cy.visit( `/${Cypress.env( "TEST_DOMAIN" - )}/admin/object-storage/containers/elektra-test/objects/X18kPQ%3D%3D/amiga.jpg/show` + )}/admin/object-storage/swift/containers/elektra-test/objects/X18kPQ%3D%3D/amiga.jpg/show` ) // check value and delete cy.get('[data-test="metaDataValue_0"]') @@ -115,7 +115,7 @@ describe("shared object storage", () => { cy.visit( `/${Cypress.env( "TEST_DOMAIN" - )}/admin/object-storage/containers/elektra-test/objects/X18kPQ%3D%3D/amiga.jpg/copy` + )}/admin/object-storage/swift/containers/elektra-test/objects/X18kPQ%3D%3D/amiga.jpg/copy` ) cy.contains("Target container") cy.contains("Target path") @@ -126,7 +126,7 @@ describe("shared object storage", () => { cy.visit( `/${Cypress.env( "TEST_DOMAIN" - )}/admin/object-storage/containers/elektra-test/objects/X18kPQ%3D%3D/amiga.jpg/move` + )}/admin/object-storage/swift/containers/elektra-test/objects/X18kPQ%3D%3D/amiga.jpg/move` ) cy.contains("Target container") cy.contains("Target path") @@ -137,7 +137,7 @@ describe("shared object storage", () => { cy.visit( `/${Cypress.env( "TEST_DOMAIN" - )}/admin/object-storage/containers/elektra-test/empty` + )}/admin/object-storage/swift/containers/elektra-test/empty` ) cy.contains("button", "Empty").should("be.disabled") cy.contains( @@ -153,7 +153,7 @@ describe("shared object storage", () => { cy.visit( `/${Cypress.env( "TEST_DOMAIN" - )}/admin/object-storage/containers/elektra-test-empty/empty` + )}/admin/object-storage/swift/containers/elektra-test-empty/empty` ) cy.contains("Nothing to do. Container is already empty.").click() }) @@ -162,7 +162,7 @@ describe("shared object storage", () => { cy.visit( `/${Cypress.env( "TEST_DOMAIN" - )}/admin/object-storage/containers/elektra-test/delete` + )}/admin/object-storage/swift/containers/elektra-test/delete` ) cy.contains( "Cannot delete Container contains objects. Please empty it first." @@ -174,7 +174,7 @@ describe("shared object storage", () => { cy.visit( `/${Cypress.env( "TEST_DOMAIN" - )}/admin/object-storage/containers/elektra-test-empty/delete` + )}/admin/object-storage/swift/containers/elektra-test-empty/delete` ) cy.contains("button", "Delete").should("be.disabled") cy.contains( @@ -190,7 +190,7 @@ describe("shared object storage", () => { }) it("open object storage and elektra-test container and check download big files dialog", () => { - cy.visit(`/${Cypress.env("TEST_DOMAIN")}/admin/object-storage/`) + cy.visit(`/${Cypress.env("TEST_DOMAIN")}/admin/object-storage/swift/`) cy.contains("[data-test=page-title]", "Object Storage") cy.contains("a", "elektra-test").click() // force: true prevents this error: @@ -201,7 +201,7 @@ describe("shared object storage", () => { // this is not working because popper is not rendering correctly // it("open object storage and search elektra-test to test dialogs", () => { - // cy.visit(`/${Cypress.env("TEST_DOMAIN")}/admin/object-storage/`) + // cy.visit(`/${Cypress.env("TEST_DOMAIN")}/admin/object-storage/swift/`) // cy.get('[data-test="search"]').type("elektra-test-empty") // cy.get('[data-test="dropdown"]').click() // cy.contains("a", "Empty").click() diff --git a/plugins/object_storage/app/controllers/object_storage/application_controller.rb b/plugins/object_storage/app/controllers/object_storage/application_controller.rb index 5172175dd1..0e00efa5c0 100644 --- a/plugins/object_storage/app/controllers/object_storage/application_controller.rb +++ b/plugins/object_storage/app/controllers/object_storage/application_controller.rb @@ -2,17 +2,6 @@ module ObjectStorage class ApplicationController < ::DashboardController - # def swift - # @service_name = "swift" - # byebug - # render :show - # end - - # def ceph - # @service_name = "ceph" - # render :show - # end - def show @service_name = params[:service_name] end diff --git a/plugins/object_storage/app/javascript/widgets/app/hooks/useActions.js b/plugins/object_storage/app/javascript/widgets/app/hooks/useActions.js index af497b58e3..f4834a6787 100644 --- a/plugins/object_storage/app/javascript/widgets/app/hooks/useActions.js +++ b/plugins/object_storage/app/javascript/widgets/app/hooks/useActions.js @@ -321,13 +321,11 @@ const useActions = () => { [] ) - const getAcls = React.useCallback( - ({ read, write }) => - apiClient - .get("check-acls", { params: { read, write } }) - .then((result) => result.data), - [] - ) + const getAcls = React.useCallback(({ read, write }) => { + return apiClient + .get(`check-acls`, { params: { read, write } }) + .then((result) => result.data) + }, []) const endpointURL = React.useCallback( (containerName, name, params = {}) => { return apiClient diff --git a/plugins/object_storage/config/routes.rb b/plugins/object_storage/config/routes.rb index 569b3c1d7e..0900734660 100644 --- a/plugins/object_storage/config/routes.rb +++ b/plugins/object_storage/config/routes.rb @@ -4,7 +4,7 @@ # root to: "application#swift", as: :widget - # get "check-acls" => "application#check_acls" + get "check-acls" => "application#check_acls" # # catch all other paths and point them to root # get "swift/*path", to: "application#swift"