websocket init
This commit is contained in:
parent
11c6d4635f
commit
13c9c8bd3d
4
.env
4
.env
|
@ -40,9 +40,9 @@ MAILER_NOREPLY=noreply@noreply.fr
|
||||||
|
|
||||||
|
|
||||||
# WEBSOCKET
|
# WEBSOCKET
|
||||||
WSS_USE=0
|
WSS_USE=1
|
||||||
WSS_PORT=5588
|
WSS_PORT=5588
|
||||||
|
WSS_URL=ws://localhost:5588
|
||||||
|
|
||||||
# Proxy
|
# Proxy
|
||||||
PROXY_USE=0
|
PROXY_USE=0
|
||||||
|
|
|
@ -69,7 +69,7 @@ app_sonde:
|
||||||
|
|
||||||
#== Wss ==================================================================================================================
|
#== Wss ==================================================================================================================
|
||||||
app_wss_sample:
|
app_wss_sample:
|
||||||
path: /user/wss/sampble
|
path: /user/wss/sample
|
||||||
defaults: { _controller: App\Controller\WebsocketController:sample }
|
defaults: { _controller: App\Controller\WebsocketController:sample }
|
||||||
|
|
||||||
#== Crop =================================================================================================================
|
#== Crop =================================================================================================================
|
||||||
|
@ -345,3 +345,8 @@ app_scrumissue_ctrlchange:
|
||||||
app_scrumissue_view:
|
app_scrumissue_view:
|
||||||
path: /user/scrumissue/view/{id}
|
path: /user/scrumissue/view/{id}
|
||||||
defaults: { _controller: App\Controller\ScrumissueController:view }
|
defaults: { _controller: App\Controller\ScrumissueController:view }
|
||||||
|
|
||||||
|
#== Poker =============================================================================================================
|
||||||
|
app_poker_get:
|
||||||
|
path: /user/poker/{userid}/{issueid}
|
||||||
|
defaults: { _controller: App\Controller\ScrumissueController:getpoker }
|
||||||
|
|
|
@ -34,7 +34,7 @@ parameters:
|
||||||
|
|
||||||
wssuse: '%env(resolve:WSS_USE)%'
|
wssuse: '%env(resolve:WSS_USE)%'
|
||||||
wssport: '%env(resolve:WSS_PORT)%'
|
wssport: '%env(resolve:WSS_PORT)%'
|
||||||
wssurl: 'wss://%env(resolve:APP_WEBURL)%/wss%env(resolve:APP_ALIAS)%'
|
wssurl: '%env(resolve:WSS_URL)%'
|
||||||
|
|
||||||
proxyUse: '%env(resolve:PROXY_USE)%'
|
proxyUse: '%env(resolve:PROXY_USE)%'
|
||||||
proxyHost: '%env(resolve:PROXY_HOST)%'
|
proxyHost: '%env(resolve:PROXY_HOST)%'
|
||||||
|
@ -105,3 +105,8 @@ services:
|
||||||
public: true
|
public: true
|
||||||
class: App\Service\giteaService
|
class: App\Service\giteaService
|
||||||
arguments: ["@session","%giteaUrl%"]
|
arguments: ["@session","%giteaUrl%"]
|
||||||
|
|
||||||
|
App\Websocket\MessageHandler:
|
||||||
|
public: true
|
||||||
|
arguments:
|
||||||
|
- "@service_container"
|
|
@ -23,13 +23,14 @@ services:
|
||||||
image: reg.cadoles.com/envole/ninegitea
|
image: reg.cadoles.com/envole/ninegitea
|
||||||
ports:
|
ports:
|
||||||
- "8005:80"
|
- "8005:80"
|
||||||
|
- "5588:5588"
|
||||||
volumes:
|
volumes:
|
||||||
- ./src:/app/src:delegated
|
- ./src:/app/src:delegated
|
||||||
- ./templates:/app/templates:delegated
|
- ./templates:/app/templates:delegated
|
||||||
- ./config:/app/config:delegated
|
- ./config:/app/config:delegated
|
||||||
- ./.env:/app/.env:delegated
|
- ./.env:/app/.env:delegated
|
||||||
- ./.env.local:/app/.env.local:delegated
|
|
||||||
- ./public/uploads:/app/public/uploads:delegated
|
- ./public/uploads:/app/public/uploads:delegated
|
||||||
|
- ./misc:/app/misc:delegated
|
||||||
|
|
||||||
adminer:
|
adminer:
|
||||||
image: adminer
|
image: adminer
|
||||||
|
|
|
@ -12,4 +12,6 @@ composer install --no-interaction
|
||||||
|
|
||||||
bin/console d:s:u --force --complete
|
bin/console d:s:u --force --complete
|
||||||
|
|
||||||
|
bin/console app:Websocket &
|
||||||
|
|
||||||
exec $@
|
exec $@
|
|
@ -424,6 +424,7 @@ class ScrumController extends AbstractController
|
||||||
{
|
{
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
$fgcsv = $request->get("fgcsv");
|
$fgcsv = $request->get("fgcsv");
|
||||||
|
$fgpoker = $request->get("fgpoker");
|
||||||
|
|
||||||
// Récupérer les repos de gitea
|
// Récupérer les repos de gitea
|
||||||
$scrum=$em->getRepository("App:Scrum")->findOneBy(["id"=>$id]);
|
$scrum=$em->getRepository("App:Scrum")->findOneBy(["id"=>$id]);
|
||||||
|
@ -594,6 +595,7 @@ class ScrumController extends AbstractController
|
||||||
"filterexcludes" => $filterexcludes,
|
"filterexcludes" => $filterexcludes,
|
||||||
"filterassignees" => $filterassignees,
|
"filterassignees" => $filterassignees,
|
||||||
"showfilters" => $showfilters,
|
"showfilters" => $showfilters,
|
||||||
|
"fgpoker" => $fgpoker,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -280,4 +280,13 @@ class ScrumissueController extends AbstractController
|
||||||
|
|
||||||
return new JsonResponse(false);
|
return new JsonResponse(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getpoker($userid,$issueid,Request $request) {
|
||||||
|
return new Response(0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setpoker($userid,$issueid,Request $request) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
namespace App\Entity;
|
namespace App\Entity;
|
||||||
|
|
||||||
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||||
|
|
||||||
|
@ -85,6 +87,16 @@ class Scrumissue
|
||||||
*/
|
*/
|
||||||
private $scrumsprint;
|
private $scrumsprint;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\OneToMany(targetEntity="Userpoker", mappedBy="scrumissue", cascade={"persist"}, orphanRemoval=true)
|
||||||
|
*/
|
||||||
|
private $userpokers;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->userpokers = new ArrayCollection();
|
||||||
|
}
|
||||||
|
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
{
|
{
|
||||||
return $this->id;
|
return $this->id;
|
||||||
|
@ -234,6 +246,37 @@ class Scrumissue
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection|Userpoker[]
|
||||||
|
*/
|
||||||
|
public function getUserpokers(): Collection
|
||||||
|
{
|
||||||
|
return $this->userpokers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addUserpoker(Userpoker $userpoker): self
|
||||||
|
{
|
||||||
|
if (!$this->userpokers->contains($userpoker)) {
|
||||||
|
$this->userpokers[] = $userpoker;
|
||||||
|
$userpoker->setScrumissue($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeUserpoker(Userpoker $userpoker): self
|
||||||
|
{
|
||||||
|
if ($this->userpokers->contains($userpoker)) {
|
||||||
|
$this->userpokers->removeElement($userpoker);
|
||||||
|
// set the owning side to null (unless already changed)
|
||||||
|
if ($userpoker->getScrumissue() === $this) {
|
||||||
|
$userpoker->setScrumissue(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -85,6 +85,11 @@ class User implements UserInterface, \Serializable
|
||||||
*/
|
*/
|
||||||
private $preference;
|
private $preference;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\OneToMany(targetEntity="Userpoker", mappedBy="user", cascade={"persist"}, orphanRemoval=true)
|
||||||
|
*/
|
||||||
|
private $userpokers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToMany(targetEntity="Group", inversedBy="users", cascade={"persist"})
|
* @ORM\ManyToMany(targetEntity="Group", inversedBy="users", cascade={"persist"})
|
||||||
* @ORM\JoinTable(name="usergroupe",
|
* @ORM\JoinTable(name="usergroupe",
|
||||||
|
@ -107,6 +112,7 @@ class User implements UserInterface, \Serializable
|
||||||
{
|
{
|
||||||
$this->groups = new ArrayCollection();
|
$this->groups = new ArrayCollection();
|
||||||
$this->scrums = new ArrayCollection();
|
$this->scrums = new ArrayCollection();
|
||||||
|
$this->userpokers = new ArrayCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUsername(): ?string
|
public function getUsername(): ?string
|
||||||
|
@ -172,7 +178,7 @@ class User implements UserInterface, \Serializable
|
||||||
|
|
||||||
public function getDisplayname()
|
public function getDisplayname()
|
||||||
{
|
{
|
||||||
return $this->firstname." ".$this->lastname;
|
return $this->username;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setId(int $id): self
|
public function setId(int $id): self
|
||||||
|
@ -336,4 +342,35 @@ class User implements UserInterface, \Serializable
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection|Userpoker[]
|
||||||
|
*/
|
||||||
|
public function getUserpokers(): Collection
|
||||||
|
{
|
||||||
|
return $this->userpokers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addUserpoker(Userpoker $userpoker): self
|
||||||
|
{
|
||||||
|
if (!$this->userpokers->contains($userpoker)) {
|
||||||
|
$this->userpokers[] = $userpoker;
|
||||||
|
$userpoker->setUser($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeUserpoker(Userpoker $userpoker): self
|
||||||
|
{
|
||||||
|
if ($this->userpokers->contains($userpoker)) {
|
||||||
|
$this->userpokers->removeElement($userpoker);
|
||||||
|
// set the owning side to null (unless already changed)
|
||||||
|
if ($userpoker->getUser() === $this) {
|
||||||
|
$userpoker->setUser(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,82 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Entity;
|
||||||
|
|
||||||
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Userpoker
|
||||||
|
*
|
||||||
|
* @ORM\Entity()
|
||||||
|
* @ORM\Table(name="userpoker")
|
||||||
|
*/
|
||||||
|
class Userpoker
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @ORM\Column(name="id", type="integer")
|
||||||
|
* @ORM\Id
|
||||||
|
* @ORM\GeneratedValue(strategy="AUTO")
|
||||||
|
*/
|
||||||
|
private $id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(name="name", type="integer")
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private $nb;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToOne(targetEntity="Scrumissue", inversedBy="userpokers")
|
||||||
|
*/
|
||||||
|
private $scrumissue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToOne(targetEntity="User", inversedBy="userpokers")
|
||||||
|
*/
|
||||||
|
private $user;
|
||||||
|
|
||||||
|
public function getId(): ?int
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getNb(): ?int
|
||||||
|
{
|
||||||
|
return $this->nb;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setNb(int $nb): self
|
||||||
|
{
|
||||||
|
$this->nb = $nb;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getScrumissue(): ?Scrumissue
|
||||||
|
{
|
||||||
|
return $this->scrumissue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setScrumissue(?Scrumissue $scrumissue): self
|
||||||
|
{
|
||||||
|
$this->scrumissue = $scrumissue;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUser(): ?User
|
||||||
|
{
|
||||||
|
return $this->user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setUser(?User $user): self
|
||||||
|
{
|
||||||
|
$this->user = $user;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -265,6 +265,14 @@ class ScrumRepository extends ServiceEntityRepository
|
||||||
}
|
}
|
||||||
$scrumissue->setGiteajson(json_decode(json_encode($giteaissue), true));
|
$scrumissue->setGiteajson(json_decode(json_encode($giteaissue), true));
|
||||||
|
|
||||||
|
// Si le ticket est lié à un sprint on s'assure que ce sprint est bien lié au milestone du ticket
|
||||||
|
if($scrumissue->getScrumsprint()) {
|
||||||
|
if($scrumissue->getScrumsprint()->getGiteamilestone()!=$scrumissue->getGiteamilestone()) {
|
||||||
|
$scrumissue->setScrumsprint(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$this->_em->persist($scrumissue);
|
$this->_em->persist($scrumissue);
|
||||||
$this->_em->flush();
|
$this->_em->flush();
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,8 @@ function ModalLoad(idmodal,title,path) {
|
||||||
}
|
}
|
||||||
|
|
||||||
{% if wssuse %}
|
{% if wssuse %}
|
||||||
|
console.log("pouet");
|
||||||
|
|
||||||
function subscribe(channeltype,channelkey,userkey) {
|
function subscribe(channeltype,channelkey,userkey) {
|
||||||
console.log("== SUBSCRIBE "+channeltype+"-"+channelkey+" with userkey "+userkey);
|
console.log("== SUBSCRIBE "+channeltype+"-"+channelkey+" with userkey "+userkey);
|
||||||
conn.send(JSON.stringify({
|
conn.send(JSON.stringify({
|
||||||
|
|
|
@ -32,6 +32,10 @@
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<div class="d-flex">
|
<div class="d-flex">
|
||||||
<div id="filters" class="d-flex flex-column pl-2 pr-2 " style="width:350px; background-color:var(--colorbgbodydark);min-height:1500px;">
|
<div id="filters" class="d-flex flex-column pl-2 pr-2 " style="width:350px; background-color:var(--colorbgbodydark);min-height:1500px;">
|
||||||
|
{% if fgpoker %}
|
||||||
|
<div id="online" class="mt-2"></div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<div style="width:100%" class="mt-3">
|
<div style="width:100%" class="mt-3">
|
||||||
<label class="control-label" style="color:var(--colorftbodydark)">Filtre TICKET</label>
|
<label class="control-label" style="color:var(--colorftbodydark)">Filtre TICKET</label>
|
||||||
<input type="number" id="filterticket" class=" form-control">
|
<input type="number" id="filterticket" class=" form-control">
|
||||||
|
@ -149,12 +153,17 @@
|
||||||
<th style="width:200px">Type</th>
|
<th style="width:200px">Type</th>
|
||||||
<th style="width:70px"class="no-string">N°</th>
|
<th style="width:70px"class="no-string">N°</th>
|
||||||
<th style="width:1000px">Titre</th>
|
<th style="width:1000px">Titre</th>
|
||||||
|
{% if (not wssuse or not fgpoker) %}
|
||||||
<th style="width:200px">Equipe</th>
|
<th style="width:200px">Equipe</th>
|
||||||
<th style="width:250px">Priorité</th>
|
<th style="width:250px">Priorité</th>
|
||||||
<th style="width:70px">Poid</th>
|
|
||||||
<th style="width:135px">Affecté à</th>
|
<th style="width:135px">Affecté à</th>
|
||||||
<th style="width:135px">Statut</th>
|
|
||||||
<th style="width:300px">Etiquettes</th>
|
<th style="width:300px">Etiquettes</th>
|
||||||
|
{% else %}
|
||||||
|
<th style="width:300px">Poker</th>
|
||||||
|
{% endif %}
|
||||||
|
<th style="width:135px">Statut</th>
|
||||||
|
<th style="width:70px">Poid</th>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
|
@ -183,7 +192,7 @@
|
||||||
{% set types = "" %}
|
{% set types = "" %}
|
||||||
{% set datateams = "" %}
|
{% set datateams = "" %}
|
||||||
{% set datatypes = "" %}
|
{% set datatypes = "" %}
|
||||||
{% set prioritys = '<span class="btn-link tag mr-1" style="background-color:#70c24a"><i class="fas fa-tag"></i>'~giteaprioritys|last~'</span>' %}
|
{% set prioritys = (not giteaprioritys?'':'<span class="btn-link tag mr-1" style="background-color:#70c24a"><i class="fas fa-tag"></i>'~giteaprioritys|last~'</span>') %}
|
||||||
{% set dataprioritys = ','~giteaprioritys|last %}
|
{% set dataprioritys = ','~giteaprioritys|last %}
|
||||||
{% set labels = "" %}
|
{% set labels = "" %}
|
||||||
{% set datalabels = "" %}
|
{% set datalabels = "" %}
|
||||||
|
@ -210,7 +219,7 @@
|
||||||
{% set dataassignees=dataassignees~','~assignee.username %}
|
{% set dataassignees=dataassignees~','~assignee.username %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
<tr data-milestone="{{datamilestone}}" data-sprint="{{datasprint}}" data-ticket="{{dataticket}}" data-column="{{statut}}" data-teams="{{datateams}}" data-prioritys="{{dataprioritys}}" data-types="{{datatypes}}" data-labels="{{datalabels}}" data-assignees="{{dataassignees}}">
|
<tr data-id="{{giteaissue.issueid}}" data-milestone="{{datamilestone}}" data-sprint="{{datasprint}}" data-ticket="{{dataticket}}" data-column="{{statut}}" data-teams="{{datateams}}" data-prioritys="{{dataprioritys}}" data-types="{{datatypes}}" data-labels="{{datalabels}}" data-assignees="{{dataassignees}}">
|
||||||
<td>
|
<td>
|
||||||
<a target="_blank" class="btn btn-link fa fa-file" href="{{giteaissue.html_url}}"></a>
|
<a target="_blank" class="btn btn-link fa fa-file" href="{{giteaissue.html_url}}"></a>
|
||||||
</td>
|
</td>
|
||||||
|
@ -225,15 +234,11 @@
|
||||||
{{ giteaissue.title }}
|
{{ giteaissue.title }}
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
{% if (not wssuse or not fgpoker) %}
|
||||||
<td>{{ teams|raw }}</td>
|
<td>{{ teams|raw }}</td>
|
||||||
<td>{{ prioritys|raw }}</td>
|
<td>{{ prioritys|raw }}</td>
|
||||||
|
|
||||||
<td>
|
|
||||||
<div id="modissu{{ giteaissue.issueid }}" data-issue="{{ giteaissue.issueid }}" data-giteaid="{{giteaissue.number}}" data-giteatitle="{{ giteaissue.title }}" type="button" class="modissu btn btn-link">
|
|
||||||
<i class="fas fa-weight-hanging"></i> = <span id="issue{{giteaissue.issueid}}-weight">{{ giteaissue.weight }}</span>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
|
|
||||||
{% set dataorder="" %}
|
{% set dataorder="" %}
|
||||||
{% for assignee in giteaissue.assignees %}
|
{% for assignee in giteaissue.assignees %}
|
||||||
{% set dataorder=dataorder~assignee.username %}
|
{% set dataorder=dataorder~assignee.username %}
|
||||||
|
@ -244,8 +249,19 @@
|
||||||
<img src="{{assignee.avatar_url}}" class="assignee" title="{{assignee.username}}">
|
<img src="{{assignee.avatar_url}}" class="assignee" title="{{assignee.username}}">
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</td>
|
</td>
|
||||||
<td>{{ statut }}</td>
|
|
||||||
<td>{{ labels|raw }}</td>
|
<td>{{ labels|raw }}</td>
|
||||||
|
{% else %}
|
||||||
|
<td>
|
||||||
|
<div class="pokertd d-flex"></div>
|
||||||
|
</td>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<td>{{ statut }}</td>
|
||||||
|
<td>
|
||||||
|
<div id="modissu{{ giteaissue.issueid }}" data-issue="{{ giteaissue.issueid }}" data-giteaid="{{giteaissue.number}}" data-giteatitle="{{ giteaissue.title }}" type="button" class="modissu btn btn-link">
|
||||||
|
<i class="fas fa-weight-hanging"></i> = <span id="issue{{giteaissue.issueid}}-weight">{{ giteaissue.weight }}</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -846,4 +862,89 @@
|
||||||
|
|
||||||
$("#mycontent").show();
|
$("#mycontent").show();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
{% if wssuse and fgpoker %}
|
||||||
|
var conn;
|
||||||
|
|
||||||
|
function connect() {
|
||||||
|
conn = new WebSocket("{{wssurl}}");
|
||||||
|
|
||||||
|
conn.onopen = function(e) {
|
||||||
|
console.log("== CONNECT");
|
||||||
|
{% set userkey = "" %}
|
||||||
|
{% if app.user %}
|
||||||
|
{% set userkey = app.user.apikey %}
|
||||||
|
{%endif%}
|
||||||
|
|
||||||
|
subscribe("home",{{id}},"{{userkey}}");
|
||||||
|
sendMessage({command: "alive"});
|
||||||
|
};
|
||||||
|
|
||||||
|
conn.onmessage = function(e) {
|
||||||
|
ret=JSON.parse(e.data);
|
||||||
|
console.log("MESSAGE REU ="+ret.command);
|
||||||
|
|
||||||
|
switch(ret.command) {
|
||||||
|
case "alive" :
|
||||||
|
if(!$('#online'+ret.from.id).length) {
|
||||||
|
img='<img id="online'+ret.from.id+'" src="'+ret.from.avatar+'" class="avatar ml-2 mr-2" title="'+ret.from.displayname+'">';
|
||||||
|
$("#online").append(img);
|
||||||
|
|
||||||
|
$("tr").each(function(){
|
||||||
|
line=$(this);
|
||||||
|
issueid=$(this).data("id");
|
||||||
|
url="{{path("app_poker_get",{userid:"xxx",issueid:"yyy"})}}";
|
||||||
|
url=url.replace("xxx",ret.from.id);
|
||||||
|
url=url.replace("yyy",issueid);
|
||||||
|
$.ajax({
|
||||||
|
method: "POST",
|
||||||
|
url: url,
|
||||||
|
async: false,
|
||||||
|
success: function(data) {
|
||||||
|
html ='<div class="d-flex flex-column align-items-center" data-user="'+ret.from.id+'">';
|
||||||
|
html+='<img src="'+ret.from.avatar+'" class="avatar mb-1" style="zoom:80%;" title="'+ret.from.displayname+'">';
|
||||||
|
html+='<input class="pokervalue" id="poker-'+ret.from.id+'-'+issueid+'" data-user="'+ret.from.id+'" data-issue="'+issueid+'" type="number" style="width:60px" value="'+data+'"></input>';
|
||||||
|
html+='</div>';
|
||||||
|
line.find(".pokertd").append(html);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ret.from.id!={{app.user.id}}) {
|
||||||
|
console.log("meto");
|
||||||
|
sendMessage({command: "meto"});
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "adead" :
|
||||||
|
$('#online'+ret.from.id).remove();
|
||||||
|
$('[data-user='+ret.from.id+']').remove();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "meto" :
|
||||||
|
if(!$('#online'+ret.from.id).length) {
|
||||||
|
html='<img id="online'+ret.from.id+'" src="'+ret.from.avatar+'" class="avatar ml-2 mr-2" title="'+ret.from.displayname+'">';
|
||||||
|
$("#online").append(html);
|
||||||
|
$(".pokertd").append(html);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
conn.onclose = function(e) {
|
||||||
|
console.log("== DISCONNECT");
|
||||||
|
$('#online img').remove();
|
||||||
|
console.log('Socket is closed. Reconnect will be attempted in 1 second.', e.reason);
|
||||||
|
setTimeout(function() { connect(); }, 1000);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
connect();
|
||||||
|
|
||||||
|
$("body").on("input", ".pokervalue", function () {
|
||||||
|
console.log($(this).val());
|
||||||
|
});
|
||||||
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
|
@ -1,10 +1,15 @@
|
||||||
|
{% extends 'base.html.twig' %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
{{wssurl}}
|
||||||
<div id="chat" class="text-center mt-5">
|
<div id="chat" class="text-center mt-5">
|
||||||
<div class="mb-2">online</div>
|
<div class="mb-2">online</div>
|
||||||
<div id="online" style="mt-2"></div>
|
<div id="online" style="mt-2"></div>
|
||||||
</div>
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block localjavascript %}
|
||||||
{% if wssuse %}
|
{% if wssuse %}
|
||||||
<script>
|
|
||||||
var conn;
|
var conn;
|
||||||
|
|
||||||
function connect() {
|
function connect() {
|
||||||
|
@ -20,13 +25,14 @@
|
||||||
subscribe("home",1,"{{userkey}}");
|
subscribe("home",1,"{{userkey}}");
|
||||||
sendMessage({command: "alive"});
|
sendMessage({command: "alive"});
|
||||||
};
|
};
|
||||||
|
|
||||||
conn.onmessage = function(e) {
|
conn.onmessage = function(e) {
|
||||||
ret=JSON.parse(e.data);
|
ret=JSON.parse(e.data);
|
||||||
console.log(ret.log);
|
|
||||||
|
|
||||||
switch(ret.command) {
|
switch(ret.command) {
|
||||||
case "alive" :
|
case "alive" :
|
||||||
if(!$('#online'+ret.from.id).length) {
|
if(!$('#online'+ret.from.id).length) {
|
||||||
|
console.log(ret);
|
||||||
html='<img id="online'+ret.from.id+'" src="'+ret.from.avatar+'" class="avatar ml-2 mr-2" title="'+ret.from.displayname+'">';
|
html='<img id="online'+ret.from.id+'" src="'+ret.from.avatar+'" class="avatar ml-2 mr-2" title="'+ret.from.displayname+'">';
|
||||||
$("#online").append(html);
|
$("#online").append(html);
|
||||||
}
|
}
|
||||||
|
@ -57,5 +63,5 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
connect();
|
connect();
|
||||||
</script>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endblock %}
|
|
@ -152,6 +152,10 @@
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
<script>
|
||||||
|
{{ include('Include/javascript.js.twig') }}
|
||||||
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
{% if app.session.get('viewclosed') %}
|
{% if app.session.get('viewclosed') %}
|
||||||
|
|
Loading…
Reference in New Issue