mirror of
https://github.com/r4sas/recastin-panel
synced 2025-08-26 13:31:47 +00:00
Added active toggle button to endpoints
This commit is contained in:
parent
b5731a28d9
commit
1acc9fded4
10
README.md
10
README.md
@ -20,10 +20,12 @@ ReCast is a multi platform streaming tool written in PHP and uses nginx RTMP. Yo
|
|||||||
|
|
||||||
## Screenshots
|
## Screenshots
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||

|

|
||||||
|
|
||||||

|

|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|

|
@ -39,6 +39,7 @@
|
|||||||
<td>{{ endpoint.server }}</td>
|
<td>{{ endpoint.server }}</td>
|
||||||
<td>
|
<td>
|
||||||
<a :href="'#/ucp/streams/' + $route.params.id + '/endpoints/' + endpoint.id" class="btn btn-secondary">Edit</a>
|
<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>
|
<a v-on:click="deleteEndpoint(endpoint)" class="btn btn-danger">Delete</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -101,6 +102,13 @@
|
|||||||
deleteEndpoint: function (endpoint) {
|
deleteEndpoint: function (endpoint) {
|
||||||
this.endpoints.splice(this.endpoints.indexOf(endpoint), 1);
|
this.endpoints.splice(this.endpoints.indexOf(endpoint), 1);
|
||||||
this.axios.post('/streams/deleteEndpoint', {id: endpoint.id});
|
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;
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -241,6 +241,33 @@ class Streams extends Controller
|
|||||||
return new JsonResponse($endpoint);
|
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")
|
* @Route(path="/deleteEndpoint")
|
||||||
* @author Soner Sayakci <shyim@posteo.de>
|
* @author Soner Sayakci <shyim@posteo.de>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user