Skip to content

Commit

Permalink
Pull request #351: CTCTOWALTZ-3048 data type section improvements 6986
Browse files Browse the repository at this point in the history
Merge in WALTZ/waltz from WALTZ/waltz-jws:CTCTOWALTZ-3048-data-type-section-improvements-6986 to db-feature/waltz-6986-data-type-decorator-section-rework

* commit '441f56a6dc72b91947ae62ae7b21f5a9017fafb2':
  Prevent flow classification rules showing where rating for flow is 'DISCOURAGED'
  Add provenance and additional information to the data type section on logical flows
  Add provenance and additional information to the data type section on logical flows
  Add provenance and additional information to the data type section on logical flows
  Add provenance and additional information to the data type section on logical flows
  • Loading branch information
jessica-woodland-scott-db authored and db-waltz committed Feb 22, 2024
2 parents 618c7fb + 441f56a commit 7705bc1
Show file tree
Hide file tree
Showing 31 changed files with 1,398 additions and 487 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,17 @@ public List<EntityReference> findByIdSelectorAsEntityReference(Select<Record1<Lo
}


public Set<DataType> findByIdSelector(Select<Record1<Long>> selector) {
checkNotNull(selector, "selector cannot be null");

return dsl
.select(DATA_TYPE.asterisk())
.from(DATA_TYPE)
.where(DATA_TYPE.ID.in(selector))
.fetchSet(TO_DOMAIN);
}


