diff --git a/app/react/edge/edge-stacks/ItemView/EnvironmentsDatatable/columns.tsx b/app/react/edge/edge-stacks/ItemView/EnvironmentsDatatable/columns.tsx index f7702b7f1..c84abe341 100644 --- a/app/react/edge/edge-stacks/ItemView/EnvironmentsDatatable/columns.tsx +++ b/app/react/edge/edge-stacks/ItemView/EnvironmentsDatatable/columns.tsx @@ -9,13 +9,13 @@ import UpToDate from '@/assets/ico/icon_up-to-date.svg?c'; import { isoDateFromTimestamp } from '@/portainer/filters/filters'; import { isBE } from '@/react/portainer/feature-flags/feature-flags.service'; import { getDashboardRoute } from '@/react/portainer/environments/utils'; +import { cleanGitRepoUrl } from '@/react/portainer/gitops/utils'; import { Button } from '@@/buttons'; import { Icon } from '@@/Icon'; import { Link } from '@@/Link'; import { DeploymentStatus, EdgeStackStatus, StatusType } from '../../types'; -import { removeTrailingGitExtension } from '../../utils'; import { EnvironmentActions } from './EnvironmentActions'; import { ActionStatus } from './ActionStatus'; @@ -188,9 +188,9 @@ function TargetVersionCell({ {row.original.TargetCommitHash ? (
@@ -239,9 +239,9 @@ function DeployedVersionCell({
{statusIcon} diff --git a/app/react/edge/edge-stacks/ListView/EdgeStacksDatatable/columns.tsx b/app/react/edge/edge-stacks/ListView/EdgeStacksDatatable/columns.tsx index 5452d926f..8167f35f8 100644 --- a/app/react/edge/edge-stacks/ListView/EdgeStacksDatatable/columns.tsx +++ b/app/react/edge/edge-stacks/ListView/EdgeStacksDatatable/columns.tsx @@ -3,12 +3,12 @@ import _ from 'lodash'; import { isoDateFromTimestamp } from '@/portainer/filters/filters'; import { isBE } from '@/react/portainer/feature-flags/feature-flags.service'; +import { cleanGitRepoUrl } from '@/react/portainer/gitops/utils'; import { buildNameColumn } from '@@/datatables/NameCell'; import { Link } from '@@/Link'; import { StatusType } from '../../types'; -import { removeTrailingGitExtension } from '../../utils'; import { EdgeStackStatus } from './EdgeStacksStatus'; import { DecoratedEdgeStack } from './types'; @@ -152,9 +152,9 @@ export const columns = _.compact([
{item.GitConfig.ConfigHash.slice(0, 7)} diff --git a/app/react/edge/edge-stacks/utils.ts b/app/react/edge/edge-stacks/utils.ts index 5c4bedee2..82cbfec7b 100644 --- a/app/react/edge/edge-stacks/utils.ts +++ b/app/react/edge/edge-stacks/utils.ts @@ -19,8 +19,3 @@ export function getValidEditorTypes( ? _.intersection(...endpointTypes.map((type) => right[type])) : [EditorType.Compose, EditorType.Kubernetes]; } - -export function removeTrailingGitExtension(url: string) { - // the url could have the .git extension. Remove it if it does. - return url.replace(/\.git$/, ''); -} diff --git a/app/react/portainer/gitops/utils.ts b/app/react/portainer/gitops/utils.ts index 654dd1755..79f6a1eff 100644 --- a/app/react/portainer/gitops/utils.ts +++ b/app/react/portainer/gitops/utils.ts @@ -32,3 +32,10 @@ export function confirmEnableTLSVerify() { 'Enabling the verification of TLS certificates without ensuring the correct configuration of your Certificate Authority (CA) for self-signed certificates can result in deployment failures.', }); } + +export function cleanGitRepoUrl(url: string) { + return url + .trim() // remove leading and trailing whitespace + .replace(/\/$/, '') // if there's a trailing slash, remove it + .replace(/\.git$/, ''); // if there's a trailing .git extension, remove it +}