feathers-mongoose-casl-dashboard
Admin screen with full CRUD functionality inside your react apps to your feathers-mongoose-casl
Demo: https://feathersjs-mongoose-casl-admin.herokuapp.com/
- the demo is depend on your local feathers-mongoose-casl server then keep the server running to see the screens
How to install?
1 - Install redxu-admin 2- Menu inside your app menu add this:
import React Component from 'react';import DashboardMenu UserAbilityMenu from 'feathers-mongoose-casl-dashboard'; { const isAuthUser = thispropsuser && thispropsuser_id return <div> isAuthUser && <DashboardMenu = /> isAuthUser && <UserAbilityMenu = /> </div> };
DashboardMenu - will render list of services that user is able to read UserAbilityMenu - will render the UserAbilityLink only if user able to post to UserAbility service
3- Create dashbaord screen that render DashboardApp with the relevant props Example of nextjs screen
import React from 'react';import DashboardApp from 'feathers-mongoose-casl-dashboard';import 'feathers-mongoose-casl-dashboard/lib/style.css'import Router from 'next/router'; // Optional -// Change the local of the app// default local is enUS// you can import heIL or create you on local file// to create your own local file, copy this [file](https://github.com/doronnahum/feathers-mongoose-casl-dashboard/tree/master/src/local/en-US.js) and updateimport DashboardApp setLocal locals from 'feathers-mongoose-casl-dashboard'; const getUrl = { return propsrouterquery && propsrouterqueryscreen} Component { ; thisstate = screenName: showErr: false ; }; { const screenName = if!screenName this else this Routerrouterevents} { Routerrouterevents } { const urlParams = windowlocationsearch; const screenName = urlParams; ifscreenName !== thisstatescreenName this } { return <DashboardApp = /> } dashboard;
4- Create user-abilities screen
import React from 'react';import 'feathers-mongoose-casl-dashboard/lib/style.css'import UserAbilities from 'feathers-mongoose-casl-dashboard'; Component { return <div> <UserAbilities /> </div> }