Skip to content

Commit

Permalink
Merge pull request #6877 from davidwatkins73/waltz-6895-flow-details-…
Browse files Browse the repository at this point in the history
…enhance

flow details enhance
  • Loading branch information
jessica-woodland-scott-db authored Nov 30, 2023
2 parents 209e6b0 + c9307d7 commit f22cdba
Show file tree
Hide file tree
Showing 30 changed files with 1,105 additions and 779 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.finos.waltz.data.logical_flow.LogicalFlowIdSelectorFactory;
import org.finos.waltz.data.measurable.MeasurableIdSelectorFactory;
import org.finos.waltz.data.orgunit.OrganisationalUnitIdSelectorFactory;
import org.finos.waltz.data.physical_flow.PhysicalFlowIdSelectorFactory;
import org.finos.waltz.data.physical_specification.PhysicalSpecificationIdSelectorFactory;
import org.finos.waltz.model.EntityKind;
import org.finos.waltz.model.HierarchyQueryScope;
Expand All @@ -53,6 +54,7 @@ public class GenericSelectorFactory {
private final OrganisationalUnitIdSelectorFactory organisationalUnitIdSelectorFactory = new OrganisationalUnitIdSelectorFactory();
private final AttestationIdSelectorFactory attestationIdSelectorFactory = new AttestationIdSelectorFactory();
private final PhysicalSpecificationIdSelectorFactory specificationIdSelectorFactory = new PhysicalSpecificationIdSelectorFactory();
private final PhysicalFlowIdSelectorFactory physicalFlowIdSelectorFactory = new PhysicalFlowIdSelectorFactory();


public GenericSelector apply(IdSelectionOptions selectionOptions) {
Expand Down Expand Up @@ -125,6 +127,8 @@ private Select<Record1<Long>> applySelectorForKind(EntityKind kind, IdSelectionO
return organisationalUnitIdSelectorFactory.apply(selectionOptions);
case ATTESTATION:
return attestationIdSelectorFactory.apply(selectionOptions);
case PHYSICAL_FLOW:
return physicalFlowIdSelectorFactory.apply(selectionOptions);
case PHYSICAL_SPECIFICATION:
return specificationIdSelectorFactory.apply(selectionOptions);
//todo: (KS) Add support for Person
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@
import static org.finos.waltz.common.Checks.checkNotNull;
import static org.finos.waltz.common.DateTimeUtilities.nowUtc;
import static org.finos.waltz.common.DateTimeUtilities.toLocalDateTime;
import static org.finos.waltz.model.EntityKind.DATA_TYPE;
import static org.finos.waltz.model.EntityKind.PHYSICAL_SPECIFICATION;
import static org.finos.waltz.model.EntityReference.mkRef;
import static org.finos.waltz.schema.Tables.DATA_TYPE;
import static org.finos.waltz.schema.tables.LogicalFlowDecorator.LOGICAL_FLOW_DECORATOR;
import static org.finos.waltz.schema.tables.PhysicalFlow.PHYSICAL_FLOW;
import static org.finos.waltz.schema.tables.PhysicalSpecDataType.PHYSICAL_SPEC_DATA_TYPE;
Expand All @@ -65,8 +64,8 @@ public class PhysicalSpecDecoratorDao extends DataTypeDecoratorDao {
public static final RecordMapper<? super Record, DataTypeDecorator> TO_DOMAIN_MAPPER = r -> {
PhysicalSpecDataTypeRecord record = r.into(PHYSICAL_SPEC_DATA_TYPE);
return ImmutableDataTypeDecorator.builder()
.decoratorEntity(mkRef(DATA_TYPE, record.getDataTypeId()))
.entityReference(mkRef(PHYSICAL_SPECIFICATION,record.getSpecificationId()))
.decoratorEntity(mkRef(EntityKind.DATA_TYPE, record.getDataTypeId(), r.get(DATA_TYPE.NAME)))
.entityReference(mkRef(EntityKind.PHYSICAL_SPECIFICATION,record.getSpecificationId()))
.provenance(record.getProvenance())
.lastUpdatedAt(toLocalDateTime(record.getLastUpdatedAt()))
.lastUpdatedBy(record.getLastUpdatedBy())
Expand Down Expand Up @@ -102,7 +101,9 @@ public PhysicalSpecDecoratorDao(DSLContext dsl) {
public DataTypeDecorator getByEntityIdAndDataTypeId(long specId, long dataTypeId) {
return dsl
.select(PHYSICAL_SPEC_DATA_TYPE.fields())
.select(DATA_TYPE.NAME)
.from(PHYSICAL_SPEC_DATA_TYPE)
.innerJoin(DATA_TYPE).on(PHYSICAL_SPEC_DATA_TYPE.DATA_TYPE_ID.eq(DATA_TYPE.ID))
.where(PHYSICAL_SPEC_DATA_TYPE.SPECIFICATION_ID.eq(specId))
.and(PHYSICAL_SPEC_DATA_TYPE.DATA_TYPE_ID.eq(dataTypeId))
.fetchOne(TO_DOMAIN_MAPPER);
Expand All @@ -113,7 +114,9 @@ public DataTypeDecorator getByEntityIdAndDataTypeId(long specId, long dataTypeId
public List<DataTypeDecorator> findByEntityId(long specId) {
return dsl
.select(PHYSICAL_SPEC_DATA_TYPE.fields())
.select(DATA_TYPE.NAME)
.from(PHYSICAL_SPEC_DATA_TYPE)
.innerJoin(DATA_TYPE).on(PHYSICAL_SPEC_DATA_TYPE.DATA_TYPE_ID.eq(DATA_TYPE.ID))
.where(PHYSICAL_SPEC_DATA_TYPE.SPECIFICATION_ID.eq(specId))
.fetch(TO_DOMAIN_MAPPER);
}
Expand All @@ -124,32 +127,33 @@ public List<DataTypeDecorator> findByEntityIdSelector(Select<Record1<Long>> spec
Optional<EntityKind> entityKind) {
return dsl
.select(PHYSICAL_SPEC_DATA_TYPE.fields())
.select(DATA_TYPE.NAME)
.from(PHYSICAL_SPEC_DATA_TYPE)
.innerJoin(DATA_TYPE).on(PHYSICAL_SPEC_DATA_TYPE.DATA_TYPE_ID.eq(DATA_TYPE.ID))
.where(PHYSICAL_SPEC_DATA_TYPE.SPECIFICATION_ID.in(specIdSelector))
.fetch(TO_DOMAIN_MAPPER);
}


@Override
public List<DataTypeDecorator> findByAppIdSelector(Select<Record1<Long>> appIdSelector) {
throw new UnsupportedOperationException("method not supported for " + PHYSICAL_SPECIFICATION.prettyName());
throw new UnsupportedOperationException("method not supported for " + EntityKind.PHYSICAL_SPECIFICATION.prettyName());
}

@Override
public Set<DataTypeDecorator> findByFlowIdSelector(Select<Record1<Long>> flowIdSelector) {
throw new UnsupportedOperationException("method not supported for " + PHYSICAL_SPECIFICATION.prettyName());
throw new UnsupportedOperationException("method not supported for " + EntityKind.PHYSICAL_SPECIFICATION.prettyName());
}


@Override
public List<DataTypeDecorator> findByDataTypeIdSelector(Select<Record1<Long>> dataTypeIdSelector) {
throw new UnsupportedOperationException("method not supported for " + PHYSICAL_SPECIFICATION.prettyName());
throw new UnsupportedOperationException("method not supported for " + EntityKind.PHYSICAL_SPECIFICATION.prettyName());
}


@Override
public Set<DataTypeDecorator> findByFlowIds(Collection<Long> flowIds) {
throw new UnsupportedOperationException("method not supported for " + PHYSICAL_SPECIFICATION.prettyName());
throw new UnsupportedOperationException("method not supported for " + EntityKind.PHYSICAL_SPECIFICATION.prettyName());
}


Expand Down Expand Up @@ -204,7 +208,7 @@ public List<DataTypeUsageCharacteristics> findDatatypeUsageCharacteristics(Entit

@Override
public Set<DataTypeDecorator> findByLogicalFlowIdSelector(Select<Record1<Long>> flowIdSelector) {
throw new UnsupportedOperationException("method not supported for " + PHYSICAL_SPECIFICATION.prettyName());
throw new UnsupportedOperationException("method not supported for " + EntityKind.PHYSICAL_SPECIFICATION.prettyName());
}


Expand Down Expand Up @@ -234,17 +238,17 @@ public int rippleDataTypesToLogicalFlows() {
SelectConditionStep<Record7<Long, String, Long, String, String, Timestamp, String>> qry = DSL
.selectDistinct(
PHYSICAL_FLOW.LOGICAL_FLOW_ID,
DSL.val(DATA_TYPE.name()),
DSL.val(EntityKind.DATA_TYPE.name()),
PHYSICAL_SPEC_DATA_TYPE.DATA_TYPE_ID,
DSL.val(AuthoritativenessRatingValue.NO_OPINION.value()),
DSL.val("waltz"),
DSL.val(Timestamp.valueOf(nowUtc())),
DSL.val("admin"))
.from(PHYSICAL_SPEC_DATA_TYPE)
.innerJoin(Tables.DATA_TYPE)
.on(PHYSICAL_SPEC_DATA_TYPE.DATA_TYPE_ID.eq(Tables.DATA_TYPE.ID)
.and(Tables.DATA_TYPE.UNKNOWN.isFalse()
.and(Tables.DATA_TYPE.DEPRECATED.isFalse())))
.innerJoin(DATA_TYPE)
.on(PHYSICAL_SPEC_DATA_TYPE.DATA_TYPE_ID.eq(DATA_TYPE.ID)
.and(DATA_TYPE.UNKNOWN.isFalse()
.and(DATA_TYPE.DEPRECATED.isFalse())))
.innerJoin(Tables.PHYSICAL_SPECIFICATION)
.on(PHYSICAL_SPEC_DATA_TYPE.SPECIFICATION_ID.eq(Tables.PHYSICAL_SPECIFICATION.ID)
.and(Tables.PHYSICAL_SPECIFICATION.IS_REMOVED.isFalse()))
Expand All @@ -259,7 +263,7 @@ public int rippleDataTypesToLogicalFlows() {
.leftJoin(LOGICAL_FLOW_DECORATOR)
.on(LOGICAL_FLOW_DECORATOR.LOGICAL_FLOW_ID.eq(Tables.LOGICAL_FLOW.ID)
.and(LOGICAL_FLOW_DECORATOR.DECORATOR_ENTITY_ID.eq(PHYSICAL_SPEC_DATA_TYPE.DATA_TYPE_ID))
.and(LOGICAL_FLOW_DECORATOR.DECORATOR_ENTITY_KIND.eq(DATA_TYPE.name())))
.and(LOGICAL_FLOW_DECORATOR.DECORATOR_ENTITY_KIND.eq(EntityKind.DATA_TYPE.name())))
.where(LOGICAL_FLOW_DECORATOR.LOGICAL_FLOW_ID.isNull());

return dsl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,28 @@
@JsonDeserialize(as = ImmutableLogicalFlowView.class)
public abstract class LogicalFlowView {

public abstract Set<LogicalFlow> flows();
public abstract Set<LogicalFlow> logicalFlows();

public abstract Set<AssessmentRating> flowRatings();
public abstract Set<PhysicalFlow> physicalFlows();

public abstract Set<AssessmentDefinition> primaryAssessmentDefinitions();
public abstract Set<PhysicalSpecification> physicalSpecifications();

public abstract Set<RatingSchemeItem> ratingSchemeItems();

public abstract Set<DataTypeDecorator> dataTypeDecorators();
public abstract Set<DataTypeDecorator> logicalFlowDataTypeDecorators();

public abstract Set<PhysicalFlow> physicalFlows();
public abstract Set<DataTypeDecorator> physicalSpecificationDataTypeDecorators();

public abstract Set<PhysicalSpecification> physicalSpecifications();
public abstract Set<AssessmentDefinition> logicalFlowAssessmentDefinitions();

public abstract Set<AssessmentDefinition> physicalFlowAssessmentDefinitions();

public abstract Set<AssessmentDefinition> physicalSpecificationAssessmentDefinitions();

public abstract Set<AssessmentRating> logicalFlowRatings();

public abstract Set<AssessmentRating> physicalFlowRatings();

public abstract Set<AssessmentRating> physicalSpecificationRatings();

}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
$: canAdd = hasAddPermission && (singleValueCanAdd || multiValueCanAdd);
$: sortedRatingList =_.sortBy($selectedAssessment?.ratings, d => _.toLower(d.ratingItem.ratingGroup + d.ratingItem.name));
$: sortedRatingList =_.sortBy($selectedAssessment?.ratings, d => _.toLower(d.ratingItem?.ratingGroup + d.ratingItem?.name));
</script>
Expand Down
3 changes: 2 additions & 1 deletion waltz-ng/client/common/svelte/DescriptionFade.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
export let text = "";
export let context = {};
export let expanderAlignment = "center"; // left | center (default) | right
let expanded = false;
Expand All @@ -17,7 +18,7 @@
<Markdown {text} {context}/>
</div>
{#if hasLongDescription}
<div class="expander">
<div class="expander" style:text-align={expanderAlignment}>
<button class="btn btn-skinny small"
on:click={() => expanded = !expanded}>
{expanded ? "Show less" : "Show more"}
Expand Down
6 changes: 6 additions & 0 deletions waltz-ng/client/common/svelte/Toggle.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,9 @@
</span>
{/if}
{/if}

<style>
button {
font-size: inherit;
}
</style>
4 changes: 3 additions & 1 deletion waltz-ng/client/common/svelte/Tooltip.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
export let content;
export let props;
export let trigger = "mouseenter click";
export let placement = "top";
export let delay = [300, 100];
Expand All @@ -21,7 +22,8 @@
content: "loading",
arrow: true,
interactive: true,
trigger: 'mouseenter click',
appendTo: document.body,
trigger,
theme: "light-border",
placement,
delay,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<script context="module">
import {writable} from "svelte/store";
let hideRatings = writable(true);
</script>

<script>
import _ from "lodash";
import EntityLabel from "../../../../common/svelte/EntityLabel.svelte";
import Toggle from "../../../../common/svelte/Toggle.svelte";
export let decorators = [];
export let flowClassifications = []
$: flowClassificationsByCode = _.keyBy(flowClassifications, d => d.code);
$: hasRatings = !_.isEmpty(flowClassifications)
$: showRatings = !$hideRatings && hasRatings;
</script>

<table class="">
<tbody class="small">
{#each _.orderBy(decorators, d => d.decoratorEntity.name) as type}
<tr>
<td>
<div class="rating-icon"
style={`background-color: ${flowClassificationsByCode[type.rating]?.color}`}>
</div>
<EntityLabel ref={type.decoratorEntity}
showIcon={false}>
</EntityLabel>
</td>
{#if showRatings}
<td>
{_.get(flowClassificationsByCode, [type.rating, "name"], "-")}
</td>
{/if}
</tr>
{/each}
</tbody>
</table>

{#if hasRatings}
<div class="smaller">
<Toggle state={showRatings}
labelOn="Hide Ratings"
onToggle={() => $hideRatings = !$hideRatings}
labelOff="Show Ratings"/>
</div>
{/if}



<style>
.rating-icon {
display: inline-block;
height: 1em;
width: 1em;
border:1px solid #ccc;
border-radius: 2px;
}
table {
width: 100%;
}
table td {
padding-bottom: 0.2em;
padding-right: 0.6em;
border-bottom: 1px solid #eee;
vertical-align: top;
}
</style>

This file was deleted.

Loading

0 comments on commit f22cdba

Please sign in to comment.