@memberjunction/ng-explorer-settings 2.42.1 → 2.44.0

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.
Files changed (2) hide show
  1. package/README.md +319 -44
  2. package/package.json +13 -13
package/README.md CHANGED
@@ -1,15 +1,20 @@
1
1
  # @memberjunction/ng-explorer-settings
2
2
 
3
- Angular components for managing MemberJunction application settings, including users, roles, and permissions.
3
+ Angular components for managing MemberJunction application settings, including users, roles, applications, and entity permissions. This package provides a comprehensive administrative interface for configuring system access and permissions.
4
+
5
+ ## Overview
6
+
7
+ The `@memberjunction/ng-explorer-settings` package provides a complete settings management interface for MemberJunction Explorer applications. It offers a unified navigation system with dedicated components for managing users, roles, applications, and entity permissions.
4
8
 
5
9
  ## Features
6
10
 
7
- - Complete settings management for MemberJunction Explorer
8
- - User management with activation/deactivation functionality
9
- - Role management and assignment
10
- - Application entity configuration
11
- - Entity permissions management
12
- - Consistent navigation between settings sections
11
+ - **User Management**: Create, edit, activate/deactivate users with role assignments
12
+ - **Role Management**: Define and manage security roles with user assignments
13
+ - **Application Configuration**: Configure applications and their associated entities
14
+ - **Entity Permissions**: Granular control over entity-level permissions
15
+ - **Transaction-based Updates**: Batch updates using MemberJunction's transaction system
16
+ - **Responsive Navigation**: Left-side navigation with dynamic content area
17
+ - **Real-time Updates**: Immediate reflection of permission and assignment changes
13
18
 
14
19
  ## Installation
15
20
 
@@ -19,102 +24,372 @@ npm install @memberjunction/ng-explorer-settings
19
24
 
20
25
  ## Usage
21
26
 
22
- Import the module in your application:
27
+ ### Module Import
28
+
29
+ Import the `ExplorerSettingsModule` in your Angular application:
23
30
 
24
31
  ```typescript
25
32
  import { ExplorerSettingsModule } from '@memberjunction/ng-explorer-settings';
26
33
 
27
34
  @NgModule({
28
35
  imports: [
29
- // ...
30
- ExplorerSettingsModule
36
+ CommonModule,
37
+ ExplorerSettingsModule,
38
+ // other imports...
31
39
  ]
32
40
  })
33
41
  export class YourModule { }
34
42
  ```
35
43
 
36
- ## Components
37
-
38
- ### SettingsComponent
44
+ ### Basic Implementation
39
45
 
40
- The main component that provides navigation between different settings sections:
46
+ Add the main settings component to your application:
41
47
 
42
48
  ```html
43
49
  <mj-settings></mj-settings>
44
50
  ```
45
51
 
46
- The component handles routing to different settings sections:
47
- - `/settings/users` - User management
52
+ The component automatically handles routing to different settings sections based on the URL path.
53
+
54
+ ## Components
55
+
56
+ ### SettingsComponent
57
+
58
+ The main navigation component that provides a consistent interface for all settings sections.
59
+
60
+ **Selector**: `mj-settings`
61
+
62
+ **Features**:
63
+ - Left-side navigation menu
64
+ - Dynamic content area based on selected section
65
+ - URL-based routing support
66
+ - Responsive layout using MemberJunction's container directives
67
+
68
+ **Routes Handled**:
69
+ - `/settings/users` - User list view
48
70
  - `/settings/user/:id` - Individual user details
49
- - `/settings/roles` - Role management
71
+ - `/settings/roles` - Role list view
50
72
  - `/settings/role/:id` - Individual role details
51
- - `/settings/applications` - Application management
73
+ - `/settings/applications` - Application list view
52
74
  - `/settings/application/:name` - Individual application details
53
75
  - `/settings/entitypermissions` - Entity permission management
54
76
 
77
+ **Example**:
78
+ ```typescript
79
+ // Navigate to a specific user
80
+ this.router.navigate(['/settings/user', userId]);
81
+
82
+ // Navigate to roles section
83
+ this.router.navigate(['/settings/roles']);
84
+ ```
85
+
55
86
  ### SingleUserComponent
56
87
 
57
- Component for managing an individual user:
88
+ Manages individual user details and configurations.
89
+
90
+ **Selector**: `mj-single-user`
91
+
92
+ **Inputs**:
93
+ - `UserID: string` - The ID of the user to display/edit
58
94
 
95
+ **Features**:
96
+ - User information display and editing
97
+ - User role assignments via embedded grid
98
+ - User views management
99
+ - Integration with entity form dialog for editing
100
+
101
+ **Example**:
59
102
  ```html
60
- <mj-single-user [UserID]="userId"></mj-single-user>
103
+ <mj-single-user [UserID]="selectedUserId"></mj-single-user>
61
104
  ```
