Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
ce-deploy-ui
Manage
Activity
Members
Labels
Plan
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ccce
dev
ce-deploy-ui
Commits
d791e2e4
Commit
d791e2e4
authored
3 years ago
by
Imre Toth
Browse files
Options
Downloads
Patches
Plain Diff
ICSHWI-7397
: Restricting user to enter (valid) tag, or commitId for IOC
parent
28f1e721
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!57
ICSHWI-7397: Restricting user to enter (valid) tag, or commitId for IOC
Pipeline
#89443
passed
3 years ago
Stage: build
Stage: lint
Stage: test
Stage: package
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/api/SwaggerApi.js
+10
-1
10 additions, 1 deletion
src/api/SwaggerApi.js
src/components/IOC/IOCDialog.js
+18
-9
18 additions, 9 deletions
src/components/IOC/IOCDialog.js
with
28 additions
and
10 deletions
src/api/SwaggerApi.js
+
10
−
1
View file @
d791e2e4
...
...
@@ -414,7 +414,6 @@ export function useRenewToken() {
}
export
function
unpackLokilog
(
logData
)
{
console
.
log
(
logData
);
return
{
...
logData
};
}
...
...
@@ -455,5 +454,15 @@ export function useNamingNames() {
const
api
=
useContext
(
apiContext
);
const
method
=
callAndUnpack
((
iocName
)
=>
api
.
apis
.
Naming
.
fetchIOCByName
({
iocName
:
iocName
}),
unpackNamingList
)
return
useAsync
({
fcn
:
method
,
call
:
false
,
init
:
[]
});
}
export
function
unpackTagAndCommitIdList
(
tagList
)
{
return
tagList
.
toString
().
split
(
"
,
"
);
}
export
function
useTagsAndCommitIds
()
{
const
api
=
useContext
(
apiContext
);
const
method
=
callAndUnpack
((
repoUrl
)
=>
api
.
apis
.
Git
.
listTagsAndCommitIds
({
gitRepo
:
repoUrl
}),
unpackTagAndCommitIdList
)
return
useAsync
({
fcn
:
method
,
call
:
false
,
init
:
[]
});
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/components/IOC/IOCDialog.js
+
18
−
9
View file @
d791e2e4
import
React
,
{
useEffect
,
useState
}
from
"
react
"
;
import
{
Button
,
TextField
,
Dialog
,
DialogActions
,
DialogContent
,
DialogTitle
,
makeStyles
}
from
"
@material-ui/core
"
;
import
{
Autocomplete
}
from
"
@material-ui/lab
"
;
import
{
useCSEntrySearch
,
useNamingNames
}
from
"
../../api/SwaggerApi
"
;
import
{
useCSEntrySearch
,
useNamingNames
,
useTagsAndCommitIds
}
from
"
../../api/SwaggerApi
"
;
import
{
useTypingTimer
}
from
"
../common/SearchBoxFilter/TypingTimer
"
;
const
useStyles
=
makeStyles
((
theme
)
=>
({
...
...
@@ -18,6 +18,8 @@ export function IOCDialog({ open, setOpen, isUpdateIoc, submitCallback, title, b
const
[
names
,
getNames
]
=
useNamingNames
();
const
[
name
,
setName
]
=
useState
(
""
);
const
[
nameQuery
,
onNameKeyUp
]
=
useTypingTimer
({
interval
:
500
});
const
[
tagOrCommitId
,
getTagOrCommitId
]
=
useTagsAndCommitIds
([]);
const
[
gitRepo
,
setGitRepo
]
=
useState
(
""
);
const
handleClose
=
()
=>
{
setOpen
(
false
);
...
...
@@ -26,12 +28,10 @@ export function IOCDialog({ open, setOpen, isUpdateIoc, submitCallback, title, b
console
.
log
({...
init
});
console
.
log
(
hosts
);
console
.
log
(
host
);
console
.
log
(
names
);
console
.
log
(
name
);
useEffect
(()
=>
getHosts
(
`fqdn:"
${
query
}
"`
),
[
query
,
getHosts
]);
useEffect
(()
=>
getHosts
(
`fqdn:"
${
query
}
"`
),
[
query
,
getHosts
,
getTagOrCommitId
]);
useEffect
(()
=>
getNames
(
nameQuery
),
[
nameQuery
,
getNames
]);
useEffect
(()
=>
getNames
(
nameQuery
),
[
nameQuery
,
getNames
,
getTagOrCommitId
]);
const
onSubmit
=
(
event
)
=>
{
event
.
preventDefault
();
...
...
@@ -71,7 +71,6 @@ export function IOCDialog({ open, setOpen, isUpdateIoc, submitCallback, title, b
autoHighlight
id
=
"
nameAutocomplete
"
options
=
{
names
}
defaultValue
=
{
init
}
getOptionLabel
=
{(
option
)
=>
{
console
.
log
(
option
?.
name
);
return
option
?.
name
}}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"
IOC name
"
variant
=
"
outlined
"
required
/>
}
onChange
=
{(
event
,
value
,
reason
)
=>
setName
(
value
)}
...
...
@@ -80,14 +79,24 @@ export function IOCDialog({ open, setOpen, isUpdateIoc, submitCallback, title, b
}
<
TextField
autoComplete
=
"
off
"
className
=
{
classes
.
textField
}
id
=
"
description
"
label
=
"
description
"
variant
=
"
outlined
"
defaultValue
=
{
init
.
description
||
""
}
fullWidth
/>
<
TextField
autoComplete
=
"
off
"
className
=
{
classes
.
textField
}
id
=
"
git
"
label
=
"
git
"
variant
=
"
outlined
"
defaultValue
=
{
init
.
git
||
""
}
fullWidth
/>
<
TextField
autoComplete
=
"
off
"
className
=
{
classes
.
textField
}
id
=
"
version
"
label
=
"
git reference
"
variant
=
"
outlined
"
defaultValue
=
{
init
.
version
||
""
}
fullWidth
/>
<
TextField
autoComplete
=
"
off
"
className
=
{
classes
.
textField
}
id
=
"
git
"
label
=
"
git
"
variant
=
"
outlined
"
defaultValue
=
{
init
.
git
||
""
}
fullWidth
onChange
=
{(
event
)
=>
setGitRepo
(
event
.
target
.
value
)}
/
>
<
Autocomplete
className
=
{
classes
.
textField
}
autoHighlight
id
=
"
version
"
options
=
{
tagOrCommitId
}
onFocus
=
{(
event
)
=>
{
getTagOrCommitId
(
gitRepo
);}}
getOptionLabel
=
{(
option
)
=>
{
return
option
}}
disabled
=
{(
!
gitRepo
)
||
(
gitRepo
.
trim
()
===
""
)}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"
Git reference
"
variant
=
"
outlined
"
/>
}
/
>
<
Autocomplete
className
=
{
classes
.
textField
}
autoHighlight
id
=
"
host
"
options
=
{
hosts
}
defaultValue
=
{
init
}
getOptionLabel
=
{
option
=>
{
console
.
log
(
option
);
return
option
?.
csEntryHost
?.
fqdn
}}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"
host
"
variant
=
"
outlined
"
/>
}
onChange
=
{(
event
,
value
,
reason
)
=>
setHost
(
value
)}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment