Skip to content
Snippets Groups Projects
Commit a327e5e1 authored by Imre Toth's avatar Imre Toth
Browse files

Merge branch 'ICSHWI-9598_Unifying_git_tags_endpoints' into 'develop'

ICSHW-9598: Unifying git tag endpoints

See merge request !205
parents d460697f 07b1b80e
No related branches found
No related tags found
3 merge requests!270Merging develop branch to master in order to create RC,!222Fixing missing time interval parameter for logs,!205ICSHW-9598: Unifying git tag endpoints
Pipeline #117008 passed
......@@ -760,7 +760,8 @@ export function unpackTagAndCommitIdList(tagList) {
export function useTagsAndCommitIds(onError) {
const api = useContext(apiContext);
const method = useCallAndUnpack((gitProjectId, reference) => api.apis.Git.listTagsAndCommitIds({ project_id: gitProjectId, reference: reference }), unpackTagAndCommitIdList)
const method = useCallAndUnpack((gitProjectId, reference, includeAllReference, searchMethod) =>
api.apis.Git.listTagsAndCommitIds({ project_id: gitProjectId, reference: reference, include_all_reference: includeAllReference, search_method: searchMethod }), unpackTagAndCommitIdList)
return useAsync({ fcn: method, call: false, onError: onError, init: [] });
}
......@@ -886,10 +887,4 @@ export function useOwnIocsWithAlarms() {
const method = useCallAndUnpack(api.apis.IOCs.listOwnIocsWithAlarms)
return useAsync({ fcn: method, call: true, init: [] });
}
export function useSearchTagsAndCommitsByRef(onError) {
const api = useContext(apiContext);
const method = useCallAndUnpack((gitProjectId, reference) => api.apis.Git.searchTagsAndCommitsByRefName({ project_id: gitProjectId, reference: reference }), unpackTagAndCommitIdList)
return useAsync({ fcn: method, call: false, onError: onError, init: [] });
}
}
\ No newline at end of file
import React, { useEffect, useState } from "react";
import { Button, TextField, Dialog, DialogActions, DialogContent, DialogTitle, Typography, makeStyles, Tooltip } from "@material-ui/core";
import { Autocomplete, Alert } from "@material-ui/lab";
import { useCSEntrySearch, useSearchTagsAndCommitsByRef } from "../../api/SwaggerApi";
import { useCSEntrySearch, useTagsAndCommitIds } from "../../api/SwaggerApi";
import { useTypingTimer } from "../common/SearchBoxFilter/TypingTimer";
import {formatDate, transformHostQuery} from "../common/Helper";
......@@ -23,7 +23,7 @@ export function IOCDeployDialog({ open, setOpen, submitCallback, hasActiveDeploy
const [hosts, getHosts] = useCSEntrySearch();
const [host, setHost] = useState(init);
const [query, onHostKeyUp] = useTypingTimer({interval: 500});
const [tagOrCommitId, getTagOrCommitId] = useSearchTagsAndCommitsByRef(onError);
const [tagOrCommitId, getTagOrCommitId] = useTagsAndCommitIds(onError);
const [gitRepo, setGitRepo] = useState(init.git || "");
const [gitVersion, setGitVersion] = useState(init.version || "");
const [queryGitVersion, onGitVersionKeyUp] = useTypingTimer({interval: 500});
......@@ -34,7 +34,7 @@ export function IOCDeployDialog({ open, setOpen, submitCallback, hasActiveDeploy
};
useEffect(() => getHosts({ query: transformHostQuery(`${query}`)}), [query, getHosts]);
useEffect(() => getTagOrCommitId(gitProjectId, queryGitVersion), [queryGitVersion, gitProjectId, getTagOrCommitId]);
useEffect(() => {getTagOrCommitId(gitProjectId, queryGitVersion, false, 'CONTAINS');}, [queryGitVersion, gitProjectId, getTagOrCommitId]);
const onSubmit = (event) => {
event.preventDefault();
......@@ -90,7 +90,7 @@ export function IOCDeployDialog({ open, setOpen, submitCallback, hasActiveDeploy
"reference": init.version,
"shortReference": init.shortVersion ? init.shortVersion : init.version
} : null }
onFocus={(event) => {getTagOrCommitId(gitProjectId);}}
getOptionLabel={(option) => {
return option.shortReference;
}}
......@@ -105,7 +105,7 @@ export function IOCDeployDialog({ open, setOpen, submitCallback, hasActiveDeploy
onChange={(event, value, reason) => {
setGitVersion(value?.reference);
resetError();
getTagOrCommitId(gitProjectId, value?.reference);
getTagOrCommitId(gitProjectId, value?.reference, false, 'CONTAINS');
}}
onInputChange={(event, value, reason) => { event && onGitVersionKeyUp(event.nativeEvent)}}
disabled={(!gitRepo) || (gitRepo.trim() === "")}
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment