refactor: Verwende GUID anstelle des Konstruktor-Namens für Button-Sichtbarkeit; Webanwendung im wwwroot aktualisiert
- Ersetzt die Nutzung des Konstruktor-Namens durch eine GUID (`id`) in der `BaseButtonService`-Klasse, um Button-Sichtbarkeitsprobleme zu beheben. - Aktualisiert die `ButtonVisibilityService`-Klasse zur Verwendung der GUIDs zur Identifikation von Buttons. - Webanwendung im `wwwroot`-Verzeichnis auf den neuesten Stand gebracht.
This commit is contained in:
@@ -38,6 +38,7 @@
|
||||
"@types/express": "^4.17.17",
|
||||
"@types/jasmine": "~5.1.0",
|
||||
"@types/node": "^18.18.0",
|
||||
"@types/uuid": "^10.0.0",
|
||||
"jasmine-core": "~5.1.0",
|
||||
"karma": "~6.4.0",
|
||||
"karma-chrome-launcher": "~3.2.0",
|
||||
@@ -4793,6 +4794,12 @@
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/uuid": {
|
||||
"version": "10.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-10.0.0.tgz",
|
||||
"integrity": "sha512-7gqG38EyHgyP1S+7+xomFtL+ZNHcKv6DwNaCZmJmo1vgMugyF3TCnXVg4t1uk89mLNwnLtnY3TpOpCOyp1/xHQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/ws": {
|
||||
"version": "8.5.10",
|
||||
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.10.tgz",
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
"@types/express": "^4.17.17",
|
||||
"@types/jasmine": "~5.1.0",
|
||||
"@types/node": "^18.18.0",
|
||||
"@types/uuid": "^10.0.0",
|
||||
"jasmine-core": "~5.1.0",
|
||||
"karma": "~6.4.0",
|
||||
"karma-chrome-launcher": "~3.2.0",
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
import { Injectable, inject } from "@angular/core";
|
||||
import { ButtonVisibilityService } from "./button-visibility.service";
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
|
||||
export class BaseButtonService {
|
||||
|
||||
readonly id = uuidv4().toString();
|
||||
|
||||
constructor() {
|
||||
const bvService = inject(ButtonVisibilityService);
|
||||
bvService.buttons[this.constructorName] = this;
|
||||
bvService.buttons[this.id] = this;
|
||||
}
|
||||
|
||||
public isVisible: boolean = true;
|
||||
|
||||
public get constructorName() {
|
||||
return this.constructor.name;
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@ export class ButtonVisibilityService {
|
||||
}
|
||||
|
||||
setVisibleOnly(...buttons: BaseButtonService[]) {
|
||||
const keys = buttons.map(b => b.constructorName)
|
||||
const keys = buttons.map(b => b.id)
|
||||
for (const key in this._buttons) {
|
||||
if (keys.includes(key)) {
|
||||
this.setVisibility(key, true)
|
||||
|
||||
Reference in New Issue
Block a user