mirror of https://github.com/portainer/portainer
				
				
				
			fix(gitops): correct commit hash link [EE-6346] (#10723)
							parent
							
								
									eb23818f83
								
							
						
					
					
						commit
						974378c9b5
					
				| 
						 | 
				
			
			@ -15,6 +15,7 @@ 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';
 | 
			
		||||
| 
						 | 
				
			
			@ -187,7 +188,9 @@ function TargetVersionCell({
 | 
			
		|||
      {row.original.TargetCommitHash ? (
 | 
			
		||||
        <div>
 | 
			
		||||
          <a
 | 
			
		||||
            href={`${row.original.GitConfigURL}/commit/${row.original.TargetCommitHash}`}
 | 
			
		||||
            href={`${removeTrailingGitExtension(
 | 
			
		||||
              row.original.GitConfigURL
 | 
			
		||||
            )}/commit/${row.original.TargetCommitHash}`}
 | 
			
		||||
            target="_blank"
 | 
			
		||||
            rel="noreferrer"
 | 
			
		||||
          >
 | 
			
		||||
| 
						 | 
				
			
			@ -236,7 +239,9 @@ function DeployedVersionCell({
 | 
			
		|||
        <div>
 | 
			
		||||
          {statusIcon}
 | 
			
		||||
          <a
 | 
			
		||||
            href={`${row.original.GitConfigURL}/commit/${row.original.TargetCommitHash}`}
 | 
			
		||||
            href={`${removeTrailingGitExtension(
 | 
			
		||||
              row.original.GitConfigURL
 | 
			
		||||
            )}/commit/${row.original.TargetCommitHash}`}
 | 
			
		||||
            target="_blank"
 | 
			
		||||
            rel="noreferrer"
 | 
			
		||||
          >
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,6 +8,7 @@ import { buildNameColumn } from '@@/datatables/buildNameColumn';
 | 
			
		|||
import { Link } from '@@/Link';
 | 
			
		||||
 | 
			
		||||
import { StatusType } from '../../types';
 | 
			
		||||
import { removeTrailingGitExtension } from '../../utils';
 | 
			
		||||
 | 
			
		||||
import { EdgeStackStatus } from './EdgeStacksStatus';
 | 
			
		||||
import { DecoratedEdgeStack } from './types';
 | 
			
		||||
| 
						 | 
				
			
			@ -146,7 +147,9 @@ export const columns = _.compact([
 | 
			
		|||
              <div className="text-center">
 | 
			
		||||
                <a
 | 
			
		||||
                  target="_blank"
 | 
			
		||||
                  href={`${item.GitConfig.URL}/commit/${item.GitConfig.ConfigHash}`}
 | 
			
		||||
                  href={`${removeTrailingGitExtension(
 | 
			
		||||
                    item.GitConfig.URL
 | 
			
		||||
                  )}/commit/${item.GitConfig.ConfigHash}`}
 | 
			
		||||
                  rel="noreferrer"
 | 
			
		||||
                >
 | 
			
		||||
                  {item.GitConfig.ConfigHash.slice(0, 7)}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -19,3 +19,8 @@ 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$/, '');
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue