Browse Source

Squash de parte da solução para SaplOnline

configura ativação para channels

change frontend

 nova versão do frontend

rename view and urls from app frontend

cria mixin para não implementação da api

add endpoint para recuperar anos que possuem sessao

altera signal de comunicação com websocket

frontend para sapl-online
pull/2601/head
Leandro Roberto 6 years ago
parent
commit
95560c4d16
  1. 3
      docs/instalacao31.rst
  2. 1
      sapl/api/views.py
  3. 2
      sapl/base/urls.py
  4. 9
      sapl/rules/apps.py
  5. 1
      sapl/static/sapl/css/chunk-3e2c11a1.753656d9.css
  6. BIN
      sapl/static/sapl/css/chunk-3e2c11a1.753656d9.css.gz
  7. 1
      sapl/static/sapl/css/chunk-4cf2dae1.c74a36e9.css
  8. BIN
      sapl/static/sapl/css/chunk-4cf2dae1.c74a36e9.css.gz
  9. 1
      sapl/static/sapl/js/chunk-2d0c4a82.e9966270.js
  10. BIN
      sapl/static/sapl/js/chunk-2d0c4a82.e9966270.js.gz
  11. 1
      sapl/static/sapl/js/chunk-2d0e8be2.7638cda0.js
  12. BIN
      sapl/static/sapl/js/chunk-2d0e8be2.7638cda0.js.gz
  13. 1
      sapl/static/sapl/js/chunk-3e2c11a1.6c006025.js
  14. BIN
      sapl/static/sapl/js/chunk-3e2c11a1.6c006025.js.gz
  15. 1
      sapl/static/sapl/js/chunk-45646c50.d38deb3f.js
  16. BIN
      sapl/static/sapl/js/chunk-45646c50.d38deb3f.js.gz
  17. 1
      sapl/static/sapl/js/chunk-4cf2dae1.c0f79763.js
  18. BIN
      sapl/static/sapl/js/chunk-4cf2dae1.c0f79763.js.gz
  19. BIN
      sapl/static/sapl/js/compilacao.7b04bca9.js.gz
  20. 2
      sapl/static/sapl/js/compilacao.c9cbd558.js
  21. BIN
      sapl/static/sapl/js/compilacao.c9cbd558.js.gz
  22. 1
      sapl/static/sapl/js/online.1659ac75.js
  23. BIN
      sapl/static/sapl/js/online.1659ac75.js.gz
  24. 12
      sapl/templates/online_app.html
  25. 2
      sapl/webpack-stats.json

3
docs/instalacao31.rst

@ -298,8 +298,11 @@ Django-Channels
Para ativar Django-Channels e a comunicação via websockets utilizada pelo entry-point sessao/online de sapl-frontend coloque no arquivo .env a variável:
USE_CHANNEL_LAYERS = True
<<<<<<< HEAD
HOST_CHANNEL_LAYERS: localhost
PORT_CHANNEL_LAYERS: 6379
=======
>>>>>>> configura ativação para channels
Ao ativar o channels, no ambiente de desenvolvimento é necessário ativar um servidor redis. Utilize/Instale o docker e execute:

1
sapl/api/views.py

@ -26,7 +26,6 @@ from sapl.materia.models import Proposicao
from sapl.parlamentares.models import Parlamentar
from sapl.utils import models_with_gr_for_model, choice_anos_com_sessaoplenaria
class BusinessRulesNotImplementedMixin:
def create(self, request, *args, **kwargs):
raise Exception(_("POST Create não implementado"))

2
sapl/base/urls.py

@ -95,7 +95,7 @@ channels_url = [
url(r'^sapl/time-refresh/$',
base.views.time_refresh_log_test, name='time_refresh_log_test_index'),
url(r'^online',
url(r'^online/',
base.views.online_app_view, name='online_app_url'),
]

9
sapl/rules/apps.py

@ -9,7 +9,7 @@ from django.contrib.auth import get_user_model
from django.contrib.auth.management import _get_all_permissions
from django.core import exceptions
from django.db import models, router
from django.db.models.signals import post_save
from django.db.models.signals import post_save, post_delete
from django.db.utils import DEFAULT_DB_ALIAS
from django.dispatch.dispatcher import receiver
from django.utils.translation import string_concat
@ -299,7 +299,7 @@ def send_signal_for_websocket_time_refresh(inst, action):
def revision_pre_delete_signal(sender, **kwargs):
send_signal_for_websocket_time_refresh(kwargs['instance'], 'pre_delete')
#send_signal_for_websocket_time_refresh(kwargs['instance'], 'pre_delete')
with reversion.create_revision():
kwargs['instance'].save()
reversion.set_comment("Deletado pelo sinal.")
@ -310,6 +310,11 @@ def sapl_post_save_signal(sender, instance, using, **kwargs):
send_signal_for_websocket_time_refresh(instance, 'post_save')
@receiver(post_delete, dispatch_uid='sapl_post_delete_signal')
def sapl_post_delete_signal(sender, instance, using, **kwargs):
send_signal_for_websocket_time_refresh(instance, 'post_delete')
models.signals.post_migrate.connect(
receiver=update_groups)

1
sapl/static/sapl/css/chunk-3e2c11a1.753656d9.css

File diff suppressed because one or more lines are too long

BIN
sapl/static/sapl/css/chunk-3e2c11a1.753656d9.css.gz

Binary file not shown.

1
sapl/static/sapl/css/chunk-4cf2dae1.c74a36e9.css

File diff suppressed because one or more lines are too long

BIN
sapl/static/sapl/css/chunk-4cf2dae1.c74a36e9.css.gz

Binary file not shown.

1
sapl/static/sapl/js/chunk-2d0c4a82.e9966270.js

@ -0,0 +1 @@
(window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-2d0c4a82"],{"3c84":function(e,n,s){"use strict";s.r(n);var a={name:"sessao-plenaria-module"},t=s("0c7c"),c=Object(t.a)(a,function(){var e=this.$createElement,n=this._self._c||e;return n("div",{staticClass:"online-sessaolenaria"},[n("router-view")],1)},[],!1,null,null,null);n.default=c.exports}}]);

BIN
sapl/static/sapl/js/chunk-2d0c4a82.e9966270.js.gz

Binary file not shown.

1
sapl/static/sapl/js/chunk-2d0e8be2.7638cda0.js

@ -0,0 +1 @@
(window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-2d0e8be2"],{"8b24":function(n,e,t){"use strict";t.r(e);var a={name:"index",data:function(){return{}}},i=t("0c7c"),c=Object(i.a)(a,function(){var n=this.$createElement;return(this._self._c||n)("div",[this._v("\n teste de página para dentro do main - INDEX INDEX\n")])},[],!1,null,null,null);e.default=c.exports}}]);

BIN
sapl/static/sapl/js/chunk-2d0e8be2.7638cda0.js.gz

Binary file not shown.

1
sapl/static/sapl/js/chunk-3e2c11a1.6c006025.js

File diff suppressed because one or more lines are too long

BIN
sapl/static/sapl/js/chunk-3e2c11a1.6c006025.js.gz

Binary file not shown.

1
sapl/static/sapl/js/chunk-45646c50.d38deb3f.js

File diff suppressed because one or more lines are too long

BIN
sapl/static/sapl/js/chunk-45646c50.d38deb3f.js.gz

Binary file not shown.

1
sapl/static/sapl/js/chunk-4cf2dae1.c0f79763.js

@ -0,0 +1 @@
(window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-4cf2dae1"],{3713:function(t,s,a){"use strict";(function(t){var e=a("975e");s.a={name:"sessao-plenaria-item-list",props:["sessao"],data:function(){return{utils:e.a.Utils,app:["sessao","parlamentares"],model:["sessaoplenaria","sessaolegislativa","tiposessaoplenaria","legislatura"],data_inicio:new Date,sessao_legislativa:{numero:""},tipo:{nome:""},legislatura:{numero:""},metadata:{sessao_legislativa:{app:"parlamentares",model:"sessaolegislativa",id:this.sessao.sessao_legislativa},legislatura:{app:"parlamentares",model:"legislatura",id:this.sessao.legislatura},tipo:{app:"sessao",model:"tiposessaoplenaria",id:this.sessao.tipo}}}},watch:{sessao:function(t){this.updateSessao(),this.fetch()}},computed:{titulo:function(){var t=this.sessao,s=this.tipo,a=this.data_inicio;return"".concat(t.numero,"ª ").concat(s.nome," da \n ").concat(a.getDate()>15?2:1,"ª Quizena do Mês de \n ").concat(this.month_text(a.getMonth())," de \n ").concat(a.getFullYear(),"\n ")},subtitulo:function(){return"".concat(this.sessao_legislativa.numero,"ª Sessão Legislativa da \n ").concat(this.legislatura.numero,"ª Legislatura")},date_text:function(){return"".concat(this.data_inicio.getDate()," de \n ").concat(this.month_text(this.data_inicio.getMonth())," de\n ").concat(this.data_inicio.getFullYear()," - ").concat(this.sessao.hora_inicio)}},methods:{sendStore:function(){this.insertInState({app:"sessao",model:"sessaoplenaria",id:this.sessao.id,value:this.sessao})},month_text:function(t){return["Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"][t]},fetch:function(){var s=this;t.mapKeys(s.metadata,function(t,a){var e=s.metadata[a];e.component=s;var i=s.getModel(e);null===i?s.insertInState(e).then(function(t){s[a]=s.getModel(e)[e.id]}):void 0===i[e.id]?s.$nextTick().then(function(){setTimeout(function(){s.fetch()},100)}):s[a]=i[e.id]})},updateSessao:function(){this.data_inicio=this.stringToDate(this.sessao.data_inicio,"yyyy-mm-dd","-"),this.metadata.sessao_legislativa.id=this.sessao.sessao_legislativa,this.metadata.tipo.id=this.sessao.tipo,this.metadata.legislatura.id=this.sessao.legislatura}},mounted:function(){this.updateSessao(),this.fetch()}}}).call(this,a("2ef0"))},4358:function(t,s,a){"use strict";var e=a("3713").a,i=(a("e94f"),a("0c7c")),n=Object(i.a)(e,function(){var t=this,s=t.$createElement,a=t._self._c||s;return a("router-link",{class:"sessao-plenaria-item-list",attrs:{to:{name:"sessao_plenaria_online_link",params:{id:t.sessao.id}}},nativeOn:{click:function(s){return t.sendStore(s)}}},[a("h5",{staticClass:"tit"},[t._v("\n "+t._s(t.titulo)+"\n ")]),a("div",{staticClass:"subtitulo"},[a("span",[t._v(t._s(t.subtitulo))]),t._v(" – "),a("span",[t._v(t._s(t.date_text))])])])},[],!1,null,null,null);s.a=n.exports},"4a7e":function(t,s,a){"use strict";a.r(s);var e=a("4358"),i=a("975e"),n={name:"sessao-plenaria-online",components:{SessaoPlenariaItemList:e.a},data:function(){return{utils:i.a.Utils,sessao:null,app:["sessao"],model:["sessaoplenaria"]}},mounted:function(){this.fetchSessao()},methods:{fetchSessao:function(){var t=this,s=t.$route.params.id,a={app:t.app[0],model:t.model[0],id:s},e=t.getModel(a);null!==e&&e.hasOwnProperty(s)?t.sessao=e[s]:t.$nextTick().then(function(){t.insertInState(a).then(function(){e=t.getModel(a),t.sessao=e[s]})})},fetch:function(){this.fetchSessao()}}},o=(a("8e03"),a("0c7c")),l=Object(o.a)(n,function(){var t=this.$createElement,s=this._self._c||t;return s("div",{staticClass:"sessao-plenaria-online"},[this.sessao?s("div",[s("sessao-plenaria-item-list",{attrs:{sessao:this.sessao}}),this._v("\nteste\n ")],1):this._e()])},[],!1,null,null,null);s.default=l.exports},"8e03":function(t,s,a){"use strict";var e=a("e8c9");a.n(e).a},e8c9:function(t,s,a){},e94f:function(t,s,a){"use strict";var e=a("f16d");a.n(e).a},f16d:function(t,s,a){}}]);

BIN
sapl/static/sapl/js/chunk-4cf2dae1.c0f79763.js.gz

Binary file not shown.

BIN
sapl/static/sapl/js/compilacao.7b04bca9.js.gz

Binary file not shown.

2
sapl/static/sapl/js/compilacao.7b04bca9.js → sapl/static/sapl/js/compilacao.c9cbd558.js

File diff suppressed because one or more lines are too long

BIN
sapl/static/sapl/js/compilacao.c9cbd558.js.gz

Binary file not shown.

1
sapl/static/sapl/js/online.1659ac75.js

File diff suppressed because one or more lines are too long

BIN
sapl/static/sapl/js/online.1659ac75.js.gz

Binary file not shown.

12
sapl/templates/online_app.html

@ -0,0 +1,12 @@
{% extends "index.html" %}
{% load render_bundle from webpack_loader %}
{% block webpack_loader_css %}
{{ block.super }}
{% render_bundle 'online' 'css' %}
{% endblock %}
{% block webpack_loader_js %}
{{ block.super }}
{% render_bundle 'online' 'js' %}
{% endblock %}

2
sapl/webpack-stats.json

@ -1 +1 @@
{"status":"done","publicPath":"/static/sapl/","chunks":{"null":[{"name":"css/chunk-4cf2dae1.c632bec6.css","publicPath":"/static/sapl/css/chunk-4cf2dae1.c632bec6.css","path":"../sapl/sapl/static/sapl/css/chunk-4cf2dae1.c632bec6.css"},{"name":"js/chunk-4cf2dae1.89120e74.js","publicPath":"/static/sapl/js/chunk-4cf2dae1.89120e74.js","path":"../sapl/sapl/static/sapl/js/chunk-4cf2dae1.89120e74.js"},{"name":"css/chunk-4cf2dae1.c632bec6.css.map","publicPath":"/static/sapl/css/chunk-4cf2dae1.c632bec6.css.map","path":"../sapl/sapl/static/sapl/css/chunk-4cf2dae1.c632bec6.css.map"}],"chunk-vendors":[{"name":"css/chunk-vendors.2ce8185b.css","publicPath":"/static/sapl/css/chunk-vendors.2ce8185b.css","path":"../sapl/sapl/static/sapl/css/chunk-vendors.2ce8185b.css"},{"name":"js/chunk-vendors.0b0a5dbb.js","publicPath":"/static/sapl/js/chunk-vendors.0b0a5dbb.js","path":"../sapl/sapl/static/sapl/js/chunk-vendors.0b0a5dbb.js"},{"name":"css/chunk-vendors.2ce8185b.css.map","publicPath":"/static/sapl/css/chunk-vendors.2ce8185b.css.map","path":"../sapl/sapl/static/sapl/css/chunk-vendors.2ce8185b.css.map"}],"compilacao":[{"name":"css/compilacao.3372b760.css","publicPath":"/static/sapl/css/compilacao.3372b760.css","path":"../sapl/sapl/static/sapl/css/compilacao.3372b760.css"},{"name":"js/compilacao.7b04bca9.js","publicPath":"/static/sapl/js/compilacao.7b04bca9.js","path":"../sapl/sapl/static/sapl/js/compilacao.7b04bca9.js"},{"name":"css/compilacao.3372b760.css.map","publicPath":"/static/sapl/css/compilacao.3372b760.css.map","path":"../sapl/sapl/static/sapl/css/compilacao.3372b760.css.map"}],"global":[{"name":"css/global.e4ae5421.css","publicPath":"/static/sapl/css/global.e4ae5421.css","path":"../sapl/sapl/static/sapl/css/global.e4ae5421.css"},{"name":"js/global.742e068f.js","publicPath":"/static/sapl/js/global.742e068f.js","path":"../sapl/sapl/static/sapl/js/global.742e068f.js"},{"name":"css/global.e4ae5421.css.map","publicPath":"/static/sapl/css/global.e4ae5421.css.map","path":"../sapl/sapl/static/sapl/css/global.e4ae5421.css.map"}],"online":[{"name":"css/online.3d6220ca.css","publicPath":"/static/sapl/css/online.3d6220ca.css","path":"../sapl/sapl/static/sapl/css/online.3d6220ca.css"},{"name":"js/online.50eb7f8e.js","publicPath":"/static/sapl/js/online.50eb7f8e.js","path":"../sapl/sapl/static/sapl/js/online.50eb7f8e.js"},{"name":"css/online.3d6220ca.css.map","publicPath":"/static/sapl/css/online.3d6220ca.css.map","path":"../sapl/sapl/static/sapl/css/online.3d6220ca.css.map"}],"painel":[{"name":"css/painel.baa845ab.css","publicPath":"/static/sapl/css/painel.baa845ab.css","path":"../sapl/sapl/static/sapl/css/painel.baa845ab.css"},{"name":"js/painel.f4adb91b.js","publicPath":"/static/sapl/js/painel.f4adb91b.js","path":"../sapl/sapl/static/sapl/js/painel.f4adb91b.js"},{"name":"css/painel.baa845ab.css.map","publicPath":"/static/sapl/css/painel.baa845ab.css.map","path":"../sapl/sapl/static/sapl/css/painel.baa845ab.css.map"}]}}
{"status":"done","publicPath":"/static/sapl/","chunks":{"null":[{"name":"css/chunk-4cf2dae1.c74a36e9.css","publicPath":"/static/sapl/css/chunk-4cf2dae1.c74a36e9.css","path":"../sapl/sapl/static/sapl/css/chunk-4cf2dae1.c74a36e9.css"},{"name":"js/chunk-4cf2dae1.c0f79763.js","publicPath":"/static/sapl/js/chunk-4cf2dae1.c0f79763.js","path":"../sapl/sapl/static/sapl/js/chunk-4cf2dae1.c0f79763.js"},{"name":"css/chunk-4cf2dae1.c74a36e9.css.map","publicPath":"/static/sapl/css/chunk-4cf2dae1.c74a36e9.css.map","path":"../sapl/sapl/static/sapl/css/chunk-4cf2dae1.c74a36e9.css.map"}],"chunk-vendors":[{"name":"css/chunk-vendors.2ce8185b.css","publicPath":"/static/sapl/css/chunk-vendors.2ce8185b.css","path":"../sapl/sapl/static/sapl/css/chunk-vendors.2ce8185b.css"},{"name":"js/chunk-vendors.0b0a5dbb.js","publicPath":"/static/sapl/js/chunk-vendors.0b0a5dbb.js","path":"../sapl/sapl/static/sapl/js/chunk-vendors.0b0a5dbb.js"},{"name":"css/chunk-vendors.2ce8185b.css.map","publicPath":"/static/sapl/css/chunk-vendors.2ce8185b.css.map","path":"../sapl/sapl/static/sapl/css/chunk-vendors.2ce8185b.css.map"}],"compilacao":[{"name":"css/compilacao.3372b760.css","publicPath":"/static/sapl/css/compilacao.3372b760.css","path":"../sapl/sapl/static/sapl/css/compilacao.3372b760.css"},{"name":"js/compilacao.c9cbd558.js","publicPath":"/static/sapl/js/compilacao.c9cbd558.js","path":"../sapl/sapl/static/sapl/js/compilacao.c9cbd558.js"},{"name":"css/compilacao.3372b760.css.map","publicPath":"/static/sapl/css/compilacao.3372b760.css.map","path":"../sapl/sapl/static/sapl/css/compilacao.3372b760.css.map"}],"global":[{"name":"css/global.e4ae5421.css","publicPath":"/static/sapl/css/global.e4ae5421.css","path":"../sapl/sapl/static/sapl/css/global.e4ae5421.css"},{"name":"js/global.eb461386.js","publicPath":"/static/sapl/js/global.eb461386.js","path":"../sapl/sapl/static/sapl/js/global.eb461386.js"},{"name":"css/global.e4ae5421.css.map","publicPath":"/static/sapl/css/global.e4ae5421.css.map","path":"../sapl/sapl/static/sapl/css/global.e4ae5421.css.map"}],"online":[{"name":"css/online.3d6220ca.css","publicPath":"/static/sapl/css/online.3d6220ca.css","path":"../sapl/sapl/static/sapl/css/online.3d6220ca.css"},{"name":"js/online.1659ac75.js","publicPath":"/static/sapl/js/online.1659ac75.js","path":"../sapl/sapl/static/sapl/js/online.1659ac75.js"},{"name":"css/online.3d6220ca.css.map","publicPath":"/static/sapl/css/online.3d6220ca.css.map","path":"../sapl/sapl/static/sapl/css/online.3d6220ca.css.map"}],"painel":[{"name":"css/painel.baa845ab.css","publicPath":"/static/sapl/css/painel.baa845ab.css","path":"../sapl/sapl/static/sapl/css/painel.baa845ab.css"},{"name":"js/painel.f4adb91b.js","publicPath":"/static/sapl/js/painel.f4adb91b.js","path":"../sapl/sapl/static/sapl/js/painel.f4adb91b.js"},{"name":"css/painel.baa845ab.css.map","publicPath":"/static/sapl/css/painel.baa845ab.css.map","path":"../sapl/sapl/static/sapl/css/painel.baa845ab.css.map"}]}}
Loading…
Cancel
Save