Skip to content

Commit

Permalink
more explicit about the entity vs the ref
Browse files Browse the repository at this point in the history
  • Loading branch information
db-waltz committed Apr 9, 2024
1 parent c6ac110 commit 6f633e8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 23 deletions.
11 changes: 6 additions & 5 deletions waltz-ng/client/end-user-apps/pages/end-user-application-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import {initialiseData} from "../../common";
import {CORE_API} from "../../common/services/core-api-utils";

const initialState = {
EndUserApplicationOverview
EndUserApplicationOverview,
parentEntityRef: null,
endUserApplication: null
};


Expand All @@ -31,9 +33,8 @@ function controller($stateParams, historyStore, serviceBroker) {
CORE_API.EndUserAppStore.getById,
[endUserAppId])
.then(r => {
const endUserApp = r.data;
vm.parentEntityRef = Object.assign({}, vm.parentEntityRef, endUserApp);
addToHistory(historyStore, vm.parentEntityRef);
vm.endUserApplication = r.data;
addToHistory(historyStore, vm.endUserApplication);
});
}

Expand All @@ -47,7 +48,7 @@ controller.$inject = [
const template = `
<div>
<waltz-svelte-component component="$ctrl.EndUserApplicationOverview"
primary-entity-reference="$ctrl.parentEntityRef">
end-user-application="$ctrl.endUserApplication">
</waltz-svelte-component>
<br>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import {applicationStore} from "../../svelte-stores/application-store";
import Icon from "../../common/svelte/Icon.svelte";
export let primaryEntityReference;
export let endUserApplication;
let orgUnitCall;
let promotedAppCall;
Expand All @@ -21,33 +21,35 @@
let orgUnit = null;
$: {
if (primaryEntityReference?.organisationalUnitId) {
orgUnitCall = orgUnitStore.getById(primaryEntityReference.organisationalUnitId);
if (endUserApplication?.organisationalUnitId) {
orgUnitCall = orgUnitStore.getById(endUserApplication.organisationalUnitId);
}
if (primaryEntityReference?.isPromoted) {
promotedAppCall = applicationStore.findByExternalId(primaryEntityReference.externalId);
if (endUserApplication?.isPromoted) {
promotedAppCall = applicationStore.findByExternalId(endUserApplication.externalId);
}
}
$: $primaryRef = primaryEntityReference; // hack to reset the assessment subsection
$: $primaryRef = endUserApplication; // hack to reset the assessment subsection
$: orgUnit = $orgUnitCall?.data;
$: promotedApp = _.find($promotedAppCall?.data || [], { applicationKind: 'EUC' });
</script>
<svelte:head>
<title>Waltz: {primaryEntityReference?.name} - End User Application</title>
<title>Waltz: {endUserApplication?.name} - End User Application</title>
</svelte:head>
{#if primaryEntityReference}
{#if endUserApplication}
<PageHeader icon="table"
name={primaryEntityReference.name || "End User Application"}>
name={endUserApplication.name || "End User Application"}>
<div slot="breadcrumbs">
<ol class="waltz-breadcrumbs">
<li><ViewLink state="main">Home</ViewLink></li>
<li>End User Application</li>
<li>{primaryEntityReference.name}</li>
<li>{endUserApplication.name}</li>
</ol>
</div>
</PageHeader>
Expand All @@ -73,15 +75,15 @@
Name
</div>
<div class="col-sm-8">
{primaryEntityReference.name}
{endUserApplication.name}
</div>
</div>
<div class="row">
<div class="col-sm-4 waltz-display-field-label">
External Id
</div>
<div class="col-sm-8">
{primaryEntityReference.externalId}
{endUserApplication.externalId}
</div>
</div>
<div class="row">
Expand All @@ -97,23 +99,23 @@
Kind
</div>
<div class="col-sm-8">
{primaryEntityReference.applicationKind}
{endUserApplication.applicationKind}
</div>
</div>
<div class="row">
<div class="col-sm-4 waltz-display-field-label">
Lifecycle Phase
</div>
<div class="col-sm-8">
{primaryEntityReference.lifecyclePhase}
{endUserApplication.lifecyclePhase}
</div>
</div>
<div class="row">
<div class="col-sm-4 waltz-display-field-label">
Risk Rating
</div>
<div class="col-sm-8">
{primaryEntityReference.riskRating}
{endUserApplication.riskRating}
</div>
</div>
<div class="row">
Expand All @@ -122,7 +124,7 @@
</div>
<div class="col-sm-8">
<DescriptionFade expanderAlignment="left"
text={primaryEntityReference.description}/>
text={endUserApplication.description}/>
</div>
</div>
</div>
Expand All @@ -137,7 +139,7 @@
<div slot="controls">
<div style="float: right; padding-top: 1px">
<button class="btn-link"
on:click={() => activeSections.add(dynamicSections.assessmentRatingSection)}>
on:click={() => activeSections.add(dynamicSections.assessmentRatingSection)}>
More
</button>
</div>
Expand All @@ -146,5 +148,4 @@
</div>
</div>
</div>
{/if}

0 comments on commit 6f633e8

Please sign in to comment.