Skip to content

Commit

Permalink
Merge pull request #205 from davidwatkins73/master
Browse files Browse the repository at this point in the history
ratings explorer, boingy graph limits, logo overlays and more
  • Loading branch information
davidwatkins73 committed Jun 15, 2016
2 parents 0bed102 + 89777c9 commit bac0509
Show file tree
Hide file tree
Showing 21 changed files with 219 additions and 104 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,34 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.time.LocalDateTime;
import java.util.Collection;
import java.util.Optional;

import static com.khartec.waltz.schema.tables.SourceDataRating.SOURCE_DATA_RATING;


@Repository
public class SourceDataRatingDao {

private static final RecordMapper<? super Record, SourceDataRating> MAPPER = r -> {
SourceDataRatingRecord record = r.into(SOURCE_DATA_RATING);

Optional<LocalDateTime> lastImportDateTime = Optional
.ofNullable(record.getLastImport())
.map(t -> t.toLocalDateTime());

return ImmutableSourceDataRating.builder()
.sourceName(record.getSourceName())
.entityKind(EntityKind.valueOf(record.getEntityKind()))
.authoritativeness(RagRating.valueOf(record.getAuthoritativeness()))
.accuracy(RagRating.valueOf(record.getAccuracy()))
.completeness(RagRating.valueOf(record.getCompleteness()))
.lastImportDate(lastImportDateTime)
.build();
};


private final DSLContext dsl;


Expand All @@ -44,7 +54,6 @@ public Collection<SourceDataRating> findAll() {
return dsl.select(SOURCE_DATA_RATING.fields())
.from(SOURCE_DATA_RATING)
.fetch(MAPPER);

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
import com.khartec.waltz.model.capabilityrating.RagRating;
import org.immutables.value.Value;

import java.time.LocalDateTime;
import java.util.Optional;

@Value.Immutable
@JsonSerialize(as = ImmutableSourceDataRating.class)
@JsonDeserialize(as = ImmutableSourceDataRating.class)
Expand All @@ -17,4 +20,6 @@ public abstract class SourceDataRating {
public abstract RagRating authoritativeness();
public abstract RagRating accuracy();
public abstract RagRating completeness();

public abstract Optional<LocalDateTime> lastImportDate();
}
20 changes: 9 additions & 11 deletions waltz-ng/client/applications/directives/app-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,32 +45,30 @@ function controller(uiGridConstants, $scope, $animate) {
{
field: 'name',
cellTemplate: '<div class="ui-grid-cell-contents"> <a ui-sref="main.app.view ({ id: row.entity[\'id\'] })">{{ COL_FIELD }}</a></div>'
},
{
}, {
field: 'kind',
cellTemplate: '<div class="ui-grid-cell-contents"> {{ COL_FIELD | toDisplayName:"applicationKind" }}</div>',
cellTemplate: '<div class="ui-grid-cell-contents"><span ng-bind="COL_FIELD | toDisplayName:\'applicationKind\'"></span></div>',
filter: {
type: uiGridConstants.filter.SELECT,
selectOptions: _.map(applicationKindDisplayNames, (label, value) => ({ label, value }))
}
},
{
}, {
field: 'assetCode'
}, {
field: 'overallRating',
cellTemplate: '<div class="ui-grid-cell-contents"> {{ COL_FIELD | toDisplayName:"investmentRating" }}</div>',
cellTemplate: '<div class="ui-grid-cell-contents"><span ng-bind="COL_FIELD | toDisplayName:\'investmentRating\'"></span></div>',
filter: {
type: uiGridConstants.filter.SELECT,
selectOptions: _.map(investmentRatingNames, (label, value) => ({ label, value }))
}
},
{
}, {
field: 'lifecyclePhase',
cellTemplate: '<div class="ui-grid-cell-contents"> {{ COL_FIELD | toDisplayName:"lifecyclePhase" }}</div>',
cellTemplate: '<div class="ui-grid-cell-contents"><span ng-bind="COL_FIELD | toDisplayName:\'lifecyclePhase\'"></span></span></div>',
filter: {
type: uiGridConstants.filter.SELECT,
selectOptions: _.map(lifecyclePhaseDisplayNames, (label, value) => ({ label, value }))
}
},
{
}, {
field: 'description',
cellTooltip: (row) => row.entity.description
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@ function handleNodeClick(node) {


const force = d3.layout.force()
.gravity(0.05)
.friction(0.6)
.distance(100)
.charge(-100);
.linkDistance(60)
.charge(-120);


function setup(holder) {
Expand Down
38 changes: 31 additions & 7 deletions waltz-ng/client/data-flow/directives/data-flows-tabgroup.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,39 @@ <h4>Data Categories</h4>
name="Loading Flow Data">
</waltz-loading-notification>

<div ng-if="ctrl.boingyEverShown && ctrl.flowData.flows.length > 0">
<div ng-if="ctrl.filteredFlowData.entities.length == 0 && ctrl.flowData.flows.length > 0">
<div class="alert alert-warning">
<strong>No data to show</strong> given the current filter options. Use the
configure button above to adjust these options.
</div>
</div>


<div ng-if="ctrl.filteredFlowData.entities.length >= 200 && !ctrl.visibility.ignoreLimits">
<div class="alert alert-warning">
This graph will have <strong>too many nodes</strong> to render smoothly.
Use the configure button too limit the amount of data to show. Alternatively
the data is available via the 'Table' tab.

<br>

If you still want to see the graph click
<a href ng-click="ctrl.visibility.ignoreLimits = true">here</a>
- however be aware that your machine may struggle.
</div>
</div>


<waltz-data-flow-diagram data="ctrl.filteredFlowData"
tweakers="ctrl.graphTweakers">
</waltz-data-flow-diagram>
<div ng-if="ctrl.boingyEverShown && ctrl.filteredFlowData.flows.length > 0">
<div ng-if="ctrl.filteredFlowData.entities.length < 200 || ctrl.visibility.ignoreLimits">
<waltz-data-flow-diagram data="ctrl.filteredFlowData"
tweakers="ctrl.graphTweakers">
</waltz-data-flow-diagram>

<div class="small text-muted">
Dragging nodes will pin them. Double click to unpin. If an application is gray
it is not a member of this group.
<div class="small text-muted">
Dragging nodes will pin them. Double click to unpin. If an application is gray
it is not a member of this group.
</div>
</div>
</div>

Expand Down
49 changes: 1 addition & 48 deletions waltz-ng/client/navbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,52 +11,5 @@
*
*/

import tmpl from "./navbar.html";
import _ from "lodash";

function controller(applicationStore, personStore, capabilityStore, orgUnitStore, timeout) {
const searchResults = {
show: false
};

function doSearch(query) {
if (_.isEmpty(query)) {
searchResults.show = false;
} else {
searchResults.show = true;
applicationStore
.search(query)
.then(r => searchResults.apps = r);
personStore
.search(query)
.then(r => searchResults.people = r);
capabilityStore
.search(query)
.then(r => searchResults.capabilities = r);
orgUnitStore
.search(query)
.then(r => searchResults.orgUnits = r);
}
}

function dismissResults() {
timeout(() => { searchResults.show = false; }, 400);
}

const vm = this;
vm.doSearch = () => doSearch(vm.query);
vm.showSearch = () => searchResults.show;
vm.dismissResults = dismissResults;
vm.searchResults = searchResults;
}

controller.$inject = ['ApplicationStore', 'PersonStore', 'CapabilityStore', 'OrgUnitStore', '$timeout'];

export default (module) => module.directive('waltzNavbar', () => {
return {
restrict: 'E',
template: tmpl,
controller,
controllerAs: 'ctrl'
};
});
export default (module) => module.directive('waltzNavbar', require('./navbar'));
6 changes: 6 additions & 0 deletions waltz-ng/client/navbar/navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
style="position: relative; top: -6px;"
src="../../images/branding/waltz_badge+text_horizontal_positive_bw_300px.png">
</a>
<span ng-bind='ctrl.logoOverlayText'
style='position: relative; left: -35px; top:30px; color: {{ ctrl.logoOverlayColor }}; font-weight: bold; font-style: italic'>

</span>

<span ng-bind="ctrl.logoOverlay" ></span>
</div>

<ul class="nav navbar-nav nav-bar-left">
Expand Down
71 changes: 71 additions & 0 deletions waltz-ng/client/navbar/navbar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import _ from "lodash";


function controller($timeout,
applicationStore,
capabilityStore,
personStore,
orgUnitStore,
settingsStore) {
const searchResults = {
show: false
};

settingsStore
.findAll()
.then(settings => {
vm.logoOverlayText = settingsStore.findOrDefault(settings, "ui.logo.overlay.text", "");
vm.logoOverlayColor = settingsStore.findOrDefault(settings, "ui.logo.overlay.color", "");
});

function doSearch(query) {
if (_.isEmpty(query)) {
searchResults.show = false;
} else {
searchResults.show = true;
applicationStore
.search(query)
.then(r => searchResults.apps = r);
personStore
.search(query)
.then(r => searchResults.people = r);
capabilityStore
.search(query)
.then(r => searchResults.capabilities = r);
orgUnitStore
.search(query)
.then(r => searchResults.orgUnits = r);
}
}

function dismissResults() {
$timeout(() => { searchResults.show = false; }, 400);
}

const vm = this;
vm.doSearch = () => doSearch(vm.query);
vm.showSearch = () => searchResults.show;
vm.dismissResults = dismissResults;
vm.searchResults = searchResults;

vm.logoOverlayText = "beta";
vm.logoOverlayColor = '#a90000';
}

controller.$inject = [
'$timeout',
'ApplicationStore',
'CapabilityStore',
'PersonStore',
'OrgUnitStore',
'SettingsStore'
];

export default () => {
return {
restrict: 'E',
template: require("./navbar.html"),
controller,
controllerAs: 'ctrl'
};
};
3 changes: 0 additions & 3 deletions waltz-ng/client/playpen/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,5 @@ export default (module) => {
}
]);

module.directive('waltzRagLine', require('./rag-line'));
module.directive('waltzRatingExplorerSection', require('./rating-explorer-section'));
module.directive('waltzSimpleStackChart', require('./simple-stack-chart'));

};
12 changes: 7 additions & 5 deletions waltz-ng/client/playpen/playpen.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
</waltz-page-header>


<waltz-rating-explorer-section applications="ctrl.applications"
app-capabilities="ctrl.appCapabilities"
capabilities="ctrl.allCapabilities"
ratings="ctrl.ratings">
</waltz-rating-explorer-section>
<!-- FLOWS -->
<waltz-data-flows-tabgroup-section ratings="ctrl.sourceDataRatings"
flow-data="ctrl.dataFlows"
on-load-detail="ctrl.loadFlowDetail"
applications="ctrl.applications">
</waltz-data-flows-tabgroup-section>

</div>
25 changes: 7 additions & 18 deletions waltz-ng/client/playpen/playpen.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
const initData = {
allCapabilities: [],
appCapabilities: [],
applications: [],
ratings: [],
visibility: {}
};


function controller($q,
$stateParams,
appStore,
appCapabilityStore,
capabilityStore,
ratingStore) {
dataFlowViewService) {

const vm = Object.assign(this, initData);

Expand All @@ -31,28 +26,22 @@ function controller($q,
.findBySelector(appIdSelector)
.then(apps => vm.applications = apps);

appCapabilityStore
.findApplicationCapabilitiesByAppIdSelector(appIdSelector)
.then(acs => vm.appCapabilities = acs);
dataFlowViewService.initialise(appIdSelector.entityReference.id, appIdSelector.entityReference.kind)
.then(flows => vm.dataFlows = flows);

ratingStore
.findByAppIdSelector(appIdSelector)
.then(rs => vm.ratings = rs);

capabilityStore
.findAll()
.then(cs => vm.allCapabilities = cs);
vm.loadFlowDetail = () => dataFlowViewService.loadDetail();


global.vm = vm;
}


controller.$inject = [
'$q',
'$stateParams',
'ApplicationStore',
'AppCapabilityStore',
'CapabilityStore',
'RatingStore'
'DataFlowViewService'
];


Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import d3 from "d3";
import {red, amber, green, grey} from "../common/colors";
import {red, amber, green, grey} from "../../../common/colors";


const BINDINGS = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import _ from "lodash";
import d3 from "d3";
import {buildHierarchies} from "../common";
import {buildHierarchies} from "../../../common";

const BINDINGS = {
applications: '=',
Expand Down
Loading

0 comments on commit bac0509

Please sign in to comment.