SciPost Code Repository
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SciPost
Manage
Activity
Members
Labels
Plan
Issues
118
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
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
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
SciPost
SciPost
Commits
93b1aab4
Commit
93b1aab4
authored
4 years ago
by
Jean-Sébastien Caux
Browse files
Options
Downloads
Patches
Plain Diff
Add flow direction selector in messages table
parent
cf7f22bf
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
apimail/api/views.py
+8
-0
8 additions, 0 deletions
apimail/api/views.py
apimail/static/apimail/assets/vue/components/MessagesTable.vue
+66
-28
66 additions, 28 deletions
...il/static/apimail/assets/vue/components/MessagesTable.vue
with
74 additions
and
28 deletions
apimail/api/views.py
+
8
−
0
View file @
93b1aab4
...
@@ -152,6 +152,14 @@ class StoredMessageFilterBackend(filters.BaseFilterBackend):
...
@@ -152,6 +152,14 @@ class StoredMessageFilterBackend(filters.BaseFilterBackend):
queryset
=
StoredMessage
.
objects
.
all
()
queryset
=
StoredMessage
.
objects
.
all
()
queryfilter
=
Q
()
queryfilter
=
Q
()
flow
=
request
.
query_params
.
get
(
'
flow
'
,
None
)
if
flow
==
'
in
'
:
# Restrict to incoming emails
queryset
=
queryset
.
exclude
(
data__sender
=
request
.
query_params
.
get
(
'
account
'
))
elif
flow
==
'
out
'
:
# Restrict to outgoing emails
queryset
=
queryset
.
filter
(
data__sender
=
request
.
query_params
.
get
(
'
account
'
))
period
=
request
.
query_params
.
get
(
'
period
'
,
'
any
'
)
period
=
request
.
query_params
.
get
(
'
period
'
,
'
any
'
)
if
period
!=
'
any
'
:
if
period
!=
'
any
'
:
days
=
365
days
=
365
...
...
This diff is collapsed.
Click to expand it.
apimail/static/apimail/assets/vue/components/MessagesTable.vue
+
66
−
28
View file @
93b1aab4
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
v-b-modal.modal-newdraft
v-b-modal.modal-newdraft
variant=
"primary"
variant=
"primary"
>
>
Compose a n
ew message
N
ew message
</b-button>
</b-button>
<b-modal
<b-modal
...
@@ -96,34 +96,35 @@
...
@@ -96,34 +96,35 @@
</div>
</div>
<div
class=
"accounts-table text-white"
>
<div
class=
"accounts-table text-white"
>
<h2
class=
"p-2 mb-0 text-center"
>
Click on an account to view messages
</h2>
<h1
class=
"p-2 mb-0 text-center"
>
Your email accounts
</h1>
<table
<div
class=
"text-center mb-1"
><em>
(click on a row to see messages)
</em></div>
class=
"table mb-4 text-white"
<table
selectable
class=
"table mb-4 text-white"
:select-mode=
"single"
selectable
:selected-variant=
"danger"
:select-mode=
"single"
>
:selected-variant=
"danger"
<tr>
<th>
Account
</th>
<th>
Address
</th>
<th>
Rights
</th>
<th>
From
</th>
<th>
Until
</th>
</tr>
<tr
v-for=
"access in accesses"
v-bind:class=
"{'highlight': isSelected(access.account.email)}"
v-on:click=
"accountSelected = access.account"
v-on:change=
""
class=
"p-2 m-0"
>
>
<td>
{{ access.account.name }}
</td>
<tr>
<td>
{{ access.account.email }}
</td>
<th>
Account
</th>
<td>
{{ access.rights }}
</td>
<th>
Address
</th>
<td>
{{ access.date_from }}
</td>
<th>
Rights
</th>
<td>
{{ access.date_until }}
</td>
<th>
From
</th>
</tr>
<th>
Until
</th>
</table>
</tr>
<tr
v-for=
"access in accesses"
v-bind:class=
"{'highlight': isSelected(access.account.email)}"
v-on:click=
"accountSelected = access.account"
v-on:change=
""
class=
"p-2 m-0"
>
<td>
{{ access.account.name }}
</td>
<td>
{{ access.account.email }}
</td>
<td>
{{ access.rights }}
</td>
<td>
{{ access.date_from }}
</td>
<td>
{{ access.date_until }}
</td>
</tr>
</table>
</div>
</div>
<div
v-if=
"accountSelected"
:key=
"accountSelected.pk"
>
<div
v-if=
"accountSelected"
:key=
"accountSelected.pk"
>
...
@@ -151,6 +152,9 @@
...
@@ -151,6 +152,9 @@
>
>
<b-form-radio-group
<b-form-radio-group
v-model=
"refreshMinutes"
v-model=
"refreshMinutes"
buttons
button-variant=
"info"
size=
"sm"
:options=
"refreshMinutesOptions"
:options=
"refreshMinutesOptions"
class=
"float-center"
class=
"float-center"
>
>
...
@@ -173,10 +177,28 @@
...
@@ -173,10 +177,28 @@
>
>
<b-form-radio-group
<b-form-radio-group
v-model=
"readStatus"
v-model=
"readStatus"
buttons
button-variant=
"info"
size=
"sm"
:options=
"readStatusOptions"
:options=
"readStatusOptions"
>
>
</b-form-radio-group>
</b-form-radio-group>
</b-form-group>
</b-form-group>
<b-form-group
label=
"Flow:"
label-cols-sm=
"3"
label-align-sm=
"right"
label-size=
"sm"
>
<b-form-radio-group
v-model=
"flowDirection"
buttons
button-variant=
"info"
size=
"sm"
:options=
"flowDirectionOptions"
>
</b-form-radio-group>
</b-form-group>
</b-col>
</b-col>
<b-col
class=
"col-lg-5"
>
<b-col
class=
"col-lg-5"
>
<b-form-group
<b-form-group
...
@@ -241,6 +263,9 @@
...
@@ -241,6 +263,9 @@
>
>
<b-form-radio-group
<b-form-radio-group
v-model=
"timePeriod"
v-model=
"timePeriod"
buttons
button-variant=
"info"
size=
"sm"
:options=
"timePeriodOptions"
:options=
"timePeriodOptions"
>
>
</b-form-radio-group>
</b-form-radio-group>
...
@@ -425,6 +450,12 @@ export default {
...
@@ -425,6 +450,12 @@ export default {
{
text
:
'
read
'
,
value
:
true
},
{
text
:
'
read
'
,
value
:
true
},
{
text
:
'
all
'
,
value
:
null
},
{
text
:
'
all
'
,
value
:
null
},
],
],
flowDirection
:
'
in
'
,
flowDirectionOptions
:
[
{
text
:
'
In
'
,
value
:
'
in
'
},
{
text
:
'
Out
'
,
value
:
'
out
'
},
{
text
:
'
Both
'
,
value
:
null
}
],
refreshInterval
:
null
,
refreshInterval
:
null
,
refreshMinutes
:
1
,
refreshMinutes
:
1
,
refreshMinutesOptions
:
[
1
,
5
,
15
],
refreshMinutesOptions
:
[
1
,
5
,
15
],
...
@@ -492,6 +523,10 @@ export default {
...
@@ -492,6 +523,10 @@ export default {
var
params
=
'
?account=
'
+
this
.
accountSelected
.
email
var
params
=
'
?account=
'
+
this
.
accountSelected
.
email
// Our API uses limit/offset pagination
// Our API uses limit/offset pagination
params
+=
'
&limit=
'
+
ctx
.
perPage
+
'
&offset=
'
+
ctx
.
perPage
*
(
ctx
.
currentPage
-
1
)
params
+=
'
&limit=
'
+
ctx
.
perPage
+
'
&offset=
'
+
ctx
.
perPage
*
(
ctx
.
currentPage
-
1
)
// Add flow direction
if
(
this
.
flowDirection
)
{
params
+=
'
&flow=
'
+
this
.
flowDirection
}
// Add search time period
// Add search time period
params
+=
'
&period=
'
+
this
.
timePeriod
params
+=
'
&period=
'
+
this
.
timePeriod
if
(
this
.
readStatus
!==
null
)
{
if
(
this
.
readStatus
!==
null
)
{
...
@@ -578,6 +613,9 @@ export default {
...
@@ -578,6 +613,9 @@ export default {
readStatus
:
function
()
{
readStatus
:
function
()
{
this
.
$root
.
$emit
(
'
bv::refresh::table
'
,
'
my-table
'
)
this
.
$root
.
$emit
(
'
bv::refresh::table
'
,
'
my-table
'
)
},
},
flowDirection
:
function
()
{
this
.
$root
.
$emit
(
'
bv::refresh::table
'
,
'
my-table
'
)
},
tagRequired
:
function
()
{
tagRequired
:
function
()
{
this
.
$root
.
$emit
(
'
bv::refresh::table
'
,
'
my-table
'
)
this
.
$root
.
$emit
(
'
bv::refresh::table
'
,
'
my-table
'
)
},
},
...
...
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