Skip to content

Commit

Permalink
Merge pull request #6158 from deutschebank/db-contrib/waltz-6149-high…
Browse files Browse the repository at this point in the history
…light-physicals-sharing-data-type

Db contrib/waltz 6149 highlight physicals sharing data type
  • Loading branch information
davidwatkins73 authored Jul 27, 2022
2 parents b318463 + 766763c commit 5374681
Show file tree
Hide file tree
Showing 8 changed files with 148 additions and 12 deletions.
2 changes: 1 addition & 1 deletion waltz-ng/client/common/selector-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function determineDownwardsScopeForKind(kind) {
case "FLOW_DIAGRAM":
case "LICENCE":
case "LOGICAL_DATA_ELEMENT":
case "LOGICAL_FLOW":
case "LOGICAL_DATA_FLOW":
case "MEASURABLE_CATEGORY":
case "PHYSICAL_FLOW":
case "PHYSICAL_SPECIFICATION":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
expanded-item-ids="$ctrl.expandedItemIds"
disable-predicate="$ctrl.disablePredicate"
is-readonly-predicate="$ctrl.isReadonlyPredicate"
name-provider-fn="$ctrl.nameProviderFn">
name-provider-fn="$ctrl.nameProviderFn"
on-click="$ctrl.click">

<span uib-popover-template="'wdtus-popup.html'"
popover-trigger="mouseenter"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ import {reduceToSelectedNodesOnly} from "../../../common/hierarchy-utils";
const bindings = {
parentEntityRef: "<",
onDirty: "<?",
onRegisterSave: "<?"
onRegisterSave: "<?",
onSelect: "<?"
};


Expand All @@ -42,6 +43,7 @@ const initialState = {
suggestedDataTypes: [],
showAllDataTypes: false,
onDirty: (d) => console.log("dtus:onDirty - default impl", d),
onSelect: (d) => console.log("dtus:onSelect - default impl", d),
onRegisterSave: (f) => console.log("dtus:onRegisterSave - default impl", f)
};

Expand Down Expand Up @@ -233,6 +235,10 @@ function controller($q, serviceBroker) {
};

vm.nameProviderFn = d => d.dataType.name;

vm.click = (key, item) => {
vm.onSelect(item);
};
}


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<script>
import {dataTypeDecoratorStore} from "../../../svelte-stores/data-type-decorator-store";
import {entity} from "../../../common/services/enums/entity";
import {mkSelectionOptions} from "../../../common/selector-utils";
import {physicalFlowStore} from "../../../svelte-stores/physical-flow-store";
import _ from "lodash";
import {truncateMiddle} from "../../../common/string-utils";
import EntityLink from "../../../common/svelte/EntityLink.svelte";
import DescriptionFade from "../../../common/svelte/DescriptionFade.svelte";
import SearchInput from "../../../common/svelte/SearchInput.svelte";
import {termSearch} from "../../../common";
export let datatype;
export let logicalFlow;
export let primaryEntityRef;
let specDecoratorCall;
let physFlowCall;
let qry = "";
$: {
if (primaryEntityRef) {
specDecoratorCall = dataTypeDecoratorStore.findBySelector(entity.PHYSICAL_SPECIFICATION.key, mkSelectionOptions(primaryEntityRef))
physFlowCall = physicalFlowStore.findBySelector(mkSelectionOptions(logicalFlow));
}
}
$: specsById = _
.chain($specDecoratorCall.data)
.filter(d => d.dataTypeId === datatype.dataType.id)
.keyBy(d => d.entityReference.id)
.value();
$: physicalFlows = _
.chain($physFlowCall.data)
.map(d => Object.assign({}, d, {specification: specsById[d.specificationId]}))
.filter(d => !_.isNil(d.specification))
.orderBy(d => d.externalId)
.value();
$: filteredPhysicalFlows = _.isEmpty(qry)
? physicalFlows
: termSearch(physicalFlows, qry, ["externalId", "frequency", "transport", "criticality"]);
</script>


<h4>{datatype?.dataType.name}</h4>
<DescriptionFade text={datatype?.dataType.description}/>