public DataType getByCode(String code) {
checkNotEmpty(code, "Code cannot be null/empty");
return dsl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,15 @@ public FlowClassification getById(long id) {
}


public Set<FlowClassification> findByIds(Set<Long> classificationRuleIds) {
return dsl
.select(FLOW_CLASSIFICATION.fields())
.from(FLOW_CLASSIFICATION)
.where(FLOW_CLASSIFICATION.ID.in(classificationRuleIds))
.fetchSet(TO_DOMAIN_MAPPER);
}


public int remove(long id) {
return dsl
.delete(FLOW_CLASSIFICATION)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.finos.waltz.model.assessment_definition.AssessmentDefinition;
import org.finos.waltz.model.assessment_rating.AssessmentRating;
import org.finos.waltz.model.application.AssessmentsView;
import org.finos.waltz.model.datatype.DataType;
import org.finos.waltz.model.datatype.DataTypeDecorator;
import org.finos.waltz.model.flow_classification_rule.FlowClassificationRule;
import org.finos.waltz.model.rating.RatingSchemeItem;
import org.finos.waltz.model.flow_classification.FlowClassification;
import org.immutables.value.Value;

import java.util.Set;
Expand All @@ -33,15 +32,11 @@
@Value.Immutable
@JsonSerialize(as = ImmutableDataTypeDecoratorView.class)
@JsonDeserialize(as = ImmutableDataTypeDecoratorView.class)
public abstract class DataTypeDecoratorView {

public abstract Set<DataTypeDecorator> dataTypeDecorators();
public abstract Set<AssessmentRating> decoratorRatings();

public abstract Set<AssessmentDefinition> primaryAssessmentDefinitions();

public abstract Set<RatingSchemeItem> ratingSchemeItems();

public abstract Set<FlowClassificationRule> flowClassificationRules();
public interface DataTypeDecoratorView {
Set<DataTypeDecorator> dataTypeDecorators();
Set<DataType> dataTypes();
Set<FlowClassification> classifications();
AssessmentsView primaryAssessments();
FlowClassificationRulesView flowClassificationRules();

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* 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
*
*/

package org.finos.waltz.model.logical_flow;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.finos.waltz.model.datatype.DataType;
import org.finos.waltz.model.flow_classification.FlowClassification;
import org.finos.waltz.model.flow_classification_rule.FlowClassificationRule;
import org.immutables.value.Value;

import java.util.Set;


@Value.Immutable
@JsonSerialize(as = ImmutableFlowClassificationRulesView.class)
@JsonDeserialize(as = ImmutableFlowClassificationRulesView.class)
public interface FlowClassificationRulesView {

Set<FlowClassificationRule> flowClassificationRules();
Set<FlowClassification> flowClassifications();
Set<DataType> dataTypes();

}
25 changes: 25 additions & 0 deletions waltz-ng/client/common/slick-grid-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import EntityLink from "./svelte/EntityLink.svelte";
import {applicationKind} from "./services/enums/application-kind";
import {lifecyclePhase} from "./services/enums/lifecycle-phase";
import _ from "lodash";
import {toLocalDate} from "./date-utils";


export function mkSortFn(sortCol, sortAsc = true) {
Expand Down Expand Up @@ -39,6 +40,30 @@ export function mkExternalIdFormatter(valueProvider = d => d.externalId) {
}


export function mkNameFormatter(valueProvider = d => d.name) {
return (row, cell, value, colDef, dataCtx) => {
const name = valueProvider(value, dataCtx);
return `<span>${name}</span>`;
}
}

export function mkReadOnlyFormatter(valueProvider = d => d.isReadonly) {
return (row, cell, value, colDef, dataCtx) => {
const isReadonly = valueProvider(value, dataCtx);
if (isReadonly) {
return `<span class="text-muted" style="padding-right: 2px"><i class="small fa fa-fw fa-lock"></i></span>`;
}
}
}

export function mkLastUpdatedFormatter(dateProvider = d => d.lastUpdatedAt) {
return (row, cell, value, colDef, dataCtx) => {
const lastUpdatedAt = dateProvider(dataCtx);
return `<span>${toLocalDate(lastUpdatedAt)}</span>`;
}
}


export function mkEnumFormatter(valueProvider, enums) {

return (row, cell, value, colDef, dataCtx) => {
Expand Down
75 changes: 75 additions & 0 deletions waltz-ng/client/common/svelte/DataTypeDecoratorNodeContent.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<script>
import RatingIndicatorCell from "../../ratings/components/rating-indicator-cell/RatingIndicatorCell.svelte";
import Icon from "./Icon.svelte";
import Tooltip from "./Tooltip.svelte";
import DataTypeDecoratorTreeTooltip from "./DataTypeDecoratorTreeTooltip.svelte";
export let node;
export let multiSelect;
export let selectNode = (d) => console.log(d);
export let isDisabled = false;
export let isChecked = false;
function mkTooltipProps(node) {
return {
dataType: node,
decorator: node.decorator
}
}
</script>

<Tooltip content={DataTypeDecoratorTreeTooltip}
placement="left-start"
props={mkTooltipProps(node)}>
<svelte:fragment slot="target">
<button class="btn btn-plain"
class:concrete={node.concrete}
class:abstract={!node.concrete}
class:unknown={node.unknown}
class:deprecated={node.deprecated}
disabled={isDisabled}
on:click={() => selectNode(node)}>
{#if multiSelect}
<Icon name={isChecked ? "square-o" : "checked-square-o}"}/>
{/if}
{node.name}
</button>
{#if node.deprecated}
<span class="label label-danger">
Deprecated
</span>
{/if}
<span class="small">
{#if node.decorator?.flowClassification}
<RatingIndicatorCell showName={false} {...node.decorator?.flowClassification}/>
{/if}
{#if node.decorator?.isReadonly}
<Icon name="lock"/>
{/if}
</span>
</svelte:fragment>
</Tooltip>



<style>
.concrete {
}
.abstract {
font-style: italic;
}
.deprecated {
color: darkred;
}
.unknown {
color: gray;
}
</style>
91 changes: 91 additions & 0 deletions waltz-ng/client/common/svelte/DataTypeDecoratorTreeNode.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<script>
import _ from "lodash";
import Icon from "./Icon.svelte";
import {createEventDispatcher} from "svelte";
import RatingIndicatorCell from "../../ratings/components/rating-indicator-cell/RatingIndicatorCell.svelte";
import DataTypeDecoratorNodeContent from "./DataTypeDecoratorNodeContent.svelte";
export let selectionFilter = () => true;
export let multiSelect = false;
export let nonConcreteSelectable = true;
export let childNodes = [];
export let node;
export let expanded = false;
export let isRoot = false;
$: sortedNodes = _.orderBy(childNodes, [d => d.deprecated, d => d.name]);
const dispatcher = createEventDispatcher();
function toggleExpanded() {
expanded = !expanded;
}
function selectNode(selectedNode) {
dispatcher("select", selectedNode);
}
function calcChecked(filterFn, n) {
const isUnchecked = filterFn(n);
return !isUnchecked;
}
function calcDisabled(filterFn, n) {
const isUnchecked = filterFn(n);
return isUnchecked // should be allowed to deselect non-concrete
&& (!nonConcreteSelectable && !n.concrete)
}
</script>

{#if !isRoot}
<button class="btn btn-plain"
on:click={toggleExpanded}>
<Icon size="lg"
name={expanded
? "caret-down fw"
: "caret-right fw"}/>
</button>
<DataTypeDecoratorNodeContent {node}
{multiSelect}
isDisabled={calcDisabled(selectionFilter, node)}
isChecked={calcChecked(selectionFilter, node)}
{selectNode}/>
{/if}

{#if expanded || node.isExpanded}
<ul>
{#each sortedNodes as childNode}
<li>
{#if childNode.children.length > 0}
<svelte:self on:select
{multiSelect}
node={childNode}
{selectionFilter}
{nonConcreteSelectable}
{expanded}
childNodes={childNode.children}/>
{:else}
<Icon size="lg"
name="fw"/>
<DataTypeDecoratorNodeContent node={childNode}
{multiSelect}
isDisabled={calcDisabled(selectionFilter, childNode)}
isChecked={calcChecked(selectionFilter, childNode)}
{selectNode}/>
{/if}
</li>
{/each}
</ul>
{/if}

<style>
ul {
padding: 0.2em 0 0 0.5em;
margin: 0 0 0 0.5em;
list-style: none;
border-left: 1px solid #eee;
}
</style>
31 changes: 31 additions & 0 deletions waltz-ng/client/common/svelte/DataTypeDecoratorTreeTooltip.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<script>
import DescriptionFade from "./DescriptionFade.svelte";
import Icon from "./Icon.svelte";
import RatingIndicatorCell from "../../ratings/components/rating-indicator-cell/RatingIndicatorCell.svelte";
import LastEdited from "./LastEdited.svelte";
import DataTypeDecoratorViewTable
from "../../data-types/components/data-type-decorator-section/context-panel/DataTypeDecoratorViewTable.svelte";
export let dataType;
export let decorator;
</script>

{#if (dataType)}
<strong>{dataType.name}</strong>
<div class="help-block">{dataType.code}</div>
<DescriptionFade text={dataType.description}/>
{#if dataType.deprecated}
<div style="padding-top: 1em">
<span style="color: darkred">
<Icon name="exclamation-triangle"/>
</span>
This data type is deprecated
</div>
{/if}
{/if}
{#if decorator}
<br>
<DataTypeDecoratorViewTable {decorator}/>
{/if}
Loading

0 comments on commit 7705bc1

Please sign in to comment.