@memberjunction/ng-explorer-core 1.0.4 → 1.0.7-next.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.
- package/dist/lib/app-view/application-view.component.js +3 -3
- package/dist/lib/auth-button/auth-button.component.js +2 -2
- package/dist/lib/dashboard-browser-component/dashboard-browser.component.js +3 -3
- package/dist/lib/data-browser-component/data-browser.component.js +3 -3
- package/dist/lib/expansion-panel-component/expansion-panel-component.js +3 -3
- package/dist/lib/favorites/favorites.component.js +3 -3
- package/dist/lib/files/files.component.js +3 -3
- package/dist/lib/generic/form-toolbar.js +10 -10
- package/dist/lib/generic/resource-container-component.js +1 -1
- package/dist/lib/generic/section-loader-component.js +1 -1
- package/dist/lib/generic-browse-list/generic-browse-list.component.js +3 -3
- package/dist/lib/generic-browser-list/generic-browser-list.component.js +4 -4
- package/dist/lib/header/header.component.js +3 -3
- package/dist/lib/home-component/home.component.js +3 -3
- package/dist/lib/join-grid/join-grid.component.js +2 -2
- package/dist/lib/navigation/navigation.component.js +3 -3
- package/dist/lib/query-browser-component/query-browser.component.js +3 -3
- package/dist/lib/report-browser-component/report-browser.component.js +3 -3
- package/dist/lib/resource-wrappers/dashboard-resource.component.js +1 -1
- package/dist/lib/resource-wrappers/query-resource.component.js +1 -1
- package/dist/lib/resource-wrappers/record-resource.component.js +1 -1
- package/dist/lib/resource-wrappers/report-resource.component.js +1 -1
- package/dist/lib/resource-wrappers/search-results-resource.component.js +1 -1
- package/dist/lib/resource-wrappers/view-resource.component.js +6 -6
- package/dist/lib/single-application/single-application.component.js +3 -3
- package/dist/lib/single-dashboard/Components/add-item/add-item.component.js +3 -3
- package/dist/lib/single-dashboard/Components/delete-item/delete-item.component.js +3 -3
- package/dist/lib/single-dashboard/Components/edit-dashboard/edit-dashboard.component.js +3 -3
- package/dist/lib/single-dashboard/single-dashboard.component.js +3 -3
- package/dist/lib/single-entity/single-entity.component.js +3 -3
- package/dist/lib/single-query/single-query.component.js +1 -1
- package/dist/lib/single-record/single-record.component.js +2 -2
- package/dist/lib/single-report/single-report.component.js +2 -2
- package/dist/lib/single-search-result/single-search-result.component.js +2 -2
- package/dist/lib/single-view/single-view.component.js +3 -3
- package/dist/lib/user-notifications/user-notifications.component.js +3 -3
- package/dist/lib/user-profile/user-profile.component.js +2 -2
- package/package.json +59 -59
- package/dist/lib/ask-skip/ask-skip.component.d.ts +0 -87
- package/dist/lib/ask-skip/ask-skip.component.js +0 -626
- package/dist/lib/ask-skip/skip-dynamic-report-wrapper.d.ts +0 -12
- package/dist/lib/ask-skip/skip-dynamic-report-wrapper.js +0 -50
- package/dist/lib/expansion-panel-component/components/expansion-panel-item-component.d.ts +0 -14
- package/dist/lib/expansion-panel-component/components/expansion-panel-item-component.d.ts.map +0 -1
- package/dist/lib/expansion-panel-component/components/expansion-panel-item-component.js +0 -33
- package/dist/lib/generic/base-form-component.d.ts +0 -77
- package/dist/lib/generic/base-form-component.d.ts.map +0 -1
- package/dist/lib/generic/base-form-component.js +0 -436
- package/dist/lib/generic/base-form-section-component.d.ts +0 -7
- package/dist/lib/generic/base-form-section-component.d.ts.map +0 -1
- package/dist/lib/generic/base-form-section-component.js +0 -9
- package/dist/lib/generic/base-record-component.d.ts +0 -7
- package/dist/lib/generic/base-record-component.d.ts.map +0 -1
- package/dist/lib/generic/base-record-component.js +0 -15
- package/dist/lib/generic/base-resource-component.d.ts +0 -34
- package/dist/lib/generic/base-resource-component.js +0 -75
- package/dist/lib/generic/dynamic-chart.d.ts +0 -33
- package/dist/lib/generic/dynamic-chart.js +0 -252
- package/dist/lib/generic/dynamic-grid.d.ts +0 -25
- package/dist/lib/generic/dynamic-grid.js +0 -142
- package/dist/lib/generic/dynamic-report.d.ts +0 -38
- package/dist/lib/generic/dynamic-report.js +0 -405
- package/dist/lib/generic-browser-list/components/resource/resource.d.ts +0 -1
- package/dist/lib/generic-browser-list/components/resource/resource.d.ts.map +0 -1
- package/dist/lib/generic-browser-list/components/resource/resource.js +0 -1
- package/dist/lib/settings/settings.component.d.ts +0 -8
- package/dist/lib/settings/settings.component.d.ts.map +0 -1
- package/dist/lib/settings/settings.component.js +0 -64
- package/dist/lib/user-view-properties/view-properties-dialog.component.d.ts +0 -72
- package/dist/lib/user-view-properties/view-properties-dialog.component.d.ts.map +0 -1
- package/dist/lib/user-view-properties/view-properties-dialog.component.js +0 -605
- package/dist/shared/shared.service.d.ts +0 -94
- package/dist/shared/shared.service.js +0 -324
- package/dist/shared/urlPipe.d.ts +0 -7
- package/dist/shared/urlPipe.js +0 -16
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { EntityInfo, PrimaryKeyValue } from '@memberjunction/core';
|
|
2
|
-
import { ResourceTypeEntity, UserNotificationEntity, ViewColumnInfo } from '@memberjunction/core-entities';
|
|
3
|
-
import { Observable } from 'rxjs';
|
|
4
|
-
import { NotificationService } from "@progress/kendo-angular-notification";
|
|
5
|
-
import * as i0 from "@angular/core";
|
|
6
|
-
export declare class SharedService {
|
|
7
|
-
private notificationService;
|
|
8
|
-
private static _instance;
|
|
9
|
-
private static _loaded;
|
|
10
|
-
private static _resourceTypes;
|
|
11
|
-
private tabChange;
|
|
12
|
-
tabChange$: Observable<unknown>;
|
|
13
|
-
constructor(notificationService: NotificationService);
|
|
14
|
-
static get Instance(): SharedService;
|
|
15
|
-
/**
|
|
16
|
-
* Returns the current session ID, which is automatically created when the service is instantiated.
|
|
17
|
-
*/
|
|
18
|
-
get SessionId(): string;
|
|
19
|
-
get ResourceTypes(): ResourceTypeEntity[];
|
|
20
|
-
get ViewResourceType(): ResourceTypeEntity;
|
|
21
|
-
get RecordResourceType(): ResourceTypeEntity;
|
|
22
|
-
get DashboardResourceType(): ResourceTypeEntity;
|
|
23
|
-
get ReportResourceType(): ResourceTypeEntity;
|
|
24
|
-
get SearchResultsResourceType(): ResourceTypeEntity;
|
|
25
|
-
ResourceTypeByID(id: number): ResourceTypeEntity | undefined;
|
|
26
|
-
ResourceTypeByName(name: string): ResourceTypeEntity | undefined;
|
|
27
|
-
static RefreshData(): Promise<void>;
|
|
28
|
-
static GeneratePrimaryKeyValueString(pkVals: PrimaryKeyValue[]): string;
|
|
29
|
-
static ParsePrimaryKeys(entity: EntityInfo, routeSegment: string): PrimaryKeyValue[];
|
|
30
|
-
FormatColumnValue(col: ViewColumnInfo, value: any, maxLength?: number, trailingChars?: string): any;
|
|
31
|
-
ConvertMarkdownStringToHtmlList(listType: HtmlListType, text: string): string;
|
|
32
|
-
InvokeManualResize(delay?: number): void;
|
|
33
|
-
PushStatusUpdates(): Observable<string>;
|
|
34
|
-
private _currentUserImage;
|
|
35
|
-
get CurrentUserImage(): string | Blob;
|
|
36
|
-
set CurrentUserImage(value: string | Blob);
|
|
37
|
-
private static _userNotifications;
|
|
38
|
-
static get UserNotifications(): UserNotificationEntity[];
|
|
39
|
-
static get UnreadUserNotifications(): UserNotificationEntity[];
|
|
40
|
-
static get UnreadUserNotificationCount(): number;
|
|
41
|
-
/**
|
|
42
|
-
* Creates a notification in the database and refreshes the UI. Returns the notification object.
|
|
43
|
-
* @param title
|
|
44
|
-
* @param message
|
|
45
|
-
* @param resourceTypeId
|
|
46
|
-
* @param resourceRecordId
|
|
47
|
-
* @param resourceConfiguration Any object, it is converted to a string by JSON.stringify and stored in the database
|
|
48
|
-
* @returns
|
|
49
|
-
*/
|
|
50
|
-
CreateNotification(title: string, message: string, resourceTypeId: number | null, resourceRecordId: number | null, resourceConfiguration: any | null): Promise<UserNotificationEntity>;
|
|
51
|
-
static RefreshUserNotifications(): Promise<void>;
|
|
52
|
-
/**
|
|
53
|
-
* Creates a message that is not saved to the User Notifications table, but is displayed to the user.
|
|
54
|
-
* @param message - text to display
|
|
55
|
-
* @param style - display styling
|
|
56
|
-
* @param hideAfter - option to auto hide after the specified delay in milliseconds
|
|
57
|
-
*/
|
|
58
|
-
CreateSimpleNotification(message: string, style?: "none" | "success" | "error" | "warning" | "info", hideAfter?: number): void;
|
|
59
|
-
private _resourceTypeMap;
|
|
60
|
-
/**
|
|
61
|
-
* Maps a Resource Type record Name column to the corresponding route segment
|
|
62
|
-
* @param resourceTypeName
|
|
63
|
-
* @returns
|
|
64
|
-
*/
|
|
65
|
-
mapResourceTypeNameToRouteSegment(resourceTypeName: string): string | null;
|
|
66
|
-
/**
|
|
67
|
-
* Maps a route segment to the corresponding Resource Type record Name column
|
|
68
|
-
* @param resourceRouteSegment
|
|
69
|
-
* @returns
|
|
70
|
-
*/
|
|
71
|
-
mapResourceTypeRouteSegmentToName(resourceRouteSegment: string): string | null;
|
|
72
|
-
kendoSVGIcon(iconName: string): any;
|
|
73
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<SharedService, never>;
|
|
74
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<SharedService>;
|
|
75
|
-
}
|
|
76
|
-
export declare const HtmlListType: {
|
|
77
|
-
readonly Unordered: "Unordered";
|
|
78
|
-
readonly Ordered: "Ordered";
|
|
79
|
-
};
|
|
80
|
-
export type HtmlListType = typeof HtmlListType[keyof typeof HtmlListType];
|
|
81
|
-
export declare const EventCodes: {
|
|
82
|
-
readonly ViewClicked: "ViewClicked";
|
|
83
|
-
readonly EntityRecordClicked: "EntityRecordClicked";
|
|
84
|
-
readonly AddDashboard: "AddDashboard";
|
|
85
|
-
readonly AddReport: "AddReport";
|
|
86
|
-
readonly AddQuery: "AddQuery";
|
|
87
|
-
readonly ViewCreated: "ViewCreated";
|
|
88
|
-
readonly ViewUpdated: "ViewUpdated";
|
|
89
|
-
readonly RunSearch: "RunSearch";
|
|
90
|
-
readonly ViewNotifications: "ViewNotifications";
|
|
91
|
-
readonly PushStatusUpdates: "PushStatusUpdates";
|
|
92
|
-
readonly UserNotificationsUpdated: "UserNotificationsUpdated";
|
|
93
|
-
};
|
|
94
|
-
export type EventCodes = typeof EventCodes[keyof typeof EventCodes];
|
|
@@ -1,324 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { Injectable } from '@angular/core';
|
|
11
|
-
import { LogError, Metadata, RunView } from '@memberjunction/core';
|
|
12
|
-
import { MJEventType, MJGlobal } from '@memberjunction/global';
|
|
13
|
-
import { Subject } from 'rxjs';
|
|
14
|
-
import { kendoSVGIcon } from '@memberjunction/ng-shared';
|
|
15
|
-
import * as i0 from "@angular/core";
|
|
16
|
-
import * as i1 from "@progress/kendo-angular-notification";
|
|
17
|
-
export class SharedService {
|
|
18
|
-
constructor(notificationService) {
|
|
19
|
-
this.notificationService = notificationService;
|
|
20
|
-
this.tabChange = new Subject();
|
|
21
|
-
this.tabChange$ = this.tabChange.asObservable();
|
|
22
|
-
this._currentUserImage = '/assets/user.png';
|
|
23
|
-
this._resourceTypeMap = [
|
|
24
|
-
{ routeSegment: 'record', name: 'records' },
|
|
25
|
-
{ routeSegment: 'view', name: 'user views' },
|
|
26
|
-
{ routeSegment: 'search', name: 'search results' },
|
|
27
|
-
{ routeSegment: 'report', name: 'reports' },
|
|
28
|
-
{ routeSegment: 'query', name: 'queries' },
|
|
29
|
-
{ routeSegment: 'dashboard', name: 'dashboards' }
|
|
30
|
-
];
|
|
31
|
-
if (SharedService._instance) {
|
|
32
|
-
// return existing instance which will short circuit the creation of a new instance
|
|
33
|
-
return SharedService._instance;
|
|
34
|
-
}
|
|
35
|
-
// first time this has been called, so return ourselves since we're in the constructor
|
|
36
|
-
SharedService._instance = this;
|
|
37
|
-
MJGlobal.Instance.GetEventListener(true).subscribe((event) => {
|
|
38
|
-
switch (event.event) {
|
|
39
|
-
case MJEventType.DisplaySimpleNotificationRequest:
|
|
40
|
-
// received the message to display a notification to the user, so do that...
|
|
41
|
-
const messageData = event.args;
|
|
42
|
-
this.CreateSimpleNotification(messageData.message, messageData.style, messageData.DisplayDuration);
|
|
43
|
-
break;
|
|
44
|
-
case MJEventType.ComponentEvent:
|
|
45
|
-
if (event.eventCode === EventCodes.UserNotificationsUpdated) {
|
|
46
|
-
// refresh the user notifications
|
|
47
|
-
SharedService.RefreshUserNotifications();
|
|
48
|
-
}
|
|
49
|
-
break;
|
|
50
|
-
case MJEventType.LoggedIn:
|
|
51
|
-
if (SharedService._loaded === false)
|
|
52
|
-
SharedService.RefreshData();
|
|
53
|
-
// got the login, now subscribe to push status updates here so we can then raise them as events in MJ Global locally
|
|
54
|
-
this.PushStatusUpdates().subscribe((status) => {
|
|
55
|
-
var _a, _b;
|
|
56
|
-
const statusObj = JSON.parse(status.message);
|
|
57
|
-
// pass along as an event so anyone else who wants to know about the push status update can do stuff
|
|
58
|
-
MJGlobal.Instance.RaiseEvent({
|
|
59
|
-
event: MJEventType.ComponentEvent,
|
|
60
|
-
eventCode: EventCodes.PushStatusUpdates,
|
|
61
|
-
args: statusObj,
|
|
62
|
-
component: this
|
|
63
|
-
});
|
|
64
|
-
if (((_a = statusObj.type) === null || _a === void 0 ? void 0 : _a.trim().toLowerCase()) === 'usernotifications') {
|
|
65
|
-
if (statusObj.details && ((_b = statusObj.details.action) === null || _b === void 0 ? void 0 : _b.trim().toLowerCase()) === 'create') {
|
|
66
|
-
// we have changes to user notifications, so refresh them
|
|
67
|
-
this.CreateSimpleNotification('New Notification Available', "success", 2000);
|
|
68
|
-
SharedService.RefreshUserNotifications();
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
// otherwise just post it as a simple notification
|
|
73
|
-
this.CreateSimpleNotification(statusObj.message, "success", 2500);
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
break;
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
static get Instance() {
|
|
81
|
-
return SharedService._instance;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Returns the current session ID, which is automatically created when the service is instantiated.
|
|
85
|
-
*/
|
|
86
|
-
get SessionId() {
|
|
87
|
-
return Metadata.Provider.sessionId;
|
|
88
|
-
}
|
|
89
|
-
get ResourceTypes() {
|
|
90
|
-
return SharedService._resourceTypes;
|
|
91
|
-
}
|
|
92
|
-
get ViewResourceType() {
|
|
93
|
-
return SharedService._resourceTypes.find(rt => rt.Name.trim().toLowerCase() === 'user views');
|
|
94
|
-
}
|
|
95
|
-
get RecordResourceType() {
|
|
96
|
-
return SharedService._resourceTypes.find(rt => rt.Name.trim().toLowerCase() === 'records');
|
|
97
|
-
}
|
|
98
|
-
get DashboardResourceType() {
|
|
99
|
-
return SharedService._resourceTypes.find(rt => rt.Name.trim().toLowerCase() === 'dashboards');
|
|
100
|
-
}
|
|
101
|
-
get ReportResourceType() {
|
|
102
|
-
return SharedService._resourceTypes.find(rt => rt.Name.trim().toLowerCase() === 'reports');
|
|
103
|
-
}
|
|
104
|
-
get SearchResultsResourceType() {
|
|
105
|
-
return SharedService._resourceTypes.find(rt => rt.Name.trim().toLowerCase() === 'search results');
|
|
106
|
-
}
|
|
107
|
-
ResourceTypeByID(id) {
|
|
108
|
-
return SharedService._resourceTypes.find(rt => rt.ID === id);
|
|
109
|
-
}
|
|
110
|
-
ResourceTypeByName(name) {
|
|
111
|
-
return SharedService._resourceTypes.find(rt => rt.Name.trim().toLowerCase() === name.trim().toLowerCase());
|
|
112
|
-
}
|
|
113
|
-
static RefreshData() {
|
|
114
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
115
|
-
// if we have a provider, then we can load the data, otherwise load isn't done yet
|
|
116
|
-
const md = new Metadata();
|
|
117
|
-
const rtResult = yield md.GetAndCacheDatasetByName('ResourceTypes');
|
|
118
|
-
if (rtResult && rtResult.Success) {
|
|
119
|
-
const data = rtResult.Results.find(r => r.EntityName === 'Resource Types');
|
|
120
|
-
if (data) {
|
|
121
|
-
SharedService._resourceTypes = data.Results;
|
|
122
|
-
SharedService._loaded = true;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
SharedService.RefreshUserNotifications(); // also call this initially when refreshing the dataset...
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
static GeneratePrimaryKeyValueString(pkVals) {
|
|
129
|
-
return pkVals.map(pk => pk.FieldName + '|' + pk.Value).join('||');
|
|
130
|
-
}
|
|
131
|
-
static ParsePrimaryKeys(entity, routeSegment) {
|
|
132
|
-
if (!routeSegment.includes('|')) {
|
|
133
|
-
// If not, return a single element array with a default field name
|
|
134
|
-
return [{ FieldName: entity.PrimaryKey.Name, Value: routeSegment }];
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
const parts = routeSegment.split('||');
|
|
138
|
-
const pkVals = [];
|
|
139
|
-
for (let p of parts) {
|
|
140
|
-
const kv = p.split('|');
|
|
141
|
-
pkVals.push({ FieldName: kv[0], Value: kv[1] });
|
|
142
|
-
}
|
|
143
|
-
return pkVals;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
FormatColumnValue(col, value, maxLength = 0, trailingChars = "...") {
|
|
147
|
-
if (value === null || value === undefined)
|
|
148
|
-
return value;
|
|
149
|
-
try {
|
|
150
|
-
const retVal = col.EntityField.FormatValue(value, 0);
|
|
151
|
-
if (maxLength > 0 && retVal && retVal.length > maxLength)
|
|
152
|
-
return retVal.substring(0, maxLength) + trailingChars;
|
|
153
|
-
else
|
|
154
|
-
return retVal;
|
|
155
|
-
}
|
|
156
|
-
catch (e) {
|
|
157
|
-
LogError(e);
|
|
158
|
-
return value;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
ConvertMarkdownStringToHtmlList(listType, text) {
|
|
162
|
-
const listTag = listType === HtmlListType.Unordered ? 'ul' : 'ol';
|
|
163
|
-
if (!text.includes('\n')) {
|
|
164
|
-
return text;
|
|
165
|
-
}
|
|
166
|
-
const listItems = text.split('\n').map(line => `<li>${line.trim().replace(/^-\s*/, '')}</li>`).join('');
|
|
167
|
-
return `<${listTag}>${listItems}</${listTag}>`;
|
|
168
|
-
}
|
|
169
|
-
InvokeManualResize(delay = 50) {
|
|
170
|
-
setTimeout(() => {
|
|
171
|
-
MJGlobal.Instance.RaiseEvent({
|
|
172
|
-
event: MJEventType.ManualResizeRequest,
|
|
173
|
-
eventCode: '',
|
|
174
|
-
args: null,
|
|
175
|
-
component: this
|
|
176
|
-
});
|
|
177
|
-
}, delay); // give the tabstrip time to render
|
|
178
|
-
}
|
|
179
|
-
PushStatusUpdates() {
|
|
180
|
-
const gp = Metadata.Provider;
|
|
181
|
-
return gp.PushStatusUpdates();
|
|
182
|
-
}
|
|
183
|
-
get CurrentUserImage() {
|
|
184
|
-
return this._currentUserImage;
|
|
185
|
-
}
|
|
186
|
-
set CurrentUserImage(value) {
|
|
187
|
-
this._currentUserImage = value;
|
|
188
|
-
}
|
|
189
|
-
static get UserNotifications() {
|
|
190
|
-
return SharedService._userNotifications;
|
|
191
|
-
}
|
|
192
|
-
static get UnreadUserNotifications() {
|
|
193
|
-
return SharedService._userNotifications.filter(n => n.Unread);
|
|
194
|
-
}
|
|
195
|
-
static get UnreadUserNotificationCount() {
|
|
196
|
-
return SharedService.UnreadUserNotifications.length;
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Creates a notification in the database and refreshes the UI. Returns the notification object.
|
|
200
|
-
* @param title
|
|
201
|
-
* @param message
|
|
202
|
-
* @param resourceTypeId
|
|
203
|
-
* @param resourceRecordId
|
|
204
|
-
* @param resourceConfiguration Any object, it is converted to a string by JSON.stringify and stored in the database
|
|
205
|
-
* @returns
|
|
206
|
-
*/
|
|
207
|
-
CreateNotification(title, message, resourceTypeId, resourceRecordId, resourceConfiguration) {
|
|
208
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
209
|
-
const md = new Metadata();
|
|
210
|
-
const notification = yield md.GetEntityObject('User Notifications');
|
|
211
|
-
notification.Title = title;
|
|
212
|
-
notification.Message = message;
|
|
213
|
-
if (resourceTypeId)
|
|
214
|
-
notification.ResourceTypeID = resourceTypeId;
|
|
215
|
-
if (resourceRecordId)
|
|
216
|
-
notification.ResourceRecordID = resourceRecordId;
|
|
217
|
-
if (resourceConfiguration)
|
|
218
|
-
notification.ResourceConfiguration = JSON.stringify(resourceConfiguration);
|
|
219
|
-
notification.UserID = md.CurrentUser.ID;
|
|
220
|
-
notification.Unread = true;
|
|
221
|
-
const result = yield notification.Save();
|
|
222
|
-
if (result) {
|
|
223
|
-
SharedService.RefreshUserNotifications();
|
|
224
|
-
}
|
|
225
|
-
// test
|
|
226
|
-
this.CreateSimpleNotification(notification.Message, "success", 2500);
|
|
227
|
-
return notification;
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
|
-
static RefreshUserNotifications() {
|
|
231
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
232
|
-
try {
|
|
233
|
-
const rv = new RunView();
|
|
234
|
-
const md = new Metadata();
|
|
235
|
-
const result = yield rv.RunView({
|
|
236
|
-
EntityName: 'User Notifications',
|
|
237
|
-
ExtraFilter: 'UserID=' + md.CurrentUser.ID,
|
|
238
|
-
OrderBy: 'CreatedAt DESC'
|
|
239
|
-
});
|
|
240
|
-
if (result && result.Success) {
|
|
241
|
-
SharedService._userNotifications = result.Results;
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
catch (e) {
|
|
245
|
-
LogError(e);
|
|
246
|
-
}
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
/**
|
|
250
|
-
* Creates a message that is not saved to the User Notifications table, but is displayed to the user.
|
|
251
|
-
* @param message - text to display
|
|
252
|
-
* @param style - display styling
|
|
253
|
-
* @param hideAfter - option to auto hide after the specified delay in milliseconds
|
|
254
|
-
*/
|
|
255
|
-
CreateSimpleNotification(message, style = "success", hideAfter) {
|
|
256
|
-
const props = {
|
|
257
|
-
content: message,
|
|
258
|
-
cssClass: "button-notification",
|
|
259
|
-
animation: { type: "slide", duration: 400 },
|
|
260
|
-
position: { horizontal: "center", vertical: "top" },
|
|
261
|
-
type: { style: style, icon: true }
|
|
262
|
-
};
|
|
263
|
-
if (hideAfter)
|
|
264
|
-
props.hideAfter = hideAfter;
|
|
265
|
-
else
|
|
266
|
-
props.closable = true;
|
|
267
|
-
this.notificationService.show(props);
|
|
268
|
-
}
|
|
269
|
-
/**
|
|
270
|
-
* Maps a Resource Type record Name column to the corresponding route segment
|
|
271
|
-
* @param resourceTypeName
|
|
272
|
-
* @returns
|
|
273
|
-
*/
|
|
274
|
-
mapResourceTypeNameToRouteSegment(resourceTypeName) {
|
|
275
|
-
const item = this._resourceTypeMap.find(rt => rt.name.trim().toLowerCase() === resourceTypeName.trim().toLowerCase());
|
|
276
|
-
if (item)
|
|
277
|
-
return item.routeSegment;
|
|
278
|
-
else
|
|
279
|
-
return null;
|
|
280
|
-
}
|
|
281
|
-
/**
|
|
282
|
-
* Maps a route segment to the corresponding Resource Type record Name column
|
|
283
|
-
* @param resourceRouteSegment
|
|
284
|
-
* @returns
|
|
285
|
-
*/
|
|
286
|
-
mapResourceTypeRouteSegmentToName(resourceRouteSegment) {
|
|
287
|
-
const item = this._resourceTypeMap.find(rt => rt.routeSegment.trim().toLowerCase() === resourceRouteSegment.trim().toLowerCase());
|
|
288
|
-
if (item)
|
|
289
|
-
return item.name;
|
|
290
|
-
else
|
|
291
|
-
return null;
|
|
292
|
-
}
|
|
293
|
-
kendoSVGIcon(iconName) {
|
|
294
|
-
return kendoSVGIcon(iconName);
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
SharedService._loaded = false;
|
|
298
|
-
SharedService._resourceTypes = [];
|
|
299
|
-
SharedService._userNotifications = [];
|
|
300
|
-
SharedService.ɵfac = function SharedService_Factory(t) { return new (t || SharedService)(i0.ɵɵinject(i1.NotificationService)); };
|
|
301
|
-
SharedService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: SharedService, factory: SharedService.ɵfac, providedIn: 'root' });
|
|
302
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(SharedService, [{
|
|
303
|
-
type: Injectable,
|
|
304
|
-
args: [{
|
|
305
|
-
providedIn: 'root'
|
|
306
|
-
}]
|
|
307
|
-
}], () => [{ type: i1.NotificationService }], null); })();
|
|
308
|
-
export const HtmlListType = {
|
|
309
|
-
Unordered: 'Unordered',
|
|
310
|
-
Ordered: 'Ordered',
|
|
311
|
-
};
|
|
312
|
-
export const EventCodes = {
|
|
313
|
-
ViewClicked: "ViewClicked",
|
|
314
|
-
EntityRecordClicked: "EntityRecordClicked",
|
|
315
|
-
AddDashboard: "AddDashboard",
|
|
316
|
-
AddReport: "AddReport",
|
|
317
|
-
AddQuery: "AddQuery",
|
|
318
|
-
ViewCreated: "ViewCreated",
|
|
319
|
-
ViewUpdated: "ViewUpdated",
|
|
320
|
-
RunSearch: "RunSearch",
|
|
321
|
-
ViewNotifications: "ViewNotifications",
|
|
322
|
-
PushStatusUpdates: "PushStatusUpdates",
|
|
323
|
-
UserNotificationsUpdated: "UserNotificationsUpdated"
|
|
324
|
-
};
|
package/dist/shared/urlPipe.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { PipeTransform } from '@angular/core';
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
export declare class URLPipe implements PipeTransform {
|
|
4
|
-
transform(value: string): string;
|
|
5
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<URLPipe, never>;
|
|
6
|
-
static ɵpipe: i0.ɵɵPipeDeclaration<URLPipe, "formatUrl", false>;
|
|
7
|
-
}
|
package/dist/shared/urlPipe.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Pipe } from '@angular/core';
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
export class URLPipe {
|
|
4
|
-
transform(value) {
|
|
5
|
-
if (value && !value.includes('http'))
|
|
6
|
-
return 'https://' + value;
|
|
7
|
-
else
|
|
8
|
-
return value;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
URLPipe.ɵfac = function URLPipe_Factory(t) { return new (t || URLPipe)(); };
|
|
12
|
-
URLPipe.ɵpipe = /*@__PURE__*/ i0.ɵɵdefinePipe({ name: "formatUrl", type: URLPipe, pure: true });
|
|
13
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(URLPipe, [{
|
|
14
|
-
type: Pipe,
|
|
15
|
-
args: [{ name: 'formatUrl' }]
|
|
16
|
-
}], null, null); })();
|