Skip to content

Commit

Permalink
All applications list view
Browse files Browse the repository at this point in the history
  • Loading branch information
davidwatkins73 committed Jul 18, 2023
1 parent 28147ae commit 4a2ed26
Show file tree
Hide file tree
Showing 11 changed files with 94 additions and 17 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 @@ -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>
10 changes: 10 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,10 @@
<div ng-if="$ctrl.parentEntityRef">
<waltz-svelte-component component="$ctrl.AppListPageHeader">
</waltz-svelte-component>
</div>

<div class="waltz-page-summary waltz-page-summary-attach">
<waltz-report-grid-view-section parent-entity-ref="$ctrl.parentEntityRef"
selected-grid-id="$ctrl.gridId">
</waltz-report-grid-view-section>
</div>
34 changes: 34 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,34 @@
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";


const initialState = {
app: {},
AppListPageHeader,
parentEntityRef: { kind: "ALL", id: 1}
};


function controller(settingsService) {
const vm = Object.assign(this, initialState);
showGridSelector.set(false);
settingsService
.findOrDie(namedSettings.defaultAppGridId, `No default app grid id defined, should be under setting: ${namedSettings.defaultAppGridId}`)
.then(d => vm.gridId = console.log(d) || d);
}



controller.$inject = [
"SettingsService"
];


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
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
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
3 changes: 2 additions & 1 deletion waltz-ng/client/system/named-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ export default {
avatarTemplateUrl: "ui.avatar.template.url",
costExportEnabled: "feature.data-extractor.entity-cost.enabled",
measurableRatingRoadmapsEnabled: "feature.measurable-rating-roadmaps.enabled",
overlayDiagramWidgetsDisabled: "feature.overlay-diagrams.disabled-widget-keys"
overlayDiagramWidgetsDisabled: "feature.overlay-diagrams.disabled-widget-keys",
defaultAppGridId: "feature.application-list.default-report-grid-id"
};

0 comments on commit 4a2ed26

Please sign in to comment.