Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
GeoInt_SIDT
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
Mario Chirinos Colunga
GeoInt_SIDT
Commits
70fc998e
Commit
70fc998e
authored
Feb 28, 2019
by
Ulises Morales Ramírez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard
parent
fff0e807
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
115 additions
and
17 deletions
+115
-17
dashboard.html
administration/templates/dashboard.html
+37
-1
urls.py
administration/urls.py
+1
-0
views.py
administration/views.py
+74
-8
L2ASCL_data.html
reports/templates/L2ASCL_data.html
+0
-5
views.py
reports/views.py
+3
-3
No files found.
administration/templates/dashboard.html
View file @
70fc998e
...
@@ -477,7 +477,7 @@
...
@@ -477,7 +477,7 @@
{% endfor %}
{% endfor %}
</div>
</div>
{% endif %}
{% endif %}
<div
id=
"ol"
></div>
{% endblock %}
{% endblock %}
...
@@ -582,5 +582,41 @@
...
@@ -582,5 +582,41 @@
order
:
[
1
,
'asc'
]
order
:
[
1
,
'asc'
]
});
});
});
});
// mostrar imagen al dar click en los puntos
document
.
getElementById
(
"salesChart"
).
onclick
=
function
(
evt
)
{
// activePoints = myChart.getElementsAtEvent(evt);
var
activePoint
=
myChart
.
getElementAtEvent
(
evt
);
var
firstPoint
=
activePoint
[
0
];
var
label
=
myChart
.
data
.
labels
[
firstPoint
.
_index
];
//if (!firstPoint) return;
$
.
ajax
({
type
:
'POST'
,
dataType
:
"json"
,
data
:
{
'title'
:
label
},
url
:
'../administration/ws/report_table'
,
success
:
function
(
data
)
{
alert
(
data
);
}
});
};
function
refresh
()
{
$
.
ajax
({
type
:
'POST'
,
dataType
:
"json"
,
data
:
{
'title'
:
label
},
url
:
'../administration/ws/report_table'
,
success
:
function
(
data
)
{
alert
(
data
);
}
});
};
</script>
</script>
{% endblock %}
{% endblock %}
\ No newline at end of file
administration/urls.py
View file @
70fc998e
...
@@ -7,4 +7,5 @@ urlpatterns = [
...
@@ -7,4 +7,5 @@ urlpatterns = [
url
(
r'^request/$'
,
views
.
Request_users
,
name
=
'Request'
),
url
(
r'^request/$'
,
views
.
Request_users
,
name
=
'Request'
),
url
(
r'^update/$'
,
views
.
update_user
,
name
=
'update'
),
url
(
r'^update/$'
,
views
.
update_user
,
name
=
'update'
),
url
(
r'^users/$'
,
views
.
active_users
,
name
=
'users'
),
url
(
r'^users/$'
,
views
.
active_users
,
name
=
'users'
),
url
(
r'^ws/report_table$'
,
views
.
wsPurchasesPM
,
name
=
'wsPurchasesPM'
),
]
]
\ No newline at end of file
administration/views.py
View file @
70fc998e
import
calendar
import
calendar
import
os
import
os
import
datetime
from
django.contrib
import
messages
from
django.contrib
import
messages
from
django.contrib.auth.models
import
User
from
django.contrib.auth.models
import
User
from
django.db.models
import
Count
from
django.db.models
import
Count
from
django.shortcuts
import
render
,
redirect
from
django.shortcuts
import
render
,
redirect
import
json
import
json
from
django.http
import
HttpResponse
,
HttpResponseRedirect
,
HttpRequest
from
django.http
import
HttpResponse
,
HttpResponseRedirect
,
HttpRequest
,
Http404
from
PIL
import
Image
from
PIL
import
Image
from
django.db.models
import
Q
# Create your views here.
# Create your views here.
from
django.views.decorators.csrf
import
csrf_exempt
from
catalog.models
import
Purchase
,
Search
from
catalog.models
import
Purchase
,
Search
from
catalog.views
import
config
from
catalog.views
import
config
USERS_PATH
=
config
[
'PATHS'
][
'PATH_NAS'
]
USERS_PATH
=
config
[
'PATHS'
][
'PATH_NAS'
]
def
Dashboard
(
request
):
def
Dashboard
(
request
):
total
=
Purchase
.
objects
.
filter
(
purchased
=
True
)
.
count
()
total
=
Purchase
.
objects
.
filter
(
purchased
=
True
)
.
count
()
usuarios
=
User
.
objects
.
filter
(
is_active
=
True
)
.
count
()
usuarios
=
User
.
objects
.
filter
(
is_active
=
True
)
.
count
()
Request
=
User
.
objects
.
filter
(
is_active
=
False
)
.
count
()
Request
=
User
.
objects
.
filter
(
is_active
=
False
)
.
count
()
...
@@ -46,18 +54,16 @@ def Dashboard(request):
...
@@ -46,18 +54,16 @@ def Dashboard(request):
Searches
=
Search
.
objects
.
values
(
'search_name'
)
.
exclude
(
search_name__in
=
search_names
)
.
annotate
(
Searches
=
Search
.
objects
.
values
(
'search_name'
)
.
exclude
(
search_name__in
=
search_names
)
.
annotate
(
count
=
Count
(
'search_name'
))
.
order_by
(
'-count'
)[:
5
]
count
=
Count
(
'search_name'
))
.
order_by
(
'-count'
)[:
5
]
print
(
USERS_PATH
)
repsat
=
os
.
stat
(
USERS_PATH
+
"/repsat_test_dev"
)
.
st_size
repsat
=
os
.
stat
(
USERS_PATH
+
"/repsat_test_dev"
)
.
st_size
if
repsat
>
10
00
:
if
repsat
>
10
24
:
size2
=
repsat
/
10
00
size2
=
repsat
/
10
24
size_repsat
=
str
(
round
(
size2
,
2
))
+
" GB"
size_repsat
=
str
(
round
(
size2
,
2
))
+
" GB"
else
:
else
:
size_repsat
=
str
(
round
(
repsat
,
2
))
+
" MB"
size_repsat
=
str
(
round
(
repsat
,
2
))
+
" MB"
sentinel
=
os
.
stat
(
USERS_PATH
+
"/
repsat_test_dev
"
)
.
st_size
sentinel
=
os
.
stat
(
USERS_PATH
+
"/
sentinelImages
"
)
.
st_size
if
sentinel
>
10
00
:
if
sentinel
>
10
24
:
size2
=
repsat
/
10
00
size2
=
repsat
/
10
24
size_sentinel
=
str
(
round
(
size2
,
2
))
+
" GB"
size_sentinel
=
str
(
round
(
size2
,
2
))
+
" GB"
else
:
else
:
size_sentinel
=
str
(
round
(
sentinel
,
2
))
+
" MB"
size_sentinel
=
str
(
round
(
sentinel
,
2
))
+
" MB"
...
@@ -128,3 +134,63 @@ def active_users(request):
...
@@ -128,3 +134,63 @@ def active_users(request):
})
})
# messages.success(request, 'your registration is being processed')
# messages.success(request, 'your registration is being processed')
return
render
(
request
,
'users_table.html'
,
{
'users'
:
user_list
,
"Viewname"
:
"Request"
})
return
render
(
request
,
'users_table.html'
,
{
'users'
:
user_list
,
"Viewname"
:
"Request"
})
#----------------------------------------------------------------------
# @csrf_exempt
# def wsPurchasesPM (request):
# if request.is_ajax():
# message = "Yes, AJAX!"
# id = request.user.id
#
# else:
# message = "Not Ajax"
#
# #
#
# return HttpResponse(message)
@
csrf_exempt
def
wsPurchasesPM
(
request
):
global
mes
print
(
request
.
POST
.
get
(
'title'
))
if
request
.
is_ajax
():
date_list
=
Purchase
.
objects
.
dates
(
'aggreg_date'
,
'month'
)
for
meses
in
date_list
:
datee
=
datetime
.
datetime
.
strptime
(
str
(
meses
),
"
%
Y-
%
m-
%
d"
)
mes
=
calendar
.
month_name
[
int
(
datee
.
month
)]
print
(
mes
)
#data =Purchase.objects.filter(Q(date__month=1) | Q(date__month=2) | Q(date__month=3))
#data = Purchase.objects.values('user__username').filter(Q(aggreg_date__month=to_if(mes))|Q(user__purchase_user_id = user__user_id))
data
=
Purchase
.
objects
.
filter
()
for
dato
in
data
:
print
(
dato
.
username
)
#return HttpResponse(json.dumps(request.POST.get('title')))
return
HttpResponse
(
json
.
dumps
(
to_if
(
mes
)))
else
:
raise
Http404
#----------------------------------------------------------------------
def
to_if
(
name
):
if
name
==
"January"
:
return
1
elif
name
==
"February"
:
return
2
elif
name
==
"March"
:
return
3
elif
name
==
"April"
:
return
4
elif
name
==
"May"
:
return
5
elif
name
==
"June"
:
return
6
elif
name
==
"July"
:
return
7
elif
name
==
"August"
:
return
8
elif
name
==
"September"
:
return
9
elif
name
==
"October"
:
return
10
elif
name
==
"November"
:
return
11
elif
name
==
"December"
:
return
12
else
:
raise
ValueError
\ No newline at end of file
reports/templates/L2ASCL_data.html
View file @
70fc998e
...
@@ -116,11 +116,6 @@
...
@@ -116,11 +116,6 @@
<!-- Main content -->
<!-- Main content -->
<div
id=
"reportPage"
class=
"wrapper"
style=
"background-color: #ecf0f5"
>
<div
id=
"reportPage"
class=
"wrapper"
style=
"background-color: #ecf0f5"
>
<div
class=
"text-center"
><h1>
{{ report_name }}
</h1></div>
<div
class=
"text-center"
><h1>
{{ report_name }}
</h1></div>
<!-- <h4 style='margin:20px'>Platform: {{platform}} <br> Product level: {{productLevel}} <br> Start date: {{startDate}} <br>End date: {{endDate}} <br> Clouds: {{clouds}} </h4> -->
<!-- Content Wrapper. Contains page content -->
<!-- Main content -->
<section
class=
"content"
>
<section
class=
"content"
>
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"col-md-12"
style=
"margin-bottom: 15px;"
>
<div
class=
"col-md-12"
style=
"margin-bottom: 15px;"
>
...
...
reports/views.py
View file @
70fc998e
...
@@ -141,9 +141,9 @@ def Reports(request):
...
@@ -141,9 +141,9 @@ def Reports(request):
if
'Finalizing...'
in
open
(
log_info
)
.
read
():
if
'Finalizing...'
in
open
(
log_info
)
.
read
():
progress
=
100
progress
=
100
#item = Purchase.objects.filter(pk=producto['id'])
#item = Purchase.objects.filter(pk=producto['id'])
item
=
Purchase
.
objects
.
get
(
pk
=
producto
[
'id'
])
#
item = Purchase.objects.get(pk=producto['id'])
item
.
progress
=
progress
#
item.progress = progress
item
.
save
()
#
item.save()
with
open
(
log_info
,
'r'
)
as
myfile
:
with
open
(
log_info
,
'r'
)
as
myfile
:
log
=
myfile
.
read
()
.
replace
(
'
\n
'
,
''
)
log
=
myfile
.
read
()
.
replace
(
'
\n
'
,
''
)
...
...
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