-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7050 from deutschebank/db-contrib/waltz-7044-euc-…
…page euc page
- Loading branch information
Showing
16 changed files
with
398 additions
and
17 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
66 changes: 66 additions & 0 deletions
66
waltz-data/src/main/java/org/finos/waltz/data/end_user_app/search/EndUserAppSearchDao.java
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,66 @@ | ||
package org.finos.waltz.data.end_user_app.search; | ||
|
||
import org.finos.waltz.data.SearchDao; | ||
import org.finos.waltz.data.end_user_app.EndUserAppDao; | ||
import org.finos.waltz.model.enduserapp.EndUserApplication; | ||
import org.finos.waltz.model.entity_search.EntitySearchOptions; | ||
import org.jooq.Condition; | ||
import org.jooq.DSLContext; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.List; | ||
|
||
import static java.util.Collections.emptyList; | ||
import static org.finos.waltz.common.ListUtilities.concat; | ||
import static org.finos.waltz.data.JooqUtilities.mkBasicTermSearch; | ||
import static org.finos.waltz.data.JooqUtilities.mkStartsWithTermSearch; | ||
import static org.finos.waltz.data.SearchUtilities.mkTerms; | ||
import static org.finos.waltz.schema.Tables.END_USER_APPLICATION; | ||
|
||
|
||
@Repository | ||
public class EndUserAppSearchDao implements SearchDao<EndUserApplication> { | ||
|
||
private final DSLContext dsl; | ||
|
||
|
||
@Autowired | ||
public EndUserAppSearchDao(DSLContext dsl) { | ||
this.dsl = dsl; | ||
} | ||
|
||
|
||
/** | ||
* Searches by <code>name</code> and <code>external_id</code> | ||
* @param options | ||
* @return List of matching end user applications, | ||
* matches on name are given precedence over external_id matches | ||
*/ | ||
@Override | ||
public List<EndUserApplication> search(EntitySearchOptions options) { | ||
List<String> terms = mkTerms(options.searchQuery()); | ||
if (terms.isEmpty()) { | ||
return emptyList(); | ||
} | ||
|
||
Condition nameCondition = mkBasicTermSearch(END_USER_APPLICATION.NAME, terms); | ||
Condition externalIdCondition = mkStartsWithTermSearch(END_USER_APPLICATION.EXTERNAL_ID, terms); | ||
|
||
return concat( | ||
mkQuery(nameCondition, options), | ||
mkQuery(externalIdCondition, options)); | ||
} | ||
|
||
|
||
private List<EndUserApplication> mkQuery(Condition nameCondition, EntitySearchOptions options) { | ||
return dsl | ||
.select(END_USER_APPLICATION.fields()) | ||
.from(END_USER_APPLICATION) | ||
.where(nameCondition) | ||
.orderBy(END_USER_APPLICATION.NAME) | ||
.limit(options.limit()) | ||
.fetch(EndUserAppDao.TO_DOMAIN_MAPPER); | ||
} | ||
|
||
} |
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
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
65 changes: 65 additions & 0 deletions
65
waltz-ng/client/end-user-apps/pages/end-user-application-view.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,65 @@ | ||
import EndUserApplicationOverview | ||
from "../svelte/EndUserApplicationOverview.svelte"; | ||
import {initialiseData} from "../../common"; | ||
import {CORE_API} from "../../common/services/core-api-utils"; | ||
|
||
const initialState = { | ||
EndUserApplicationOverview, | ||
parentEntityRef: null, | ||
endUserApplication: null | ||
}; | ||
|
||
|
||
const addToHistory = (historyStore, ref) => { | ||
if (! ref) { return; } | ||
historyStore.put( | ||
ref.name, | ||
"END_USER_APPLICATION", | ||
"main.end-user-application.view", | ||
{ id: ref.id }); | ||
}; | ||
|
||
|
||
function controller($stateParams, historyStore, serviceBroker) { | ||
|
||
const vm = initialiseData(this, initialState); | ||
|
||
const endUserAppId = $stateParams.id; | ||
|
||
vm.parentEntityRef = { id: endUserAppId, kind: "END_USER_APPLICATION" }; | ||
|
||
serviceBroker | ||
.loadViewData( | ||
CORE_API.EndUserAppStore.getById, | ||
[endUserAppId]) | ||
.then(r => { | ||
vm.endUserApplication = r.data; | ||
addToHistory(historyStore, vm.endUserApplication); | ||
}); | ||
} | ||
|
||
|
||
controller.$inject = [ | ||
"$stateParams", | ||
"HistoryStore", | ||
"ServiceBroker" | ||
]; | ||
|
||
const template = ` | ||
<div> | ||
<waltz-svelte-component component="$ctrl.EndUserApplicationOverview" | ||
end-user-application="$ctrl.endUserApplication"> | ||
</waltz-svelte-component> | ||
<br> | ||
<waltz-dynamic-sections-view parent-entity-ref="$ctrl.parentEntityRef"> | ||
</waltz-dynamic-sections-view> | ||
</div>`; | ||
|
||
export default { | ||
template, | ||
controller, | ||
controllerAs: "$ctrl", | ||
bindToController: true, | ||
}; |
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,41 @@ | ||
/* | ||
* 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 EndUserApplicationView from "./pages/end-user-application-view"; | ||
|
||
const baseState = {}; | ||
|
||
|
||
const viewState = { | ||
url: "end-user-application/id/{id:int}", | ||
views: { | ||
"content@": EndUserApplicationView | ||
} | ||
|
||
}; | ||
|
||
function setup($stateProvider) { | ||
$stateProvider | ||
.state("main.end-user-application", baseState) | ||
.state("main.end-user-application.view", viewState); | ||
} | ||
|
||
setup.$inject = ["$stateProvider"]; | ||
|
||
|
||
export default setup; |
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.