From 3dc030c2f3ff3ffea7ae9971c6793ceb0390c0c3 Mon Sep 17 00:00:00 2001 From: "david.watkins@db.com" Date: Wed, 17 Jan 2024 16:18:06 +0000 Subject: [PATCH 1/4] Allow rating scheme items to mandate comments - updated the DDL #CTCTOWALTZ-2827 #6708 --- .../resources/liquibase/db.changelog-1.57.xml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/waltz-schema/src/main/resources/liquibase/db.changelog-1.57.xml b/waltz-schema/src/main/resources/liquibase/db.changelog-1.57.xml index 230636f9c0..da209f914c 100644 --- a/waltz-schema/src/main/resources/liquibase/db.changelog-1.57.xml +++ b/waltz-schema/src/main/resources/liquibase/db.changelog-1.57.xml @@ -69,4 +69,20 @@ tableName="software_version" /> + + + 6708: Allow assessments to require mandatory comments + + + + + + + + From a92d8b74a27a37e549d8b5c1ce7f91a8823a8655 Mon Sep 17 00:00:00 2001 From: "david.watkins@db.com" Date: Wed, 17 Jan 2024 16:22:02 +0000 Subject: [PATCH 2/4] Allow rating scheme items to mandate comments - updated model and dao #CTCTOWALTZ-2827 #6708 --- .../finos/waltz/data/rating_scheme/RatingSchemeDAO.java | 8 +++++--- .../org/finos/waltz/model/rating/RatingSchemeItem.java | 5 +++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/waltz-data/src/main/java/org/finos/waltz/data/rating_scheme/RatingSchemeDAO.java b/waltz-data/src/main/java/org/finos/waltz/data/rating_scheme/RatingSchemeDAO.java index 1cfa3916ab..69d78da596 100644 --- a/waltz-data/src/main/java/org/finos/waltz/data/rating_scheme/RatingSchemeDAO.java +++ b/waltz-data/src/main/java/org/finos/waltz/data/rating_scheme/RatingSchemeDAO.java @@ -71,7 +71,8 @@ public class RatingSchemeDAO { RatingSchemeItemRecord r = record.into(RATING_SCHEME_ITEM); - ImmutableRatingSchemeItem.Builder builder = ImmutableRatingSchemeItem.builder() + ImmutableRatingSchemeItem.Builder builder = ImmutableRatingSchemeItem + .builder() .id(r.getId()) .ratingSchemeId(r.getSchemeId()) .name(r.getName()) @@ -81,7 +82,8 @@ public class RatingSchemeDAO { .position(r.getPosition()) .description(r.getDescription()) .externalId(ofNullable(r.getExternalId())) - .ratingGroup(r.getRatingGroup()); + .ratingGroup(r.getRatingGroup()) + .requiresComment(r.getRequiresComment()); if (record.field(IS_RESTRICTED_FIELD) != null){ @@ -237,6 +239,7 @@ public Long saveRatingItem(long schemeId, r.setPosition(item.position()); r.setUserSelectable(item.userSelectable()); r.setRatingGroup(item.ratingGroup()); + r.setRequiresComment(item.requiresComment()); item.externalId().ifPresent(r::setExternalId); @@ -324,5 +327,4 @@ public List calcRatingUsageStats() { .build()); } - } diff --git a/waltz-model/src/main/java/org/finos/waltz/model/rating/RatingSchemeItem.java b/waltz-model/src/main/java/org/finos/waltz/model/rating/RatingSchemeItem.java index 197d1ec43d..8cfcb81aa6 100644 --- a/waltz-model/src/main/java/org/finos/waltz/model/rating/RatingSchemeItem.java +++ b/waltz-model/src/main/java/org/finos/waltz/model/rating/RatingSchemeItem.java @@ -51,4 +51,9 @@ public boolean userSelectable() { @Nullable public abstract String ratingGroup(); + @Value.Default + public boolean requiresComment() { + return false; + } + } From 1fbeaf0cc44c9ccce5da8ead844f70b0093b41b8 Mon Sep 17 00:00:00 2001 From: "david.watkins@db.com" Date: Wed, 17 Jan 2024 17:08:19 +0000 Subject: [PATCH 3/4] Allow rating scheme items to mandate comments - updated admin screens #CTCTOWALTZ-2827 #6708 --- .../svelte/ratings-schemes/ItemEditor.svelte | 21 +++++++++++++++++++ .../svelte/ratings-schemes/ItemsView.svelte | 17 ++++++++++----- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/waltz-ng/client/system/svelte/ratings-schemes/ItemEditor.svelte b/waltz-ng/client/system/svelte/ratings-schemes/ItemEditor.svelte index 3341f1b071..6088ff29df 100644 --- a/waltz-ng/client/system/svelte/ratings-schemes/ItemEditor.svelte +++ b/waltz-ng/client/system/svelte/ratings-schemes/ItemEditor.svelte @@ -145,6 +145,27 @@ + + + + + {#if workingCopy.requiresComment} + Yes, user must supply a comment when selecting this item + + {:else} + No, users may omit providing a comment when selecting this item + + {/if} + +
+ Determines if the user must supply a comment when selecting this item. +
+ +
diff --git a/waltz-ng/client/system/svelte/ratings-schemes/ItemsView.svelte b/waltz-ng/client/system/svelte/ratings-schemes/ItemsView.svelte index ea0b7240d3..b77b27b178 100644 --- a/waltz-ng/client/system/svelte/ratings-schemes/ItemsView.svelte +++ b/waltz-ng/client/system/svelte/ratings-schemes/ItemsView.svelte @@ -97,15 +97,17 @@ {/if} {#if activeMode === Modes.LIST} - +
+ + - - + + @@ -114,6 +116,11 @@ + {:else} - + {/each} -
Group Rating CodeReq. CommentColorUsagesOperationsUsagesOperations
{rating.ratingGroup || '-'} {rating.name} {rating.rating} + {#if rating.requiresComment} + + {/if} +
@@ -142,13 +149,13 @@
No ratings yetNo ratings yet
+ + + + - - + \ No newline at end of file diff --git a/waltz-ng/client/assessments/components/rating-editor/RatingDetailView.svelte b/waltz-ng/client/assessments/components/rating-editor/RatingDetailView.svelte index 8c2361b705..cf14687c93 100644 --- a/waltz-ng/client/assessments/components/rating-editor/RatingDetailView.svelte +++ b/waltz-ng/client/assessments/components/rating-editor/RatingDetailView.svelte @@ -19,6 +19,7 @@ import {displayError} from "../../../common/error-utils"; import {cardinality} from "../../../common/services/enums/cardinality"; import EditableRatingValue from "./EditableRatingValue.svelte"; + import Markdown from "../../../common/svelte/Markdown.svelte"; export let onCancel; export let onRemove; @@ -134,6 +135,9 @@ showGroup={true} disablementReason={ratingDisablementReason} onSave={saveRating}/> +
+ +
@@ -142,6 +146,7 @@
diff --git a/waltz-ng/client/common/svelte/TextEditableField.svelte b/waltz-ng/client/common/svelte/TextEditableField.svelte index 9872e5bd43..61c4f0f93f 100644 --- a/waltz-ng/client/common/svelte/TextEditableField.svelte +++ b/waltz-ng/client/common/svelte/TextEditableField.svelte @@ -10,6 +10,7 @@ export let onSave = (text) => console.log("Text to save", {text}); export let editable; export let label; + export let mandatory = false; let workingText; let savePromise @@ -37,52 +38,64 @@ savePromise .then(() => activeMode = Modes.VIEW); } - - -{#if activeMode === Modes.VIEW} - {#if !_.isEmpty(label)} - - {#if editable} - + {/if} + {/if} +
+ +
+ {#if mandatory} +
+ A comment is mandatory +
+ {/if} + {#if _.isEmpty(label) && editable} + {/if} - {/if} -
- -
- {#if _.isEmpty(label) && editable} + {:else if activeMode === Modes.EDIT} + {#if !_.isEmpty(label)} + + {/if} + + {#if mandatory} +
+ A comment is mandatory +
+ {/if} + + {:else if activeMode === Modes.SAVING} + {/if} -{:else if activeMode === Modes.EDIT} - {#if !_.isEmpty(label)} - - {/if} -