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
64aa3408
Commit
64aa3408
authored
3 years ago
by
John Sparger
Browse files
Options
Downloads
Patches
Plain Diff
Update HostListView, HostList, and HostTable to use SearchBar and api loading info
parent
6a18352c
No related branches found
No related tags found
2 merge requests
!139
Merge before release
,
!111
Reimplement search to be more responsive
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/components/host/HostList.js
+1
-23
1 addition, 23 deletions
src/components/host/HostList.js
src/components/host/HostTable.js
+7
-26
7 additions, 26 deletions
src/components/host/HostTable.js
src/views/host/HostListView.js
+9
-6
9 additions, 6 deletions
src/views/host/HostListView.js
with
17 additions
and
55 deletions
src/components/host/HostList.js
+
1
−
23
View file @
64aa3408
...
...
@@ -4,10 +4,7 @@ import {
ListItem
,
Paper
}
from
'
@material-ui/core
'
;
import
{
Link
}
from
'
react-router-dom
'
;
import
{
SearchBoxFilter
}
from
"
../common/SearchBoxFilter/SearchBoxFilter
"
;
import
{
useGlobalAppBar
}
from
"
../../components/navigation/GlobalAppBar/GlobalAppBar
"
;
import
{
HostBadge
}
from
'
./HostBadge
'
;
export
function
HostListItem
({
host
})
{
...
...
@@ -20,7 +17,7 @@ export function HostListItem({ host }) {
);
}
export
function
HostList
s
({
hosts
})
{
export
function
HostList
({
hosts
})
{
return
(
<
List
>
{
hosts
&&
hosts
.
map
((
host
)
=>
{
...
...
@@ -31,23 +28,4 @@ export function HostLists({ hosts }) {
})}
<
/List
>
);
}
export
default
function
HostList
({
hosts
,
setQuery
})
{
useGlobalAppBar
(
"
Hosts
"
);
const
filter
=
(
search
)
=>
{
setQuery
(
search
.
toLowerCase
());
return
(
host
)
=>
{
return
true
;
}
}
const
renderFilteredHosts
=
(
filteredHosts
)
=>
<
HostLists
hosts
=
{
filteredHosts
}
/>
;
return
(
<
SearchBoxFilter
items
=
{
hosts
}
filter
=
{
filter
}
render
=
{
renderFilteredHosts
}
/
>
);
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/components/host/HostTable.js
+
7
−
26
View file @
64aa3408
import
React
from
'
react
'
;
import
{
Grid
,
Tooltip
}
from
"
@material-ui/core
"
;
import
{
CustomTable
}
from
'
../common/table/CustomTable
'
;
import
{
SearchBoxFilter
}
from
"
../common/SearchBoxFilter/SearchBoxFilter
"
;
import
{
useHistory
}
from
'
react-router-dom
'
;
import
{
HostStatusIcon
}
from
'
./HostIcons
'
;
...
...
@@ -16,7 +15,7 @@ const columns = [
export
function
rowDescription
(
description
)
{
return
(
return
(
<
div
className
=
{
'
shortenLongDataLines
'
}
>
<
Tooltip
title
=
{
description
}
arrow
enterDelay
=
{
400
}
>
<
label
>
{
description
}
<
/label
>
...
...
@@ -29,10 +28,10 @@ export function createRow(hostContainer) {
const
host
=
hostContainer
.
csEntryHost
;
return
{
id
:
host
.
id
,
bulb
:
<
Grid
container
direction
=
"
column
"
justifyContent
=
"
center
"
alignItems
=
"
center
"
>
<
HostStatusIcon
host
=
{
hostContainer
}
/
>
<
/Grid>
,
bulb
:
<
Grid
container
direction
=
"
column
"
justifyContent
=
"
center
"
alignItems
=
"
center
"
>
<
HostStatusIcon
host
=
{
hostContainer
}
/
>
<
/Grid>
,
host
:
host
.
name
,
description
:
rowDescription
(
host
.
description
),
network
:
host
.
network
,
...
...
@@ -43,31 +42,13 @@ export function createRow(hostContainer) {
}
export
function
Host
s
Table
({
hosts
,
totalCount
,
lazyParams
,
setLazyParams
,
columnSort
,
setColumnSort
,
rowsPerPage
})
{
export
function
HostTable
({
hosts
,
totalCount
,
lazyParams
,
setLazyParams
,
columnSort
,
setColumnSort
,
rowsPerPage
,
loading
})
{
const
history
=
useHistory
();
console
.
log
(
hosts
);
const
onRowClicked
=
(
id
)
=>
{
history
.
push
(
`/hosts/
${
id
}
`
);
};
return
<
CustomTable
columns
=
{
columns
}
rows
=
{
hosts
.
map
(
host
=>
createRow
(
host
))}
handleRowClick
=
{
onRowClicked
}
totalCount
=
{
totalCount
}
lazyParams
=
{
lazyParams
}
setLazyParams
=
{
setLazyParams
}
columnSort
=
{
columnSort
}
setColumnSort
=
{
setColumnSort
}
rowsPerPage
=
{
rowsPerPage
}
/>
;
}
export
default
function
HostTable
({
hosts
,
setQuery
,
totalCount
,
lazyParams
,
setLazyParams
,
columnSort
,
setColumnSort
,
rowsPerPage
})
{
const
filter
=
(
search
)
=>
{
setQuery
(
search
.
toLowerCase
());
return
(
hostContainer
)
=>
{
return
true
;
}
}
const
renderFilteredHosts
=
(
filteredHosts
)
=>
<
HostsTable
hosts
=
{
filteredHosts
}
totalCount
=
{
totalCount
}
lazyParams
=
{
lazyParams
}
setLazyParams
=
{
setLazyParams
}
columnSort
=
{
columnSort
}
setColumnSort
=
{
setColumnSort
}
rowsPerPage
=
{
rowsPerPage
}
/>
;
return
(
<
SearchBoxFilter
items
=
{
hosts
}
filter
=
{
filter
}
render
=
{
renderFilteredHosts
}
/
>
);
lazyParams
=
{
lazyParams
}
setLazyParams
=
{
setLazyParams
}
columnSort
=
{
columnSort
}
setColumnSort
=
{
setColumnSort
}
rowsPerPage
=
{
rowsPerPage
}
loading
=
{
loading
}
/>
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/views/host/HostListView.js
+
9
−
6
View file @
64aa3408
...
...
@@ -6,12 +6,13 @@ import {
Container
}
from
'
@material-ui/core
'
;
import
{
RootContainer
}
from
"
../../components/common/Container/RootContainer
"
;
import
HostList
from
'
../../components/host/HostList
'
;
import
HostTable
from
'
../../components/host/HostTable
'
;
import
{
HostList
}
from
'
../../components/host/HostList
'
;
import
{
HostTable
}
from
'
../../components/host/HostTable
'
;
import
{
useCSEntrySearch
}
from
"
../../api/SwaggerApi
"
;
import
{
useGlobalAppBar
}
from
'
../../components/navigation/GlobalAppBar/GlobalAppBar
'
;
import
{
makeStyles
}
from
'
@material-ui/core/styles
'
;
import
{
initRequestParams
}
from
"
../../components/common/Helper
"
;
import
{
SearchBar
}
from
"
../../components/common/SearchBar/SearchBar
"
;
const
useStyles
=
makeStyles
((
theme
)
=>
({
root
:
{
...
...
@@ -22,8 +23,8 @@ const useStyles = makeStyles((theme) => ({
export
function
HostListView
()
{
useGlobalAppBar
(
"
Explore IOC hosts
"
);
const
[
hosts
,
getHosts
]
=
useCSEntrySearch
();
const
[
query
,
setQuery
]
=
useState
();
const
[
hosts
,
getHosts
,
/*reset*/
,
loading
]
=
useCSEntrySearch
();
const
[
query
,
setQuery
]
=
useState
(
""
);
const
classes
=
useStyles
();
const
[
lazyParams
,
setLazyParams
]
=
useState
({
...
...
@@ -48,14 +49,16 @@ export function HostListView() {
const
content
=
(
<>
<
SearchBar
search
=
{
setQuery
}
loading
=
{
loading
}
>
<
Hidden
smUp
>
<
HostList
hosts
=
{
hosts
.
hostList
}
setQuery
=
{
setQuery
}
/
>
<
HostList
hosts
=
{
hosts
.
hostList
}
/
>
<
/Hidden
>
<
Hidden
xsDown
>
<
HostTable
hosts
=
{
hosts
.
hostList
}
setQuery
=
{
setQuery
}
<
HostTable
hosts
=
{
hosts
.
hostList
}
loading
=
{
loading
}
totalCount
=
{
hosts
.
totalCount
}
lazyParams
=
{
lazyParams
}
setLazyParams
=
{
setLazyParams
}
columnSort
=
{
columnSort
}
setColumnSort
=
{
setColumnSort
}
rowsPerPage
=
{
rowsPerPage
}
/
>
<
/Hidden
>
<
/SearchBar
>
<
/
>
);
...
...
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