62
105
 
63
106
  ### SingleRoleComponent
64
107
 
65
- Component for managing an individual role:
108
+ Manages individual role details and user assignments.
109
+
110
+ **Selector**: `mj-single-role`
66
111
 
112
+ **Inputs**:
113
+ - `RoleID: string` - The ID of the role to display/edit
114
+
115
+ **Features**:
116
+ - Role information display and editing
117
+ - User assignments to the role
118
+ - Batch operations for user-role assignments
119
+
120
+ **Example**:
67
121
  ```html
68
- <mj-single-role [RoleID]="roleId"></mj-single-role>
122
+ <mj-single-role [RoleID]="selectedRoleId"></mj-single-role>
69
123
  ```
70
124
 
71
125
  ### SingleApplicationComponent
72
126
 
73
- Component for managing an individual application:
127
+ Manages application configurations and entity associations.
128
+
129
+ **Selector**: `mj-single-application`
74
130
 
131
+ **Inputs**:
132
+ - `ApplicationID: string` - The ID of the application to manage
133
+
134
+ **Features**:
135
+ - Application details management
136
+ - Entity associations configuration
137
+ - Bulk entity assignment operations
138
+
139
+ **Example**:
75
140
  ```html
76
- <mj-single-application [ApplicationID]="applicationId"></mj-single-application>
141
+ <mj-single-application [ApplicationID]="selectedApplicationId"></mj-single-application>
77
142
  ```
78
143
 
79
144
  ### UserRolesGridComponent
80
145
 
81
- Grid component for managing role assignments for a user:
146
+ A specialized grid for managing user-role relationships.
147
+
148
+ **Selector**: `mj-user-roles-grid`
82
149
 
150
+ **Inputs**:
151
+ - `UserID: string` - User ID when in 'Users' mode
152
+ - `RoleID: string` - Role ID when in 'Roles' mode
153
+ - `Mode: 'Users' | 'Roles'` - Determines the grid's perspective
154
+ - `UserRecord: UserEntity | null` - User entity when in 'Users' mode
155
+ - `RoleRecord: RoleEntity | null` - Role entity when in 'Roles' mode
156
+
157
+ **Features**:
158
+ - Checkbox-based role/user selection
159
+ - Batch save/cancel operations
160
+ - Flip all functionality
161
+ - Transaction-based updates
162
+ - Visual indication of pending changes
163
+
164
+ **Example**:
83
165
  ```html
84
- <mj-user-roles-grid [UserID]="userId"></mj-user-roles-grid>
166
+ <!-- For managing roles assigned to a user -->
167
+ <mj-user-roles-grid
168
+ [UserID]="userId"
169
+ [UserRecord]="userEntity"
170
+ Mode="Users">
171
+ </mj-user-roles-grid>
172
+
173
+ <!-- For managing users assigned to a role -->
174
+ <mj-user-roles-grid
175
+ [RoleID]="roleId"
176
+ [RoleRecord]="roleEntity"
177
+ Mode="Roles">
178
+ </mj-user-roles-grid>
85
179
  ```
86
180
 
87
181
  ### ApplicationEntitiesGridComponent
88
182
 
89
- Grid component for managing entities associated with an application:
183
+ Manages entity associations with applications.
184
+
185
+ **Selector**: `mj-application-entities-grid`
186
+
187
+ **Inputs**:
188
+ - `ApplicationID: string` - Application ID when in 'Applications' mode
189
+ - `EntityID: string` - Entity ID when in 'Entities' mode
190
+ - `Mode: 'Applications' | 'Entities'` - Determines the grid's perspective
191
+ - `ApplicationRecord: ApplicationEntity | null` - Application entity
192
+ - `EntityRecord: EntityEntity | null` - Entity record
193
+
194
+ **Features**:
195
+ - Entity-application association management
196
+ - Bulk selection/deselection
197
+ - Transaction-based saves
198
+ - Dirty state tracking
90
199
 
200
+ **Example**:
91
201
  ```html
92
- <mj-application-entities-grid [ApplicationID]="applicationId"></mj-application-entities-grid>
202
+ <mj-application-entities-grid
203
+ [ApplicationID]="appId"
204
+ [ApplicationRecord]="appEntity"
205
+ Mode="Applications">
206
+ </mj-application-entities-grid>
93
207
  ```
94
208
 
95
209
  ## User Management Features
96
210
 
