Edit client modal... we'll need a server one too
This commit is contained in:
@ -200,3 +200,28 @@ export function setSnapcastClientName(id, name){
|
||||
}
|
||||
}
|
||||
|
||||
export function setSnapcastClientLatency(id, latency){
|
||||
return {
|
||||
type: 'PUSHER_SET_SNAPCAST_CLIENT_LATENCY',
|
||||
data: {
|
||||
method: 'Client.SetLatency',
|
||||
params: {
|
||||
id: id,
|
||||
latency: latency
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function deleteSnapcastClient(id){
|
||||
return {
|
||||
type: 'PUSHER_DELETE_SNAPCAST_CLIENT',
|
||||
data: {
|
||||
method: 'Server.DeleteClient',
|
||||
params: {
|
||||
id: id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -525,8 +525,8 @@ const PusherMiddleware = (function(){
|
||||
var clients_ids = [];
|
||||
|
||||
// And now this groups' clients
|
||||
for (var i = 0; i < group.clients.length; i++){
|
||||
var client = group.clients[i];
|
||||
for (var j = 0; j < group.clients.length; j++){
|
||||
var client = group.clients[j];
|
||||
clients[client.id] = client;
|
||||
clients_ids.push(client.id);
|
||||
}
|
||||
@ -544,7 +544,7 @@ const PusherMiddleware = (function(){
|
||||
type: 'PUSHER_SNAPCAST',
|
||||
snapcast_clients: clients,
|
||||
snapcast_groups: groups
|
||||
})
|
||||
});
|
||||
},
|
||||
error => {
|
||||
store.dispatch(coreActions.handleException(
|
||||
@ -604,6 +604,49 @@ const PusherMiddleware = (function(){
|
||||
);
|
||||
break
|
||||
|
||||
case 'PUSHER_SET_SNAPCAST_CLIENT_LATENCY':
|
||||
request(store, 'snapcast_instruct', action.data)
|
||||
.then(
|
||||
response => {
|
||||
store.dispatch({
|
||||
type: 'PUSHER_SNAPCAST_CLIENT_UPDATED',
|
||||
key: action.data.params.id,
|
||||
client: {
|
||||
config: {
|
||||
latency: response.latency
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
error => {
|
||||
store.dispatch(coreActions.handleException(
|
||||
'Error',
|
||||
error,
|
||||
error.message
|
||||
));
|
||||
}
|
||||
);
|
||||
break
|
||||
|
||||
case 'PUSHER_DELETE_SNAPCAST_CLIENT':
|
||||
request(store, 'snapcast_instruct', action.data)
|
||||
.then(
|
||||
response => {
|
||||
store.dispatch({
|
||||
type: 'PUSHER_SNAPCAST_CLIENT_REMOVED',
|
||||
key: action.data.params.id
|
||||
})
|
||||
},
|
||||
error => {
|
||||
store.dispatch(coreActions.handleException(
|
||||
'Error',
|
||||
error,
|
||||
error.message
|
||||
));
|
||||
}
|
||||
);
|
||||
break
|
||||
|
||||
// This action is irrelevant to us, pass it on to the next middleware
|
||||
default:
|
||||
return next(action);
|
||||
|
||||
@ -61,6 +61,11 @@ export default function reducer(pusher = {}, action){
|
||||
snapcast_clients[action.key] = client;
|
||||
return Object.assign({}, pusher, { snapcast_clients: snapcast_clients });
|
||||
|
||||
case 'PUSHER_SNAPCAST_CLIENT_REMOVED':
|
||||
var snapcast_clients = Object.assign({}, pusher.snapcast_clients);
|
||||
delete snapcast_clients[action.key];
|
||||
return Object.assign({}, pusher, { snapcast_clients: snapcast_clients });
|
||||
|
||||
default:
|
||||
return pusher
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user