Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor/2318/migrate range slider component #2797

Merged
merged 56 commits into from
May 17, 2022
Merged
Show file tree
Hide file tree
Changes from 48 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
0bc37fa
refactor: add skelton for range-slider
shaman-apprentice May 3, 2022
55e3b47
refactor: decide to hard code width
May 4, 2022
a8b12d9
refactor: add skelton for 3 color section
May 4, 2022
c7c7498
refactor: calculate real width of sections
May 4, 2022
bbc8f56
refactor: add skelton for dragging left thumb
May 4, 2022
fb54ca3
refactor: add thumbPosition2Value
May 4, 2022
08131af
refactor: add PoC for dynamically controlled value
May 4, 2022
df7dc7c
refactor: finalize poc for controlled value
May 4, 2022
41a2a50
refactor: add right thumb
May 5, 2022
9750650
refactor: prevent thumbs from overtake each other
May 5, 2022
1fd095f
refactor: implement input fields
May 5, 2022
c1376ce
refactor: style thumb and add value
May 5, 2022
ec7f3d7
refactor: migrate to manual
shaman-apprentice May 8, 2022
7f3ef67
refactor: implement working version
shaman-apprentice May 8, 2022
d00808c
refactor: clean up
shaman-apprentice May 8, 2022
2ef9cb6
refactor: add skelton for labels
shaman-apprentice May 9, 2022
783b7cc
refactor: aling labels and hide min max labels in case of overlapping
shaman-apprentice May 9, 2022
43b62ee
refactor: init correctly
shaman-apprentice May 9, 2022
4f6fb47
refactor: finish features for labels
shaman-apprentice May 9, 2022
53edab6
refactor: add skelton for connected range slider
shaman-apprentice May 9, 2022
9c22e76
refactor: wip connecting
shaman-apprentice May 9, 2022
a77bdba
refactor: connect color range
shaman-apprentice May 10, 2022
4b2d16c
refactor: add debounce to color range update
shaman-apprentice May 10, 2022
8dec139
refactor: connect color
shaman-apprentice May 10, 2022
26136d0
refactor: fix flaky alignment of labels
shaman-apprentice May 10, 2022
69686f0
refactor: disable when in delta state
shaman-apprentice May 10, 2022
b59d3ef
refactor: remove decimals from displayed values
shaman-apprentice May 10, 2022
531990c
Merge remote-tracking branch 'origin/main' into refactor/2318/migrate…
shaman-apprentice May 12, 2022
3bc94a3
refactor: add tracking
shaman-apprentice May 12, 2022
d1e1cbe
refactor: update labels on slide
shaman-apprentice May 12, 2022
2c3cf18
refactor: fix rounding error (Math.ceil by thumbPosition2Value) for r…
shaman-apprentice May 12, 2022
6bb50df
refactor: add changelog for fix of #2798
shaman-apprentice May 12, 2022
da24857
refactor: remove obsolete AngularJS range-slider
shaman-apprentice May 12, 2022
37d5def
refactor: fix debounce and rounding issues
shaman-apprentice May 12, 2022
3f5698f
refactor: put last moved thumb on top
shaman-apprentice May 12, 2022
59bf8f6
Merge remote-tracking branch 'origin/main' into refactor/2318/migrate…
shaman-apprentice May 14, 2022
ebcdd6c
feat: hide metric color range slider in delta state
shaman-apprentice May 14, 2022
2e0e91f
refactor: add tests for calculations
shaman-apprentice May 14, 2022
2f01253
refactor: prevent input changes to be out of range
shaman-apprentice May 14, 2022
8c674e8
refactor: add some tests
shaman-apprentice May 14, 2022
e546b34
refactor: add some further tests
shaman-apprentice May 14, 2022
8a002a1
docs: add a fix to changelog
shaman-apprentice May 14, 2022
1de3d6e
test: give reasonable default color range and adjust tests
shaman-apprentice May 14, 2022
cd46b12
refactor: remove now unused property
shaman-apprentice May 14, 2022
cd615f1
refactor: remove another now unused property
shaman-apprentice May 14, 2022
a5f9e25
fix: use real color metric min value and clean up redundant data
shaman-apprentice May 14, 2022
5486ba5
refactor: adjust tests to deriving color range min and max values fro…
shaman-apprentice May 14, 2022
779777f
fix: put thumbs of range slider in case of min value equal to max val…
shaman-apprentice May 15, 2022
6dcd410
refactor: align naming
shaman-apprentice May 15, 2022
1f95ead
refactor: remove another obsolete AngularJS slider
shaman-apprentice May 15, 2022
71e82fa
Merge remote-tracking branch 'origin/main' into refactor/2318/migrate…
May 16, 2022
dce3bcc
refactor: rename some selectors
May 16, 2022
48cc341
refactor: adjust mocked import to previous renaming
May 17, 2022
461dac7
Merge branch 'main' into refactor/2318/migrate-range-slider-component
shaman-apprentice May 17, 2022
8581cf4
refactor: rename local variables according to renamed types/selectors
luelista May 17, 2022
5399502
chore: fix formatting
luelista May 17, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,22 @@ and this project adheres to [Semantic Versioning](http://semver.org/)
### Changed

- Remove all mentions of regular `.cc` `.json` `.gz` file extensions from file panel and sidebar [#2793](https://github.com/MaibornWolff/codecharta/pull/2793)
- Hide color metric range-slider in color metric options of ribbon bar in delta mode instead of disabling it [#2797](https://github.com/MaibornWolff/codecharta/pull/2797)

### Fixed 🐞

- Update slider of area metric options correctly on changes of related input field [#2787](https://github.com/MaibornWolff/codecharta/pull/2787)
- Prevent invalid input for margin in area metric options to be submitted [#2799](https://github.com/MaibornWolff/codecharta/pull/2799)
- Handle invalid input of range-slider correctly [#2797](https://github.com/MaibornWolff/codecharta/pull/2797)
- Use real color range min value instead of 0 and take color range min value into account for calculating initial first third of positive color [#2797](https://github.com/MaibornWolff/codecharta/pull/2797)
- Fix range slider in case of min value equal to max value [#2797](https://github.com/MaibornWolff/codecharta/pull/2797)

### Chore 👨‍💻 👩‍💻

- Introduce custom angular material theme [#2784](https://github.com/MaibornWolff/codecharta/pull/2784)
- Migrate height-settings-panel-component [#2790](https://github.com/MaibornWolff/codecharta/pull/2790)
- Fully migrate custom-config-component [#2760](https://github.com/MaibornWolff/codecharta/pull/2760)
- Track not only changes to color metric options by slider but also by related input field [#2797](https://github.com/MaibornWolff/codecharta/pull/2797)

## [1.95.2] - 2022-04-19

Expand Down
8 changes: 6 additions & 2 deletions visualization/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ import { MetricTypeHoveredModule } from "./codeCharta/ui/metricChooser/metricTyp
import { SliderModule } from "./codeCharta/ui/slider/slider.module"
import { HeightSettingsPanelModule } from "./codeCharta/ui/ribbonBar/heightSettingsPanel/heightSettingsPanel.module"
import { ResetSettingsButtonModule } from "./codeCharta/ui/resetSettingsButton/resetSettingsButton.module"
import { MetricColorRangeSliderModule } from "./codeCharta/ui/colorSettingsPanel/metricColorRangeSlider/metricColorRangeSlider.module"
import { FilePanelModule } from "./codeCharta/ui/filePanel/filePanel.module"
import { CustomConfigsModule } from "./codeCharta/ui/customConfigs/customConfigs.module"
import { ResetColorRangeEffect } from "./codeCharta/state/store/dynamicSettings/colorRange/resetColorRange.effect"

@NgModule({
imports: [
Expand All @@ -57,7 +59,8 @@ import { CustomConfigsModule } from "./codeCharta/ui/customConfigs/customConfigs
AddBlacklistItemsIfNotResultsInEmptyMapEffect,
OpenNodeContextMenuEffect,
TrackEventUsageDataEffect,
BlacklistSearchPatternEffect
BlacklistSearchPatternEffect,
ResetColorRangeEffect
]),
SliderModule,
AttributeSideBarModule,
Expand All @@ -76,7 +79,8 @@ import { CustomConfigsModule } from "./codeCharta/ui/customConfigs/customConfigs
CustomConfigsModule,
FilePanelModule,
HeightSettingsPanelModule,
ResetSettingsButtonModule
ResetSettingsButtonModule,
MetricColorRangeSliderModule
],
providers: [
threeSceneServiceProvider,
Expand Down
2 changes: 0 additions & 2 deletions visualization/app/codeCharta/codeCharta.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,6 @@ export interface MapColors {
export interface ColorRange {
from: number
to: number
min: number
max: number
}

export interface AttributeTypes {
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 @@ -23,7 +23,6 @@ import { MarkedPackagesService } from "./store/fileSettings/markedPackages/marke
import { EdgesService } from "./store/fileSettings/edges/edges.service"
import { AttributeTypesService } from "./store/fileSettings/attributeTypes/attributeTypes.service"
import { EdgeMetricService } from "./store/dynamicSettings/edgeMetric/edgeMetric.service"
import { ColorRangeService } from "./store/dynamicSettings/colorRange/colorRange.service"
import { MarginService } from "./store/dynamicSettings/margin/margin.service"
import { FocusedNodePathService } from "./store/dynamicSettings/focusedNodePath/focusedNodePath.service"
import { HeightMetricService } from "./store/dynamicSettings/heightMetric/heightMetric.service"
Expand Down Expand Up @@ -65,7 +64,6 @@ export class InjectorService {
private edgesService: EdgesService,
private attributeTypesService: AttributeTypesService,
private edgeMetricService: EdgeMetricService,
private colorRangeService: ColorRangeService,
private marginService: MarginService,
private focusedNodePathService: FocusedNodePathService,
private heightMetricService: HeightMetricService,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { createSelector } from "../../../angular-redux/createSelector"
import { colorMetricSelector } from "../../../store/dynamicSettings/colorMetric/colorMetric.selector"
import { CcState } from "../../../store/store"
import { nodeMetricDataSelector } from "./nodeMetricData.selector"

export type NodeMetricRange = {
minValue: number
maxValue: number
}

export const nodeMetricRangeSelector: (state: CcState) => NodeMetricRange = createSelector(
[nodeMetricDataSelector, colorMetricSelector],
(nodeMetricData, colorMetric) => {
const data = nodeMetricData.find(x => x.name === colorMetric)
return {
minValue: data?.minValue ?? 0,
maxValue: data?.maxValue ?? 0
}
}
)
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe("areDynamicSettingsAvailable", () => {

it("should return false when colorRange.from isn't set", () => {
const dynamicSettings = {
colorRange: { from: null, to: 25, min: 0, max: 100 }
colorRange: { from: null, to: 25 }
}
expect(areDynamicSettingsAvailable(dynamicSettings)).toBe(false)
})
Expand All @@ -28,7 +28,7 @@ describe("areDynamicSettingsAvailable", () => {
focusedNodePath: [],
searchPattern: "",
margin: 2,
colorRange: { from: 0, to: 25, min: 0, max: 100 },
colorRange: { from: 0, to: 25 },
recentFiles: ["test.cc.json"]
}
expect(areDynamicSettingsAvailable(dynamicSettings)).toBe(true)
Expand Down
2 changes: 0 additions & 2 deletions visualization/app/codeCharta/state/state.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { MarkedPackagesService } from "./store/fileSettings/markedPackages/marke
import { EdgesService } from "./store/fileSettings/edges/edges.service"
import { AttributeTypesService } from "./store/fileSettings/attributeTypes/attributeTypes.service"
import { EdgeMetricService } from "./store/dynamicSettings/edgeMetric/edgeMetric.service"
import { ColorRangeService } from "./store/dynamicSettings/colorRange/colorRange.service"
import { MarginService } from "./store/dynamicSettings/margin/margin.service"
import { FocusedNodePathService } from "./store/dynamicSettings/focusedNodePath/focusedNodePath.service"
import { HeightMetricService } from "./store/dynamicSettings/heightMetric/heightMetric.service"
Expand Down Expand Up @@ -68,7 +67,6 @@ angular
.service(camelCase(EdgesService.name), EdgesService)
.service(camelCase(AttributeTypesService.name), AttributeTypesService)
.service(camelCase(EdgeMetricService.name), EdgeMetricService)
.service(camelCase(ColorRangeService.name), ColorRangeService)
.service(camelCase(MarginService.name), MarginService)
.service(camelCase(FocusedNodePathService.name), FocusedNodePathService)
.service(camelCase(HeightMetricService.name), HeightMetricService)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ export enum ColorRangeActions {

export interface SetColorRangeAction extends CCAction {
type: ColorRangeActions.SET_COLOR_RANGE
payload: ColorRange
payload: Partial<ColorRange>
}

export type ColorRangeAction = SetColorRangeAction

export function setColorRange(colorRange: ColorRange = defaultColorRange): SetColorRangeAction {
export function setColorRange(colorRange: Partial<ColorRange> = defaultColorRange): SetColorRangeAction {
return {
type: ColorRangeActions.SET_COLOR_RANGE,
payload: colorRange
}
}

export const defaultColorRange: ColorRange = { from: null, to: null, min: null, max: null }
export const defaultColorRange: ColorRange = { from: 0, to: 0 }
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { _nodeMetricRangeToInitialColorRange } from "./resetColorRange.effect"

describe("ColorRangeEffect", () => {
it("should split positive, neutral, negative to a third each", () => {
expect(_nodeMetricRangeToInitialColorRange({ minValue: 20, maxValue: 120 })).toEqual({ from: 53, to: 86 })
})
})
Original file line number Diff line number Diff line change
@@ -1,26 +1,16 @@
import { colorRange } from "./colorRange.reducer"
import { ColorRangeAction, setColorRange } from "./colorRange.actions"
import { defaultColorRange, setColorRange } from "./colorRange.actions"

describe("colorRange", () => {
describe("Default State", () => {
it("should initialize the default state", () => {
const result = colorRange(undefined, {} as ColorRangeAction)
it("should set new colorRange", () => {
const result = colorRange({ from: 0, to: 0 }, setColorRange({ from: 21, to: 42 }))

expect(result).toEqual({ from: null, to: null, min: null, max: null })
})
expect(result).toEqual({ from: 21, to: 42 })
})

describe("Action: SET_COLOR_RANGE", () => {
it("should set new colorRange", () => {
const result = colorRange({ from: null, to: null, min: null, max: null }, setColorRange({ from: 33, to: 66, min: 0, max: 10 }))
it("should set default colorRange", () => {
const result = colorRange({ from: 33, to: 66 }, setColorRange())

expect(result).toEqual({ from: 33, to: 66, min: 0, max: 10 })
})

it("should set default colorRange", () => {
const result = colorRange({ from: 33, to: 66, min: 0, max: 10 }, setColorRange())

expect(result).toEqual({ from: null, to: null, min: null, max: null })
})
expect(result).toEqual(defaultColorRange)
})
})
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { ColorRangeAction, ColorRangeActions, setColorRange } from "./colorRange.actions"
import { ColorRangeAction, ColorRangeActions, defaultColorRange } from "./colorRange.actions"

export function colorRange(state = setColorRange().payload, action: ColorRangeAction) {
export function colorRange(state = defaultColorRange, action: ColorRangeAction) {
switch (action.type) {
case ColorRangeActions.SET_COLOR_RANGE:
return action.payload
return { ...state, ...action.payload }
default:
return state
}
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.