mirror of
https://github.com/hashicorp/vault.git
synced 2026-05-28 04:10:44 -04:00
* [VAULT-33083] UI: support builtin plugins as external plugins * address copilot review comments * add changelog * remove unused id property * address some nits & add test coverage * should use utils instead of mixins * update comments * move/consolidate logic for 'transform' engine type into ENGINE_TYPE_TO_MODEL_TYPE_MAP, added/updated test coverage * cleanup: extract transform engine model type logic into helper functions * address pr comment * separation of concerns - move relevant vars/fns from all engines metadata to external plugin helpers & secret engine model helpers files * add TODO; remove unnecessary exports * rename secret-engine-model-helpers to secret-engine-helpers * update unknown engine metadata from var to fn to handle a methodType param * remove unnecessary test * update changelog; return methodType for unknown engine metadata, simplify code for readability * add optional chaining for fail-safe * address kvv1 edge case - on exit configuration, kvv1 should redirect to list-root while kvv2 should redirect to the engineRoute defined in all-engines-metadata * add ibm header * fix test failure after updating unknown engine type Co-authored-by: Shannon Roberts (Beagin) <beagins@users.noreply.github.com>
35 lines
1 KiB
TypeScript
35 lines
1 KiB
TypeScript
/**
|
|
* Copyright IBM Corp. 2016, 2025
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import Route from '@ember/routing/route';
|
|
import { getEffectiveEngineType } from 'vault/utils/external-plugin-helpers';
|
|
|
|
/**
|
|
* Utility functions for backend-related route operations.
|
|
* Replaces the deprecated backend-helpers mixin.
|
|
*/
|
|
|
|
/**
|
|
* Get the effective engine type for a given route's backend.
|
|
* This handles external plugin mapping to builtin types.
|
|
*
|
|
* @param route - The Ember route instance
|
|
* @returns The effective engine type
|
|
*/
|
|
export function getBackendEffectiveType(route: Route): string {
|
|
const backendModel = route.modelFor('vault.cluster.secrets.backend') as { engineType: string };
|
|
return getEffectiveEngineType(backendModel?.engineType);
|
|
}
|
|
|
|
/**
|
|
* Get the current backend path parameter from a route.
|
|
*
|
|
* @param route - The Ember route instance
|
|
* @returns The backend path
|
|
*/
|
|
export function getEnginePathParam(route: Route): string {
|
|
const params = route.paramsFor('vault.cluster.secrets.backend') as { backend: string };
|
|
return params?.backend;
|
|
}
|