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
864e0a4d
Commit
864e0a4d
authored
5 years ago
by
Chris Lawton
Committed by
Todd Dembrey
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
sort notes by timestamp
parent
41fc9077
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/containers/NoteListing.js
+8
-6
8 additions, 6 deletions
opentech/static_src/src/app/src/containers/NoteListing.js
opentech/static_src/src/app/src/redux/selectors/notes.js
+5
-0
5 additions, 0 deletions
opentech/static_src/src/app/src/redux/selectors/notes.js
with
13 additions
and
6 deletions
opentech/static_src/src/app/src/containers/NoteListing.js
+
8
−
6
View file @
864e0a4d
...
@@ -10,13 +10,13 @@ import Note from '@containers/Note';
...
@@ -10,13 +10,13 @@ import Note from '@containers/Note';
import
{
import
{
getNotesErrorState
,
getNotesErrorState
,
getNotesErrorMessage
,
getNotesErrorMessage
,
getNote
ID
sForSubmission
OfID
,
getNotesForSubmission
,
getNotesFetchState
,
getNotesFetchState
,
getNoteEditingStateForSubmission
getNoteEditingStateForSubmission
}
from
'
@selectors/notes
'
;
}
from
'
@selectors/notes
'
;
const
NoteListing
=
({
loadNotes
,
submissionID
,
note
ID
s
,
isErrored
,
errorMessage
,
isLoading
,
editing
})
=>
{
const
NoteListing
=
({
loadNotes
,
submissionID
,
notes
,
isErrored
,
errorMessage
,
isLoading
,
editing
})
=>
{
const
fetchNotes
=
()
=>
loadNotes
(
submissionID
)
const
fetchNotes
=
()
=>
loadNotes
(
submissionID
)
const
{
start
,
stop
}
=
useInterval
(
fetchNotes
,
30000
)
const
{
start
,
stop
}
=
useInterval
(
fetchNotes
,
30000
)
...
@@ -37,7 +37,9 @@ const NoteListing = ({ loadNotes, submissionID, noteIDs, isErrored, errorMessage
...
@@ -37,7 +37,9 @@ const NoteListing = ({ loadNotes, submissionID, noteIDs, isErrored, errorMessage
}
}
}
}
const
renderItem
=
noteID
=>
<
Note
key
=
{
`note-
${
noteID
}
`
}
noteID
=
{
noteID
}
submissionID
=
{
submissionID
}
disabled
=
{
!!
editing
}
/>
;
const
orderedNotes
=
notes
.
sort
((
a
,
b
)
=>
a
.
timestamp
-
b
.
timestamp
);
const
renderItem
=
note
=>
<
Note
key
=
{
`note-
${
note
.
id
}
`
}
noteID
=
{
note
.
id
}
submissionID
=
{
submissionID
}
disabled
=
{
!!
editing
}
/>
;
return
(
return
(
<
Listing
<
Listing
...
@@ -46,7 +48,7 @@ const NoteListing = ({ loadNotes, submissionID, noteIDs, isErrored, errorMessage
...
@@ -46,7 +48,7 @@ const NoteListing = ({ loadNotes, submissionID, noteIDs, isErrored, errorMessage
errorMessage
=
{
errorMessage
}
errorMessage
=
{
errorMessage
}
handleRetry
=
{
handleRetry
}
handleRetry
=
{
handleRetry
}
renderItem
=
{
renderItem
}
renderItem
=
{
renderItem
}
items
=
{
n
ote
ID
s
}
items
=
{
orderedN
otes
}
column
=
"
notes
"
column
=
"
notes
"
/>
/>
);
);
...
@@ -55,7 +57,7 @@ const NoteListing = ({ loadNotes, submissionID, noteIDs, isErrored, errorMessage
...
@@ -55,7 +57,7 @@ const NoteListing = ({ loadNotes, submissionID, noteIDs, isErrored, errorMessage
NoteListing
.
propTypes
=
{
NoteListing
.
propTypes
=
{
loadNotes
:
PropTypes
.
func
,
loadNotes
:
PropTypes
.
func
,
submissionID
:
PropTypes
.
number
,
submissionID
:
PropTypes
.
number
,
note
ID
s
:
PropTypes
.
array
,
notes
:
PropTypes
.
array
,
isErrored
:
PropTypes
.
bool
,
isErrored
:
PropTypes
.
bool
,
errorMessage
:
PropTypes
.
string
,
errorMessage
:
PropTypes
.
string
,
isLoading
:
PropTypes
.
bool
,
isLoading
:
PropTypes
.
bool
,
...
@@ -68,7 +70,7 @@ const mapDispatchToProps = dispatch => ({
...
@@ -68,7 +70,7 @@ const mapDispatchToProps = dispatch => ({
});
});
const
mapStateToProps
=
(
state
,
ownProps
)
=>
({
const
mapStateToProps
=
(
state
,
ownProps
)
=>
({
note
ID
s
:
getNote
ID
sForSubmission
OfID
(
ownProps
.
submissionID
)(
state
),
notes
:
getNotesForSubmission
(
ownProps
.
submissionID
)(
state
),
isLoading
:
getNotesFetchState
(
state
),
isLoading
:
getNotesFetchState
(
state
),
isErrored
:
getNotesErrorState
(
state
),
isErrored
:
getNotesErrorState
(
state
),
errorMessage
:
getNotesErrorMessage
(
state
),
errorMessage
:
getNotesErrorMessage
(
state
),
...
...
This diff is collapsed.
Click to expand it.
opentech/static_src/src/app/src/redux/selectors/notes.js
+
5
−
0
View file @
864e0a4d
...
@@ -24,6 +24,11 @@ export const getLatestNoteForSubmissionOfID = submissionID => createSelector(
...
@@ -24,6 +24,11 @@ export const getLatestNoteForSubmissionOfID = submissionID => createSelector(
notes
=>
notes
[
0
]
||
null
notes
=>
notes
[
0
]
||
null
);
);
export
const
getNotesForSubmission
=
submissionID
=>
createSelector
(
[
getNoteIDsForSubmissionOfID
(
submissionID
),
getNotes
],
(
noteIDs
,
notes
)
=>
noteIDs
.
map
(
noteID
=>
notes
[
noteID
])
);
const
getNoteCreatingErrors
=
state
=>
state
.
notes
.
createError
;
const
getNoteCreatingErrors
=
state
=>
state
.
notes
.
createError
;
export
const
getNoteCreatingErrorForSubmission
=
submissionID
=>
createSelector
(
export
const
getNoteCreatingErrorForSubmission
=
submissionID
=>
createSelector
(
...
...
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