Browse Source

Added active toggle button to endpoints

master
Shyim 7 years ago
parent
commit
1acc9fded4
  1. 10
      README.md
  2. 8
      public/theme/src/components/ReCast/Streams/EditStream.vue
  3. 27
      src/Controller/Streams.php

10
README.md

@ -20,10 +20,12 @@ ReCast is a multi platform streaming tool written in PHP and uses nginx RTMP. Yo @@ -20,10 +20,12 @@ ReCast is a multi platform streaming tool written in PHP and uses nginx RTMP. Yo
## Screenshots
![Dashboard](https://i.imgur.com/CJFRqFM.png)
![Dashboard](https://i.imgur.com/6gcqWTh.png)
![List Streams](https://i.imgur.com/xRi6eQT.png)
![List Streams](https://i.imgur.com/E5FVy9K.png)
![Add Endpoint](https://i.imgur.com/OvLihhw.png)
![Edit Stream](https://i.imgur.com/PHYjnQn.png)
![Setup](https://i.imgur.com/gPDnIfr.png)
![Add Endpoint](https://i.imgur.com/bYteEQR.png)
![Setup](https://i.imgur.com/ZfP7Tpv.png)

8
public/theme/src/components/ReCast/Streams/EditStream.vue

@ -39,6 +39,7 @@ @@ -39,6 +39,7 @@
<td>{{ endpoint.server }}</td>
<td>
<a :href="'#/ucp/streams/' + $route.params.id + '/endpoints/' + endpoint.id" class="btn btn-secondary">Edit</a>
<a v-on:click="toggleEndpoint(endpoint)" class="btn btn-info">{{ endpoint.active ? 'Disable' : 'Enable' }}</a>
<a v-on:click="deleteEndpoint(endpoint)" class="btn btn-danger">Delete</a>
</td>
</tr>
@ -101,6 +102,13 @@ @@ -101,6 +102,13 @@
deleteEndpoint: function (endpoint) {
this.endpoints.splice(this.endpoints.indexOf(endpoint), 1);
this.axios.post('/streams/deleteEndpoint', {id: endpoint.id});
},
toggleEndpoint: function (endpoint) {
this.axios.post('/streams/toggleEndpoint', {id: endpoint.id}).then(response => {
this.axios.get('/streams/' + this.$route.params.id + '/endpoints/').then(response => {
this.endpoints = response.data;
});
});
}
}
}

27
src/Controller/Streams.php

@ -241,6 +241,33 @@ class Streams extends Controller @@ -241,6 +241,33 @@ class Streams extends Controller
return new JsonResponse($endpoint);
}
/**
* @Route(path="/toggleEndpoint")
* @param Request $request
* @return JsonResponse
* @throws \Doctrine\ORM\ORMException
* @throws \Doctrine\ORM\OptimisticLockException
* @author Soner Sayakci <shyim@posteo.de>
*/
public function toggleEndpoint(Request $request) : JsonResponse
{
$id = $request->request->get('id');
$endpoint = $this->endpointRepository->find($id);
if ($endpoint === null || $endpoint->getStream()->getUserId() !== $this->getUser()->getId()) {
return new JsonResponse([]);
}
$endpoint->setActive(!$endpoint->isActive());
$manager = $this->get('doctrine.orm.entity_manager');
$manager->persist($endpoint);
$manager->flush();
return new JsonResponse($endpoint);
}
/**
* @Route(path="/deleteEndpoint")
* @author Soner Sayakci <shyim@posteo.de>

Loading…
Cancel
Save