diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8e45fe8e29..a3566bab35 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -67,67 +67,3 @@ jobs: with: name: system-test-failures path: apps/dashboard/tmp/screenshots/*.png - - k8s-tests: - runs-on: ubuntu-latest - name: Kubernetes tests - steps: - - name: Checkout ${{ github.sha }} - uses: actions/checkout@v2 - - name: Create kind cluster - uses: container-tools/kind-action@v1 - - name: Apply ondemand RBAC - run: kubectl apply -f hooks/k8s-bootstrap/ondemand.yaml - - name: Get ondemand token - id: token - run: | - TOKEN_NAME=$(kubectl describe serviceaccount ondemand -n ondemand | grep Tokens | awk '{ print $2 }') - TOKEN=$(kubectl describe secret $TOKEN_NAME -n ondemand | grep "token:" | awk '{ print $2 }') - echo "::set-output name=ondemand::${TOKEN}" - - name: Setup kubectl - run: | - kubectl config set-credentials ondemand --token="${{ steps.token.outputs.ondemand }}" - kubectl config set-context kind-kind --user=ondemand - kubectl config use-context kind-kind - kubectl cluster-info - - name: Test k8s-bootstrap - run: /bin/bash hooks/k8s-bootstrap/k8s-bootstrap-ondemand.sh test hooks/hook.env.example - - e2e-tests: - strategy: - fail-fast: false - matrix: - dist: ["el7", "el8", "el9", "ubuntu-20.04", "ubuntu-22.04"] - version: ["2.1"] - runs-on: "ubuntu-latest" - name: E2E test ${{ matrix.dist }} (ondemand-${{ matrix.version }}) - - steps: - - name: Checkout ${{ github.sha }} - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Setup Ruby using Bundler - uses: ruby/setup-ruby@v1 - with: - ruby-version: "2.7.1" - bundler: "2.1.4" - bundler-cache: true - - - name: Build package - run: bundle exec rake package:build[${{ matrix.dist }}] - env: - VERSION: "${{ matrix.version }}.0" - OOD_PACKAGING_DEBUG: 'true' - - - name: Run package tests - run: bundle exec rake test:e2e - env: - BEAKER_set: ${{ matrix.dist }} - OOD_BUILD_REPO: ${{ matrix.version }} - - - name: Debug failure - if: failure() - run: | - find tmp/e2e_ctr/ -type f -name *.log -exec cat {} + diff --git a/apps/dashboard/app/controllers/batch_connect/session_contexts_controller.rb b/apps/dashboard/app/controllers/batch_connect/session_contexts_controller.rb index 657c03ba1b..2d68ac097c 100644 --- a/apps/dashboard/app/controllers/batch_connect/session_contexts_controller.rb +++ b/apps/dashboard/app/controllers/batch_connect/session_contexts_controller.rb @@ -37,8 +37,13 @@ def create respond_to do |format| if @session.save(app: @app, context: @session_context, format: @render_format) cache_file.write(@session_context.to_json) # save context to cache file - - format.html { redirect_to batch_connect_sessions_url, notice: t('dashboard.batch_connect_sessions_status_blurb_create_success') } + + if redirect_to_referer? + format.html { redirect_back allow_other_host: false, fallback_location: batch_connect_sessions_url, notice: t('dashboard.batch_connect_sessions_status_blurb_create_success') } + else + format.html { redirect_to batch_connect_sessions_url, notice: t('dashboard.batch_connect_sessions_status_blurb_create_success') } + end + format.json { head :no_content } else format.html do @@ -79,6 +84,10 @@ def session_contexts_param params.require(:batch_connect_session_context).permit(@session_context.attributes.keys) if params[:batch_connect_session_context].present? end + def redirect_to_referer? + params[:back] ? params[:back] == 'true' : false + end + # Store session context into a cache file def cache_file BatchConnect::Session.cache_root.tap do |p| diff --git a/apps/dashboard/app/helpers/pinned_apps_helper.rb b/apps/dashboard/app/helpers/pinned_apps_helper.rb new file mode 100644 index 0000000000..96c6fa98b8 --- /dev/null +++ b/apps/dashboard/app/helpers/pinned_apps_helper.rb @@ -0,0 +1,18 @@ +# Helper for pinned apps widget +module PinnedAppsHelper + + # utility to add query string parameters to an existing URL + def add_query_parameters(url, parameters) + return url if parameters.to_h.empty? + + as_uri = Addressable::URI.parse(url.to_s) + query_params = as_uri.query_values || {} + as_uri.query_values = query_params.merge(parameters.to_h) + as_uri.to_s + end + + def redirect_to_referer?(link) + @user_configuration.pinned_apps_redirect && link.data.fetch(:method, '').downcase == 'post' + end + +end \ No newline at end of file diff --git a/apps/dashboard/app/models/user_configuration.rb b/apps/dashboard/app/models/user_configuration.rb index c66662427f..595782abda 100644 --- a/apps/dashboard/app/models/user_configuration.rb +++ b/apps/dashboard/app/models/user_configuration.rb @@ -37,6 +37,8 @@ class UserConfiguration # The length of the "Pinned Apps" navbar menu ConfigurationProperty.property(name: :pinned_apps_menu_length, default_value: 6), ConfigurationProperty.property(name: :pinned_apps_group_by, default_value: nil, read_from_env: true), + # Redirect preset pinned apps to the Referer after session creation + ConfigurationProperty.property(name: :pinned_apps_redirect, default_value: false), # Links to change profile under the Help navigation menu ConfigurationProperty.property(name: :profile_links, default_value: []), diff --git a/apps/dashboard/app/views/widgets/pinned_apps/_app.html.erb b/apps/dashboard/app/views/widgets/pinned_apps/_app.html.erb index df40f5b229..cdc581e1c5 100644 --- a/apps/dashboard/app/views/widgets/pinned_apps/_app.html.erb +++ b/apps/dashboard/app/views/widgets/pinned_apps/_app.html.erb @@ -1,15 +1,15 @@ <%- link = app.links.first -%> -<%- link_data = {:method => "get"}.merge link.data -%> +<%- link_params = redirect_to_referer?(link) ? { back: 'true' } : {} -%> <%- tile_data = link.tile -%>