소스 검색

add case for ecr parsing

Alexander Belanger 5 년 전
부모
커밋
a578531fb8
1개의 변경된 파일과 10개의 추가작업 그리고 0개의 파일을 삭제
  1. 10 0
      dashboard/src/components/image-selector/TagList.tsx

+ 10 - 0
dashboard/src/components/image-selector/TagList.tsx

@@ -8,6 +8,8 @@ import { Context } from "shared/Context";
 
 import Loading from "../Loading";
 
+var ecrRepoRegex = /(^[a-zA-Z0-9][a-zA-Z0-9-_]*)\.dkr\.ecr(\-fips)?\.([a-zA-Z0-9][a-zA-Z0-9-_]*)\.amazonaws\.com(\.cn)?/igm
+
 type PropsType = {
   setSelectedTag: (x: string) => void;
   selectedTag: string;
@@ -32,8 +34,16 @@ export default class TagList extends Component<PropsType, StateType> {
 
   componentDidMount() {
     const { currentProject } = this.context;
+
     let splits = this.props.selectedImageUrl.split("/");
     let repoName = splits[splits.length - 1];
+
+    let matches = this.props.selectedImageUrl.match(ecrRepoRegex)
+
+    if (matches) {
+      repoName = this.props.selectedImageUrl.split(/\/(.+)/)[1]
+    }
+  
     api
       .getImageTags(
         "<token>",