identity-admin 1.26.14 → 1.26.15
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
|
@@ -148,7 +148,7 @@ Dashboard constructor to create new instance from idntity-admin.
|
|
|
148
148
|
`To add admin notifications in your project you should add the following`
|
|
149
149
|
|
|
150
150
|
- Enable the admin notifications in the configuration file of the dashboard.
|
|
151
|
-
|
|
151
|
+
> Configuration.ts
|
|
152
152
|
|
|
153
153
|
```Typescript
|
|
154
154
|
import { IConfiguartionFile } from "identity-admin/lib/types/IConfigurationFile";
|
|
@@ -161,7 +161,7 @@ export const configuration: IConfiguartionFile = {
|
|
|
161
161
|
```
|
|
162
162
|
|
|
163
163
|
- Add these lines for the admin notification repository in the inversify container.
|
|
164
|
-
|
|
164
|
+
> RepositoryTypes.ts
|
|
165
165
|
|
|
166
166
|
```Typescript
|
|
167
167
|
IAdminNotificationRepository: Symbol.for('IAdminNotificationRepository')
|
|
@@ -176,7 +176,7 @@ container.bind<IAdminNotificationRepository>(TYPES.IAdminNotificationRepository)
|
|
|
176
176
|
```
|
|
177
177
|
|
|
178
178
|
- Create new dashboard controller for the admin notifications CRUD operations and another controller for the notifications services.
|
|
179
|
-
|
|
179
|
+
> AdminNotificationController.ts
|
|
180
180
|
|
|
181
181
|
```TypeScript
|
|
182
182
|
import { controller } from "inversify-express-utils";
|
|
@@ -270,3 +270,26 @@ const record = await AdminNotificationCreation.insert({
|
|
|
270
270
|
- In case you choose **NotificationNavigationType.LIST** then you should provide a model name to be navigated to
|
|
271
271
|
- In case you choose **NotificationNavigationType.SHOW** then you should provide a model name to be navigated to and the relatedId of the record to be shown
|
|
272
272
|
- In case you choose **NotificationNavigationType.EXTERNAL_LINK** then you should provide the external link
|
|
273
|
+
|
|
274
|
+
#### The Frontend code:
|
|
275
|
+
|
|
276
|
+
- Add the notification provider just before the router.
|
|
277
|
+
> app.tsx
|
|
278
|
+
|
|
279
|
+
```tsx
|
|
280
|
+
import { NotificationsContextProvider } from 'identity-admin-ui';
|
|
281
|
+
|
|
282
|
+
<NotificationsContextProvider notificationsUrl="notifications">
|
|
283
|
+
<Router />
|
|
284
|
+
</NotificationsContextProvider>;
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
- Add the notification icon in the dashboard header.
|
|
288
|
+
> DashboardHeader.tsx
|
|
289
|
+
|
|
290
|
+
```tsx
|
|
291
|
+
const showNotifications = resources?.appConfigurations?.adminNotifications;
|
|
292
|
+
|
|
293
|
+
{showNotifications && <NotificationPopover />} // Add it just above the account popover
|
|
294
|
+
<AccountPopover userType={userType} />
|
|
295
|
+
```
|
|
@@ -50,6 +50,10 @@ class SchemaGenerator {
|
|
|
50
50
|
model[field].apiRoute = model[field].apiRoute ? model[field].apiRoute : 'admin/' + StringUtils_1.default.lowerCaseFirstLetter(pluralize(schema[field].caster.options.ref));
|
|
51
51
|
model[field].arrayType = model[field].arrayType ? model[field].arrayType : helpers_1.FieldTypes.REFERENCE;
|
|
52
52
|
}
|
|
53
|
+
else if (schema[field].caster.enumValues && schema[field].caster.enumValues.length > 0) {
|
|
54
|
+
model[field].arrayType = model[field].arrayType ? model[field].arrayType : helpers_1.FieldTypes.ENUM;
|
|
55
|
+
model[field].enumValues = model[field].enumValues ? model[field].enumValues : schema[field].caster.enumValues;
|
|
56
|
+
}
|
|
53
57
|
else {
|
|
54
58
|
model[field].arrayType = model[field].arrayType ? model[field].arrayType : schema[field].caster.instance;
|
|
55
59
|
}
|
|
@@ -284,6 +284,12 @@ export interface IFieldValue {
|
|
|
284
284
|
* ex: ["sa", "eg", ...]
|
|
285
285
|
*/
|
|
286
286
|
countryCodes?: string[];
|
|
287
|
+
/**
|
|
288
|
+
* Specify the default country code.
|
|
289
|
+
* ex: ["sa", "eg", ...]
|
|
290
|
+
* @default 'First country of provided country codes or sa if no country codes provided'
|
|
291
|
+
*/
|
|
292
|
+
defaultCountryCode?: string;
|
|
287
293
|
/**
|
|
288
294
|
* Specify the array type if the field is of type array.
|
|
289
295
|
* @default 'Same as schema''
|
package/lib/types/helpers.d.ts
CHANGED
|
@@ -35,7 +35,8 @@ export declare enum FieldTypes {
|
|
|
35
35
|
HTML = "HTML",
|
|
36
36
|
RICH_TEXT_I = "RICH_TEXT_I",
|
|
37
37
|
RICH_TEXT_II = "RICH_TEXT_II",
|
|
38
|
-
EXTERNAL_LINK = "EXTERNAL_LINK"
|
|
38
|
+
EXTERNAL_LINK = "EXTERNAL_LINK",
|
|
39
|
+
MULTIPLE_TEXT = "MULTIPLE_TEXT"
|
|
39
40
|
}
|
|
40
41
|
export declare enum FileTypes {
|
|
41
42
|
ALL = "ALL",
|
package/lib/types/helpers.js
CHANGED
|
@@ -43,6 +43,7 @@ var FieldTypes;
|
|
|
43
43
|
FieldTypes["RICH_TEXT_I"] = "RICH_TEXT_I";
|
|
44
44
|
FieldTypes["RICH_TEXT_II"] = "RICH_TEXT_II";
|
|
45
45
|
FieldTypes["EXTERNAL_LINK"] = "EXTERNAL_LINK";
|
|
46
|
+
FieldTypes["MULTIPLE_TEXT"] = "MULTIPLE_TEXT";
|
|
46
47
|
})(FieldTypes = exports.FieldTypes || (exports.FieldTypes = {}));
|
|
47
48
|
var FileTypes;
|
|
48
49
|
(function (FileTypes) {
|