http-request-manager 18.5.16 → 18.5.18
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.
|
@@ -2870,9 +2870,11 @@ class HTTPManagerStateService extends ComponentStore {
|
|
|
2870
2870
|
this.wsConnection = false;
|
|
2871
2871
|
this.wsOptions = WSOptions.adapt();
|
|
2872
2872
|
// WebSocket
|
|
2873
|
-
this.initWS = this.effect((wsOptions$) => wsOptions$.pipe(
|
|
2874
|
-
|
|
2875
|
-
|
|
2873
|
+
this.initWS = this.effect((wsOptions$) => wsOptions$.pipe(
|
|
2874
|
+
// tap((wsOptions) => { debugger
|
|
2875
|
+
// this.wsOptions = wsOptions
|
|
2876
|
+
// }),
|
|
2877
|
+
switchMap((wsOptions) => merge(this.httpManagerService.connectionStatus$.pipe(tap((isConnected) => {
|
|
2876
2878
|
this.wsConnection = isConnected;
|
|
2877
2879
|
})), this.httpManagerService.messages$.pipe(tap((message) => {
|
|
2878
2880
|
if (!message)
|
|
@@ -3228,7 +3230,6 @@ class HTTPManagerStateService extends ComponentStore {
|
|
|
3228
3230
|
this.wsNextRetry = new BehaviorSubject(this.retryDelay);
|
|
3229
3231
|
this.wsNextRetry$ = this.wsNextRetry.asObservable();
|
|
3230
3232
|
this.setApiRequestOptions(apiOptions, dataType, database);
|
|
3231
|
-
this.connectionStatus$ = this.setupConnectionStatus();
|
|
3232
3233
|
if (this.databaseOptions && this.databaseOptions.table) {
|
|
3233
3234
|
this.localStorageManagerService.createStore({
|
|
3234
3235
|
name: this.databaseOptions.table,
|
|
@@ -3238,6 +3239,7 @@ class HTTPManagerStateService extends ComponentStore {
|
|
|
3238
3239
|
encrypted: false,
|
|
3239
3240
|
})
|
|
3240
3241
|
});
|
|
3242
|
+
this.initDBStorage();
|
|
3241
3243
|
}
|
|
3242
3244
|
}
|
|
3243
3245
|
setApiRequestOptions(apiOptions, dataType, database) {
|
|
@@ -3248,16 +3250,29 @@ class HTTPManagerStateService extends ComponentStore {
|
|
|
3248
3250
|
this.hasDatabase = (database?.table) ? true : false;
|
|
3249
3251
|
this.databaseOptions = (this.hasDatabase) ? DatabaseStorage.adapt(database) : undefined;
|
|
3250
3252
|
}
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3253
|
+
if (this.apiOptions.ws && this.apiOptions.ws.id !== '') {
|
|
3254
|
+
// Update WebSocket retry settings when options change
|
|
3255
|
+
if (this.apiOptions.ws?.retry) {
|
|
3256
|
+
this.maxRetries = this.apiOptions.ws.retry.times || 3;
|
|
3257
|
+
this.retryDelay = (this.apiOptions.ws.retry.delay && this.apiOptions.ws.retry.delay * 1000) || 5 * 1000;
|
|
3258
|
+
this.wsNextRetry.next(this.retryDelay);
|
|
3259
|
+
}
|
|
3260
|
+
// Validate wsServer before attempting connection
|
|
3261
|
+
if (!this.apiOptions.ws.wsServer || this.apiOptions.ws.wsServer === '') {
|
|
3262
|
+
console.error('WSOptions invalid: wsServer is missing or empty');
|
|
3263
|
+
return;
|
|
3264
|
+
}
|
|
3265
|
+
// Setup connection status monitoring
|
|
3266
|
+
this.connectionStatus$ = this.setupConnectionStatus();
|
|
3267
|
+
// Make initial connection attempt
|
|
3268
|
+
console.log('🔄 Initial WebSocket connection attempt...');
|
|
3269
|
+
this.httpManagerService.connect(this.apiOptions.ws, this.apiOptions.ws.jwtToken || '');
|
|
3270
|
+
// Initialize WS effect to handle messages
|
|
3260
3271
|
this.initWS(this.apiOptions.ws);
|
|
3272
|
+
}
|
|
3273
|
+
else {
|
|
3274
|
+
console.warn('WSOptions invalid Id: empty');
|
|
3275
|
+
}
|
|
3261
3276
|
}
|
|
3262
3277
|
// WebSocket
|
|
3263
3278
|
setupConnectionStatus() {
|
|
@@ -3283,11 +3298,16 @@ class HTTPManagerStateService extends ComponentStore {
|
|
|
3283
3298
|
const attempt = i + 1;
|
|
3284
3299
|
this.wsRetryAttempts.next(attempt);
|
|
3285
3300
|
countdownEnder$.next();
|
|
3286
|
-
//
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
this.
|
|
3301
|
+
// Validate WS options; abort retries if invalid
|
|
3302
|
+
const hasValidWS = !!(this.apiOptions.ws && this.apiOptions.ws.wsServer && this.apiOptions.ws.wsServer !== '');
|
|
3303
|
+
if (!hasValidWS) {
|
|
3304
|
+
this.shouldRetry = false;
|
|
3305
|
+
this.wsNextRetry.next(0);
|
|
3306
|
+
this.wsRetryAttempts.next(0);
|
|
3307
|
+
return; // Skip connect and countdown
|
|
3290
3308
|
}
|
|
3309
|
+
console.log(`🔄 Retry attempt #${attempt}/${this.maxRetries}`);
|
|
3310
|
+
this.httpManagerService.connect(this.apiOptions.ws, this.apiOptions.ws.jwtToken || '');
|
|
3291
3311
|
if (attempt === this.maxRetries) {
|
|
3292
3312
|
this.wsNextRetry.next(0);
|
|
3293
3313
|
// console.error(`🚨 FAILED CONNECTION: Tried #${attempt} times`);
|
|
@@ -3382,7 +3402,6 @@ class HTTPManagerStateService extends ComponentStore {
|
|
|
3382
3402
|
const messageInfo = ChannelMessage.adapt({ ...message, fromUser: user });
|
|
3383
3403
|
if (this.wsConnection && this.apiOptions.ws) {
|
|
3384
3404
|
const wsServer = (channels) ? channels : this.apiOptions.ws.id;
|
|
3385
|
-
debugger;
|
|
3386
3405
|
// if(messageInfo.toUser === 'allChannels') {
|
|
3387
3406
|
// this.httpManagerService.sendBroadcast(messageInfo)
|
|
3388
3407
|
// } else if(messageInfo.toUser === 'allInChannel') {
|
|
@@ -4031,18 +4050,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
4031
4050
|
args: [CONFIG_SETTINGS_TOKEN]
|
|
4032
4051
|
}] }] });
|
|
4033
4052
|
|
|
4034
|
-
class UserData {
|
|
4035
|
-
constructor(ldap = '', name = '', email = '') {
|
|
4036
|
-
this.ldap = ldap;
|
|
4037
|
-
this.name = name;
|
|
4038
|
-
this.email = email;
|
|
4039
|
-
}
|
|
4040
|
-
static adapt(item) {
|
|
4041
|
-
const userName = `${item?.first_name} ${item?.last_name}`;
|
|
4042
|
-
return new UserData(item?.ldap, userName, item?.email);
|
|
4043
|
-
}
|
|
4044
|
-
}
|
|
4045
|
-
|
|
4046
4053
|
class OIDCClient {
|
|
4047
4054
|
constructor(spiffe = '', id = 0, first_name = '', last_name = '', email = '') {
|
|
4048
4055
|
this.spiffe = spiffe;
|
|
@@ -4065,18 +4072,6 @@ class StateRequestServiceDemo extends HTTPManagerStateService {
|
|
|
4065
4072
|
delay: 1,
|
|
4066
4073
|
}),
|
|
4067
4074
|
adapter: OIDCClient.adapt,
|
|
4068
|
-
ws: {
|
|
4069
|
-
id: ``,
|
|
4070
|
-
// wsChannels: ['allChannels'],
|
|
4071
|
-
// access: ['read,write,delete,update'],
|
|
4072
|
-
wsServer: '',
|
|
4073
|
-
jwtToken: '',
|
|
4074
|
-
user: UserData.adapt(),
|
|
4075
|
-
retry: RetryOptions.adapt({
|
|
4076
|
-
times: 3,
|
|
4077
|
-
delay: 10,
|
|
4078
|
-
}),
|
|
4079
|
-
}
|
|
4080
4075
|
}), DataType.ARRAY, DatabaseStorage.adapt({
|
|
4081
4076
|
table: 'ws_demo_data',
|
|
4082
4077
|
expiresIn: '5mn',
|
|
@@ -4093,7 +4088,7 @@ class StateRequestServiceDemo extends HTTPManagerStateService {
|
|
|
4093
4088
|
}),
|
|
4094
4089
|
adapter: OIDCClient.adapt,
|
|
4095
4090
|
ws: {
|
|
4096
|
-
id: 'WS-
|
|
4091
|
+
id: 'WS-USERS123',
|
|
4097
4092
|
wsServer,
|
|
4098
4093
|
jwtToken,
|
|
4099
4094
|
user, // user object
|
|
@@ -4126,6 +4121,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
4126
4121
|
}]
|
|
4127
4122
|
}], ctorParameters: () => [] });
|
|
4128
4123
|
|
|
4124
|
+
class UserData {
|
|
4125
|
+
constructor(ldap = '', name = '', email = '') {
|
|
4126
|
+
this.ldap = ldap;
|
|
4127
|
+
this.name = name;
|
|
4128
|
+
this.email = email;
|
|
4129
|
+
}
|
|
4130
|
+
static adapt(item) {
|
|
4131
|
+
const userName = `${item?.first_name} ${item?.last_name}`;
|
|
4132
|
+
return new UserData(item?.ldap, userName, item?.email);
|
|
4133
|
+
}
|
|
4134
|
+
}
|
|
4135
|
+
|
|
4129
4136
|
class StateDataRequestService extends HTTPManagerStateService {
|
|
4130
4137
|
constructor() {
|
|
4131
4138
|
super(ApiRequest.adapt({
|
|
@@ -4154,9 +4161,8 @@ class StateDataRequestService extends HTTPManagerStateService {
|
|
|
4154
4161
|
this.attempts$ = this.wsRetryAttempts$;
|
|
4155
4162
|
this.nextRetry$ = this.wsNextRetry$;
|
|
4156
4163
|
this.path = ['ai', 'tests'];
|
|
4157
|
-
this.wsChannel = 'WS-USERS';
|
|
4158
4164
|
}
|
|
4159
|
-
updateConnection(server, wsServer, jwtToken, user, path = [
|
|
4165
|
+
updateConnection(server, wsServer, jwtToken, user, path = [], wsChannel = '') {
|
|
4160
4166
|
this.path = path;
|
|
4161
4167
|
this.setApiRequestOptions({
|
|
4162
4168
|
server,
|
|
@@ -4274,115 +4280,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
4274
4280
|
type: Input
|
|
4275
4281
|
}] } });
|
|
4276
4282
|
|
|
4277
|
-
class WsMessagingComponent {
|
|
4278
|
-
constructor() {
|
|
4279
|
-
this.fb = inject(FormBuilder);
|
|
4280
|
-
this.stateRequestServiceDemo = inject(StateRequestServiceDemo);
|
|
4281
|
-
this.channels$ = this.stateRequestServiceDemo.channels$;
|
|
4282
|
-
this.user$ = this.stateRequestServiceDemo.user$;
|
|
4283
|
-
this.users$ = this.stateRequestServiceDemo.userList$;
|
|
4284
|
-
this.data$ = this.stateRequestServiceDemo.data$;
|
|
4285
|
-
this.connectionStatus$ = this.stateRequestServiceDemo.connectionStatus$;
|
|
4286
|
-
this.messages = this.fb.group({
|
|
4287
|
-
channels: this.fb.control(null, Validators.required),
|
|
4288
|
-
toUsers: this.fb.control(null, Validators.required),
|
|
4289
|
-
content: this.fb.control(null, Validators.required),
|
|
4290
|
-
});
|
|
4291
|
-
this.communicationMessages$ = this.stateRequestServiceDemo.communicationMessages$;
|
|
4292
|
-
this.latestCommunicationMessages$ = this.stateRequestServiceDemo.latestCommunicationMessages$;
|
|
4293
|
-
this.chat$ = combineLatest([this.user$, this.communicationMessages$])
|
|
4294
|
-
.pipe(map$1(([user, messages]) => ({ user, messages })), map$1(obj => {
|
|
4295
|
-
if (!obj.user)
|
|
4296
|
-
return EMPTY;
|
|
4297
|
-
// const mainUser = UserName.adapt({
|
|
4298
|
-
// id: obj.user.username,
|
|
4299
|
-
// first: obj.user?.name?.first,
|
|
4300
|
-
// last: obj.user?.name?.last,
|
|
4301
|
-
// })
|
|
4302
|
-
const mainUser = '';
|
|
4303
|
-
const messages = obj.messages.map((item) => {
|
|
4304
|
-
if (item.toUser === 'allChannels') {
|
|
4305
|
-
// item.toUser = UserName.adapt({
|
|
4306
|
-
// id: '',
|
|
4307
|
-
// first: 'All Users',
|
|
4308
|
-
// last: '',
|
|
4309
|
-
// })
|
|
4310
|
-
}
|
|
4311
|
-
// return Message.adapt({
|
|
4312
|
-
// fromUser: {
|
|
4313
|
-
// id: item.fromUser.username,
|
|
4314
|
-
// first: item.fromUser?.name?.first,
|
|
4315
|
-
// last: item.fromUser?.name?.last,
|
|
4316
|
-
// },
|
|
4317
|
-
// toUser: {
|
|
4318
|
-
// id: item.toUser.username,
|
|
4319
|
-
// first: item.toUser?.name?.first,
|
|
4320
|
-
// last: item.toUser?.name?.last,
|
|
4321
|
-
// },
|
|
4322
|
-
// content: item.content,
|
|
4323
|
-
// date: item.issued,
|
|
4324
|
-
// })
|
|
4325
|
-
});
|
|
4326
|
-
return { user: mainUser, messages };
|
|
4327
|
-
}));
|
|
4328
|
-
}
|
|
4329
|
-
get channels() {
|
|
4330
|
-
return this.messages.get('channels');
|
|
4331
|
-
}
|
|
4332
|
-
get toUsers() {
|
|
4333
|
-
return this.messages.get('toUsers');
|
|
4334
|
-
}
|
|
4335
|
-
get content() {
|
|
4336
|
-
return this.messages.get('content');
|
|
4337
|
-
}
|
|
4338
|
-
get isValid() {
|
|
4339
|
-
return this.toUsers.valid;
|
|
4340
|
-
}
|
|
4341
|
-
ngOnInit() {
|
|
4342
|
-
this.stateRequestServiceDemo.updateConnection(this.server, this.wsServer, this.jwtToken, this.user);
|
|
4343
|
-
// this.stateRequestServiceDemo.getData()
|
|
4344
|
-
this.connectionStatus$
|
|
4345
|
-
.subscribe(status => {
|
|
4346
|
-
this.stateRequestServiceDemo.getAllChannels();
|
|
4347
|
-
});
|
|
4348
|
-
}
|
|
4349
|
-
onSendMessage(user) {
|
|
4350
|
-
this.messages.markAllAsTouched();
|
|
4351
|
-
if (this.messages.invalid)
|
|
4352
|
-
return;
|
|
4353
|
-
const message = ChannelMessage.adapt({
|
|
4354
|
-
message: this.messages.value.content,
|
|
4355
|
-
...user,
|
|
4356
|
-
users: this.toUsers.value,
|
|
4357
|
-
});
|
|
4358
|
-
this.stateRequestServiceDemo.sendMessage(message);
|
|
4359
|
-
this.content.reset();
|
|
4360
|
-
}
|
|
4361
|
-
onSendAlert() {
|
|
4362
|
-
debugger;
|
|
4363
|
-
this.messages.markAllAsTouched();
|
|
4364
|
-
if (this.messages.invalid)
|
|
4365
|
-
return;
|
|
4366
|
-
const message = ChannelMessage.adapt({ ...this.messages.value, type: CommunicationType.ALERT });
|
|
4367
|
-
this.stateRequestServiceDemo.sendMessage(message);
|
|
4368
|
-
this.content.reset();
|
|
4369
|
-
}
|
|
4370
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: WsMessagingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
4371
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: WsMessagingComponent, selector: "app-ws-messaging", inputs: { server: "server", wsServer: "wsServer", jwtToken: "jwtToken", user: "user" }, ngImport: i0, template: "\n @if ((data$ | async); as data) {\n <div style=\"margin: 1rem; display: flex; gap: 1rem; flex-direction: column;\">\n <div>\n\n <div>\n <div style=\"display: flex; gap: 1rem\">\n <div style=\"flex:1\" [formGroup]=\"messages\">\n\n <div style=\"display:flex; gap: 1rem\">\n @if ((channels$ | async); as channels) {\n <mat-form-field style=\"flex:1\" appearance=\"outline\">\n <mat-label>Channels</mat-label>\n <mat-select formControlName=\"channels\" multiple #channelsSelect>\n <mat-select-trigger>\n {{ (channelsSelect.value?.[0] === 'allChannels' ? 'All Channels' : channelsSelect.value?.[0]?.content?.name) || '' }}\n @if ((channelsSelect.value?.length || 0) > 1) {\n <span>\n (+{{(channelsSelect.value?.length || 0) - 1}} {{channelsSelect.value?.length === 2 ? 'other' : 'others'}})\n </span>\n }\n </mat-select-trigger>\n <mat-option value=\"allChannels\">\n All Channels\n </mat-option>\n @for (channel of channels; track channel) {\n <mat-option [value]=\"channel\">\n {{ channel }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n }\n @if ((users$ | async); as users) {\n <mat-form-field style=\"flex:1\" appearance=\"outline\">\n <mat-label>Users</mat-label>\n <mat-select formControlName=\"toUsers\" multiple #userSelect>\n <mat-select-trigger>\n {{ (userSelect.value?.[0] === 'allUsers' ? 'All Users' : userSelect.value?.[0]?.content?.name) || '' }}\n @if ((userSelect.value?.length || 0) > 1) {\n <span>\n (+{{(userSelect.value?.length || 0) - 1}} {{userSelect.value?.length === 2 ? 'other' : 'others'}})\n </span>\n }\n </mat-select-trigger>\n <mat-option value=\"allChannels\">\n All Users\n </mat-option>\n @for (user of users; track user) {\n <mat-option [value]=\"user\">\n {{ user.content.name }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n }\n </div>\n\n @if ((users$ | async); as users) {\n <div style=\"display:flex\">\n <mat-form-field style=\"flex:1\" appearance=\"outline\">\n <mat-label>Send a Message</mat-label>\n <textarea\n matInput placeholder=\"Ex. It makes me feel...\"\n formControlName=\"content\"\n (keydown.enter)=\"onSendMessage(user); $event.preventDefault()\"\n [disabled]=\"!isValid\"\n ></textarea>\n </mat-form-field>\n </div>\n }\n\n <div style=\"display:flex; gap: .5rem;\">\n <div style=\"flex:1\"></div>\n <button mat-stroked-button (click)=\"onSendAlert()\" color=\"warn\">\n Send Alert\n </button>\n <button mat-stroked-button (click)=\"onSendMessage(user)\">\n Send Message\n </button>\n </div>\n </div>\n </div>\n @if ((chat$ | async); as chat) {\n <div style=\"border: thin gray solid; padding: 1rem; margin-top: 1rem;\">\n <!-- <app-messenger-chat\n [user]=\"chat.user\"\n [messages]=\"chat.messages\"\n ></app-messenger-chat> -->\n </div>\n }\n </div>\n\n </div>\n </div>\n }\n\n\n {{ channels$ | async | json }}\n", styles: [""], dependencies: [{ kind: "directive", type: i1$2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i2$1.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatLabel, selector: "mat-label" }, { kind: "component", type: i4.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "directive", type: i4.MatSelectTrigger, selector: "mat-select-trigger" }, { kind: "component", type: i5.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "directive", type: i12.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }, { kind: "pipe", type: i1$1.JsonPipe, name: "json" }] }); }
|
|
4372
|
-
}
|
|
4373
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: WsMessagingComponent, decorators: [{
|
|
4374
|
-
type: Component,
|
|
4375
|
-
args: [{ selector: 'app-ws-messaging', standalone: false, template: "\n @if ((data$ | async); as data) {\n <div style=\"margin: 1rem; display: flex; gap: 1rem; flex-direction: column;\">\n <div>\n\n <div>\n <div style=\"display: flex; gap: 1rem\">\n <div style=\"flex:1\" [formGroup]=\"messages\">\n\n <div style=\"display:flex; gap: 1rem\">\n @if ((channels$ | async); as channels) {\n <mat-form-field style=\"flex:1\" appearance=\"outline\">\n <mat-label>Channels</mat-label>\n <mat-select formControlName=\"channels\" multiple #channelsSelect>\n <mat-select-trigger>\n {{ (channelsSelect.value?.[0] === 'allChannels' ? 'All Channels' : channelsSelect.value?.[0]?.content?.name) || '' }}\n @if ((channelsSelect.value?.length || 0) > 1) {\n <span>\n (+{{(channelsSelect.value?.length || 0) - 1}} {{channelsSelect.value?.length === 2 ? 'other' : 'others'}})\n </span>\n }\n </mat-select-trigger>\n <mat-option value=\"allChannels\">\n All Channels\n </mat-option>\n @for (channel of channels; track channel) {\n <mat-option [value]=\"channel\">\n {{ channel }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n }\n @if ((users$ | async); as users) {\n <mat-form-field style=\"flex:1\" appearance=\"outline\">\n <mat-label>Users</mat-label>\n <mat-select formControlName=\"toUsers\" multiple #userSelect>\n <mat-select-trigger>\n {{ (userSelect.value?.[0] === 'allUsers' ? 'All Users' : userSelect.value?.[0]?.content?.name) || '' }}\n @if ((userSelect.value?.length || 0) > 1) {\n <span>\n (+{{(userSelect.value?.length || 0) - 1}} {{userSelect.value?.length === 2 ? 'other' : 'others'}})\n </span>\n }\n </mat-select-trigger>\n <mat-option value=\"allChannels\">\n All Users\n </mat-option>\n @for (user of users; track user) {\n <mat-option [value]=\"user\">\n {{ user.content.name }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n }\n </div>\n\n @if ((users$ | async); as users) {\n <div style=\"display:flex\">\n <mat-form-field style=\"flex:1\" appearance=\"outline\">\n <mat-label>Send a Message</mat-label>\n <textarea\n matInput placeholder=\"Ex. It makes me feel...\"\n formControlName=\"content\"\n (keydown.enter)=\"onSendMessage(user); $event.preventDefault()\"\n [disabled]=\"!isValid\"\n ></textarea>\n </mat-form-field>\n </div>\n }\n\n <div style=\"display:flex; gap: .5rem;\">\n <div style=\"flex:1\"></div>\n <button mat-stroked-button (click)=\"onSendAlert()\" color=\"warn\">\n Send Alert\n </button>\n <button mat-stroked-button (click)=\"onSendMessage(user)\">\n Send Message\n </button>\n </div>\n </div>\n </div>\n @if ((chat$ | async); as chat) {\n <div style=\"border: thin gray solid; padding: 1rem; margin-top: 1rem;\">\n <!-- <app-messenger-chat\n [user]=\"chat.user\"\n [messages]=\"chat.messages\"\n ></app-messenger-chat> -->\n </div>\n }\n </div>\n\n </div>\n </div>\n }\n\n\n {{ channels$ | async | json }}\n" }]
|
|
4376
|
-
}], propDecorators: { server: [{
|
|
4377
|
-
type: Input
|
|
4378
|
-
}], wsServer: [{
|
|
4379
|
-
type: Input
|
|
4380
|
-
}], jwtToken: [{
|
|
4381
|
-
type: Input
|
|
4382
|
-
}], user: [{
|
|
4383
|
-
type: Input
|
|
4384
|
-
}] } });
|
|
4385
|
-
|
|
4386
4283
|
class WsNotificationsComponent {
|
|
4387
4284
|
constructor() { }
|
|
4388
4285
|
ngOnInit() {
|
|
@@ -4481,11 +4378,11 @@ class RequestManagerWsDemoComponent {
|
|
|
4481
4378
|
// this.stateRequestServiceDemo.updateConnection(this.server, this.wsServer, this.jwtToken, this.user);
|
|
4482
4379
|
}
|
|
4483
4380
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: RequestManagerWsDemoComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
4484
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: RequestManagerWsDemoComponent, selector: "app-request-manager-ws-demo", inputs: { server: "server", wsServer: "wsServer", jwtToken: "jwtToken", user: "user", path: "path", wsChannel: "wsChannel" }, ngImport: i0, template: "<div style=\"margin: 2rem;\">\n\n <h2 style=\"display: flex;\">\n <span style=\"flex:1\">HTTP Request State Manager - Websockets</span>\n @if ((connectionStatus$ | async); as connected) {\n <span>\n WS -\n <span style=\"color: green;\">Connected</span>\n </span>\n } @else {\n <span style=\"color: red;\">Disconnected {{ attempts$ | async }} - {{ nextRetry$ |async }}</span>\n }\n </h2>\n\n <div>\n\n @if ((user$ | async); as userInfo) {\n <div>\n <mat-toolbar>\n <div style=\"display: flex; flex:1\">\n <div style=\"flex:1\">{{ userInfo.content.name }}</div>\n <div>({{ userInfo.content.ldap }})</div>\n </div>\n </mat-toolbar>\n </div>\n }\n\n @if ((isPending$ | async)) {\n <div>\n <mat-progress-bar mode=\"indeterminate\"></mat-progress-bar>\n </div>\n }\n\n <mat-tab-group animationDuration=\"0ms\" [selectedIndex]=\"1\">\n\n <mat-tab label=\"WS - Data Control\">\n <!-- DATA CONTROL -->\n <app-ws-data-control\n [server]=\"server\"\n [wsServer]=\"wsServer\"\n [jwtToken]=\"jwtToken\"\n [user]=\"user\"\n [path]=\"path\"\n [wsChannel]=\"wsChannel\"\n ></app-ws-data-control>\n\n </mat-tab>\n\n <mat-tab label=\"WS - Messaging\">\n <!-- MESSAGING -->\n <app-ws-messaging\n [server]=\"server\"\n [wsServer]=\"wsServer\"\n [jwtToken]=\"jwtToken\"\n [user]=\"user\"\n ></app-ws-messaging
|
|
4381
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: RequestManagerWsDemoComponent, selector: "app-request-manager-ws-demo", inputs: { server: "server", wsServer: "wsServer", jwtToken: "jwtToken", user: "user", path: "path", wsChannel: "wsChannel" }, ngImport: i0, template: "<div style=\"margin: 2rem;\">\n\n <h2 style=\"display: flex;\">\n <span style=\"flex:1\">HTTP Request State Manager - Websockets</span>\n @if ((connectionStatus$ | async); as connected) {\n <span>\n WS -\n <span style=\"color: green;\">Connected</span>\n </span>\n } @else {\n <span style=\"color: red;\">Disconnected {{ attempts$ | async }} - {{ nextRetry$ |async }}</span>\n }\n </h2>\n\n <div>\n\n @if ((user$ | async); as userInfo) {\n <div>\n <mat-toolbar>\n <div style=\"display: flex; flex:1\">\n <div style=\"flex:1\">{{ userInfo.content.name }}</div>\n <div>({{ userInfo.content.ldap }})</div>\n </div>\n </mat-toolbar>\n </div>\n }\n\n @if ((isPending$ | async)) {\n <div>\n <mat-progress-bar mode=\"indeterminate\"></mat-progress-bar>\n </div>\n }\n\n <mat-tab-group animationDuration=\"0ms\" [selectedIndex]=\"1\">\n\n <mat-tab label=\"WS - Data Control\">\n <!-- DATA CONTROL -->\n <app-ws-data-control\n [server]=\"server\"\n [wsServer]=\"wsServer\"\n [jwtToken]=\"jwtToken\"\n [user]=\"user\"\n [path]=\"path\"\n [wsChannel]=\"wsChannel\"\n ></app-ws-data-control>\n\n </mat-tab>\n\n <mat-tab label=\"WS - Messaging\">\n <!-- MESSAGING -->\n <!-- <app-ws-messaging\n [server]=\"server\"\n [wsServer]=\"wsServer\"\n [jwtToken]=\"jwtToken\"\n [user]=\"user\"\n ></app-ws-messaging> -->\n\n </mat-tab>\n\n <mat-tab label=\"WS - Notifications\" [disabled]=\"true\">\n <!-- WS - Custom Messaging -->\n <app-ws-notifications></app-ws-notifications>\n </mat-tab>\n\n <mat-tab label=\"WS - AI Messaging\" [disabled]=\"true\">\n <!-- WS - AI Messaging -->\n <app-ws-ai-messaging></app-ws-ai-messaging>\n </mat-tab>\n\n </mat-tab-group>\n</div>\n\n</div>\n\n", styles: [""], dependencies: [{ kind: "component", type: i1$3.MatTab, selector: "mat-tab", inputs: ["disabled", "label", "aria-label", "aria-labelledby", "labelClass", "bodyClass"], exportAs: ["matTab"] }, { kind: "component", type: i1$3.MatTabGroup, selector: "mat-tab-group", inputs: ["color", "fitInkBarToContent", "mat-stretch-tabs", "dynamicHeight", "selectedIndex", "headerPosition", "animationDuration", "contentTabIndex", "disablePagination", "disableRipple", "preserveContent", "backgroundColor", "aria-label", "aria-labelledby"], outputs: ["selectedIndexChange", "focusChange", "animationDone", "selectedTabChange"], exportAs: ["matTabGroup"] }, { kind: "component", type: i9.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "component", type: i3$2.MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }, { kind: "component", type: WsDataControlComponent, selector: "app-ws-data-control", inputs: ["server", "wsServer", "jwtToken", "user", "path", "wsChannel"] }, { kind: "component", type: WsNotificationsComponent, selector: "app-ws-notifications" }, { kind: "component", type: WsAiMessagingComponent, selector: "app-ws-ai-messaging" }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }] }); }
|
|
4485
4382
|
}
|
|
4486
4383
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: RequestManagerWsDemoComponent, decorators: [{
|
|
4487
4384
|
type: Component,
|
|
4488
|
-
args: [{ selector: 'app-request-manager-ws-demo', standalone: false, template: "<div style=\"margin: 2rem;\">\n\n <h2 style=\"display: flex;\">\n <span style=\"flex:1\">HTTP Request State Manager - Websockets</span>\n @if ((connectionStatus$ | async); as connected) {\n <span>\n WS -\n <span style=\"color: green;\">Connected</span>\n </span>\n } @else {\n <span style=\"color: red;\">Disconnected {{ attempts$ | async }} - {{ nextRetry$ |async }}</span>\n }\n </h2>\n\n <div>\n\n @if ((user$ | async); as userInfo) {\n <div>\n <mat-toolbar>\n <div style=\"display: flex; flex:1\">\n <div style=\"flex:1\">{{ userInfo.content.name }}</div>\n <div>({{ userInfo.content.ldap }})</div>\n </div>\n </mat-toolbar>\n </div>\n }\n\n @if ((isPending$ | async)) {\n <div>\n <mat-progress-bar mode=\"indeterminate\"></mat-progress-bar>\n </div>\n }\n\n <mat-tab-group animationDuration=\"0ms\" [selectedIndex]=\"1\">\n\n <mat-tab label=\"WS - Data Control\">\n <!-- DATA CONTROL -->\n <app-ws-data-control\n [server]=\"server\"\n [wsServer]=\"wsServer\"\n [jwtToken]=\"jwtToken\"\n [user]=\"user\"\n [path]=\"path\"\n [wsChannel]=\"wsChannel\"\n ></app-ws-data-control>\n\n </mat-tab>\n\n <mat-tab label=\"WS - Messaging\">\n <!-- MESSAGING -->\n <app-ws-messaging\n [server]=\"server\"\n [wsServer]=\"wsServer\"\n [jwtToken]=\"jwtToken\"\n [user]=\"user\"\n ></app-ws-messaging
|
|
4385
|
+
args: [{ selector: 'app-request-manager-ws-demo', standalone: false, template: "<div style=\"margin: 2rem;\">\n\n <h2 style=\"display: flex;\">\n <span style=\"flex:1\">HTTP Request State Manager - Websockets</span>\n @if ((connectionStatus$ | async); as connected) {\n <span>\n WS -\n <span style=\"color: green;\">Connected</span>\n </span>\n } @else {\n <span style=\"color: red;\">Disconnected {{ attempts$ | async }} - {{ nextRetry$ |async }}</span>\n }\n </h2>\n\n <div>\n\n @if ((user$ | async); as userInfo) {\n <div>\n <mat-toolbar>\n <div style=\"display: flex; flex:1\">\n <div style=\"flex:1\">{{ userInfo.content.name }}</div>\n <div>({{ userInfo.content.ldap }})</div>\n </div>\n </mat-toolbar>\n </div>\n }\n\n @if ((isPending$ | async)) {\n <div>\n <mat-progress-bar mode=\"indeterminate\"></mat-progress-bar>\n </div>\n }\n\n <mat-tab-group animationDuration=\"0ms\" [selectedIndex]=\"1\">\n\n <mat-tab label=\"WS - Data Control\">\n <!-- DATA CONTROL -->\n <app-ws-data-control\n [server]=\"server\"\n [wsServer]=\"wsServer\"\n [jwtToken]=\"jwtToken\"\n [user]=\"user\"\n [path]=\"path\"\n [wsChannel]=\"wsChannel\"\n ></app-ws-data-control>\n\n </mat-tab>\n\n <mat-tab label=\"WS - Messaging\">\n <!-- MESSAGING -->\n <!-- <app-ws-messaging\n [server]=\"server\"\n [wsServer]=\"wsServer\"\n [jwtToken]=\"jwtToken\"\n [user]=\"user\"\n ></app-ws-messaging> -->\n\n </mat-tab>\n\n <mat-tab label=\"WS - Notifications\" [disabled]=\"true\">\n <!-- WS - Custom Messaging -->\n <app-ws-notifications></app-ws-notifications>\n </mat-tab>\n\n <mat-tab label=\"WS - AI Messaging\" [disabled]=\"true\">\n <!-- WS - AI Messaging -->\n <app-ws-ai-messaging></app-ws-ai-messaging>\n </mat-tab>\n\n </mat-tab-group>\n</div>\n\n</div>\n\n" }]
|
|
4489
4386
|
}], propDecorators: { server: [{
|
|
4490
4387
|
type: Input
|
|
4491
4388
|
}], wsServer: [{
|
|
@@ -4918,6 +4815,117 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
4918
4815
|
args: [{ selector: 'app-store-state-manager-demo', providers: [SettingsStateService], standalone: false, template: "<div style=\"margin: 2rem;\">\n\n <h2>\n <span>Store State Manager</span>\n <span style=\"margin-left: .5rem;\">\n <mat-icon color=\"accent\">fiber_new</mat-icon>\n </span>\n </h2>\n\n {{ dataState$ | async | json}}\n\n <div style=\"display: flex; gap:.5rem; margin-top: 1rem; margin-bottom: 1rem;\">\n <button mat-stroked-button (click)=\"onUpdateEnum_1()\">Update Start</button>\n <button mat-stroked-button (click)=\"onUpdateEnum_2()\">Update End</button>\n <button mat-stroked-button (click)=\"onGetEnum_1()\">Dump</button>\n </div>\n\n <div>\n <h3 style=\"margin: 0;\">Enum 1</h3>\n {{ dataEnum$ | async | json}}\n </div>\n\n</div>\n" }]
|
|
4919
4816
|
}] });
|
|
4920
4817
|
|
|
4818
|
+
class WsMessagingComponent {
|
|
4819
|
+
constructor() {
|
|
4820
|
+
this.fb = inject(FormBuilder);
|
|
4821
|
+
this.stateRequestServiceDemo = inject(StateRequestServiceDemo);
|
|
4822
|
+
this.channels$ = this.stateRequestServiceDemo.channels$;
|
|
4823
|
+
this.user$ = this.stateRequestServiceDemo.user$;
|
|
4824
|
+
this.users$ = this.stateRequestServiceDemo.userList$;
|
|
4825
|
+
this.data$ = this.stateRequestServiceDemo.data$;
|
|
4826
|
+
this.connectionStatus$ = this.stateRequestServiceDemo.connectionStatus$;
|
|
4827
|
+
this.messages = this.fb.group({
|
|
4828
|
+
channels: this.fb.control(null, Validators.required),
|
|
4829
|
+
toUsers: this.fb.control(null, Validators.required),
|
|
4830
|
+
content: this.fb.control(null, Validators.required),
|
|
4831
|
+
});
|
|
4832
|
+
this.communicationMessages$ = this.stateRequestServiceDemo.communicationMessages$;
|
|
4833
|
+
this.latestCommunicationMessages$ = this.stateRequestServiceDemo.latestCommunicationMessages$;
|
|
4834
|
+
this.chat$ = combineLatest([this.user$, this.communicationMessages$])
|
|
4835
|
+
.pipe(map$1(([user, messages]) => ({ user, messages })), map$1(obj => {
|
|
4836
|
+
if (!obj.user)
|
|
4837
|
+
return EMPTY;
|
|
4838
|
+
// const mainUser = UserName.adapt({
|
|
4839
|
+
// id: obj.user.username,
|
|
4840
|
+
// first: obj.user?.name?.first,
|
|
4841
|
+
// last: obj.user?.name?.last,
|
|
4842
|
+
// })
|
|
4843
|
+
const mainUser = '';
|
|
4844
|
+
const messages = obj.messages.map((item) => {
|
|
4845
|
+
if (item.toUser === 'allChannels') {
|
|
4846
|
+
// item.toUser = UserName.adapt({
|
|
4847
|
+
// id: '',
|
|
4848
|
+
// first: 'All Users',
|
|
4849
|
+
// last: '',
|
|
4850
|
+
// })
|
|
4851
|
+
}
|
|
4852
|
+
// return Message.adapt({
|
|
4853
|
+
// fromUser: {
|
|
4854
|
+
// id: item.fromUser.username,
|
|
4855
|
+
// first: item.fromUser?.name?.first,
|
|
4856
|
+
// last: item.fromUser?.name?.last,
|
|
4857
|
+
// },
|
|
4858
|
+
// toUser: {
|
|
4859
|
+
// id: item.toUser.username,
|
|
4860
|
+
// first: item.toUser?.name?.first,
|
|
4861
|
+
// last: item.toUser?.name?.last,
|
|
4862
|
+
// },
|
|
4863
|
+
// content: item.content,
|
|
4864
|
+
// date: item.issued,
|
|
4865
|
+
// })
|
|
4866
|
+
});
|
|
4867
|
+
return { user: mainUser, messages };
|
|
4868
|
+
}));
|
|
4869
|
+
}
|
|
4870
|
+
get channels() {
|
|
4871
|
+
return this.messages.get('channels');
|
|
4872
|
+
}
|
|
4873
|
+
get toUsers() {
|
|
4874
|
+
return this.messages.get('toUsers');
|
|
4875
|
+
}
|
|
4876
|
+
get content() {
|
|
4877
|
+
return this.messages.get('content');
|
|
4878
|
+
}
|
|
4879
|
+
get isValid() {
|
|
4880
|
+
return this.toUsers.valid;
|
|
4881
|
+
}
|
|
4882
|
+
ngOnInit() {
|
|
4883
|
+
this.stateRequestServiceDemo.updateConnection(this.server, this.wsServer, this.jwtToken, this.user);
|
|
4884
|
+
// this.stateRequestServiceDemo.getData()
|
|
4885
|
+
if (this.connectionStatus$) {
|
|
4886
|
+
this.connectionStatus$
|
|
4887
|
+
.subscribe(status => {
|
|
4888
|
+
this.stateRequestServiceDemo.getAllChannels();
|
|
4889
|
+
});
|
|
4890
|
+
}
|
|
4891
|
+
}
|
|
4892
|
+
onSendMessage(user) {
|
|
4893
|
+
this.messages.markAllAsTouched();
|
|
4894
|
+
if (this.messages.invalid)
|
|
4895
|
+
return;
|
|
4896
|
+
const message = ChannelMessage.adapt({
|
|
4897
|
+
message: this.messages.value.content,
|
|
4898
|
+
...user,
|
|
4899
|
+
users: this.toUsers.value,
|
|
4900
|
+
});
|
|
4901
|
+
this.stateRequestServiceDemo.sendMessage(message);
|
|
4902
|
+
this.content.reset();
|
|
4903
|
+
}
|
|
4904
|
+
onSendAlert() {
|
|
4905
|
+
debugger;
|
|
4906
|
+
this.messages.markAllAsTouched();
|
|
4907
|
+
if (this.messages.invalid)
|
|
4908
|
+
return;
|
|
4909
|
+
const message = ChannelMessage.adapt({ ...this.messages.value, type: CommunicationType.ALERT });
|
|
4910
|
+
this.stateRequestServiceDemo.sendMessage(message);
|
|
4911
|
+
this.content.reset();
|
|
4912
|
+
}
|
|
4913
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: WsMessagingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
4914
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: WsMessagingComponent, selector: "app-ws-messaging", inputs: { server: "server", wsServer: "wsServer", jwtToken: "jwtToken", user: "user" }, ngImport: i0, template: "\n @if ((data$ | async); as data) {\n <div style=\"margin: 1rem; display: flex; gap: 1rem; flex-direction: column;\">\n <div>\n\n <div>\n <div style=\"display: flex; gap: 1rem\">\n <div style=\"flex:1\" [formGroup]=\"messages\">\n\n <div style=\"display:flex; gap: 1rem\">\n @if ((channels$ | async); as channels) {\n <mat-form-field style=\"flex:1\" appearance=\"outline\">\n <mat-label>Channels</mat-label>\n <mat-select formControlName=\"channels\" multiple #channelsSelect>\n <mat-select-trigger>\n {{ (channelsSelect.value?.[0] === 'allChannels' ? 'All Channels' : channelsSelect.value?.[0]?.content?.name) || '' }}\n @if ((channelsSelect.value?.length || 0) > 1) {\n <span>\n (+{{(channelsSelect.value?.length || 0) - 1}} {{channelsSelect.value?.length === 2 ? 'other' : 'others'}})\n </span>\n }\n </mat-select-trigger>\n <mat-option value=\"allChannels\">\n All Channels\n </mat-option>\n @for (channel of channels; track channel) {\n <mat-option [value]=\"channel\">\n {{ channel }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n }\n @if ((users$ | async); as users) {\n <mat-form-field style=\"flex:1\" appearance=\"outline\">\n <mat-label>Users</mat-label>\n <mat-select formControlName=\"toUsers\" multiple #userSelect>\n <mat-select-trigger>\n {{ (userSelect.value?.[0] === 'allUsers' ? 'All Users' : userSelect.value?.[0]?.content?.name) || '' }}\n @if ((userSelect.value?.length || 0) > 1) {\n <span>\n (+{{(userSelect.value?.length || 0) - 1}} {{userSelect.value?.length === 2 ? 'other' : 'others'}})\n </span>\n }\n </mat-select-trigger>\n <mat-option value=\"allChannels\">\n All Users\n </mat-option>\n @for (user of users; track user) {\n <mat-option [value]=\"user\">\n {{ user.content.name }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n }\n </div>\n\n @if ((users$ | async); as users) {\n <div style=\"display:flex\">\n <mat-form-field style=\"flex:1\" appearance=\"outline\">\n <mat-label>Send a Message</mat-label>\n <textarea\n matInput placeholder=\"Ex. It makes me feel...\"\n formControlName=\"content\"\n (keydown.enter)=\"onSendMessage(user); $event.preventDefault()\"\n [disabled]=\"!isValid\"\n ></textarea>\n </mat-form-field>\n </div>\n }\n\n <div style=\"display:flex; gap: .5rem;\">\n <div style=\"flex:1\"></div>\n <button mat-stroked-button (click)=\"onSendAlert()\" color=\"warn\">\n Send Alert\n </button>\n <button mat-stroked-button (click)=\"onSendMessage(user)\">\n Send Message\n </button>\n </div>\n </div>\n </div>\n @if ((chat$ | async); as chat) {\n <div style=\"border: thin gray solid; padding: 1rem; margin-top: 1rem;\">\n <!-- <app-messenger-chat\n [user]=\"chat.user\"\n [messages]=\"chat.messages\"\n ></app-messenger-chat> -->\n </div>\n }\n </div>\n\n </div>\n </div>\n }\n\n\n {{ channels$ | async | json }}\n", styles: [""], dependencies: [{ kind: "directive", type: i1$2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i2$1.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatLabel, selector: "mat-label" }, { kind: "component", type: i4.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "directive", type: i4.MatSelectTrigger, selector: "mat-select-trigger" }, { kind: "component", type: i5.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "directive", type: i12.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }, { kind: "pipe", type: i1$1.JsonPipe, name: "json" }] }); }
|
|
4915
|
+
}
|
|
4916
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: WsMessagingComponent, decorators: [{
|
|
4917
|
+
type: Component,
|
|
4918
|
+
args: [{ selector: 'app-ws-messaging', standalone: false, template: "\n @if ((data$ | async); as data) {\n <div style=\"margin: 1rem; display: flex; gap: 1rem; flex-direction: column;\">\n <div>\n\n <div>\n <div style=\"display: flex; gap: 1rem\">\n <div style=\"flex:1\" [formGroup]=\"messages\">\n\n <div style=\"display:flex; gap: 1rem\">\n @if ((channels$ | async); as channels) {\n <mat-form-field style=\"flex:1\" appearance=\"outline\">\n <mat-label>Channels</mat-label>\n <mat-select formControlName=\"channels\" multiple #channelsSelect>\n <mat-select-trigger>\n {{ (channelsSelect.value?.[0] === 'allChannels' ? 'All Channels' : channelsSelect.value?.[0]?.content?.name) || '' }}\n @if ((channelsSelect.value?.length || 0) > 1) {\n <span>\n (+{{(channelsSelect.value?.length || 0) - 1}} {{channelsSelect.value?.length === 2 ? 'other' : 'others'}})\n </span>\n }\n </mat-select-trigger>\n <mat-option value=\"allChannels\">\n All Channels\n </mat-option>\n @for (channel of channels; track channel) {\n <mat-option [value]=\"channel\">\n {{ channel }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n }\n @if ((users$ | async); as users) {\n <mat-form-field style=\"flex:1\" appearance=\"outline\">\n <mat-label>Users</mat-label>\n <mat-select formControlName=\"toUsers\" multiple #userSelect>\n <mat-select-trigger>\n {{ (userSelect.value?.[0] === 'allUsers' ? 'All Users' : userSelect.value?.[0]?.content?.name) || '' }}\n @if ((userSelect.value?.length || 0) > 1) {\n <span>\n (+{{(userSelect.value?.length || 0) - 1}} {{userSelect.value?.length === 2 ? 'other' : 'others'}})\n </span>\n }\n </mat-select-trigger>\n <mat-option value=\"allChannels\">\n All Users\n </mat-option>\n @for (user of users; track user) {\n <mat-option [value]=\"user\">\n {{ user.content.name }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n }\n </div>\n\n @if ((users$ | async); as users) {\n <div style=\"display:flex\">\n <mat-form-field style=\"flex:1\" appearance=\"outline\">\n <mat-label>Send a Message</mat-label>\n <textarea\n matInput placeholder=\"Ex. It makes me feel...\"\n formControlName=\"content\"\n (keydown.enter)=\"onSendMessage(user); $event.preventDefault()\"\n [disabled]=\"!isValid\"\n ></textarea>\n </mat-form-field>\n </div>\n }\n\n <div style=\"display:flex; gap: .5rem;\">\n <div style=\"flex:1\"></div>\n <button mat-stroked-button (click)=\"onSendAlert()\" color=\"warn\">\n Send Alert\n </button>\n <button mat-stroked-button (click)=\"onSendMessage(user)\">\n Send Message\n </button>\n </div>\n </div>\n </div>\n @if ((chat$ | async); as chat) {\n <div style=\"border: thin gray solid; padding: 1rem; margin-top: 1rem;\">\n <!-- <app-messenger-chat\n [user]=\"chat.user\"\n [messages]=\"chat.messages\"\n ></app-messenger-chat> -->\n </div>\n }\n </div>\n\n </div>\n </div>\n }\n\n\n {{ channels$ | async | json }}\n" }]
|
|
4919
|
+
}], propDecorators: { server: [{
|
|
4920
|
+
type: Input
|
|
4921
|
+
}], wsServer: [{
|
|
4922
|
+
type: Input
|
|
4923
|
+
}], jwtToken: [{
|
|
4924
|
+
type: Input
|
|
4925
|
+
}], user: [{
|
|
4926
|
+
type: Input
|
|
4927
|
+
}] } });
|
|
4928
|
+
|
|
4921
4929
|
// import { MessengerChatModule } from 'src/app/components/messenger-chat/messenger-chat.module';
|
|
4922
4930
|
// import { StoreStateManagerModule } from "src/app/beta_components/store-state-manager/store-state-manager.module";
|
|
4923
4931
|
class HttpRequestManagerModule {
|