@bigbinary/neeto-team-members-frontend 2.10.3 → 2.10.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,19 +1,212 @@
1
1
  # neeto-team-members-nano
2
2
 
3
- This repo acts as the source of truth for the new nano's structure, configs,
4
- data etc.
3
+ The `neeto-team-members-nano` facilitates the administration of team members within neeto applications. The nano exports the `@bigbinary/neeto-team-members-frontend` NPM package and `neeto-team-members-engine` Rails engine for development.
5
4
 
6
- # Local Development Setup
5
+ # Contents
6
+ 1. [Development with Host Application](#development-with-host-application)
7
+ - [Engine](#engine)
8
+ * [Installation](#installation)
9
+ * [Usage](#usage)
10
+ - [Frontend package](#frontend-package)
11
+ * [Installation](#installation-1)
12
+ * [Components](#components)
13
+ 2. [Instructions for Publishing](#instructions-for-publishing)
7
14
 
8
- 1. Setup
9
- [Instructions](https://github.com/bigbinary/neeto-engineering/tree/main/Local-Development-Setup).
15
+ # Development with Host Application
16
+ ## Engine
17
+ The engine is used to seed the roles and permissions for the organization. It also provides concerns to handle common logic related to `User` model.
10
18
 
11
- 2. Run `yarn build` to bundle the app.
19
+ ### Installation
20
+ 1. Add this line to your application's Gemfile:
21
+ ```ruby
22
+ source "NEETO_GEM_SERVER_URL" do
23
+ # ..existing gems
12
24
 
13
- 3. Visit http://spinkart.lvh.me:9100 and login with email `oliver@example.com`
14
- and password `welcome`.
25
+ gem 'neeto-team-members-engine'
26
+ end
27
+ ```
28
+ 2. And then execute:
29
+ ```shell
30
+ bundle install
31
+ ```
32
+ 3. Add this line to your application's `config/routes.rb` file:
33
+ ```ruby
34
+ mount NeetoTeamMembersEngine::Engine => "/neeto_team_members_engine"
35
+ ```
36
+ 4. Run the command to bring in all migrations required from the engine to the host application:
37
+ ```shell
38
+ bundle exec rails neeto_team_members_engine:install:migrations
39
+ ```
40
+ 5. Add the migrations to the database:
41
+ ```shell
42
+ bundle exec rails db:migrate
43
+ ```
44
+ 6. Now, run the generator which will copy the required files.
45
+ ```shell
46
+ bundle exec rails g neeto_team_members_engine:install
47
+ ```
48
+ This command will try to inject the engine's route as well as create a `config/permissions.yml` file to add the permissions required.
15
49
 
16
- # Publish instructions
50
+ ### Usage
51
+ You can learn more about the setup and usage here:
52
+ 1. [Permissions](./docs/engine/permissions.md)
53
+ 2. [Roles](./docs/engine/roles.md)
54
+ 3. [Concerns](./docs/engine/concerns.md)
17
55
 
18
- 1. [Engine and package installation](./docs/engine-and-package-installation.md)
19
- 2. [Building and releasing](./docs/building-and-releasing.md)
56
+ ## Frontend package
57
+ The package exports the four components: `Roles`, `TeamMembers`, `Permissions`, and `ManageRole`.
58
+
59
+ ### Installation
60
+ Install the latest `NeetoTeamMembersnano` package using the below command:
61
+
62
+ ```shell
63
+ yarn add @bigbinary/neeto-team-members-frontend
64
+ ```
65
+ ### Components
66
+ #### `Roles`
67
+ This component manages team roles. It includes functionalities such as adding roles and allowing updates to roles with associated permissions.
68
+ ##### Props
69
+ - `config`: Configuration object that includes mandatory specifications for header breadcrumbs and role permissions. It also allows optional configurations for help articles and permission hierarchy.
70
+ ##### Configuration
71
+ Refer to the [Roles](./docs/frontend/roles.md) section for detailed information on the available configurations for the `Roles` component.
72
+ ##### Usage
73
+ ```jsx
74
+ import React from "react";
75
+
76
+ import { Roles } from "@bigbinary/neeto-team-members-frontend";
77
+ import { BrowserRouter, Redirect, Route, Switch } from "react-router-dom";
78
+ import { ToastContainer } from "react-toastify";
79
+
80
+ import SideBar from "./components/Common/SideBar";
81
+
82
+ const App = () => (
83
+ <BrowserRouter>
84
+ <div className="flex">
85
+ <SideBar />
86
+ <Switch>
87
+ <Route exact path="/roles">
88
+ <Roles config={ROLES_CONFIG} />
89
+ </Route>
90
+ </Switch>
91
+ </div>
92
+ <ToastContainer />
93
+ </BrowserRouter>
94
+ );
95
+
96
+ export default App;
97
+ ```
98
+ #### `TeamMembers`
99
+ The component offers functionalities for adding, updating and viewing team members and their roles in a tabular format. Additionally, it provides filtering options based on email, name, and role.
100
+ ##### Props
101
+ - `config`: Configuration object that allows customization of role management, member operation permissions, UI elements like buttons and headers, callback functions, table structure, dropdown actions, and various display aspects.
102
+ ##### Configuration
103
+ Refer to the [TeamMembers](./docs/frontend/team_members.md) section for detailed information on the available configurations for the `TeamMembers` component.
104
+ ##### Usage
105
+ ```jsx
106
+ import React from "react";
107
+
108
+ import { TeamMembers } from "@bigbinary/neeto-team-members-frontend";
109
+ import { BrowserRouter, Redirect, Route, Switch } from "react-router-dom";
110
+ import { ToastContainer } from "react-toastify";
111
+
112
+ import SideBar from "./components/Common/SideBar";
113
+
114
+ const App = () => (
115
+ <BrowserRouter>
116
+ <div className="flex">
117
+ <SideBar />
118
+ <Switch>
119
+ <Route exact path="/members">
120
+ <TeamMembers config={MEMBERS_CONFIG} />
121
+ </Route>
122
+ </Switch>
123
+ </div>
124
+ <ToastContainer />
125
+ </BrowserRouter>
126
+ );
127
+
128
+ export default App;
129
+ ```
130
+
131
+ #### `Permissions`
132
+ The component handles the rendering and management of permissions for team members. It organizes permissions into categories, provides checkboxes for selection, and supports hierarchical structures with parent-child relationships.
133
+ ##### Props
134
+ - `permissions`: An array of permissions.
135
+ - `isDisabled`: A boolean indicating whether the component is disabled. By default, it is false.
136
+ - `permissionRelationConfig`: Configuration for managing parent-child relationships and unchecking permissions on select.
137
+ ##### Configuration
138
+ Refer to the [Permissions](./docs/frontend/permissions.md) section for detailed information on the available configurations for the `TeamMembers` component.
139
+ ##### Usage
140
+ ```jsx
141
+ import React from "react";
142
+
143
+ import { Permissions } from "@bigbinary/neeto-team-members-frontend";
144
+ import { BrowserRouter, Redirect, Route, Switch } from "react-router-dom";
145
+ import { ToastContainer } from "react-toastify";
146
+
147
+ import SideBar from "./components/Common/SideBar";
148
+
149
+ const App = () => (
150
+ <BrowserRouter>
151
+ <div className="flex">
152
+ <SideBar />
153
+ <Switch>
154
+ <Route exact path="/permissions">
155
+ <Permissions
156
+ permissionRelationConfig={PERMISSION_RELATION_CONFIG}
157
+ permissions={PERMISSIONS}
158
+ />
159
+ </Route>
160
+ </Switch>
161
+ </div>
162
+ <ToastContainer />
163
+ </BrowserRouter>
164
+ );
165
+
166
+ export default App;
167
+ ```
168
+
169
+ #### `ManageMembers`
170
+ The component is a form-based interface for adding or editing team members.
171
+ ##### Props
172
+ - `config`: Configuration object with various options for customizing the behavior of the component.
173
+ - `onComplete`: Callback function to be executed when the component is closed or the form is submitted.
174
+ - `roles`: An array of roles available for team members.
175
+ - `selectedMember`: The team member object being edited, if applicable.
176
+ - `componentConfig`: Configuration specific to the component, including the type of pane, initial focus reference, etc.
177
+
178
+ ##### Configuration
179
+ Refer to the [ManageMembers](./docs/frontend/manage_members.md) section for detailed information on the available configurations for the `ManageMembers` component.
180
+ ##### Usage
181
+ ```jsx
182
+ import React from "react";
183
+
184
+ import { ManageMembers } from "@bigbinary/neeto-team-members-frontend";
185
+ import { BrowserRouter, Redirect, Route, Switch } from "react-router-dom";
186
+ import { ToastContainer } from "react-toastify";
187
+
188
+ import SideBar from "./components/Common/SideBar";
189
+
190
+ const App = () => (
191
+ <BrowserRouter>
192
+ <div className="flex">
193
+ <SideBar />
194
+ <Switch>
195
+ <Route exact path="/permissions">
196
+ <ManageMembers
197
+ componentConfig={COMPONENT_CONFIG}
198
+ config={CONFIG}
199
+ onComplete={() => void}
200
+ />
201
+ </Route>
202
+ </Switch>
203
+ </div>
204
+ <ToastContainer />
205
+ </BrowserRouter>
206
+ );
207
+
208
+ export default App;
209
+ ```
210
+ # Instructions for Publishing
211
+
212
+ Consult the [building and releasing packages](https://neeto-engineering.neetokb.com/articles/building-and-releasing-packages) guide for details on how to publish.