97
- The settings module includes special functionality for user management, such as:
211
+ ### User Activation/Deactivation
212
+
213
+ The settings module implements a soft-delete pattern for users:
214
+
215
+ ```typescript
216
+ // Example implementation in SettingsComponent
217
+ public async toggleUserActivation(record: BaseEntity) {
218
+ try {
219
+ const user = record as UserEntity;
220
+ const currentlyActive = user.IsActive;
221
+
222
+ // Toggle the IsActive flag
223
+ user.IsActive = !currentlyActive;
224
+
225
+ if (await user.Save()) {
226
+ MJNotificationService.Instance.CreateSimpleNotification(
227
+ `User ${user.Name} has been ${currentlyActive ? 'deactivated' : 'activated'} successfully.`,
228
+ 'success',
229
+ 3000
230
+ );
231
+ }
232
+ } catch (error) {
233
+ console.error('Error toggling user activation:', error);
234
+ MJNotificationService.Instance.CreateSimpleNotification(
235
+ 'An error occurred while toggling user activation.',
236
+ 'error',
237
+ 5000
238
+ );
239
+ }
240
+ }
241
+ ```
242
+
243
+ ### Custom Action Support
244
+
245
+ The user list supports custom actions with configurable icons and tooltips:
246
+
247
+ ```typescript
248
+ // Icon function for toggle button
249
+ public getUserToggleIcon(record: BaseEntity): string {
250
+ const user = record as UserEntity;
251
+ return user.IsActive ? 'fa-user-lock' : 'fa-user-check';
252
+ }
253
+
254
+ // Tooltip function for toggle button
255
+ public getUserToggleTooltip(record: BaseEntity): string {
256
+ const user = record as UserEntity;
257
+ return user.IsActive ? 'Deactivate user' : 'Activate user';
258
+ }
259
+ ```
260
+
261
+ ## Configuration Options
262
+
263
+ ### Navigation Options
264
+
265
+ The settings component defines navigation options:
266
+
267
+ ```typescript
268
+ public options = [
269
+ { label: 'Users', value: SettingsItem.Users },
270
+ { label: 'Roles', value: SettingsItem.Roles },
271
+ { label: 'Applications', value: SettingsItem.Applications },
272
+ { label: 'Entity Permissions', value: SettingsItem.EntityPermissions }
273
+ ];
274
+ ```
275
+
276
+ ### Grid Configuration
277
+
278
+ User roles and application entities grids support various configurations:
279
+
280
+ ```typescript
281
+ // Example: Configure grid height
282
+ <mj-user-roles-grid
283
+ [UserID]="userId"
284
+ style="height: 600px;">
285
+ </mj-user-roles-grid>
286
+ ```
287
+
288
+ ## Dependencies
289
+
290
+ This package depends on several MemberJunction and third-party packages:
291
+
292
+ ### MemberJunction Dependencies
293
+ - `@memberjunction/core`: Core functionality and metadata
294
+ - `@memberjunction/core-entities`: Entity definitions
295
+ - `@memberjunction/global`: Global utilities and decorators
296
+ - `@memberjunction/ng-container-directives`: Layout directives
297
+ - `@memberjunction/ng-shared`: Shared Angular components
298
+ - `@memberjunction/ng-notifications`: Notification service
299
+ - `@memberjunction/ng-entity-permissions`: Entity permission components
300
+ - `@memberjunction/ng-base-forms`: Base form components
301
+ - `@memberjunction/ng-entity-form-dialog`: Entity editing dialogs
302
+ - `@memberjunction/ng-user-view-grid`: User view grid component
303
+ - `@memberjunction/ng-simple-record-list`: Record list component
304
+ - `@memberjunction/ng-tabstrip`: Tab navigation component
305
+
306
+ ### Kendo UI Dependencies
307
+ - `@progress/kendo-angular-dropdowns`: Dropdown components
308
+ - `@progress/kendo-angular-grid`: Grid functionality
309
+ - `@progress/kendo-angular-buttons`: Button components
310
+ - `@progress/kendo-angular-dialog`: Dialog components
311
+ - `@progress/kendo-angular-layout`: Layout utilities
312
+ - `@progress/kendo-angular-indicators`: Loading indicators
313
+
314
+ ### Angular Dependencies (Peer)
315
+ - `@angular/common`: ^18.0.2
316
+ - `@angular/core`: ^18.0.2
317
+ - `@angular/forms`: ^18.0.2
318
+ - `@angular/router`: ^18.0.2
319
+
320
+ ## Integration with MemberJunction
321
+
322
+ ### Entity Registration
323
+
324
+ Components register with MemberJunction's class system:
325
+
326
+ ```typescript
327
+ @RegisterClass(BaseNavigationComponent, 'Settings')
328
+ export class SettingsComponent extends BaseNavigationComponent {
329
+ // Component implementation
330
+ }
331
+ ```
98
332
 
99
- - Activating/deactivating users instead of deleting them
100
- - Role assignment
101
- - User details editing
333
+ ### Transaction Support
102
334
 
