Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion frontend/webEditor/src/diagram/nodes/annotation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}
Expand Down Expand Up @@ -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";
Expand All @@ -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;
}
Expand Down
2 changes: 2 additions & 0 deletions frontend/webEditor/src/settings/Settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
4 changes: 3 additions & 1 deletion frontend/webEditor/src/settings/SettingsUi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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,
Expand All @@ -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" });
Expand Down
1 change: 1 addition & 0 deletions frontend/webEditor/src/settings/di.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
14 changes: 14 additions & 0 deletions frontend/webEditor/src/startUpAgent/LoadSettings.ts
Original file line number Diff line number Diff line change
@@ -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);
}
}
2 changes: 2 additions & 0 deletions frontend/webEditor/src/startUpAgent/di.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Loading