Skip to content

Commit

Permalink
Merge pull request finos#4213 from davidwatkins73/waltz-4205-assessments
Browse files Browse the repository at this point in the history
Collapse down 'Not Provided' into a shortened list
  • Loading branch information
kamransaleem authored Jul 22, 2019
2 parents 140be6f + f9007e9 commit ab548c8
Show file tree
Hide file tree
Showing 7 changed files with 184 additions and 53 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Waltz - Enterprise Architecture
* Copyright (C) 2016, 2017 Waltz open source project
* Copyright (C) 2016, 2017, 2018, 2019 Waltz open source project
* See README.md for more information
*
* This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -122,6 +122,11 @@ public static <K, V, V2> Map<K, Collection<V2>> groupBy(Function<V, K> keyFn,
}


public static <K, V> Map<K, V> indexBy(Collection<V> xs, Function<V, K> keyFn) {
return indexBy(keyFn, xs);
}


public static <K, V> Map<K, V> indexBy(Function<V, K> keyFn,
Collection<V> xs) {
checkNotNull(xs, "xs cannot be null");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
package com.khartec.waltz.jobs.generators;

import com.khartec.waltz.common.ColorUtilities;
import com.khartec.waltz.common.ListUtilities;
import com.khartec.waltz.common.RandomUtilities;
import com.khartec.waltz.model.EntityKind;
import com.khartec.waltz.model.rating.RatingScheme;
Expand Down Expand Up @@ -53,6 +54,8 @@ public Map<String, Integer> create(ApplicationContext ctx) {
Long archAssessmentRating = createArchImpactAssessmentDefinition(ctx, impactRatingScheme);
Long regAssessmentRating = createRegulatoryImpactAssessmentDefinition(ctx, impactRatingScheme);

createLotsOfAssessmentDefinitions(ctx, impactRatingScheme);

createAssessmentRecords(getDsl(ctx), confidentialityRatingScheme, appDefnId, EntityKind.APPLICATION, APPLICATION.ID, 0.9);
createAssessmentRecords(getDsl(ctx), impactRatingScheme, archAssessmentRating, EntityKind.CHANGE_INITIATIVE, CHANGE_INITIATIVE.ID, 0.9);
createAssessmentRecords(getDsl(ctx), impactRatingScheme, regAssessmentRating, EntityKind.CHANGE_INITIATIVE, CHANGE_INITIATIVE.ID, 0.5);
Expand Down Expand Up @@ -114,6 +117,22 @@ private Long createArchImpactAssessmentDefinition(ApplicationContext ctx, Rating
ratingScheme);
}


private void createLotsOfAssessmentDefinitions(ApplicationContext ctx, RatingScheme ratingScheme) {
List<Tuple3<EntityKind, String, String>> defns = ListUtilities.newArrayList(
tuple(EntityKind.APPLICATION, "Sanctions Apply", "Indicates if sanctions apply to this application"),
tuple(EntityKind.APPLICATION, "Records Retentions Relevancy", "Indicates what record retention rules (if any) apply to this app"),
tuple(EntityKind.APPLICATION, "Internet facing", "Indicates if an application has a direct connection to the internet"));

defns.forEach(d -> createAssessmentDefinition(
getDsl(ctx),
d.v2,
d.v3,
d.v1,
ratingScheme));
}


private Long createRegulatoryImpactAssessmentDefinition(ApplicationContext ctx, RatingScheme ratingScheme) {
return createAssessmentDefinition(
getDsl(ctx),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class LoadAll {
// new AppGroupGenerator(),
// new AppGroupEntryGenerator(),
// new BookmarkGenerator(),
new ChangeInitiativeGenerator(),
// new ChangeInitiativeGenerator(),
// new ProcessGenerator(),
// new MeasurableGenerator("PRODUCT"),
// new MeasurableGenerator("CAPABILITY"),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
/*
* Waltz - Enterprise Architecture
* Copyright (C) 2016, 2017, 2018, 2019 Waltz open source project
* See README.md for more information
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package com.khartec.waltz.jobs.tools.importers;

import com.khartec.waltz.common.DateTimeUtilities;
Expand All @@ -20,9 +39,7 @@
import com.khartec.waltz.service.DIConfiguration;
import org.jooq.DSLContext;
import org.jooq.lambda.tuple.Tuple;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.stereotype.Component;
import org.supercsv.io.CsvMapReader;
import org.supercsv.io.ICsvMapReader;
import org.supercsv.prefs.CsvPreference;
Expand Down
168 changes: 122 additions & 46 deletions waltz-ng/client/assessments/components/list/assessment-rating-list.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
<!--
~ Waltz - Enterprise Architecture
~ Copyright (C) 2016, 2017, 2018, 2019 Waltz open source project
~ See README.md for more information
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU Lesser General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU Lesser General Public License for more details.
~
~ You should have received a copy of the GNU Lesser General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->

<div class="waltz-assessment-rating-panel">
<div class="row">
<div class="col-md-12">
Expand All @@ -9,70 +28,120 @@
</message>
</waltz-no-data>

<div ng-if="$ctrl.assessments.length > 0"
ng-class="{ 'waltz-scroll-region-200' : $ctrl.assessments.length > 7}">
<div ng-class="{ 'waltz-scroll-region-200' : $ctrl.assessmentsWithRatings.length > 7}">
<table class="waltz-field-table waltz-field-table-border"
style="width: 100%">
<colgroup>
<col width="30%">
<col width="70%">
</colgroup>
<tbody>
<tr ng-repeat="item in $ctrl.assessments">
<!-- definition name -->
<td class="wft-label">
<span uib-popover-template="'arp-desc-popover.html'"
popover-placement="left"
popover-enable="item.definition.description"
popover-trigger="mouseenter"
popover-popup-delay="300"
popover-append-to-body="true">
<span ng-bind="item.definition.name"></span>
</span>
</td>
<!-- rating -->
<td valign="top">
<span ng-if="item.rating"
uib-popover-template="'arp-popover.html'"
popover-placement="right"
popover-trigger="mouseenter"
popover-popup-delay="300"
popover-append-to-body="true">
<a ng-click="$ctrl.onSelect(item)"
class="clickable">
<waltz-rating-indicator-cell rating="item.ratingItem"
show-name="true">
</waltz-rating-indicator-cell>
<span style="position: relative; top: -4px;"
ng-if="item.rating.description.length > 0">
<waltz-icon name="sticky-note-o">
</waltz-icon>
</span>
</a>
</span>
<span ng-if="!item.rating">
<a ng-click="$ctrl.onSelect(item)"
class="clickable">
Not Provided
</a>
</span>
</td>
</tr>
<tbody ng-if="$ctrl.assessmentsWithRatings.length > 0"
ng-include="'warl-list-with-ratings'">
</tbody>
<tbody ng-if="$ctrl.assessmentsWithoutRatings.length > 0"
style="border-top: 1px solid #eee;"
ng-include="'warl-list-without-ratings'">
</tbody>
</table>
</div>
</div>
</div>
</div>


<!-- WITHOUT RATINGS -->
<script type="text/ng-template"
id="warl-list-without-ratings">
<tr style="vertical-align: top">
<td>
<span class="wft-label">
Not Provided
</span>
</td>
<td>
<ul class="text-muted list-inline">
<li ng-repeat="item in $ctrl.assessmentsWithoutRatings">
<span ng-if="item.definition.isReadOnly">
<span ng-include="'warl-definition-name'"></span>
</span>
<a ng-click="$ctrl.onSelect(item)"
ng-if="!item.definition.isReadOnly"
class="clickable">
<span ng-include="'warl-definition-name'"></span>
</a>
<span ng-if="!$last">, </span>
</li>
</ul>
</td>
</tr>
</script>


<!-- WITH RATINGS -->
<script type="text/ng-template"
id="warl-list-with-ratings">
<tr ng-repeat="item in $ctrl.assessmentsWithRatings"
style="vertical-align: top">
<!-- definition name -->
<td class="wft-label">
<span ng-include="'warl-definition-name'"></span>
</td>
<!-- rating -->
<td>
<a ng-click="$ctrl.onSelect(item)"
class="clickable">
<span ng-include="'warl-rating-name'"></span>
</a>
</td>
</tr>
</script>



<!-- RATING NAME WITH POPOVER -->
<script type="text/ng-template"
id="warl-rating-name">
<span uib-popover-template="'warl-rating-popover.html'"
popover-placement="right"
popover-trigger="mouseenter"
popover-popup-delay="300"
popover-append-to-body="true">
<waltz-rating-indicator-cell rating="item.ratingItem"
show-name="true">
</waltz-rating-indicator-cell>
<span style="position: relative; top: -4px;"
ng-if="item.rating.description.length > 0">
<waltz-icon name="sticky-note-o">
</waltz-icon>
</span>
</span>
</script>

<!-- DEFINITION NAME WITH POPOVER -->
<script type="text/ng-template"
id="arp-popover.html">
id="warl-definition-name">
<span uib-popover-template="'warl-desc-popover.html'"
popover-placement="left"
popover-enable="item.definition.description"
popover-trigger="mouseenter"
popover-popup-delay="300"
popover-append-to-body="true">
<span ng-bind="item.definition.name"></span>
</span>
<waltz-icon name="lock"
ng-if="item.definition.isReadOnly">
</waltz-icon>
</script>


<!-- RATING POPOVER -->
<script type="text/ng-template"
id="warl-rating-popover.html">
<div>
<div>
<div>
<strong ng-bind="item.ratingItem.name"></strong>
</div>

<span class="text-muted">
<waltz-markdown text="item.rating.description">
</waltz-markdown>
Expand All @@ -89,8 +158,9 @@
</script>


<!-- DEFINITION POPOVER -->
<script type="text/ng-template"
id="arp-desc-popover.html">
id="warl-desc-popover.html">
<div>
<div>
<div>
Expand All @@ -104,6 +174,12 @@
<waltz-markdown text="item.definition.description">
</waltz-markdown>
</div>
<div class="text-muted small"
ng-if="item.definition.isReadOnly">
<hr>
<waltz-icon name="lock"></waltz-icon>
Assessments relating to this definition are read-only and cannot be edited.
</div>
</div>
</div>
</script>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Waltz - Enterprise Architecture
* Copyright (C) 2016, 2017 Waltz open source project
* Copyright (C) 2016, 2017, 2018, 2019 Waltz open source project
* See README.md for more information
*
* This program is free software: you can redistribute it and/or modify
Expand All @@ -18,6 +18,7 @@
*/

import {initialiseData} from "../../../common";
import _ from "lodash";
import template from "./assessment-rating-list.html";


Expand All @@ -28,11 +29,24 @@ const bindings = {


const initialState = {
assessmentsWithRatings: [],
assessmentsWithoutRatings: []
};


function controller() {
initialiseData(this, initialState);
const vm = initialiseData(this, initialState);

vm.$onChanges = () => {
if (vm.assessments) {
const partitioned = _.partition(
vm.assessments,
assessment => _.isNil(assessment.rating));
vm.assessmentsWithoutRatings = _.sortBy(partitioned[0], d => d.definition.name);
vm.assessmentsWithRatings = _.sortBy(partitioned[1], d => d.definition.name);
}
};

}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Waltz - Enterprise Architecture
* Copyright (C) 2016, 2017 Waltz open source project
* Copyright (C) 2016, 2017, 2018, 2019 Waltz open source project
* See README.md for more information
*
* This program is free software: you can redistribute it and/or modify
Expand Down

0 comments on commit ab548c8

Please sign in to comment.