Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hypha
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ots
hypha
Commits
9d6cce54
Commit
9d6cce54
authored
6 years ago
by
Tomasz Knapik
Committed by
Todd Dembrey
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Update grouped listing to use new listing
parent
180344fc
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
opentech/static_src/src/app/src/components/GroupedListing.js
+20
-49
20 additions, 49 deletions
opentech/static_src/src/app/src/components/GroupedListing.js
opentech/static_src/src/app/src/components/Listing/index.js
+1
-2
1 addition, 2 deletions
opentech/static_src/src/app/src/components/Listing/index.js
with
21 additions
and
51 deletions
opentech/static_src/src/app/src/components/GroupedListing.js
+
20
−
49
View file @
9d6cce54
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
PropTypes
from
'
prop-types
'
;
import
PropTypes
from
'
prop-types
'
;
import
Listing
from
'
@components/Listing
'
;
import
ListingGroup
from
'
@components/ListingGroup
'
;
import
ListingGroup
from
'
@components/ListingGroup
'
;
import
ListingItem
from
'
@components/ListingItem
'
;
import
ListingItem
from
'
@components/ListingItem
'
;
import
LoadingPanel
from
'
@components/LoadingPanel
'
;
import
'
@components/Listing/style.scss
'
;
import
'
@components/Listing/style.scss
'
;
...
@@ -45,49 +45,6 @@ export default class GroupedListing extends React.Component {
...
@@ -45,49 +45,6 @@ export default class GroupedListing extends React.Component {
}
}
}
}
renderListItems
()
{
const
{
isLoading
,
error
,
items
,
onItemSelection
,
activeItem
}
=
this
.
props
;
if
(
isLoading
)
{
return
(
<
div
className
=
"
listing__list is-loading
"
>
<
LoadingPanel
/>
<
/div
>
)
}
else
if
(
error
)
{
return
(
<
div
className
=
"
listing__list is-loading
"
>
<
p
>
Something
went
wrong
.
Please
try
again
later
.
<
/p
>
<
p
>
{
error
}
<
/p
>
<
/div
>
)
}
else
if
(
items
.
length
===
0
)
{
return
(
<
div
className
=
"
listing__list is-loading
"
>
<
p
>
No
results
found
.
<
/p
>
<
/div
>
)
}
return
(
<
ul
className
=
"
listing__list
"
>
{
this
.
state
.
orderedItems
.
map
(
group
=>
{
return
(
<
ListingGroup
key
=
{
`listing-group-
${
group
.
name
}
`
}
item
=
{
group
}
>
{
group
.
items
.
map
(
item
=>
{
return
<
ListingItem
selected
=
{
!!
activeItem
&&
activeItem
===
item
.
id
}
onClick
=
{()
=>
onItemSelection
(
item
.
id
)}
key
=
{
`listing-item-
${
item
.
id
}
`
}
item
=
{
item
}
/>
;
})}
<
/ListingGroup
>
);
})}
<
/ul
>
);
}
getGroupedItems
()
{
getGroupedItems
()
{
const
{
groupBy
,
items
}
=
this
.
props
;
const
{
groupBy
,
items
}
=
this
.
props
;
...
@@ -113,12 +70,26 @@ export default class GroupedListing extends React.Component {
...
@@ -113,12 +70,26 @@ export default class GroupedListing extends React.Component {
});
});
}
}
render
()
{
renderItem
=
group
=>
{
const
{
activeItem
,
onItemSelection
}
=
this
.
props
;
return
(
return
(
<
div
className
=
"
listing
"
>
<
ListingGroup
key
=
{
`listing-group-
${
group
.
name
}
`
}
item
=
{
group
}
>
<
div
className
=
"
listing__header
"
><
/div
>
{
group
.
items
.
map
(
item
=>
{
{
this
.
renderListItems
()}
return
<
ListingItem
<
/div
>
selected
=
{
!!
activeItem
&&
activeItem
===
item
.
id
}
onClick
=
{()
=>
onItemSelection
(
item
.
id
)}
key
=
{
`listing-item-
${
item
.
id
}
`
}
item
=
{
item
}
/>
;
})}
<
/ListingGroup
>
);
);
}
}
render
()
{
const
passProps
=
{
items
:
this
.
state
.
orderedItems
,
renderItem
:
this
.
renderItem
,
};
return
<
Listing
{...
passProps
}
/>
;
}
}
}
This diff is collapsed.
Click to expand it.
opentech/static_src/src/app/src/components/Listing/index.js
+
1
−
2
View file @
9d6cce54
...
@@ -7,8 +7,7 @@ import './style.scss';
...
@@ -7,8 +7,7 @@ import './style.scss';
export
default
class
Listing
extends
React
.
Component
{
export
default
class
Listing
extends
React
.
Component
{
static
propTypes
=
{
static
propTypes
=
{
items
:
PropTypes
.
array
,
items
:
PropTypes
.
array
.
isRequired
,
activeItem
:
PropTypes
.
number
,
isLoading
:
PropTypes
.
bool
,
isLoading
:
PropTypes
.
bool
,
isError
:
PropTypes
.
bool
,
isError
:
PropTypes
.
bool
,
error
:
PropTypes
.
string
,
error
:
PropTypes
.
string
,
...
...
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