Skip to content

Commit

Permalink
Change UI option to max TM files MaibornWolff#904
Browse files Browse the repository at this point in the history
  • Loading branch information
lurichte committed Apr 16, 2020
1 parent e66209b commit c6369d2
Show file tree
Hide file tree
Showing 23 changed files with 123 additions and 262 deletions.
4 changes: 0 additions & 4 deletions visualization/app/codeCharta/codeCharta.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,6 @@ export enum TreeMapAlgorithm {
Strip = "Strip"
}

export interface TreeMapStartDepth {
depth: number
}

export interface TreeMapSettings {
mapSize: number
}
Expand Down
2 changes: 0 additions & 2 deletions visualization/app/codeCharta/state/injector.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

// Plop: Append service import here
import { MaxTreeMapFilesService } from "./store/appSettings/maxTreeMapFiles/maxTreeMapFiles.service"
import { TreeMapStartDepthService } from "./store//treeMapStartDepth/treeMapStartDepth.service"
import { LayoutAlgorithmService } from "./store/appSettings/layoutAlgorithm/layoutAlgorithm.service"
import { SortingOptionService } from "./store/dynamicSettings/sortingOption/sortingOption.service"
import { SortingOrderAscendingService } from "./store/appSettings/sortingOrderAscending/sortingOrderAscending.service"
Expand Down Expand Up @@ -49,7 +48,6 @@ export class InjectorService {
// We have to inject the services somewhere
// Plop: Append service injection here
private maxTreeMapFilesService: MaxTreeMapFilesService,
private treeMapStartDepthService: TreeMapStartDepthService,
private layoutAlgorithmService: LayoutAlgorithmService,
private sortingOptionService: SortingOptionService,
private sortingOrderAscendingService: SortingOrderAscendingService,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { MaxTreeMapFilesAction, MaxTreeMapFilesActions, setMaxTreeMapFiles } from "./maxTreeMapFiles.actions"
const clone = require("rfdc")()

export function maxTreeMapFiles(state: number = setMaxTreeMapFiles().payload, action: MaxTreeMapFilesAction): number {
switch (action.type) {
case MaxTreeMapFilesActions.SET_MAX_TREE_MAP_FILES:
return clone(action.payload) //TODO: clone not required for primitives
return action.payload
default:
return state
}
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

14 changes: 14 additions & 0 deletions visualization/app/codeCharta/ui/dialog/dialog.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,20 @@
.global-settings {
min-width: 50%;

md-slider-container {
position: relative;
padding-left: 2px;

span {
white-space: nowrap;
position: absolute;
top: 0;
font-size: 10pt;
color: grey;
left: 5px;
}
}

.weblink {
display: block;
margin: 0 0 10px 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ <h2 class="md-toolbar-tools">Global Settings</h2>
<md-dialog-content>
<div class="md-dialog-content">
<layout-selection-component></layout-selection-component>
<tree-map-start-depth-component></tree-map-start-depth-component>
<max-tree-map-files-component></max-tree-map-files-component>
<md-input-container class="input-container md-block">
<md-checkbox
class="md-primary"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<md-slider-container class="md-block">
<span>Maximum TreeMap Files</span>
<md-slider
flex
step="1"
min="1"
max="1000"
ng-model="$ctrl._viewModel.maxTreeMapFiles"
id="maxTreeMapFiles-slider"
ng-change="$ctrl.onChangeMaxTreeMapFilesSlider()"
class="md-primary"
>
</md-slider>
<md-input-container>
<input
flex
step="1"
min="1"
max="1000"
type="number"
ng-model="$ctrl._viewModel.maxTreeMapFiles"
ng-change="$ctrl.onChangeMaxTreeMapFilesSlider()"
/>
</md-input-container>
</md-slider-container>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
max-tree-map-files-component {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import "./maxTreeMapFiles.module"
import { MaxTreeMapFilesController } from "./maxTreeMapFiles.component"
import { instantiateModule } from "../../../../mocks/ng.mockhelper"

describe("MaxTreeMapFilesController", () => {
let maxTreeMapFilesController: MaxTreeMapFilesController

beforeEach(() => {
restartSystem()
rebuildController()
})

function restartSystem() {
instantiateModule("app.codeCharta.ui.maxTreeMapFiles")
}

function rebuildController() {
maxTreeMapFilesController = new MaxTreeMapFilesController()
}

describe("someMethodName", () => {
it("should do something", () => {})
})
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import "./maxTreeMapFiles.component.scss"
import { MaxTreeMapFilesSubscriber, MaxTreeMapFilesService } from "../../state/store/appSettings/maxTreeMapFiles/maxTreeMapFiles.service"
import { IRootScopeService } from "angular"
import { StoreService } from "../../state/store.service"
import { setMaxTreeMapFiles } from "../../state/store/appSettings/maxTreeMapFiles/maxTreeMapFiles.actions"

export class MaxTreeMapFilesController implements MaxTreeMapFilesSubscriber {
private _viewModel: {
maxTreeMapFiles: number
} = {
maxTreeMapFiles: null
}

constructor(private $rootScope: IRootScopeService, private storeService: StoreService) {
MaxTreeMapFilesService.subscribe(this.$rootScope, this)
const maxTreeMapFiles = this.storeService.getState().appSettings.maxTreeMapFiles
this.onMaxTreeMapFilesChanged(maxTreeMapFiles)
this._viewModel.maxTreeMapFiles = maxTreeMapFiles
}

public onMaxTreeMapFilesChanged(maxTreeMapFiles: number) {
this._viewModel.maxTreeMapFiles = maxTreeMapFiles
}

public onChangeMaxTreeMapFilesSlider() {
this.storeService.dispatch(setMaxTreeMapFiles(this._viewModel.maxTreeMapFiles))
}
}

export const maxTreeMapFilesComponent = {
selector: "maxTreeMapFilesComponent",
template: require("./maxTreeMapFiles.component.html"),
controller: MaxTreeMapFilesController
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import "../../state/state.module"
import angular from "angular"
import { maxTreeMapFilesComponent } from "./maxTreeMapFiles.component"

angular
.module("app.codeCharta.ui.maxTreeMapFiles", ["app.codeCharta.state"])
.component(maxTreeMapFilesComponent.selector, maxTreeMapFilesComponent)

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit c6369d2

Please sign in to comment.