103
- Example of user activation toggle:
335
+ Batch operations use MemberJunction's transaction system:
104
336
 
105
337
  ```typescript
106
- // Toggle user activation status
107
- async function toggleUserActivation(user: UserEntity) {
108
- user.IsActive = !user.IsActive;
109
- await user.Save();
338
+ const md = new Metadata();
339
+ const tg = await md.CreateTransactionGroup();
340
+
341
+ for (const record of records) {
342
+ record.TransactionGroup = tg;
343
+ await record.Save();
110
344
  }
345
+
346
+ await tg.Submit();
347
+ ```
348
+
349
+ ### Metadata Integration
350
+
351
+ Components leverage MemberJunction's metadata system:
352
+
353
+ ```typescript
354
+ const md = new Metadata();
355
+ const userEntity = await md.GetEntityObject<UserEntity>('Users');
356
+ const applications = md.Applications;
357
+ const roles = md.Roles;
358
+ ```
359
+
360
+ ## Build and Development
361
+
362
+ ### Building the Package
363
+
364
+ ```bash
365
+ # From the package directory
366
+ npm run build
367
+
368
+ # Or from the repository root
369
+ npm run build -- --filter="@memberjunction/ng-explorer-settings"
111
370
  ```
112
371
 
113
- ## Integration
372
+ ### TypeScript Configuration
373
+
374
+ The package uses strict TypeScript settings:
375
+ - Target: ES2015
376
+ - Module: ES2020
377
+ - Strict mode enabled
378
+ - Source maps generated
379
+ - Declaration files generated
380
+
381
+ ## Best Practices
382
+
383
+ 1. **Always use transactions** for batch operations to ensure data consistency
384
+ 2. **Leverage entity metadata** instead of hardcoding entity names
385
+ 3. **Use the provided navigation methods** for consistent routing behavior
386
+ 4. **Handle errors appropriately** with user-friendly notifications
387
+ 5. **Follow MemberJunction patterns** for entity instantiation and data loading
388
+
389
+ ## Version
390
+
391
+ Current version: 2.43.0
392
+
393
+ ## License
114
394
 
115
- This module integrates with other MemberJunction Explorer components:
116
- - Uses simple-record-list for displaying entity records
117
- - Uses entity-form-dialog for editing records
118
- - Uses entity-permissions for permission management
119
- - Uses tabstrip for sectioned display
120
- - Uses notifications for user feedback
395
+ ISC
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memberjunction/ng-explorer-settings",
3
- "version": "2.42.1",
3
+ "version": "2.44.0",
4
4
  "description": "MemberJunction: Reusable Angular components for the settings section of the MJ Explorer App",
5
5
  "main": "./dist/public-api.js",
6
6
  "typings": "./dist/public-api.d.ts",
@@ -25,18 +25,18 @@
25
25
  "@angular/router": "18.0.2"
26
26
  },
27
27
  "dependencies": {
28
- "@memberjunction/core-entities": "2.42.1",
29
- "@memberjunction/global": "2.42.1",
30
- "@memberjunction/core": "2.42.1",
31
- "@memberjunction/ng-container-directives": "2.42.1",
32
- "@memberjunction/ng-shared": "2.42.1",
33
- "@memberjunction/ng-notifications": "2.42.1",
34
- "@memberjunction/ng-entity-permissions": "2.42.1",
35
- "@memberjunction/ng-base-forms": "2.42.1",
36
- "@memberjunction/ng-entity-form-dialog": "2.42.1",
37
- "@memberjunction/ng-user-view-grid": "2.42.1",
38
- "@memberjunction/ng-simple-record-list": "2.42.1",
39
- "@memberjunction/ng-tabstrip": "2.42.1",
28
+ "@memberjunction/core-entities": "2.44.0",
29
+ "@memberjunction/global": "2.44.0",
30
+ "@memberjunction/core": "2.44.0",
31
+ "@memberjunction/ng-container-directives": "2.44.0",
32
+ "@memberjunction/ng-shared": "2.44.0",
33
+ "@memberjunction/ng-notifications": "2.44.0",
34
+ "@memberjunction/ng-entity-permissions": "2.44.0",
35
+ "@memberjunction/ng-base-forms": "2.44.0",
36
+ "@memberjunction/ng-entity-form-dialog": "2.44.0",
37
+ "@memberjunction/ng-user-view-grid": "2.44.0",
38
+ "@memberjunction/ng-simple-record-list": "2.44.0",
39
+ "@memberjunction/ng-tabstrip": "2.44.0",
40
40
  "@progress/kendo-angular-dropdowns": "16.2.0",
41
41
  "@progress/kendo-angular-grid": "16.2.0",
42
42
  "@progress/kendo-angular-buttons": "16.2.0",