From d02bc68c7bf5c14cee3a72ee538b17222116017c Mon Sep 17 00:00:00 2001 From: okoyzar Date: Thu, 10 Oct 2024 13:30:39 +0100 Subject: [PATCH 1/2] Static Diagrams Admin Page - added getById to SvgDiagramEndpoint - Created page in system admin to view and edit static diagrams - Route to static diagram page via ID - capability to add and delete new static diagram - filled in help blocks (add help for where to find magic group names) #7155 #CTCTOWALTZ-3382 --- waltz-ng/client/common/svelte/ViewLink.svelte | 12 ++ .../client/svelte-stores/svg-diagram-store.js | 8 + waltz-ng/client/system/routes.js | 13 ++ .../client/system/static-diagram-view.html | 21 ++ waltz-ng/client/system/static-diagram-view.js | 42 ++++ .../client/system/static-diagrams-view.html | 19 ++ .../client/system/static-diagrams-view.js | 39 ++++ .../static-diagrams/StaticDiagram.svelte | 196 ++++++++++++++++++ .../StaticDiagramsAdminView.svelte | 96 +++++++++ waltz-ng/client/system/system-admin-list.js | 6 + .../waltz/service/svg/SvgDiagramService.java | 1 + .../web/endpoints/api/SvgDiagramEndpoint.java | 10 +- 12 files changed, 460 insertions(+), 3 deletions(-) create mode 100644 waltz-ng/client/system/static-diagram-view.html create mode 100644 waltz-ng/client/system/static-diagram-view.js create mode 100644 waltz-ng/client/system/static-diagrams-view.html create mode 100644 waltz-ng/client/system/static-diagrams-view.js create mode 100644 waltz-ng/client/system/svelte/static-diagrams/StaticDiagram.svelte create mode 100644 waltz-ng/client/system/svelte/static-diagrams/StaticDiagramsAdminView.svelte diff --git a/waltz-ng/client/common/svelte/ViewLink.svelte b/waltz-ng/client/common/svelte/ViewLink.svelte index 024eab1b45..fb809d375e 100644 --- a/waltz-ng/client/common/svelte/ViewLink.svelte +++ b/waltz-ng/client/common/svelte/ViewLink.svelte @@ -125,6 +125,18 @@ path: ctx => `server/${ctx.id}`, title: "Server View" }, + "main.system.static-diagrams": { + path: () => `system/static-diagrams`, + title: "Static Diagrams" + }, + "main.system.static-diagram": { + path: () => `system/static-diagrams/${ctx.id}`, + title: "" + }, + "main.system.static-diagram.create": { + path: ctx => `system/static-diagram/create`, + title: "Static Diagram Create" + }, "main.survey.instance.view": { path: ctx => `survey/instance/${ctx.id}/response/view`, title: "Survey View" diff --git a/waltz-ng/client/svelte-stores/svg-diagram-store.js b/waltz-ng/client/svelte-stores/svg-diagram-store.js index 9fb3ece9b0..2a2230b976 100644 --- a/waltz-ng/client/svelte-stores/svg-diagram-store.js +++ b/waltz-ng/client/svelte-stores/svg-diagram-store.js @@ -10,6 +10,13 @@ export function mkSvgDiagramStore() { [], {force}); + const getById = (diagramId, force) => remote + .fetchAppList( + "GET", + `api/svg-diagram/${diagramId}`, + [], + {force}); + const save = (diagram) => remote .execute( "POST", @@ -23,6 +30,7 @@ export function mkSvgDiagramStore() { return { findAll, + getById, save, remove }; diff --git a/waltz-ng/client/system/routes.js b/waltz-ng/client/system/routes.js index a9bcfe8dd6..7e8655c9ea 100644 --- a/waltz-ng/client/system/routes.js +++ b/waltz-ng/client/system/routes.js @@ -27,6 +27,8 @@ import RecalculateView from "./recalculate-view"; import ActorsView from "./actors-view"; import EntityNamedNoteTypesView from "./entity-named-node-types-view"; import StaticPanelsView from "./static-panels-view"; +import StaticDiagramsView from "./static-diagrams-view"; +import StaticDiagramView from "./static-diagram-view"; import AssessmentDefinitionsView from "./assessment-defintions-view"; import RatingSchemesView from "./rating-schemes-view"; import EudaListView from "./euda-list-view"; @@ -102,6 +104,15 @@ const staticPanelsState = { views: {"content@": StaticPanelsView} }; +const staticDiagramsState = { + url: "/static-diagrams", + views: {"content@": StaticDiagramsView} +} + +const staticDiagramState = { + url: "/static-diagrams/{id:int}", + views: {"content@": StaticDiagramView} +} const assessmentDefintionsState = { url: "/assessment-definitions", @@ -214,6 +225,8 @@ function setupRoutes($stateProvider) { .state("main.system.recalculate", recalculateState) .state("main.system.relationship-kinds", relationshipKindsState) .state("main.system.settings", settingsState) + .state("main.system.static-diagrams", staticDiagramsState) + .state("main.system.static-diagram", staticDiagramState) .state("main.system.static-panels", staticPanelsState) .state("main.system.version-info", versionInfoState); } diff --git a/waltz-ng/client/system/static-diagram-view.html b/waltz-ng/client/system/static-diagram-view.html new file mode 100644 index 0000000000..638c2a5daf --- /dev/null +++ b/waltz-ng/client/system/static-diagram-view.html @@ -0,0 +1,21 @@ + + + + + diff --git a/waltz-ng/client/system/static-diagram-view.js b/waltz-ng/client/system/static-diagram-view.js new file mode 100644 index 0000000000..bbbc8ef2a7 --- /dev/null +++ b/waltz-ng/client/system/static-diagram-view.js @@ -0,0 +1,42 @@ +/* + * Waltz - Enterprise Architecture + * Copyright (C) 2016, 2017, 2018, 2019 Waltz open source project + * See README.md for more information + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific + * + */ +import template from './static-diagram-view.html'; + +import StaticDiagram from "./svelte/static-diagrams/StaticDiagram.svelte" +import {initialiseData} from '../common'; + +const initialState = { + StaticDiagram +}; + +function controller($stateParams) { + const vm = initialiseData(this, initialState); + + vm.diagramId = $stateParams.id; +} + +controller.$inject = ["$stateParams"]; + +const page = { + controller, + template, + controllerAs: '$ctrl' +}; + + +export default page; \ No newline at end of file diff --git a/waltz-ng/client/system/static-diagrams-view.html b/waltz-ng/client/system/static-diagrams-view.html new file mode 100644 index 0000000000..939b8c72c9 --- /dev/null +++ b/waltz-ng/client/system/static-diagrams-view.html @@ -0,0 +1,19 @@ + + + diff --git a/waltz-ng/client/system/static-diagrams-view.js b/waltz-ng/client/system/static-diagrams-view.js new file mode 100644 index 0000000000..d9ab28d661 --- /dev/null +++ b/waltz-ng/client/system/static-diagrams-view.js @@ -0,0 +1,39 @@ +/* + * Waltz - Enterprise Architecture + * Copyright (C) 2016, 2017, 2018, 2019 Waltz open source project + * See README.md for more information + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific + * + */ +import template from './static-diagrams-view.html'; + +import StaticDiagramsAdminView from "./svelte/static-diagrams/StaticDiagramsAdminView.svelte" +import {initialiseData} from '../common'; + + +const initialState = { + StaticDiagramsAdminView +}; + + +function controller() { + initialiseData(this, initialState); +} + +const page = { + controller, + template, + controllerAs: '$ctrl' +}; + +export default page; \ No newline at end of file diff --git a/waltz-ng/client/system/svelte/static-diagrams/StaticDiagram.svelte b/waltz-ng/client/system/svelte/static-diagrams/StaticDiagram.svelte new file mode 100644 index 0000000000..f4b1fb58f5 --- /dev/null +++ b/waltz-ng/client/system/svelte/static-diagrams/StaticDiagram.svelte @@ -0,0 +1,196 @@ + + + + +
+
    +
  1. Home
  2. +
  3. System Admin
  4. +
  5. Static Diagrams
  6. +
  7. {diagram ? diagram.name : ""}
  8. +
