diff --git a/frontend/webEditor/src/diagram/nodes/annotation.ts b/frontend/webEditor/src/diagram/nodes/annotation.ts index 0204952a..3d04cbae 100644 --- a/frontend/webEditor/src/diagram/nodes/annotation.ts +++ b/frontend/webEditor/src/diagram/nodes/annotation.ts @@ -13,7 +13,7 @@ import { Action } from "sprotty-protocol"; import { DfdNodeImpl } from "./common"; import "./nodeAnnotationUi.css"; import { ShownLabels, ShownLabelsValue } from "../../settings/ShownLabels"; -import { SETTINGS } from "../../settings/Settings"; +import { HideNoErrorsLabel, SETTINGS } from "../../settings/Settings"; export class DfdNodeAnnotationUIMouseListener extends MouseListener { private stillTimeout: number | undefined; @@ -107,6 +107,7 @@ export class DfdNodeAnnotationUI extends AbstractUIExtension { @inject(DfdNodeAnnotationUIMouseListener) private readonly mouseListener: DfdNodeAnnotationUIMouseListener, @inject(SETTINGS.ShownLabels) private shownLabels: ShownLabelsValue, + @inject(SETTINGS.HideNoErrorsLabel) private hideNoErrorsLabel: HideNoErrorsLabel, ) { super(); } @@ -160,6 +161,7 @@ export class DfdNodeAnnotationUI extends AbstractUIExtension { containerElement.style.top = `${annotationPosition.y}px`; // Set tooltip size and scroll to prevent them from growing out of the screen + containerElement.style.display = "unset"; containerElement.style.overflowY = "auto"; this.annotationParagraph.style.whiteSpace = "normal"; this.annotationParagraph.style.wordBreak = "break-word"; @@ -170,6 +172,9 @@ export class DfdNodeAnnotationUI extends AbstractUIExtension { // Set content if (!node.annotations || node.annotations.length == 0) { + if (this.hideNoErrorsLabel.get()) { + containerElement.style.display = "none"; + } this.annotationParagraph.innerText = "No errors"; return; } diff --git a/frontend/webEditor/src/settings/Settings.ts b/frontend/webEditor/src/settings/Settings.ts index 32d3a1af..7ad0c790 100644 --- a/frontend/webEditor/src/settings/Settings.ts +++ b/frontend/webEditor/src/settings/Settings.ts @@ -7,7 +7,9 @@ export const SETTINGS = { SimplifyNodeNames: Symbol("SimplifyNodeNames"), ShownLabels: Symbol("ShownLabels"), BackEndURL: Symbol("BackEndURL"), + HideNoErrorsLabel: Symbol("HideNoErrorsLabel"), }; export type SimplifyNodeNames = BoolSettingsValue; export type HideEdgeNames = BoolSettingsValue; +export type HideNoErrorsLabel = BoolSettingsValue; diff --git a/frontend/webEditor/src/settings/SettingsUi.ts b/frontend/webEditor/src/settings/SettingsUi.ts index 74713fa8..0ed3f76e 100644 --- a/frontend/webEditor/src/settings/SettingsUi.ts +++ b/frontend/webEditor/src/settings/SettingsUi.ts @@ -2,7 +2,7 @@ import { inject, injectable } from "inversify"; import "./settingsUi.css"; import { SettingsValue } from "./SettingsValue"; import { AccordionUiExtension } from "../accordionUiExtension"; -import { HideEdgeNames, SETTINGS, SimplifyNodeNames } from "./Settings"; +import { HideEdgeNames, HideNoErrorsLabel, SETTINGS, SimplifyNodeNames } from "./Settings"; import { EditorModeController } from "./editorMode"; import { Theme, ThemeManager } from "./Theme"; import { ShownLabels, ShownLabelsValue } from "./ShownLabels"; @@ -15,6 +15,7 @@ export class SettingsUI extends AccordionUiExtension { constructor( @inject(SETTINGS.Theme) private readonly themeManager: ThemeManager, @inject(SETTINGS.ShownLabels) private readonly shownLabels: ShownLabelsValue, + @inject(SETTINGS.HideNoErrorsLabel) private readonly hideNoErrorsLabel: HideNoErrorsLabel, @inject(SETTINGS.HideEdgeNames) private readonly hideEdgeNames: HideEdgeNames, @inject(SETTINGS.SimplifyNodeNames) private readonly simplifyNodeNames: SimplifyNodeNames, @inject(SETTINGS.Mode) private readonly editorModeController: EditorModeController, @@ -41,6 +42,7 @@ export class SettingsUI extends AccordionUiExtension { ShownLabels.OUTGOING, ShownLabels.ALL, ]); + this.addBooleanSwitch(grid, "Hide No Errors Label", this.hideNoErrorsLabel); this.addBooleanSwitch(grid, "Hide Edge Names", this.hideEdgeNames); this.addBooleanSwitch(grid, "Simplify Node Names", this.simplifyNodeNames); this.addSwitch(grid, "Read Only", this.editorModeController, { true: "view", false: "edit" }); diff --git a/frontend/webEditor/src/settings/di.config.ts b/frontend/webEditor/src/settings/di.config.ts index a10e86e4..d9e961f3 100644 --- a/frontend/webEditor/src/settings/di.config.ts +++ b/frontend/webEditor/src/settings/di.config.ts @@ -20,6 +20,7 @@ export const settingsModule = new ContainerModule((bind, _, isBound) => { bind(SETTINGS.SimplifyNodeNames).to(BoolSettingsValue).inSingletonScope(); bind(SETTINGS.Mode).to(EditorModeController).inSingletonScope(); bind(SETTINGS.ShownLabels).to(ShownLabelsValue).inSingletonScope(); + bind(SETTINGS.HideNoErrorsLabel).to(BoolSettingsValue).inSingletonScope(); const context = { bind, isBound }; configureCommand(context, HideEdgeNamesCommand); diff --git a/frontend/webEditor/src/startUpAgent/LoadSettings.ts b/frontend/webEditor/src/startUpAgent/LoadSettings.ts new file mode 100644 index 00000000..b8d9e924 --- /dev/null +++ b/frontend/webEditor/src/startUpAgent/LoadSettings.ts @@ -0,0 +1,14 @@ +import { inject, injectable } from "inversify"; +import { IStartUpAgent } from "./StartUpAgent"; +import { HideNoErrorsLabel, SETTINGS } from "../settings/Settings"; + +@injectable() +export class LoadSettingsStartUpAgent implements IStartUpAgent { + constructor(@inject(SETTINGS.HideNoErrorsLabel) private readonly hideNoErrorsLabel: HideNoErrorsLabel) {} + + public run() { + const hideNoErrorsLabelValue = new URLSearchParams(window.location.search).get("hideNoErrorsLabel") === "true"; + + this.hideNoErrorsLabel.set(hideNoErrorsLabelValue); + } +} diff --git a/frontend/webEditor/src/startUpAgent/di.config.ts b/frontend/webEditor/src/startUpAgent/di.config.ts index fd3434ea..478ce581 100644 --- a/frontend/webEditor/src/startUpAgent/di.config.ts +++ b/frontend/webEditor/src/startUpAgent/di.config.ts @@ -5,11 +5,13 @@ import { LoadDefaultDiagramStartUpAgent } from "./LoadDefaultDiagram"; import { SettingsInitStartUpAgent } from "./settingsInit"; import { FocusContainerCommand, FocusContainerStartUpAgent } from "./FocusContainer"; import { configureCommand } from "sprotty"; +import { LoadSettingsStartUpAgent } from "./LoadSettings"; export const startUpAgentModule = new ContainerModule((bind, _, isBound) => { bind(StartUpAgent).to(LoadDefaultUiExtensionsStartUpAgent); bind(StartUpAgent).to(LoadDefaultDiagramStartUpAgent); bind(StartUpAgent).to(SettingsInitStartUpAgent); bind(StartUpAgent).to(FocusContainerStartUpAgent); + bind(StartUpAgent).to(LoadSettingsStartUpAgent); configureCommand({ bind, isBound }, FocusContainerCommand); });