Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AKPlanning
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
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
91cfb559
Commit
91cfb559
authored
4 years ago
by
Benjamin Hättasch
Browse files
Options
Downloads
Plain Diff
Merge branch 'improve-graphical-scheduling' into 'master'
Improve graphical scheduling See merge request
!62
parents
7f8352e0
fae6fb6b
No related branches found
No related tags found
1 merge request
!62
Improve graphical scheduling
Pipeline
#8846
passed
4 years ago
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
AKModel/models.py
+10
-0
10 additions, 0 deletions
AKModel/models.py
AKScheduling/api.py
+2
-2
2 additions, 2 deletions
AKScheduling/api.py
AKScheduling/templates/admin/AKScheduling/scheduling.html
+29
-19
29 additions, 19 deletions
AKScheduling/templates/admin/AKScheduling/scheduling.html
with
41 additions
and
21 deletions
AKModel/models.py
+
10
−
0
View file @
91cfb559
...
...
@@ -245,6 +245,16 @@ class AK(models.Model):
return
self
.
short_name
return
self
.
name
@property
def
details
(
self
):
return
f
"""
{
self
.
name
}{
"
(R)
"
if
self
.
reso
else
""
}
:
{
self
.
owners_list
}
{
_
(
"
Requirements
"
)
}
:
{
"
,
"
.
join
(
str
(
r
)
for
r
in
self
.
requirements
.
all
())
}
{
_
(
"
Conflicts
"
)
}
:
{
"
,
"
.
join
(
str
(
c
)
for
c
in
self
.
conflicts
.
all
())
}
{
_
(
"
Prerequisites
"
)
}
:
{
"
,
"
.
join
(
str
(
p
)
for
p
in
self
.
prerequisites
.
all
())
}
"""
@property
def
owners_list
(
self
):
return
"
,
"
.
join
(
str
(
owner
)
for
owner
in
self
.
owners
.
all
())
...
...
This diff is collapsed.
Click to expand it.
AKScheduling/api.py
+
2
−
2
View file @
91cfb559
...
...
@@ -42,8 +42,8 @@ class EventsView(LoginRequiredMixin, EventSlugMixin, ListView):
return
JsonResponse
(
[{
"
slotID
"
:
slot
.
pk
,
"
title
"
:
slot
.
ak
.
short_name
,
"
description
"
:
slot
.
ak
.
name
,
"
title
"
:
f
'
{
slot
.
ak
.
short_name
}
:
\n
{
slot
.
ak
.
owners_list
}
'
,
"
description
"
:
slot
.
ak
.
details
,
"
resourceId
"
:
slot
.
room
.
id
,
"
start
"
:
timezone
.
localtime
(
slot
.
start
,
self
.
event
.
timezone
).
strftime
(
"
%Y-%m-%d %H:%M:%S
"
),
"
end
"
:
timezone
.
localtime
(
slot
.
end
,
self
.
event
.
timezone
).
strftime
(
"
%Y-%m-%d %H:%M:%S
"
),
...
...
This diff is collapsed.
Click to expand it.
AKScheduling/templates/admin/AKScheduling/scheduling.html
+
29
−
19
View file @
91cfb559
...
...
@@ -7,7 +7,7 @@
{% load static %}
{% load tags_AKPlan %}
{% block title %}{% trans "Scheduling for" %} {{event}}{% endblock %}
{% block title %}{% trans "Scheduling for" %} {{
event
}}{% endblock %}
{% block extrahead %}
{{ block.super }}
...
...
@@ -21,10 +21,14 @@
{% endwith %}
<style>
.unscheduled-slot
{
cursor
:
move
;
.unscheduled-slot
{
cursor
:
move
;
}
}
.fc-v-event
,
.tooltip
{
white-space
:
pre-line
;
}
</style>
<script>
...
...
@@ -45,14 +49,16 @@
}
return
cookieValue
;
}
const
csrftoken
=
getCookie
(
'
csrftoken
'
);
function
csrfSafeMethod
(
method
)
{
// these HTTP methods do not require CSRF protection
return
(
/^
(
GET|HEAD|OPTIONS|TRACE
)
$/
.
test
(
method
));
}
$
.
ajaxSetup
({
beforeSend
:
function
(
xhr
,
settings
)
{
beforeSend
:
function
(
xhr
,
settings
)
{
if
(
!
csrfSafeMethod
(
settings
.
type
)
&&
!
this
.
crossDomain
)
{
xhr
.
setRequestHeader
(
"
X-CSRFToken
"
,
csrftoken
);
}
...
...
@@ -64,7 +70,7 @@
var
containerEl
=
document
.
getElementById
(
'
unscheduled-slots
'
);
new
FullCalendar
.
Draggable
(
containerEl
,
{
itemSelector
:
'
.unscheduled-slot
'
,
});
});
// Calendar
...
...
@@ -72,7 +78,7 @@
plan
=
new
FullCalendar
.
Calendar
(
planEl
,
{
timeZone
:
'
{{ event.timezone }}
'
,
headerToolbar
:
{
headerToolbar
:
{
left
:
'
today prev,next
'
,
center
:
'
title
'
,
right
:
'
resourceTimelineDayVert,resourceTimelineDayHoriz,resourceTimelineEventVert,resourceTimelineEventHoriz
'
...
...
@@ -115,12 +121,12 @@
}
},
// Show full AK title as tooltip for each AK (needs to be removed and newly placed when AK is moved)
eventDidMount
:
function
(
info
)
{
if
(
info
.
event
.
extendedProps
.
description
!==
undefined
)
{
eventDidMount
:
function
(
info
)
{
if
(
info
.
event
.
extendedProps
.
description
!==
undefined
)
{
$
(
info
.
el
).
tooltip
({
title
:
info
.
event
.
extendedProps
.
description
,
trigger
:
'
hover
'
});
}
},
eventWillUnmount
:
function
(
info
)
{
eventWillUnmount
:
function
(
info
)
{
$
(
info
.
el
).
tooltip
(
'
dispose
'
);
},
...
...
@@ -129,7 +135,7 @@
eventReceive
:
updateEvent
,
editable
:
true
,
dropable
:
true
,
drop
:
function
(
info
)
{
drop
:
function
(
info
)
{
info
.
draggedEl
.
parentNode
.
removeChild
(
info
.
draggedEl
);
},
allDaySlot
:
false
,
...
...
@@ -140,9 +146,9 @@
resourceAreaHeaderContent
:
'
{% trans "Room" %}
'
,
resources
:
'
{% url "model:scheduling-resources-list" event_slug=event.slug %}
'
,
eventSources
:
[
'
{% url "model:scheduling-events" event_slug=event.slug %}
'
,
'
{% url "model:scheduling-room-availabilities" event_slug=event.slug %}
'
],
'
{% url "model:scheduling-events" event_slug=event.slug %}
'
,
'
{% url "model:scheduling-room-availabilities" event_slug=event.slug %}
'
],
schedulerLicenseKey
:
'
GPL-My-Project-Is-Open-Source
'
,
dayMinWidth
:
100
,
});
...
...
@@ -160,10 +166,11 @@
end
:
plan
.
formatIso
(
changeInfo
.
event
.
end
),
roomId
:
room
.
id
,
},
success
:
function
(
response
)
{},
error
:
function
(
response
)
{
success
:
function
(
response
)
{
},
error
:
function
(
response
)
{
changeInfo
.
revert
();
alert
(
"
ERROR. Did not update
"
+
changeInfo
.
event
.
title
)
alert
(
"
ERROR. Did not update
"
+
changeInfo
.
event
.
title
)
}
});
}
...
...
@@ -175,11 +182,14 @@
<div
class=
"row"
style=
"margin-bottom: 50px;"
>
<div
class=
"col-md-10 col-lg-11"
>
<div
id=
"planCalendar"
></div>
<div
id=
"planCalendar"
></div>
</div>
<div
class=
"col-md-2 col-lg-1"
id=
"unscheduled-slots"
>
{% for slot in slots_unscheduled %}
<div
class=
"unscheduled-slot badge badge-primary"
data-event=
'{ "title": "{{ slot.ak.short_name }}", "duration": {"hours": "{{ slot.duration|unlocalize }}"}, "description": "{{ slot.ak.name }}", "slotID": "{{ slot.pk }}"}'
>
{{ slot.ak.short_name }} ({{ slot.duration }} h)
</div>
<div
class=
"unscheduled-slot badge badge-primary"
style=
'background-color: {{ slot.ak.category.color }}'
data-event=
'{ "title": "{{ slot.ak.short_name }}", "duration": {"hours": "{{ slot.duration|unlocalize }}"}, "description": "{{ slot.ak.name }}", "slotID": "{{ slot.pk }}"}'
>
{{ slot.ak.short_name }}
({{ slot.duration }} h)
<br>
{{ slot.ak.owners_list }}
</div>
{% endfor %}
</div>
</div>
...
...
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