+
+
+ +
+
+
+ + {#if diagram} +
+
+
+
+ +
+ +
+ Group determines what screen the diagram will appear. Some example naming conventions include +
    +
  • DATA_TYPE to appear on the Data screen
  • +
  • ORG_TREE to appear on the People screen
  • +
  • ORG_UNIT to appear on the Org Units screen
  • +
  • NAVAID.MEASURABLE.id to appear on one of the measurable screens, where id denotes the category (which can be found in the url of the category)
  • +
+
+
+
+
+
+ +
+ +
Description of this diagram
+
+
+
+
+
+
+ +
+ +
Short name that describes this diagram
+
+
+
+
+
+
+ +
+ +
If multiple diagrams belong to the same group, priority will be used to order them (ascending, where 1 is the highest priority)
+
+
+
+
+
+
+ +
+ +
HTML or SVG code, any paths will be resolved against the context root of this waltz installation, e.g., /waltz
+
+
+
+ + + +
+ {:else} +

not found

+ {/if} +
+
+
+ + diff --git a/waltz-ng/client/system/svelte/static-diagrams/StaticDiagramsAdminView.svelte b/waltz-ng/client/system/svelte/static-diagrams/StaticDiagramsAdminView.svelte new file mode 100644 index 0000000000..a0aea178fc --- /dev/null +++ b/waltz-ng/client/system/svelte/static-diagrams/StaticDiagramsAdminView.svelte @@ -0,0 +1,96 @@ + + + + +
+
    +
  1. Home
  2. +
  3. System Admin
  4. +
  5. Static Diagrams
  6. +
+
+
+ + +
+
+
+ + +
+ + + + + + + + + {#each visibleDiagrams as diagram} + + + + + + {/each} + + + + + + +
GroupDiagram Name
+ + {diagram.group} + + + {diagram.name} + + +
+ + + Add new + +
+
+
+
\ No newline at end of file diff --git a/waltz-ng/client/system/system-admin-list.js b/waltz-ng/client/system/system-admin-list.js index ad726839a1..1390243146 100644 --- a/waltz-ng/client/system/system-admin-list.js +++ b/waltz-ng/client/system/system-admin-list.js @@ -128,6 +128,12 @@ const referenceDataOptions= [ description: "View and edit relationship kinds", state: "main.system.relationship-kinds", icon: "link" + }, { + name: "Static Diagrams", + role: "ADMIN", + description: "View and edit static diagrams", + state: "main.system.static-diagrams", + icon: "picture-o" }, { name: "Static Panels", role: "ADMIN", diff --git a/waltz-service/src/main/java/org/finos/waltz/service/svg/SvgDiagramService.java b/waltz-service/src/main/java/org/finos/waltz/service/svg/SvgDiagramService.java index 65a45d27c4..312cb0ef85 100644 --- a/waltz-service/src/main/java/org/finos/waltz/service/svg/SvgDiagramService.java +++ b/waltz-service/src/main/java/org/finos/waltz/service/svg/SvgDiagramService.java @@ -101,4 +101,5 @@ public Boolean remove(long id) { public Boolean save(SvgDiagram diagram) { return svgDiagramDao.save(diagram); } + } \ No newline at end of file diff --git a/waltz-web/src/main/java/org/finos/waltz/web/endpoints/api/SvgDiagramEndpoint.java b/waltz-web/src/main/java/org/finos/waltz/web/endpoints/api/SvgDiagramEndpoint.java index 7323e5a623..29953be06f 100644 --- a/waltz-web/src/main/java/org/finos/waltz/web/endpoints/api/SvgDiagramEndpoint.java +++ b/waltz-web/src/main/java/org/finos/waltz/web/endpoints/api/SvgDiagramEndpoint.java @@ -32,9 +32,7 @@ import static org.finos.waltz.web.WebUtilities.mkPath; import static org.finos.waltz.web.WebUtilities.readBody; import static org.finos.waltz.web.WebUtilities.requireRole; -import static org.finos.waltz.web.endpoints.EndpointUtilities.deleteForDatum; -import static org.finos.waltz.web.endpoints.EndpointUtilities.getForList; -import static org.finos.waltz.web.endpoints.EndpointUtilities.postForDatum; +import static org.finos.waltz.web.endpoints.EndpointUtilities.*; @Service @@ -57,6 +55,7 @@ public SvgDiagramEndpoint(SvgDiagramService svgDiagramService, @Override public void register() { String findAllPath = mkPath(BASE_URL); + String getById = mkPath(BASE_URL, ":id"); String removePath = mkPath(BASE_URL, ":id"); String savePath = mkPath(BASE_URL, "save"); String findByGroupsPath = mkPath(BASE_URL, "group"); @@ -67,6 +66,10 @@ public void register() { ListRoute findAllRoute = (request, response) -> svgDiagramService.findAll(); + DatumRoute getByIdRoute = (request, response) -> { + return svgDiagramService.getById(getId(request)); + }; + DatumRoute removeRoute = (request, response) -> { requireRole(userRoleService, request, SystemRole.ADMIN); return svgDiagramService.remove(getId(request)); @@ -79,6 +82,7 @@ public void register() { getForList(findByGroupsPath, findByGroupsRoute); getForList(findAllPath, findAllRoute); + getForDatum(getById, getByIdRoute); deleteForDatum(removePath, removeRoute); postForDatum(savePath, saveRoute); } From ad71e592393d1fcc840b3d5d08981c7c8fc52f22 Mon Sep 17 00:00:00 2001 From: okoyzar Date: Thu, 10 Oct 2024 13:40:10 +0100 Subject: [PATCH 2/2] Static Diagrams Admin Page - Viewlink ammend #7155 --- waltz-ng/client/common/svelte/ViewLink.svelte | 4 ---- 1 file changed, 4 deletions(-) diff --git a/waltz-ng/client/common/svelte/ViewLink.svelte b/waltz-ng/client/common/svelte/ViewLink.svelte index fb809d375e..f242d7f338 100644 --- a/waltz-ng/client/common/svelte/ViewLink.svelte +++ b/waltz-ng/client/common/svelte/ViewLink.svelte @@ -133,10 +133,6 @@ path: () => `system/static-diagrams/${ctx.id}`, title: "" }, - "main.system.static-diagram.create": { - path: ctx => `system/static-diagram/create`, - title: "Static Diagram Create" - }, "main.survey.instance.view": { path: ctx => `survey/instance/${ctx.id}/response/view`, title: "Survey View"