{#if !_.isEmpty(physicalFlows)}
<br>
<div>Physical flows sharing this data type:</div>

{#if _.size(physicalFlows) > 10}
<SearchInput bind:value={qry}/>
{/if}
<div class:waltz-scroll-region-350={_.size(physicalFlows) > 10}>
<table class="table table-condensed small">
<colgroup>
<col width="40%"/>
<col width="20%"/>
<col width="20%"/>
<col width="20%"/>
</colgroup>
<thead>
<tr>
<th>External Id</th>
<th>Frequency</th>
<th>Transport</th>
<th>Criticality</th>
</tr>
</thead>
<tbody>
{#each filteredPhysicalFlows as flow}
<tr>
<td title={flow.externalId}>
<EntityLink ref={flow}>
{truncateMiddle(flow.externalId, 30)}
</EntityLink>
</td>
<td>{flow.frequency}</td>
<td>{flow.transport}</td>
<td>{flow.criticality}</td>
</tr>
{/each}
</tbody>
</table>
</div>
{/if}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ <h4>
<waltz-data-type-usage-selector parent-entity-ref="$ctrl.logicalFlowEntityRef"
parent-flow="$ctrl.logicalFlowEntityRef"
on-dirty="$ctrl.onDirty"
on-register-save="$ctrl.registerSaveFn">
on-register-save="$ctrl.registerSaveFn"
on-select="$ctrl.onSelect">
</waltz-data-type-usage-selector>

<!-- ACTIONS -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,18 @@ const bindings = {
flow: "<",
onDelete: "<",
onReload: "<",
onCancel: "<"
onCancel: "<",
onSelect: "<?"
};


const initialState = {
flow: null,
isDirty:false,
isDirty: false,
onDelete: (x) => console.log("lfte: default onDelete()", x),
onReload: (x) => console.log("lfte: default onReload()", x),
onCancel: (x) => console.log("lfte: default onCancel()", x)
onCancel: (x) => console.log("lfte: default onCancel()", x),
onSelect: (x) => console.log("lfte: default onSelect()", x)
};


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@
ng-submit="$ctrl.submit()">

<!-- ACTIONS -->
<div class="row">
<div class="col-sm-5">
<div class="row"
ng-if="$ctrl.mode === 'addSource' || $ctrl.mode === 'addTarget' || $ctrl.mode === ''">
<div class="col-sm-6">
<div class="alert"
style="background-color: #f5f5f5; border-radius: 10px;">
<ul class="small">
Expand Down Expand Up @@ -80,7 +81,8 @@
</ul>
</div>
</div>
<div class="col-sm-7">
<div class="col-sm-6">

<div ng-if="$ctrl.mode === 'addSource'"
class="waltz-fade-if">
<waltz-logical-flow-counterpart-selector all-actors="$ctrl.allActors"
Expand Down Expand Up @@ -118,13 +120,20 @@
</waltz-logical-flow-counterpart-selector>
</div>

</div>
</div>

<div class="row"
ng-if="$ctrl.mode === 'editDataTypeUsage' || $ctrl.mode === 'editCounterpart'">
<div class="col-sm-6">

<div ng-if="$ctrl.mode === 'editCounterpart'"
class="waltz-fade-if">
<waltz-logical-flow-type-editor flow="$ctrl.selectedFlow"
on-delete="$ctrl.deleteFlow"
on-reload="$ctrl.onReload"
on-cancel="$ctrl.cancel">
on-cancel="$ctrl.cancel"
on-select="$ctrl.onSelectDataType">
</waltz-logical-flow-type-editor>
</div>

Expand All @@ -138,6 +147,24 @@
</waltz-app-data-type-usage-editor>
</div>
</div>

<div class="col-sm-6">
<div ng-if="$ctrl.mode === 'editCounterpart'">
<waltz-svelte-component ng-if="$ctrl.dataTypeInfo"
component="$ctrl.DataTypeInfoPanel"
datatype="$ctrl.dataTypeInfo"
primary-entity-ref="$ctrl.parentEntityRef"
logical-flow="$ctrl.selectedFlow">
</waltz-svelte-component>
<div class="help-block small"
style="padding-top: 1em"
ng-if="!$ctrl.dataTypeInfo">
<waltz-icon name="info-circle"></waltz-icon>
Select a datatype on the tree to see more information and the underlying physical flows which
share it (if any)
</div>
</div>
</div>
</div>
</form>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {event} from "d3-selection";
import {entity} from "../../../common/services/enums/entity";
import {loadFlowClassificationRatings} from "../../../flow-classification-rule/flow-classification-utils";
import toasts from "../../../svelte-stores/toast-store";
import DataTypeInfoPanel from "../data-type-info-panel/DataTypeInfoPanel.svelte";

const bindings = {
parentEntityRef: "<",
Expand All @@ -46,7 +47,9 @@ const initialState = {
selectedCounterpart: null,
selectedDecorators: null,
selectedFlow: null,
selectedUsages: []
selectedUsages: [],
dataTypeInfo: null,
DataTypeInfoPanel
};


Expand Down Expand Up @@ -321,6 +324,7 @@ function controller($element,
vm.selectedCounterpart = null;
vm.selectedDecorators = null;
vm.selectedFlow = null;
vm.dataTypeInfo = null;
vm.isDirty = false;
vm.setMode("");
};
Expand Down Expand Up @@ -404,6 +408,10 @@ function controller($element,
}
vm.mode = mode;
};

vm.onSelectDataType = (dt) => {
vm.dataTypeInfo = dt;
}
}


Expand Down

0 comments on commit 5374681

Please sign in to comment.