Commit 80eebb7b authored by Janez K's avatar Janez K
Browse files

managiranje streamov

parent e13167d5
......@@ -30,8 +30,12 @@
<div class="row">
<div class="span12">
<a href="#" class="btn btn-warning btn-large">Deactivate</a>
<a href="#" class="btn btn-warning btn-danger btn-large">Reset</a>
{% if %}
<a href="{% url 'deactivate stream' %}" class="btn btn-warning btn-large">Deactivate</a>
{% else %}
<a href="{% url 'activate stream' %}" class="btn btn-success btn-large">Activate</a>
{% endif %}
<a href="javascript:;" class="reset-stream btn btn-warning btn-danger btn-large">Reset</a>
......@@ -49,11 +53,25 @@
{% for w in stream.stream_visualization_widgets %}
<td class="name">{{w}}</td>
<td><a href="#" class="btn btn-mini">View results</a></td>
<td><a href="{% url 'stream widget visualization' %}" class="btn btn-mini">View results</a></td>
{% endfor %}
<script type="text/javascript">
$(function() {
$(".reset-stream").click(function() {
bootbox.confirm("Are you sure you wish to reset the stream? This means that all data that you have mined so far will be cleared.","No way!", "Yes, definitely!", function(result) {
if (result==true) {
window.location='{% url 'reset stream' %}';
{% endblock %}
......@@ -24,7 +24,7 @@
{% if %}
{% if %}<span class="label label-success"><i class="icon-ok icon-white"></i> Active</span> <a href="{{}}" class="btn btn-mini"><i class="icon-wrench"></i></a>
{% else %}<span class="label label-warning"><i class="icon-remove icon-white"></i> Inactive</span> <a href="{{}}" class="btn btn-mini"><i class="icon-wrench"></i></a>{% endif %}
{% else %}<a href="#" class="btn btn-mini">Start stream mining</a>{% endif %}
{% else %}<a href="{% url 'start stream' %}" class="btn btn-mini">Start stream mining</a>{% endif %}
{% else %}<span class="label"><i class="icon-remove icon-white"></i> No streaming widgets</span>{% endif %}
<td><a href="{{w.get_absolute_url}}">Edit</a> | <a href="{{w.get_copy_url}}">Open as new</a> | <a href="javascript:;" rel="{{}}" class="delete_workflow">Delete</a> | {% if not w.public %}<a href="{% url 'make public' %}">Make public</a>{% else %}<a href="{% url 'make private' %}">Make private</a>{% endif %}</td>
......@@ -7,6 +7,13 @@ urlpatterns = patterns('',
url(r'^your-workflows/', 'website.views.your_workflows', name='your workflows'),
url(r'^streams/(?P<stream_id>[0-9]+)/$', '', name='stream'),
url(r'^start-stream/(?P<workflow_id>[0-9]+)/$', 'website.views.start_stream', name='start stream'),
url(r'^activate-stream/(?P<stream_id>[0-9]+)/$', 'website.views.activate_stream', name='activate stream'),
url(r'^deactivate-stream/(?P<stream_id>[0-9]+)/$', 'website.views.deactivate_stream', name='deactivate stream'),
url(r'^reset-stream/(?P<stream_id>[0-9]+)/$', 'website.views.reset_stream', name='reset stream'),
url(r'^make-private/(?P<workflow_id>[0-9]+)/$', 'website.views.make_private', name='make private'),
url(r'^make-public/(?P<workflow_id>[0-9]+)/$', 'website.views.make_public', name='make public'),
......@@ -22,6 +22,38 @@ import os
def index(request):
return render(request, 'website/index.html')
def reset_stream(request,stream_id):
s = get_object_or_404(Stream, pk=stream_id)
if s.user != request.user:
raise Http404
return redirect(s.get_absolute_url())
def deactivate_stream(request,stream_id):
s = get_object_or_404(Stream, pk=stream_id)
if s.user != request.user:
raise Http404 = False
return redirect(s.get_absolute_url())
def activate_stream(request,stream_id):
s = get_object_or_404(Stream, pk=stream_id)
if s.user != request.user:
raise Http404 = True
return redirect(s.get_absolute_url())
def start_stream(request,workflow_id):
w = get_object_or_404(Workflow, pk=workflow_id)
if w.user != request.user:
raise Http404
s = Stream(workflow=w,user=request.user,active=True)
return redirect(s.get_absolute_url())
def stream(request,stream_id):
stream = get_object_or_404(Stream,pk=stream_id)
if stream.workflow.user != request.user:
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment