Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AKPlanning
Manage
Activity
Members
Labels
Plan
Issues
60
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
10
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
KIF
AKPlanning
Commits
fd8e3e3e
Commit
fd8e3e3e
authored
3 years ago
by
Benjamin Hättasch
Browse files
Options
Downloads
Patches
Plain Diff
Improve dashboard recent change feed restriction
parent
c52ebde0
No related branches found
No related tags found
No related merge requests found
Pipeline
#22890
passed with stage
in 1 minute and 29 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
AKDashboard/views.py
+11
-6
11 additions, 6 deletions
AKDashboard/views.py
with
11 additions
and
6 deletions
AKDashboard/views.py
+
11
−
6
View file @
fd8e3e3e
...
...
@@ -36,7 +36,7 @@ class DashboardEventView(DetailView):
# Newest AKs
if
apps
.
is_installed
(
"
AKSubmission
"
):
submission_changes
=
AK
.
history
.
filter
(
event
=
context
[
'
event
'
])[:
50
]
submission_changes
=
AK
.
history
.
filter
(
event
=
context
[
'
event
'
])[:
int
(
settings
.
DASHBOARD_RECENT_MAX
)
]
for
s
in
submission_changes
:
if
s
.
history_type
==
'
+
'
:
text
=
_
(
'
New AK: %(ak)s.
'
)
%
{
'
ak
'
:
s
.
name
}
...
...
@@ -48,20 +48,25 @@ class DashboardEventView(DetailView):
text
=
_
(
'
AK
"
%(ak)s
"
deleted.
'
)
%
{
'
ak
'
:
s
.
name
}
icon
=
(
'
times
'
,
'
fas
'
)
recent_changes
.
append
({
'
icon
'
:
icon
,
'
text
'
:
text
,
'
link
'
:
reverse_lazy
(
'
submit:ak_detail
'
,
kwargs
=
{
'
event_slug
'
:
context
[
'
event
'
].
slug
,
'
pk
'
:
s
.
id
}),
'
timestamp
'
:
s
.
history_date
})
recent_changes
.
append
({
'
icon
'
:
icon
,
'
text
'
:
text
,
'
link
'
:
reverse_lazy
(
'
submit:ak_detail
'
,
kwargs
=
{
'
event_slug
'
:
context
[
'
event
'
].
slug
,
'
pk
'
:
s
.
id
}),
'
timestamp
'
:
s
.
history_date
})
# Changes in plan
if
apps
.
is_installed
(
"
AKPlan
"
):
if
not
context
[
'
event
'
].
plan_hidden
:
last_changed_slots
=
AKSlot
.
objects
.
filter
(
event
=
context
[
'
event
'
]).
order_by
(
'
-updated
'
)[:
50
]
last_changed_slots
=
AKSlot
.
objects
.
filter
(
event
=
context
[
'
event
'
]).
order_by
(
'
-updated
'
)[
:
int
(
settings
.
DASHBOARD_RECENT_MAX
)]
for
changed_slot
in
last_changed_slots
:
recent_changes
.
append
({
'
icon
'
:
(
'
clock
'
,
'
far
'
),
'
text
'
:
_
(
'
AK
"
%(ak)s
"
(re-)scheduled.
'
)
%
{
'
ak
'
:
changed_slot
.
ak
.
name
},
'
link
'
:
reverse_lazy
(
'
submit:ak_detail
'
,
kwargs
=
{
'
event_slug
'
:
context
[
'
event
'
].
slug
,
'
pk
'
:
changed_slot
.
ak
.
id
}),
'
timestamp
'
:
changed_slot
.
updated
})
recent_changes
.
append
({
'
icon
'
:
(
'
clock
'
,
'
far
'
),
'
text
'
:
_
(
'
AK
"
%(ak)s
"
(re-)scheduled.
'
)
%
{
'
ak
'
:
changed_slot
.
ak
.
name
},
'
link
'
:
reverse_lazy
(
'
submit:ak_detail
'
,
kwargs
=
{
'
event_slug
'
:
context
[
'
event
'
].
slug
,
'
pk
'
:
changed_slot
.
ak
.
id
}),
'
timestamp
'
:
changed_slot
.
updated
})
# Sort by change date...
recent_changes
.
sort
(
key
=
lambda
x
:
x
[
'
timestamp
'
],
reverse
=
True
)
# ... and restrict to the latest 25 changes
context
[
'
recent_changes
'
]
=
recent_changes
[:
settings
.
DASHBOARD_RECENT_MAX
]
context
[
'
recent_changes
'
]
=
recent_changes
[:
int
(
settings
.
DASHBOARD_RECENT_MAX
)
]
else
:
context
[
'
recent_changes
'
]
=
[]
...
...
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