Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

UI updates

vlichtenberg2c0cec63dffc
diff --git a/ui/component/or-rules/src/flow-viewer/components/editor-workspace.ts b/ui/component/or-rules/src/flow-viewer/components/editor-workspace.ts
index 41698bfc9..44b9cfa05 100644
--- a/ui/component/or-rules/src/flow-viewer/components/editor-workspace.ts
+++ b/ui/component/or-rules/src/flow-viewer/components/editor-workspace.ts
@@ -76,6 +76,10 @@ export class EditorWorkspace extends translate(i18next)(LitElement) {
this.removeEventListener("mousemove", project.connectionDragging);
});
+ project.addListener("fitview", () => {
+ this.fitCamera(project.nodes);
+ });
+
window.addEventListener("resize", () => {
this.cachedClientRect = this.getBoundingClientRect();
this.dispatchEvent(new CustomEvent("pan"));
diff --git a/ui/component/or-rules/src/flow-viewer/components/flow-editor.ts b/ui/component/or-rules/src/flow-viewer/components/flow-editor.ts
index 43d170c7c..72eeb5a62 100644
--- a/ui/component/or-rules/src/flow-viewer/components/flow-editor.ts
+++ b/ui/component/or-rules/src/flow-viewer/components/flow-editor.ts
@@ -108,6 +108,7 @@ export class FlowEditor extends translate(i18next)(LitElement) implements RuleVi
await integration.refreshNodes();
this.requestUpdate();
await this.updateComplete;
+ project.emit("fitview");
project.addListener("changed", () => {
this.serialiseRule();
this.dispatchEvent(new OrRulesRuleChangedEvent(this.validate()));
diff --git a/ui/component/or-rules/src/or-rule-list.ts b/ui/component/or-rules/src/or-rule-list.ts
index db657bf8d..81e07313a 100644
--- a/ui/component/or-rules/src/or-rule-list.ts
+++ b/ui/component/or-rules/src/or-rule-list.ts
@@ -413,6 +413,7 @@ export class OrRuleList extends translate(i18next)(LitElement) {
})).then((detail) => {
if (detail.allow) {
this.selectedIds = detail.detail.newNodes.map((node) => node.ruleset.id!);
+ this.refresh();
}
});
}
diff --git a/ui/component/or-rules/src/or-rule-viewer.ts b/ui/component/or-rules/src/or-rule-viewer.ts
index dbecc4118..49436e9fb 100644
--- a/ui/component/or-rules/src/or-rule-viewer.ts
+++ b/ui/component/or-rules/src/or-rule-viewer.ts
@@ -20,6 +20,7 @@ import {InputType, OrInputChangedEvent, OrMwcInput} from "@openremote/or-mwc-com
import i18next from "i18next";
import { GenericAxiosResponse } from "@openremote/rest";
import { showErrorDialog } from "@openremote/or-mwc-components/or-mwc-dialog";
+import {project} from "./flow-viewer/components/flow-editor";
// language=CSS
export const style = css`
@@ -232,6 +233,8 @@ export class OrRuleViewer extends translate(i18next)(LitElement) {
return;
}
+ project.emit("fitview");
+
if (this.config && this.config.rulesetSaveHandler && !this.config.rulesetSaveHandler(this.ruleset)) {
return;
}