Skip to content

Commit

Permalink
Merge pull request #6685 from davidwatkins73/waltz-6677-apps-list
Browse files Browse the repository at this point in the history
All applications list view
  • Loading branch information
jessica-woodland-scott-db authored Jul 20, 2023
2 parents 28147ae + 75a9f7c commit ed1e82e
Show file tree
Hide file tree
Showing 25 changed files with 210 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@
import org.jooq.SelectOrderByStep;
import org.jooq.SelectWhereStep;
import org.jooq.impl.DSL;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import java.util.function.Function;
Expand All @@ -61,8 +59,6 @@
@Service
public class ApplicationIdSelectorFactory implements Function<IdSelectionOptions, Select<Record1<Long>>> {

private static final Logger LOG = LoggerFactory.getLogger(ApplicationIdSelectorFactory.class);

private static final DataTypeIdSelectorFactory dataTypeIdSelectorFactory = new DataTypeIdSelectorFactory();
private static final MeasurableIdSelectorFactory measurableIdSelectorFactory = new MeasurableIdSelectorFactory();
private static final OrganisationalUnitIdSelectorFactory orgUnitIdSelectorFactory = new OrganisationalUnitIdSelectorFactory();
Expand All @@ -80,6 +76,8 @@ public Select<Record1<Long>> apply(IdSelectionOptions options) {
checkNotNull(options, "options cannot be null");
EntityReference ref = options.entityReference();
switch (ref.kind()) {
case ALL:
return mkForAll(options);
case ACTOR:
return mkForActor(options);
case APP_GROUP:
Expand Down Expand Up @@ -129,6 +127,16 @@ public Select<Record1<Long>> apply(IdSelectionOptions options) {
}
}


private Select<Record1<Long>> mkForAll(IdSelectionOptions options) {
Condition applicationConditions = SelectorUtilities.mkApplicationConditions(options);

return DSL
.select(APPLICATION.ID)
.from(APPLICATION)
.where(applicationConditions);
}

private Select<Record1<Long>> mkForLegalEntity(IdSelectionOptions options) {
return DSL
.select(LEGAL_ENTITY_RELATIONSHIP.TARGET_ID)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.finos.waltz.data.entity_hierarchy.AbstractIdSelectorFactory;
import org.finos.waltz.data.orgunit.OrganisationalUnitIdSelectorFactory;
import org.finos.waltz.model.*;
import org.finos.waltz.model.application.LifecyclePhase;
import org.finos.waltz.schema.tables.EntityHierarchy;
import org.jooq.Record1;
import org.jooq.Select;
Expand All @@ -48,6 +49,8 @@ public ChangeInitiativeIdSelectorFactory() {
@Override
protected Select<Record1<Long>> mkForOptions(IdSelectionOptions options) {
switch (options.entityReference().kind()) {
case ALL:
return mkForAll(options);
case ACTOR:
case APPLICATION:
case MEASURABLE:
Expand Down Expand Up @@ -124,6 +127,14 @@ private Select<Record1<Long>> mkForChangeInitiative(IdSelectionOptions options)
}


private Select<Record1<Long>> mkForAll(IdSelectionOptions options) {
return DSL
.select(CHANGE_INITIATIVE.ID)
.from(CHANGE_INITIATIVE)
.where(CHANGE_INITIATIVE.LIFECYCLE_PHASE.ne(LifecyclePhase.RETIRED.name()));
}


private Select<Record1<Long>> mkForRef(IdSelectionOptions options) {
EntityReference ref = options.entityReference();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public Select<Record1<Long>> apply(IdSelectionOptions options) {
case CHANGE_INITIATIVE:
// all physical flows where the app is a source or target
return mkForChangeInitiative(options);
case ALL:
case APPLICATION:
case APP_GROUP:
case FLOW_DIAGRAM:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public Select<Record1<Long>> apply(IdSelectionOptions options) {
case APPLICATION:
// all physical flows where the app is a source or target
return mkForFlowEndpoint(options);
case ALL:
case APP_GROUP:
case FLOW_DIAGRAM:
case MEASURABLE:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public Select<Record1<Long>> apply(IdSelectionOptions options) {
switch (options.entityReference().kind()) {
case ACTOR:
return mkForActor(options);
case ALL:
case APPLICATION:
case APP_GROUP:
case MEASURABLE:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ protected Select<Record1<Long>> mkForOptions(IdSelectionOptions options) {
case LICENCE:
return mkForLicence(options);
case ACTOR:
case ALL:
case APP_GROUP:
case CHANGE_INITIATIVE:
case FLOW_DIAGRAM:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public Select<Record1<Long>> apply(IdSelectionOptions options) {
switch (options.entityReference().kind()) {
case ACTOR:
return mkForActor(options);
case ALL:
case APPLICATION:
case APP_GROUP:
case CHANGE_INITIATIVE:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public Select<Record1<Long>> apply(IdSelectionOptions options) {
return mkForMeasurable(options);
case APP_GROUP:
case PROCESS_DIAGRAM:
case ALL:
return mkViaAppSelector(options);
case AGGREGATE_OVERLAY_DIAGRAM:
return mkForAggregatedEntityDiagram(options);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public Select<Record1<Long>> apply(IdSelectionOptions options) {
checkNotNull(options, "options cannot be null");
switch(options.entityReference().kind()) {
case ACTOR:
case ALL:
case APPLICATION:
case CHANGE_INITIATIVE:
case DATA_TYPE:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

public enum EntityKind {

ALL("All"), // when used in an entity ref the id will be ignored
ACTOR("Actor"),
AGGREGATE_OVERLAY_DIAGRAM("Aggregate Overlay Diagram"),
AGGREGATE_OVERLAY_DIAGRAM_INSTANCE("Aggregate Overlay Diagram Instance"),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<script>
import ViewLink from "../../../common/svelte/ViewLink.svelte";
import PageHeader from "../../../common/svelte/PageHeader.svelte";
</script>

<PageHeader icon="cubes"
name="Applications"
small="All">
<div slot="breadcrumbs">
<ol class="waltz-breadcrumbs">
<li>
<ViewLink state="main">Home</ViewLink>
</li>
<li>
<span>Application</span>
</li>
</ol>
</div>
</PageHeader>
61 changes: 61 additions & 0 deletions waltz-ng/client/applications/pages/list/app-list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<div ng-if="$ctrl.parentEntityRef">
<waltz-svelte-component component="$ctrl.AppListPageHeader">
</waltz-svelte-component>
</div>

<div class="waltz-page-summary waltz-page-summary-attach">
<div class="help-block">This page contains details about all active applications</div>


<div class="row row-mini-gutters">
<div class="col-sm-4">
<waltz-apps-by-investment-pie applications="$ctrl.apps"
waltz-jump-to="apps-section"
class="clickable"
size="70">
</waltz-apps-by-investment-pie>
</div>

<div class="col-sm-4">
<waltz-apps-by-lifecycle-phase-pie applications="$ctrl.apps"
waltz-jump-to="apps-section"
class="clickable"
size="70">
</waltz-apps-by-lifecycle-phase-pie>
</div>

<div class="col-sm-4">
<waltz-complexity-basic-info-tile parent-entity-ref="$ctrl.parentEntityRef"
filters="$ctrl.filters">
</waltz-complexity-basic-info-tile>
</div>

</div>

<div class="row row-mini-gutters">
<div class="col-sm-4">
<waltz-server-basic-info-tile parent-entity-ref="$ctrl.parentEntityRef"
filters="$ctrl.filters">
</waltz-server-basic-info-tile>
</div>
<div class="col-sm-8">
<waltz-assessment-info-tile parent-entity-ref="$ctrl.parentEntityRef"
filters="$ctrl.filters">
</waltz-assessment-info-tile>
</div>
</div>



</div>
<!-- Non visual control to watch for filter changes -->
<waltz-filter-change-watcher on-filters-changed="$ctrl.filtersChanged">
</waltz-filter-change-watcher>


<br>

<waltz-dynamic-sections-view ng-if="$ctrl.parentEntityRef"
parent-entity-ref="$ctrl.parentEntityRef"
filters="$ctrl.filters">
</waltz-dynamic-sections-view>
50 changes: 50 additions & 0 deletions waltz-ng/client/applications/pages/list/app-list.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import template from "./app-list.html";
import AppListPageHeader from "../../components/app-list-page-header/AppListPageHeader.svelte";
import {showGridSelector} from "../../../report-grid/components/svelte/report-grid-ui-service";
import namedSettings from "../../../system/named-settings";
import {CORE_API} from "../../../common/services/core-api-utils";
import {mkSelectionOptions} from "../../../common/selector-utils";
import {hierarchyQueryScope} from "../../../common/services/enums/hierarchy-query-scope";
import {entityLifecycleStatus} from "../../../common/services/enums/entity-lifecycle-status";


const initialState = {
AppListPageHeader,
parentEntityRef: { kind: "ALL", id: 1},
apps: []
};


function controller(serviceBroker) {
const vm = Object.assign(this, initialState);

const selector = mkSelectionOptions(
vm.parentEntityRef,
hierarchyQueryScope.CHILDREN.key,
[entityLifecycleStatus.ACTIVE.key],
vm.filters);

serviceBroker
.loadViewData(
CORE_API.ApplicationStore.findBySelector,
[ selector] )
.then(r => vm.apps = r.data);

vm.filtersChanged = (filters) => {
vm.filters = filters;
};
}



controller.$inject = [
"ServiceBroker"
];


export default {
template,
controller,
controllerAs: "$ctrl"
};

2 changes: 1 addition & 1 deletion waltz-ng/client/applications/pages/view/app-view.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<breadcrumbs>
<ol class="waltz-breadcrumbs">
<li><a ui-sref="main">Home</a></li>
<li>Applications</li>
<li><a ui-sref="main.app">Applications</a></li>
<li><span ng-bind="ctrl.app.name"></span></li>
</ol>
</breadcrumbs>
Expand Down
5 changes: 3 additions & 2 deletions waltz-ng/client/applications/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ import AppViewAssetCode from "./pages/asset-code-view/app-asset-code-view";
import AppEdit from "./pages/edit/app-edit";
import AppRegistration from "./pages/registration/app-registration";
import AppView from "./pages/view/app-view";
import {activeSections} from "../dynamic-section/section-store";
import AppList from "./pages/list/app-list";

const base = {
url: "application"
url: "application",
views: {"content@": AppList }
};


Expand Down
1 change: 0 additions & 1 deletion waltz-ng/client/common/entity-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export function sameRef(r1, r2, options = { skipChecks: false }) {
}



export function isSameParentEntityRef(changes) {
return sameRef(
changes.parentEntityRef.previousValue,
Expand Down
1 change: 1 addition & 0 deletions waltz-ng/client/common/link-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {toMap} from "./map-utils";
* @type [ {<entityKind>, <uiState>}, ... ]
*/
const stateKindTuples = [
{kind: "ALL", state: "main.app"},
{kind: "ACTOR", state: "main.actor.view"},
{kind: "AGGREGATE_OVERLAY_DIAGRAM_INSTANCE", state: "main.aggregate-overlay-diagram.instance-view"},
{kind: "APPLICATION", state: "main.app.view"},
Expand Down
2 changes: 1 addition & 1 deletion waltz-ng/client/common/svelte/ViewLink.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
const routes = {
"main": {
path: () => "",
path: () => "home",
title: "Home page"
},
"main.system.list": {
Expand Down
24 changes: 24 additions & 0 deletions waltz-ng/client/dynamic-section/dynamic-section-definitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,29 @@ const appGroupSections = [
changeLogSection
];

const appListSections = [
pack(appsSection,
[
appCostsSummarySection,
appComplexitySummarySection,
attestationSummarySection,
entityStatisticSummarySection,
measurableRatingsBrowserSection,
reportGridViewSection,
technologySummarySection
]),
bookmarksSection,
entityDiagramsSection,
changeInitiativeSection,
changeSetSection,
entityNamedNotesSection,
pack(logicalFlowsTabgroupSection, [flowClassificationRulesSection]),
legalEntitySection,
relatedDataTypesSection,
relatedMeasurablesSection,
changeLogSection
];

const scenarioSections = [
pack(appsSection,
[
Expand Down Expand Up @@ -838,6 +861,7 @@ export const dynamicSectionsByKind = {
"main.app.asset-code": appSections,
"main.app.external-id": appSections,
"main.app.view": appSections,
"main.app": appListSections,
"main.change-initiative.external-id": changeInitiativeSections,
"main.change-initiative.view": changeInitiativeSections,
"main.change-set.view": changeSetSections,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ function utils(serviceBroker) {
.then(r => serviceBroker
.loadViewData(CORE_API.ScenarioStore.findForRoadmap, [r.data.scenario.roadmapId]))
.then(r => r.data);
case 'ALL':
return Promise.resolve([{kind: 'ALL', id: 1, name: "All"}]);
default :
throw `esu: Cannot create hierarchy for kind - ${kind}`;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,15 @@
doCancel={cancel}/>
{:else if activeMode === Modes.VIEW || activeMode === Modes.REMOVE}
{#if $gridDefinition?.id}
<h4 title="Click to open in dedicated view">
<button on:click={() => visitPageView()}
class="btn btn-link">
{$gridDefinition?.name}
<Icon name="external-link"/>
</button>
</h4>
{#if primaryEntityRef.kind !== "ALL"}
<h4 title="Click to open in dedicated view">
<button on:click={() => visitPageView()}
class="btn btn-link">
{$gridDefinition?.name}
<Icon name="external-link"/>
</button>
</h4>
{/if}
<table class="table table-condensed small">
<tbody>
<tr>
Expand Down
Loading

0 comments on commit ed1e82e

Please sign in to comment.