forked from finos/waltz
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Legal entity related entities section and exports
#CTCTOWALTZ-2626 finos#6368
- Loading branch information
1 parent
57a059c
commit 7a53418
Showing
9 changed files
with
316 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
...ntity/components/legal-entity-relationship-section/legal-entity-relationship-section.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<!-- | ||
~ 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 | ||
~ | ||
--> | ||
<waltz-section-actions> | ||
<waltz-data-extract-link name="Export" | ||
styling="button" | ||
extract="legal-entity/id/{{$ctrl.parentEntityRef.id}}" | ||
method="GET"> | ||
</waltz-data-extract-link> | ||
<button class="btn btn-xs waltz-btn-transparent" | ||
ng-click="$ctrl.visibility.overlay = ! $ctrl.visibility.overlay"> | ||
<waltz-icon name="map-signs"></waltz-icon> | ||
</button> | ||
|
||
</waltz-section-actions> | ||
|
||
<waltz-source-data-overlay visible="$ctrl.visibility.overlay" | ||
entities="['LEGAL_ENTITY']"> | ||
</waltz-source-data-overlay> | ||
|
||
<div class="row"> | ||
<div class="col-sm-12"> | ||
<waltz-grid-with-search ng-if="$ctrl.relationships.length > 0" | ||
entries="$ctrl.relationships" | ||
column-defs="$ctrl.columnDefs"> | ||
</waltz-grid-with-search> | ||
<waltz-no-data ng-if="$ctrl.relationships.length == 0"> | ||
<message> | ||
No legal entities have been linked to this <span | ||
ng-bind="$ctrl.parentEntityRef.kind | toDisplayName:'entity'"></span> | ||
</message> | ||
</waltz-no-data> | ||
</div> | ||
</div> |
113 changes: 113 additions & 0 deletions
113
...-entity/components/legal-entity-relationship-section/legal-entity-relationship-section.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
/* | ||
* 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 | ||
* | ||
*/ | ||
import template from "./legal-entity-relationship-section.html"; | ||
import {initialiseData} from "../../../common"; | ||
import {CORE_API} from "../../../common/services/core-api-utils"; | ||
import _ from "lodash"; | ||
|
||
const bindings = { | ||
parentEntityRef: "<" | ||
}; | ||
|
||
const initialState = { | ||
relationshipKinds: [], | ||
relationships: [], | ||
visibility: { | ||
overlay: false | ||
}, | ||
columnDefs: [ | ||
{ | ||
field: "targetEntityReference", | ||
name: "Target Entity", | ||
width: "30%", | ||
cellTemplate: `<div style="padding-top: 0.5em"> | ||
<waltz-entity-link entity-ref="row.entity.targetEntityReference"></waltz-entity-link> | ||
</div>` | ||
}, | ||
{ | ||
field: "relationshipKind.name", | ||
name: "Relationship", | ||
width: "15%" | ||
}, | ||
{field: "description", width: "30%"}, | ||
{ | ||
field: "lastUpdatedAt", | ||
name: "Last Updated At", | ||
width: "10%", | ||
cellTemplate: ` | ||
<div class="ui-grid-cell-contents" | ||
style="vertical-align: baseline;"> | ||
<waltz-from-now timestamp="COL_FIELD" | ||
days-only="true"> | ||
</waltz-from-now> | ||
</div>` | ||
}, | ||
{ | ||
field: "lastUpdatedBy", | ||
name: "Last Updated By", | ||
width: "15%" | ||
} | ||
] | ||
} | ||
|
||
|
||
function controller($q, serviceBroker) { | ||
|
||
const vm = initialiseData(this, initialState); | ||
|
||
vm.$onChanges = () => { | ||
|
||
const relKindsPromise = serviceBroker | ||
.loadAppData(CORE_API.LegalEntityRelationshipKindStore.findAll, []) | ||
.then(r => r.data); | ||
|
||
const relationshipsPromise = serviceBroker | ||
.loadViewData(CORE_API.LegalEntityRelationshipStore.findByLegalEntityId, [vm.parentEntityRef.id]) | ||
.then(r => r.data); | ||
|
||
return $q | ||
.all([relKindsPromise, relationshipsPromise]) | ||
.then(([relKinds, relationships]) => { | ||
const relKindsById = _.keyBy(relKinds, d => d.id); | ||
|
||
vm.relationships = _ | ||
.chain(relationships) | ||
.map(d => Object.assign({}, d, {relationshipKind: relKindsById[d.relationshipKindId]})) | ||
.sortBy(d => d.targetEntityReference.name, d => d.relationshipKind.name) | ||
.value(); | ||
}); | ||
} | ||
} | ||
|
||
controller.$inject = [ | ||
"$q", | ||
"ServiceBroker" | ||
]; | ||
|
||
|
||
const component = { | ||
template, | ||
bindings, | ||
controller | ||
}; | ||
|
||
|
||
export default { | ||
id: "waltzLegalEntityRelationshipSection", | ||
component | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.