* feat ui: login flow for spot extension * spot list, store and service created * some fixing for header * start work on single spot * spot player start * header for player, comments, icons, etc * split stuff into compoennts, create player state manager * player controls, activity panel etc etc * comments, empty page, rename and stuff * interval buttons etc * access modal * pubkey support * fix tooltip * limit 10 -> 9 * hls lib instead of videojs * some warnings * fix date display for exp * change public links * display more client data * fix cleaning, init comment * map network to replay player network ev * stream support, console panel, close panels on X * fixing streaming, destroy on leave * fix autoplay * show notification on spot login * fix spot login * backup player added, fix audio issue * show thumbnail when no video, add spot roles * add poster thumbnail * some fixes to video check * fix events jump * fix play btn * try catch over pubkey * icons * spot login pinging * move spot login flow to login comp, use separate spot login path for unique jwt * invalidate spot jwt on logout * add visual data on page load event * typo fix * issue to copy change * share spot url f
62 lines
1.9 KiB
JavaScript
62 lines
1.9 KiB
JavaScript
import { List, Map } from 'immutable';
|
|
import Role from 'Types/role';
|
|
import crudDuckGenerator from './tools/crudDuck';
|
|
import { reduceDucks } from 'Duck/tools';
|
|
import { createListUpdater } from './funcTools/tools';
|
|
|
|
const crudDuck = crudDuckGenerator('client/role', Role, { idKey: 'roleId' });
|
|
export const { fetchList, init, edit, remove } = crudDuck.actions;
|
|
|
|
const RESET_ERRORS = 'roles/RESET_ERRORS';
|
|
|
|
const initialState = Map({
|
|
list: List(),
|
|
permissions: List([
|
|
{ text: 'Session Replay', value: 'SESSION_REPLAY' },
|
|
{ text: 'Developer Tools', value: 'DEV_TOOLS' },
|
|
// { text: 'Errors', value: 'ERRORS' },
|
|
{ text: 'Dashboard', value: 'METRICS' },
|
|
{ text: 'Assist (Live)', value: 'ASSIST_LIVE' },
|
|
{ text: 'Assist (Call)', value: 'ASSIST_CALL' },
|
|
{ text: 'Feature Flags', value: 'FEATURE_FLAGS' },
|
|
{ text: 'Spots', value: "SPOT" },
|
|
{ text: 'Change Spot Visibility', value: 'SPOT_PUBLIC' }
|
|
]),
|
|
});
|
|
|
|
// const name = "role";
|
|
const idKey = 'roleId';
|
|
|
|
const updateItemInList = createListUpdater(idKey);
|
|
const updateInstance = (state, instance) =>
|
|
state.getIn(['instance', idKey]) === instance[idKey]
|
|
? state.mergeIn(['instance'], instance)
|
|
: state;
|
|
|
|
const reducer = (state = initialState, action = {}) => {
|
|
switch (action.type) {
|
|
case RESET_ERRORS:
|
|
return state.setIn(['removeRequest', 'errors'], null);
|
|
case crudDuck.actionTypes.SAVE.SUCCESS:
|
|
return updateItemInList(updateInstance(state, action.data), Role(action.data));
|
|
}
|
|
return state;
|
|
};
|
|
|
|
export function save(instance) {
|
|
return {
|
|
types: crudDuck.actionTypes.SAVE.toArray(),
|
|
call: (client) =>
|
|
instance.roleId
|
|
? client.post(`/client/roles/${instance.roleId}`, instance.toData())
|
|
: client.put(`/client/roles`, instance.toData()),
|
|
};
|
|
}
|
|
|
|
export function resetErrors() {
|
|
return {
|
|
type: RESET_ERRORS,
|
|
};
|
|
}
|
|
|
|
export default reduceDucks(crudDuck, { initialState, reducer }).reducer;
|