Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
humanities
gargantext
Commits
b86a3941
Commit
b86a3941
authored
Jan 08, 2015
by
PkSM3
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
ssh://delanoe.org:1979/gargantext
into samuel
parents
d93223f0
89e826ed
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
468 additions
and
42 deletions
+468
-42
api.py
gargantext_web/api.py
+1
-0
urls.py
gargantext_web/urls.py
+4
-2
views.py
gargantext_web/views.py
+39
-14
gargantext.angular.js
static/js/gargantext.angular.js
+40
-7
chart.html
templates/chart.html
+7
-9
corpus.html
templates/corpus.html
+2
-2
menu.html
templates/menu.html
+10
-3
mvc-listdocuments.html
templates/tests/mvc-listdocuments.html
+360
-0
mvc.html
templates/tests/mvc.html
+5
-5
No files found.
gargantext_web/api.py
View file @
b86a3941
...
...
@@ -509,6 +509,7 @@ class NodesList(APIView):
def
get
(
self
,
request
):
query
=
(
Node
.
query
(
Node
.
id
,
Node
.
name
,
NodeType
.
name
.
label
(
'type'
))
.
filter
(
Node
.
user_id
==
request
.
session
.
_session_cache
[
'_auth_user_id'
])
.
join
(
NodeType
)
)
if
'type'
in
request
.
GET
:
...
...
gargantext_web/urls.py
View file @
b86a3941
...
...
@@ -32,13 +32,14 @@ urlpatterns = patterns('',
url
(
r'^project/(\d+)/corpus/(\d+)/$'
,
views
.
corpus
),
url
(
r'^project/(\d+)/corpus/(\d+)/delete/$'
,
views
.
delete_corpus
),
url
(
r'^project/(\d+)/corpus/(\d+)/corpus.csv$'
,
views
.
corpus_csv
),
url
(
r'^project/(\d+)/corpus/(tests_mvc_listdocuments+)/corpus.tests_mvc_listdocuments$'
,
views
.
corpus_csv
),
url
(
r'^project/(\d+)/corpus/(\d+)/timerange/(\d+)/(\d+)$'
,
views
.
subcorpus
),
# Visualizations
url
(
r'^project/(\d+)/corpus/(\d+)/chart$'
,
views
.
chart
),
url
(
r'^corpus/(\d+)/explorer$'
,
views
.
graph
),
url
(
r'^corpus/(\d+)/matrix$'
,
views
.
matrix
),
url
(
r'^
project/(\d+)/
corpus/(\d+)/explorer$'
,
views
.
graph
),
url
(
r'^
project/(\d+)/
corpus/(\d+)/matrix$'
,
views
.
matrix
),
# Data management
url
(
r'^chart/corpus/(\d+)/data.csv$'
,
views
.
send_csv
),
...
...
@@ -60,6 +61,7 @@ urlpatterns = patterns('',
url
(
r'^ngrams$'
,
views
.
ngrams
),
url
(
r'^nodeinfo/(\d+)$'
,
views
.
nodeinfo
),
url
(
r'^tests/mvc$'
,
views
.
tests_mvc
),
url
(
r'^tests/mvc-listdocuments$'
,
views
.
tests_mvc_listdocuments
),
)
...
...
gargantext_web/views.py
View file @
b86a3941
...
...
@@ -27,7 +27,7 @@ from parsing.FileParsers import *
# SOME FUNCTIONS
from
gargantext_web.settings
import
DEBUG
from
django.http
import
*
from
django.shortcuts
import
render_to_response
,
redirect
from
django.template
import
RequestContext
...
...
@@ -266,8 +266,12 @@ def project(request, project_id):
)
try
:
corpus
.
workflow
()
#corpus.workflow((), countdown=3)
#corpus.parse_and_extract_ngrams()
#corpus.parse_and_extract_ngrams.apply_async((), countdown=3)
if
DEBUG
is
True
:
corpus
.
workflow
()
else
:
corpus
.
workflow
.
apply_async
((),
countdown
=
3
)
except
Exception
as
error
:
print
(
error
)
...
...
@@ -547,38 +551,48 @@ def chart(request, project_id, corpus_id):
t
=
get_template
(
'chart.html'
)
user
=
request
.
user
date
=
datetime
.
datetime
.
now
()
project
=
Node
.
objects
.
get
(
id
=
project_id
)
corpus
=
Node
.
objects
.
get
(
id
=
corpus_id
)
html
=
t
.
render
(
Context
({
'user'
:
user
,
'date'
:
date
,
'project'
:
project
,
'user'
:
user
,
'date'
:
date
,
'project'
:
project
,
'corpus'
:
corpus
,
}))
return
HttpResponse
(
html
)
def
matrix
(
request
,
corpus_id
):
def
matrix
(
request
,
project_id
,
corpus_id
):
t
=
get_template
(
'matrix.html'
)
user
=
request
.
user
date
=
datetime
.
datetime
.
now
()
project
=
Node
.
objects
.
get
(
id
=
project_id
)
corpus
=
Node
.
objects
.
get
(
id
=
corpus_id
)
html
=
t
.
render
(
Context
({
\
'user'
:
user
,
\
'date'
:
date
,
\
'corpus'
:
corpus
,
\
'user'
:
user
,
\
'date'
:
date
,
\
'corpus'
:
corpus
,
\
'project'
:
project
,
\
}))
return
HttpResponse
(
html
)
def
graph
(
request
,
corpus_id
):
def
graph
(
request
,
project_id
,
corpus_id
):
t
=
get_template
(
'explorer.html'
)
user
=
request
.
user
date
=
datetime
.
datetime
.
now
()
project
=
Node
.
objects
.
get
(
id
=
project_id
)
corpus
=
Node
.
objects
.
get
(
id
=
corpus_id
)
html
=
t
.
render
(
Context
({
\
'user'
:
user
,
\
'date'
:
date
,
\
'corpus'
:
corpus
,
\
'user'
:
user
,
\
'date'
:
date
,
\
'corpus'
:
corpus
,
\
'project'
:
project
,
\
}))
return
HttpResponse
(
html
)
...
...
@@ -728,6 +742,17 @@ def tests_mvc(request):
}))
return
HttpResponse
(
html
)
def
tests_mvc_listdocuments
(
request
):
'''Just a test page for Javascript MVC.'''
t
=
get_template
(
'tests/mvc-listdocuments.html'
)
user
=
request
.
user
date
=
datetime
.
datetime
.
now
()
html
=
t
.
render
(
Context
({
'user'
:
user
,
'date'
:
date
,
}))
return
HttpResponse
(
html
)
def
ngrams
(
request
):
'''The ngrams list.'''
t
=
get_template
(
'ngrams.html'
)
...
...
static/js/gargantext.angular.js
View file @
b86a3941
...
...
@@ -87,7 +87,7 @@ var groupings = {
// Define the application
var
gargantext
=
angular
.
module
(
'Gargantext'
,
[
'n3-charts.linechart'
,
'ngCookies'
])
var
gargantext
=
angular
.
module
(
'Gargantext'
,
[
'n3-charts.linechart'
,
'ngCookies'
])
;
// Customize the application's scope
...
...
@@ -168,7 +168,7 @@ gargantext.controller("QueryController", function($scope, $http) {
// change view to loading mode
$scope
.
loading
=
true
;
// query parameters: columns
var
retrieve
=
{
type
:
'fields'
,
list
:
[
'id'
,
'name'
]};
var
retrieve
=
{
type
:
'fields'
,
list
:
[
'id'
,
'name'
,
'metadata.publication_date'
]};
// query parameters: pagination
var
pagination
=
$scope
.
pagination
;
// query parameters: sort
...
...
@@ -200,13 +200,27 @@ gargantext.controller("QueryController", function($scope, $http) {
// send query to the server
$http
.
post
(
url
,
query
).
success
(
function
(
response
){
$scope
.
resultsCount
=
response
.
pagination
.
total
;
$scope
.
results
=
response
.
data
;
$scope
.
results
=
response
.
results
;
$scope
.
columns
=
response
.
retrieve
;
$scope
.
loading
=
false
;
}).
error
(
function
(
response
){
console
.
error
(
response
);
});
}
}
// change current page
$scope
.
decrement
=
function
()
{
if
(
$scope
.
pagination
.
offset
>
0
)
{
$scope
.
pagination
.
offset
--
;
}
$scope
.
postQuery
();
};
$scope
.
increment
=
function
()
{
if
(
$scope
.
pagination
.
offset
<
$scope
.
resultsCount
)
{
$scope
.
pagination
.
offset
+=
$scope
.
pagination
.
limit
;
}
$scope
.
postQuery
();
};
});
// Controller for datasets
...
...
@@ -220,10 +234,17 @@ gargantext.controller("DatasetController", function($scope, $http) {
$scope
.
results
=
[];
$scope
.
resultsCount
=
undefined
;
// corpus retrieval
$scope
.
projects
=
[];
$scope
.
corpora
=
[];
$http
.
get
(
'/api/nodes?type=
Corpus
'
,
{
cache
:
true
}).
success
(
function
(
response
){
$scope
.
corpora
=
response
.
data
;
$http
.
get
(
'/api/nodes?type=
Project
'
,
{
cache
:
true
}).
success
(
function
(
response
){
$scope
.
projects
=
response
.
data
;
});
// update corpora according to the select parent project
$scope
.
updateCorpora
=
function
()
{
$http
.
get
(
'/api/nodes?type=Corpus&parent='
+
$scope
.
projectId
,
{
cache
:
true
}).
success
(
function
(
response
){
$scope
.
corpora
=
response
.
data
;
});
};
// update entities depending on the selected corpus
$scope
.
updateEntities
=
function
()
{
var
url
=
'/api/nodes/'
+
$scope
.
corpusId
+
'/children/metadata'
;
...
...
@@ -302,7 +323,7 @@ gargantext.controller("GraphController", function($scope, $http, $element) {
options
:
{
axes
:
{
x
:
{
key
:
'x'
,
type
:
'date'
},
y
:
{
type
:
'l
og
'
},
y
:
{
type
:
'l
inear'
,
type
:
'numeric
'
},
},
tension
:
1.0
,
lineMode
:
'bundle'
,
...
...
@@ -363,15 +384,27 @@ gargantext.controller("GraphController", function($scope, $http, $element) {
});
});
// Convert this object back to a sorted array
var
yMin
,
yMax
;
var
linearData
=
[];
for
(
var
x
in
dataObject
)
{
var
row
=
{
x
:
convert
(
x
)};
var
yList
=
dataObject
[
x
];
for
(
var
i
=
0
;
i
<
yList
.
length
;
i
++
)
{
row
[
'y'
+
i
]
=
yList
[
i
];
y
=
yList
[
i
];
row
[
'y'
+
i
]
=
y
;
if
(
yMax
==
undefined
||
y
>
yMax
)
{
yMax
=
y
;
}
if
(
yMin
==
undefined
||
y
<
yMin
)
{
yMin
=
y
;
}
}
linearData
.
push
(
row
);
}
// Update the axis
$scope
.
graph
.
options
.
axes
.
y
.
min
=
yMin
;
$scope
.
graph
.
options
.
axes
.
y
.
max
=
yMax
;
$scope
.
graph
.
options
.
axes
.
y
.
ticks
=
100
;
// Finally, update the graph
var
series
=
[];
for
(
var
i
=
0
,
n
=
$scope
.
datasets
.
length
;
i
<
n
;
i
++
)
{
...
...
templates/chart.html
View file @
b86a3941
...
...
@@ -13,8 +13,7 @@
<div
class=
"container theme-showcase"
role=
"main"
>
<div
class=
"jumbotron"
>
<h1>
{{ project.name }}
</h1>
<p>
Advanced charts
</p>
<h1>
Advanced charts
</h1>
</div>
</div>
...
...
@@ -22,7 +21,7 @@
<div
id=
"test-container"
></div>
</div>
<!-- All the templates used by the Javascript framework -->
<!-- All the templates used by the Javascript framework -->
{% verbatim %}
<!--
<script type="text/template" id="filter-template">
...
...
@@ -227,10 +226,10 @@
<div
class=
"corpus"
>
<button
ng-click=
"removeDataset($index)"
title=
"remove this dataset"
>
X
</button>
<select
ng-model=
"mesured"
style=
"background-color:{{ getColor($index, datasets.length) }}"
ng-options=
"value as key for (key, value) in {'Documents count': 'nodes.count', 'Ngrams count': 'ngrams.count'}"
ng-change=
"updateQuery()"
></select>
in the
corpus
<select
ng-model=
"
corpusId"
ng-change=
"updateEntities()"
>
<option
ng-repeat=
"corpus in corpora"
value=
"{{corpus.id}}"
>
{{corpus.name}}
</option>
</select>
in the
project
<select
ng-model=
"
projectId"
ng-change=
"updateCorpora()"
ng-options=
"project.id as project.name for project in projects"
></select>
,
corpus
<
select
ng-model=
"corpusId"
ng-change=
"updateEntities()"
ng-options=
"corpus.id as corpus.name for corpus in corpora"
><
/select>
</div>
<div
class=
"filters"
ng-if=
"entities"
>
<ul>
...
...
@@ -273,7 +272,7 @@
<br/>
Y-axis: use a
<select
ng-model=
"graph.options.axes.y.type"
ng-options=
"type for type in ['l
og', 'linear
']"
></select>
<select
ng-model=
"graph.options.axes.y.type"
ng-options=
"type for type in ['l
inear', 'log
']"
></select>
scale
<br/>
...
...
@@ -359,4 +358,3 @@
templates/corpus.html
View file @
b86a3941
...
...
@@ -110,7 +110,7 @@
<div
class=
"col-md-4"
>
<div
class=
"jumbotron"
>
<h3><a
href=
"/corpus/{{corpus.id}}/matrix"
>
Matrix
</a></h3>
<h3><a
href=
"/
project/{{project.id}}/
corpus/{{corpus.id}}/matrix"
>
Matrix
</a></h3>
<ol>
<li>
Sort
</li>
<li>
Group
</li>
...
...
@@ -122,7 +122,7 @@
<div
class=
"col-md-4"
>
<div
class=
"jumbotron"
>
<h3><a
href=
"/corpus/{{ corpus.id }}/explorer"
>
Graph
</a></h3>
<h3><a
href=
"/
project/{{project.id}}/
corpus/{{ corpus.id }}/explorer"
>
Graph
</a></h3>
<ol>
<li>
Visualize
</li>
<li>
Explore
</li>
...
...
templates/menu.html
View file @
b86a3941
...
...
@@ -22,9 +22,16 @@
<div
class=
"navbar-collapse collapse"
>
<ul
class=
"nav navbar-nav"
>
<li><a
href=
"/admin/"
>
Admin
</a></li>
<li><a
href=
"/projects/"
>
Projects
</a></li>
<li><a
href=
"/projects/"
>
Corpus
</a></li>
<!-- <li><a href="/admin/">Admin/</a></li> --!>
<li><a href="/projects/">Projects/</a></li>
{% if project %}
<li><a href="/project/{{project.id}}">{{project.name}}/</a></li>
{% endif %}
{% if corpus %}
<li><a href="/project/{{project.id}}/corpus/{{corpus.id}}">{{corpus.name}}/</a></li>
{% endif %}
</ul>
<ul class="nav pull-right">
...
...
templates/tests/mvc-listdocuments.html
0 → 100644
View file @
b86a3941
This diff is collapsed.
Click to expand it.
templates/tests/mvc.html
View file @
b86a3941
...
...
@@ -227,10 +227,10 @@
<div
class=
"corpus"
>
<button
ng-click=
"removeDataset($index)"
title=
"remove this dataset"
>
X
</button>
<select
ng-model=
"mesured"
style=
"background-color:{{ getColor($index, datasets.length) }}"
ng-options=
"value as key for (key, value) in {'Documents count': 'nodes.count', 'Ngrams count': 'ngrams.count'}"
ng-change=
"updateQuery()"
></select>
in the
corpus
<select
ng-model=
"
corpusId"
ng-change=
"updateEntities()"
>
<option
ng-repeat=
"corpus in corpora"
value=
"{{corpus.id}}"
>
{{corpus.name}}
</option>
</select>
in the
project
<select
ng-model=
"
projectId"
ng-change=
"updateCorpora()"
ng-options=
"project.id as project.name for project in projects"
></select>
,
corpus
<
select
ng-model=
"corpusId"
ng-change=
"updateEntities()"
ng-options=
"corpus.id as corpus.name for corpus in corpora"
><
/select>
</div>
<div
class=
"filters"
ng-if=
"entities"
>
<ul>
...
...
@@ -273,7 +273,7 @@
<br/>
Y-axis: use a
<select
ng-model=
"graph.options.axes.y.type"
ng-options=
"type for type in ['l
og', 'linear
']"
></select>
<select
ng-model=
"graph.options.axes.y.type"
ng-options=
"type for type in ['l
inear', 'log
']"
></select>
scale
<br/>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment