RulesLoggerPOC
This commit is contained in:
parent
8f541081ae
commit
df64a73adc
@ -24,6 +24,7 @@ import { AuditService } from './services/audit.service';
|
|||||||
import { DigitalSignatureService } from './services/digital-signature.service';
|
import { DigitalSignatureService } from './services/digital-signature.service';
|
||||||
import { RulesService } from './services/rules.service';
|
import { RulesService } from './services/rules.service';
|
||||||
import { SmtpConfigService } from './services/smtp-config.service';
|
import { SmtpConfigService } from './services/smtp-config.service';
|
||||||
|
import { RulesLoggerService } from '@services/rules-logger.service';
|
||||||
|
|
||||||
const entityRoutes: IqserRoutes = [
|
const entityRoutes: IqserRoutes = [
|
||||||
{
|
{
|
||||||
@ -95,6 +96,19 @@ const dossierTemplateIdRoutes: IqserRoutes = [
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
provide: ENVIRONMENT_INITIALIZER,
|
||||||
|
multi: true,
|
||||||
|
useFactory: () => {
|
||||||
|
const service = inject(RulesLoggerService);
|
||||||
|
return () => {
|
||||||
|
setTimeout(() => {
|
||||||
|
service.connect('/api/rules-logging/rulesocket');
|
||||||
|
console.log('Rules logger ready');
|
||||||
|
}, 2000);
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -85,3 +85,5 @@
|
|||||||
<div (click)="revert()" [translate]="translations[type()]['revert-changes']" class="all-caps-label cancel"></div>
|
<div (click)="revert()" [translate]="translations[type()]['revert-changes']" class="all-caps-label cancel"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<redaction-rules-logger></redaction-rules-logger>
|
||||||
|
|||||||
@ -24,6 +24,7 @@ import { rulesScreenTranslations } from '../../../translations/rules-screen-tran
|
|||||||
import ICodeEditor = monaco.editor.ICodeEditor;
|
import ICodeEditor = monaco.editor.ICodeEditor;
|
||||||
import IModelDeltaDecoration = monaco.editor.IModelDeltaDecoration;
|
import IModelDeltaDecoration = monaco.editor.IModelDeltaDecoration;
|
||||||
import IStandaloneEditorConstructionOptions = monaco.editor.IStandaloneEditorConstructionOptions;
|
import IStandaloneEditorConstructionOptions = monaco.editor.IStandaloneEditorConstructionOptions;
|
||||||
|
import { RulesLoggerComponent } from '@components/rules-logger/rules-logger.component';
|
||||||
|
|
||||||
interface SyntaxError {
|
interface SyntaxError {
|
||||||
line: number;
|
line: number;
|
||||||
@ -60,6 +61,7 @@ const RULE_VALIDATION_TIMEOUT = 2000;
|
|||||||
NamePipe,
|
NamePipe,
|
||||||
NgForOf,
|
NgForOf,
|
||||||
MatTooltip,
|
MatTooltip,
|
||||||
|
RulesLoggerComponent,
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export default class RulesScreenComponent implements OnInit, ComponentCanDeactivate {
|
export default class RulesScreenComponent implements OnInit, ComponentCanDeactivate {
|
||||||
|
|||||||
@ -8,3 +8,5 @@
|
|||||||
></ngx-monaco-editor>
|
></ngx-monaco-editor>
|
||||||
|
|
||||||
<ngx-monaco-diff-editor (init)="onDiffEditorInit($event)" *ngIf="showDiffEditor" [options]="editorOptions"></ngx-monaco-diff-editor>
|
<ngx-monaco-diff-editor (init)="onDiffEditorInit($event)" *ngIf="showDiffEditor" [options]="editorOptions"></ngx-monaco-diff-editor>
|
||||||
|
|
||||||
|
<redaction-rules-logger></redaction-rules-logger>
|
||||||
|
|||||||
@ -14,6 +14,7 @@ import ICodeEditor = monaco.editor.ICodeEditor;
|
|||||||
import IModelDeltaDecoration = monaco.editor.IModelDeltaDecoration;
|
import IModelDeltaDecoration = monaco.editor.IModelDeltaDecoration;
|
||||||
import ILineChange = monaco.editor.ILineChange;
|
import ILineChange = monaco.editor.ILineChange;
|
||||||
import IEditorMouseEvent = monaco.editor.IEditorMouseEvent;
|
import IEditorMouseEvent = monaco.editor.IEditorMouseEvent;
|
||||||
|
import { RulesLoggerComponent } from '@components/rules-logger/rules-logger.component';
|
||||||
|
|
||||||
const MIN_WORD_LENGTH = 2;
|
const MIN_WORD_LENGTH = 2;
|
||||||
const lineChangeToDecoration = ({ originalEndLineNumber, originalStartLineNumber }: ILineChange) =>
|
const lineChangeToDecoration = ({ originalEndLineNumber, originalStartLineNumber }: ILineChange) =>
|
||||||
@ -32,7 +33,7 @@ const notZero = (lineChange: ILineChange) => lineChange.originalEndLineNumber !=
|
|||||||
templateUrl: './editor.component.html',
|
templateUrl: './editor.component.html',
|
||||||
styleUrls: ['./editor.component.scss'],
|
styleUrls: ['./editor.component.scss'],
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [MonacoEditorModule, FormsModule, NgIf],
|
imports: [MonacoEditorModule, FormsModule, NgIf, RulesLoggerComponent],
|
||||||
})
|
})
|
||||||
export class EditorComponent implements OnInit, OnChanges {
|
export class EditorComponent implements OnInit, OnChanges {
|
||||||
@Input() showDiffEditor = false;
|
@Input() showDiffEditor = false;
|
||||||
|
|||||||
11
apps/red-ui/src/app/services/rules-logger.service.ts
Normal file
11
apps/red-ui/src/app/services/rules-logger.service.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import { WebSocketService } from '@services/web-socket.service';
|
||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root',
|
||||||
|
})
|
||||||
|
export class RulesLoggerService extends WebSocketService {
|
||||||
|
get topicPrefix(): string {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -19,6 +19,8 @@ export class WebSocketService extends RxStomp {
|
|||||||
readonly #tenantService = inject(TenantsService);
|
readonly #tenantService = inject(TenantsService);
|
||||||
readonly #destroyRef = inject(DestroyRef);
|
readonly #destroyRef = inject(DestroyRef);
|
||||||
|
|
||||||
|
url: string;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
@ -46,16 +48,11 @@ export class WebSocketService extends RxStomp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
connect(url: string) {
|
connect(url: string) {
|
||||||
const headers = { Authorization: 'Bearer ' + localStorage.getItem('token') };
|
this.url = url;
|
||||||
console.log(headers);
|
this.configureConnection();
|
||||||
this.configure({
|
|
||||||
debug: (msg: string) => this.#logger.debug(msg),
|
|
||||||
brokerURL: this.#config.API_URL + url,
|
|
||||||
connectHeaders: headers,
|
|
||||||
});
|
|
||||||
|
|
||||||
this.connectionState$.pipe(log('[WS] Connection state')).subscribe();
|
this.connectionState$.pipe(log('[WS] Connection state')).subscribe();
|
||||||
this.webSocketErrors$.pipe(log('[WS] Errors')).subscribe();
|
this.webSocketErrors$.pipe(log('[WS] Errors')).subscribe(frame => this.configureConnection());
|
||||||
this.stompErrors$
|
this.stompErrors$
|
||||||
.pipe(
|
.pipe(
|
||||||
tap(frame => {
|
tap(frame => {
|
||||||
@ -69,4 +66,14 @@ export class WebSocketService extends RxStomp {
|
|||||||
|
|
||||||
this.activate();
|
this.activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private configureConnection() {
|
||||||
|
const headers = { Authorization: 'Bearer ' + localStorage.getItem('token') };
|
||||||
|
console.log(headers);
|
||||||
|
this.configure({
|
||||||
|
debug: (msg: string) => this.#logger.debug(msg),
|
||||||
|
brokerURL: this.#config.API_URL + this.url,
|
||||||
|
connectHeaders: headers,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"ADMIN_CONTACT_NAME": null,
|
"ADMIN_CONTACT_NAME": null,
|
||||||
"ADMIN_CONTACT_URL": null,
|
"ADMIN_CONTACT_URL": null,
|
||||||
"API_URL": "https://dan1.iqser.cloud",
|
"API_URL": "https://dom1.iqser.cloud",
|
||||||
"APP_NAME": "RedactManager",
|
"APP_NAME": "RedactManager",
|
||||||
"IS_DOCUMINE": false,
|
"IS_DOCUMINE": false,
|
||||||
"RULE_EDITOR_DEV_ONLY": false,
|
"RULE_EDITOR_DEV_ONLY": false,
|
||||||
@ -13,7 +13,7 @@
|
|||||||
"MAX_RETRIES_ON_SERVER_ERROR": 3,
|
"MAX_RETRIES_ON_SERVER_ERROR": 3,
|
||||||
"OAUTH_CLIENT_ID": "redaction",
|
"OAUTH_CLIENT_ID": "redaction",
|
||||||
"OAUTH_IDP_HINT": null,
|
"OAUTH_IDP_HINT": null,
|
||||||
"OAUTH_URL": "https://dan1.iqser.cloud/auth",
|
"OAUTH_URL": "https://dom1.iqser.cloud/auth",
|
||||||
"RECENT_PERIOD_IN_HOURS": 24,
|
"RECENT_PERIOD_IN_HOURS": 24,
|
||||||
"SELECTION_MODE": "structural",
|
"SELECTION_MODE": "structural",
|
||||||
"MANUAL_BASE_URL": "https://docs.redactmanager.com/preview",
|
"MANUAL_BASE_URL": "https://docs.redactmanager.com/preview",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user