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

Feature/2507/Link Height And Color Metric As New Default #3058

Merged
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
d5dc20e
Implement new action for couple height and color metric
Hall-Ma Sep 28, 2022
559e3eb
Complete implementation of couple height and color metric action
Hall-Ma Sep 28, 2022
1d68403
Add selector for coupling height and color metric
Hall-Ma Sep 28, 2022
f6a5220
Add a button to toggle coupling of height and color metric
Hall-Ma Sep 28, 2022
78f9f6d
Add some styling to button
Hall-Ma Sep 28, 2022
4ef94ad
Add effect to dispatch color metric when height metric is changed whe…
Hall-Ma Sep 28, 2022
efc47c3
Adjust effect (now it has the desired behavior)
Hall-Ma Sep 28, 2022
49f8e9e
Adjust effect in a better way
Hall-Ma Sep 28, 2022
448882b
Disable color metric chooser when coupling of height and color metric…
Hall-Ma Sep 28, 2022
f0b062d
Hide button for metric coupling when rloc/loc is not available
Hall-Ma Sep 28, 2022
73ee6da
Redesign link metrics button
Hall-Ma Sep 28, 2022
580ca91
Rename 'coupled' metrics to 'linked' metrics, remove splitter action
Hall-Ma Sep 28, 2022
dd6ba0d
Rename 'coupled' metrics to 'linked' metrics Part II, remove hidden p…
Hall-Ma Sep 28, 2022
2def811
Merge remote-tracking branch 'origin' into feature/2507/couple-height…
Hall-Ma Sep 28, 2022
56690fa
Add changelog entry
Hall-Ma Sep 28, 2022
590f9ba
Adjust icon template for linking metrics
Hall-Ma Sep 28, 2022
90e6276
Adjust button description and let the user know if he links or unlink…
Hall-Ma Sep 28, 2022
8654e64
Set disable property of metric chooser to false by default
Hall-Ma Sep 28, 2022
4300915
Add test for effect
Hall-Ma Sep 29, 2022
73a824f
Add test for component and delete unused import
Hall-Ma Sep 29, 2022
402c47c
Adjust tests for metric chooser
Hall-Ma Sep 29, 2022
9547759
Adjust toggle link metric button style (WIP)
Hall-Ma Sep 29, 2022
3a5abbc
Merge branch 'main' of github.com:MaibornWolff/codecharta into featur…
Hall-Ma Sep 29, 2022
6ba2e54
Adjust toggle link metric button style
Hall-Ma Sep 29, 2022
11cd68b
Fix code style with prettier #2507
Hall-Ma Sep 29, 2022
720b123
Adjust metric chooser test
Hall-Ma Sep 29, 2022
81f00ad
Adjust style in ribbon bar
Hall-Ma Sep 30, 2022
dfa176c
Adjust screenshots in changelog entry
Hall-Ma Sep 30, 2022
62f5d1e
Adjust test for button component
Hall-Ma Oct 3, 2022
4f5891f
Change switch condition to if/else condition in reducer and add reduc…
Hall-Ma Oct 3, 2022
85c0bb1
Adjust style
Hall-Ma Oct 3, 2022
030f36d
Add disabled color to color height brush
Hall-Ma Oct 6, 2022
a57fd24
Remove await from expect when using toMatch because IDE suggests it w…
Hall-Ma Oct 6, 2022
537f3c7
Adjust test in metric chooser to test brush icon color (not working yet)
Hall-Ma Oct 6, 2022
68a97f3
Rename files
Hall-Ma Oct 6, 2022
521de70
Merge branch 'main' of github.com:MaibornWolff/codecharta into featur…
Hall-Ma Oct 6, 2022
241e2d5
Adjust image in changelog
Hall-Ma Oct 6, 2022
ce96964
Rename module
Hall-Ma Oct 6, 2022
646854a
Remove await from expect when using toMatch because IDE suggests it w…
Hall-Ma Oct 6, 2022
c9ff819
Fix test for testing bursh icon color
Hall-Ma Oct 7, 2022
7c71f4c
Merge branch 'main' into feature/2507/couple-height-and-color-metric-…
Hall-Ma Oct 7, 2022
1e5a231
Finalize renaming of metric link action, add new action to set 'isCol…
Hall-Ma Oct 7, 2022
ff74e3f
Finalize renaming of metric link action, add new action to set 'isCol…
Hall-Ma Oct 7, 2022
bc8d22f
Merge branch 'feature/2507/couple-height-and-color-metric-as-new-stan…
Hall-Ma Oct 7, 2022
2db231e
Merge branch 'main' into feature/2507/couple-height-and-color-metric-…
Hall-Ma Oct 7, 2022
6544a98
Last renaming of observables and remove unused observable
Hall-Ma Oct 7, 2022
292ec56
Add test for new action
Hall-Ma Oct 7, 2022
9d9c552
Merge branch 'main' into feature/2507/couple-height-and-color-metric-…
jannikr Oct 11, 2022
b74de19
Fix syntax error #2507
jannikr Oct 11, 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 @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/)

## [unreleased] (Added 🚀 | Changed | Removed 🗑 | Fixed 🐞 | Chore 👨‍💻 👩‍💻)

### Added 🚀

- Add a new button that links the height metric to the color metric so that the colour metric is automatically set to the selected height metric [#3058](https://github.com/MaibornWolff/codecharta/pull/3058) </br>
![image](https://user-images.githubusercontent.com/72517530/192830420-d3440302-ae01-4df2-8546-1a372e571518.png)

## [1.108.0] - 2022-09-28

### Added 🚀
Expand Down
4 changes: 3 additions & 1 deletion visualization/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import { AutoFitCodeMapOnFileSelectionChangeEffect } from "./codeCharta/state/ef
import { CodeChartaModule } from "./codeCharta/codeCharta.module"
import { UpdateVisibleTopLabelsEffect } from "./codeCharta/state/effects/updateVisibleTopLabels/updateVisibleTopLabels.effect"
import { ResetSelectedEdgeMetricWhenItDoesntExistAnymoreEffect } from "./codeCharta/state/effects/resetSelectedEdgeMetricWhenItDoesntExistAnymore/resetSelectedEdgeMetricWhenItDoesntExistAnymore.effect"
import { LinkHeightAndColorMetricEffect } from "./codeCharta/state/effects/linkHeightAndColorMetric/linkHeightAndColorMetric.effect"

@NgModule({
imports: [
Expand All @@ -66,7 +67,8 @@ import { ResetSelectedEdgeMetricWhenItDoesntExistAnymoreEffect } from "./codeCha
RenderCodeMapEffect,
AutoFitCodeMapOnFileSelectionChangeEffect,
UpdateVisibleTopLabelsEffect,
ResetSelectedEdgeMetricWhenItDoesntExistAnymoreEffect
ResetSelectedEdgeMetricWhenItDoesntExistAnymoreEffect,
LinkHeightAndColorMetricEffect
]),
SliderModule,
AttributeSideBarModule,
Expand Down
1 change: 1 addition & 0 deletions visualization/app/codeCharta/codeCharta.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ export interface AppSettings {
experimentalFeaturesEnabled: boolean
screenshotToClipboardEnabled: boolean
colorLabels: colorLabelOptions
isHeightAndColorMetricLinked: boolean
}

export interface TreeMapSettings {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Inject, Injectable } from "@angular/core"
import { Store } from "../../angular-redux/store"
import { createEffect } from "../../angular-redux/effects/createEffect"
import { combineLatest, filter, map } from "rxjs"
import { isHeightAndColorMetricLinkedSelector } from "../../store/appSettings/isHeightAndColorMetricLinked/isHeightAndColorMetricLinked.selector"

import { setColorMetric } from "../../store/dynamicSettings/colorMetric/colorMetric.actions"
import { heightMetricSelector } from "../../store/dynamicSettings/heightMetric/heightMetric.selector"

@Injectable()
export class LinkHeightAndColorMetricEffect {
Hall-Ma marked this conversation as resolved.
Show resolved Hide resolved
constructor(@Inject(Store) private store: Store) {}

linkHeightAndColorMetric$ = createEffect(() =>
combineLatest([this.store.select(heightMetricSelector), this.store.select(isHeightAndColorMetricLinkedSelector)]).pipe(
filter(([, isHeightAndColorMetricLinked]) => isHeightAndColorMetricLinked),
map(([heightMetric]) => setColorMetric(heightMetric))
)
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { defaultSharpnessMode } from "./sharpnessMode/sharpnessMode.actions"
import { defaultScreenshotToClipboardEnabled } from "./enableClipboard/screenshotToClipboardEnabled.actions"
import { defaultInvertArea } from "./invertArea/invertArea.actions"
import { defaultIsEdgeMetricVisible } from "./isEdgeMetricVisible/isEdgeMetricVisible.actions"
import { defaultIsHeightAndColorMetricLinked } from "./isHeightAndColorMetricLinked/isHeightAndColorMetricLinked.actions"

export enum AppSettingsActions {
SET_APP_SETTINGS = "SET_APP_SETTINGS"
Expand Down Expand Up @@ -71,5 +72,6 @@ export const defaultAppSettings: AppSettings = {
screenshotToClipboardEnabled: defaultScreenshotToClipboardEnabled,
layoutAlgorithm: defaultLayoutAlgorithm,
maxTreeMapFiles: defaultMaxTreeMapFiles,
sharpnessMode: defaultSharpnessMode
sharpnessMode: defaultSharpnessMode,
isHeightAndColorMetricLinked: defaultIsHeightAndColorMetricLinked
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { sharpnessMode } from "./sharpnessMode/sharpnessMode.reducer"
import { screenshotToClipboardEnabled } from "./enableClipboard/screenshotToClipboardEnabled.reducer"
import { invertArea } from "./invertArea/invertArea.reducer"
import { isEdgeMetricVisible } from "./isEdgeMetricVisible/isEdgeMetricVisible.reducer"
import { isHeightAndColorMetricLinked } from "./isHeightAndColorMetricLinked/isHeightAndColorMetricLinked.reducer"

const appSettings = combineReducers({
colorLabels,
Expand Down Expand Up @@ -52,7 +53,8 @@ const appSettings = combineReducers({
screenshotToClipboardEnabled,
layoutAlgorithm,
maxTreeMapFiles,
sharpnessMode
sharpnessMode,
isHeightAndColorMetricLinked
})

export default appSettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Action } from "redux"

export enum IsHeightAndColorMetricLinkedActions {
Hall-Ma marked this conversation as resolved.
Show resolved Hide resolved
TOGGLE_IS_HEIGHT_AND_COLOR_METRIC_LINKED = "TOGGLE_IS_HEIGHT_AND_COLOR_METRIC_LINKED"
}

export interface ToggleHeightAndColorMetricLinkedAction extends Action {
type: IsHeightAndColorMetricLinkedActions.TOGGLE_IS_HEIGHT_AND_COLOR_METRIC_LINKED
}

export type IsHeightAndColorMetricLinkedAction = ToggleHeightAndColorMetricLinkedAction

export function toggleHeightAndColorMetricLink(): ToggleHeightAndColorMetricLinkedAction {
return {
type: IsHeightAndColorMetricLinkedActions.TOGGLE_IS_HEIGHT_AND_COLOR_METRIC_LINKED
}
}

export const defaultIsHeightAndColorMetricLinked = false
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import {
defaultIsHeightAndColorMetricLinked,
IsHeightAndColorMetricLinkedAction,
IsHeightAndColorMetricLinkedActions
} from "./isHeightAndColorMetricLinked.actions"

export function isHeightAndColorMetricLinked(state = defaultIsHeightAndColorMetricLinked, action: IsHeightAndColorMetricLinkedAction) {
switch (action.type) {
case IsHeightAndColorMetricLinkedActions.TOGGLE_IS_HEIGHT_AND_COLOR_METRIC_LINKED:
Hall-Ma marked this conversation as resolved.
Show resolved Hide resolved
return !state
default:
return state
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { createSelector } from "../../../angular-redux/store"
import { appSettingsSelector } from "../appSettings.selector"

export const isHeightAndColorMetricLinkedSelector = createSelector(
[appSettingsSelector],
appSettings => appSettings.isHeightAndColorMetricLinked
)
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[value]="selectedMetricName"
(selectionChange)="handleMetricChanged($event.value)"
(openedChange)="handleOpenedChanged($event)"
[disabled]="disabled"
ce-bo marked this conversation as resolved.
Show resolved Hide resolved
>
<mat-form-field class="cc-metric-chooser-search-field">
<i matPrefix class="fa fa-search search-icon"></i>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export class MetricChooserComponent implements OnInit {
@Input() searchPlaceholder: string
@Input() handleMetricChanged: (newSelectedMetricName: string) => void
@Input() type: MetricChooserType = "node"
@Input() disabled: boolean
@ViewChild("searchTermInput") searchTermInput: ElementRef<HTMLInputElement>
searchTerm = ""
metricData$: Observable<NodeMetricData[] | EdgeMetricData[]>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[selectedMetricName]="colorMetric$ | async"
[searchPlaceholder]="'Color Metric (highest value)'"
[handleMetricChanged]="handleColorMetricChanged"
[disabled]="isHeightAndColorMetricLinked$ | async"
>
<cc-metric-chooser-value-hovered hoveredInformation [metricFor]="'colorMetric'"></cc-metric-chooser-value-hovered>
</cc-metric-chooser>
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ import { Component, Inject } from "@angular/core"
import { Store } from "../../../state/angular-redux/store"
import { setColorMetric } from "../../../state/store/dynamicSettings/colorMetric/colorMetric.actions"
import { colorMetricSelector } from "../../../state/store/dynamicSettings/colorMetric/colorMetric.selector"
import { isHeightAndColorMetricLinkedSelector } from "../../../state/store/appSettings/isHeightAndColorMetricLinked/isHeightAndColorMetricLinked.selector"

@Component({
selector: "cc-color-metric-chooser",
template: require("./colorMetricChooser.component.html")
})
export class ColorMetricChooserComponent {
colorMetric$ = this.store.select(colorMetricSelector)
isHeightAndColorMetricLinked$ = this.store.select(isHeightAndColorMetricLinkedSelector)

constructor(@Inject(Store) private store: Store) {}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<button title="Link Height And Color Metric" class="link-metrics-button" (click)="toggleHeightAndColorMetricLink()">
<i class="fa fa-long-arrow-left"></i>
<i [ngClass]="(isHeightAndColorMetricLinked$ | async) ? 'fa fa-link' : 'fa fa-chain-broken'"></i>
<i class="fa fa-long-arrow-right"></i>
</button>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
cc-link-height-and-color-metric-button {
display: flex;
justify-content: center;

.link-metrics-button {
display: flex;
flex-wrap: nowrap;
align-items: center;
justify-content: space-around;
align-content: space-between;
width: 80%;
height: 22px;
padding: 2px 0 0 0;
margin: 0;

.fa {
color: rgb(68, 68, 68);
}

&:hover {
background-color: #c8c8c8;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import "./linkHeightAndColorMetricButton.component.scss"
import { Component, Inject } from "@angular/core"
import { Store } from "../../../state/angular-redux/store"
import { isHeightAndColorMetricLinkedSelector } from "../../../state/store/appSettings/isHeightAndColorMetricLinked/isHeightAndColorMetricLinked.selector"
import { toggleHeightAndColorMetricLink } from "../../../state/store/appSettings/isHeightAndColorMetricLinked/isHeightAndColorMetricLinked.actions"

@Component({
selector: "cc-link-height-and-color-metric-button",
template: require("./linkHeightAndColorMetricButton.component.html")
})
export class LinkHeightAndColorMetricButtonComponent {
Hall-Ma marked this conversation as resolved.
Show resolved Hide resolved
isHeightAndColorMetricLinked$ = this.store.select(isHeightAndColorMetricLinkedSelector)

constructor(@Inject(Store) private store: Store) {}

toggleHeightAndColorMetricLink() {
this.store.dispatch(toggleHeightAndColorMetricLink())
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { CommonModule } from "@angular/common"
import { NgModule } from "@angular/core"
import { MaterialModule } from "../../../../material/material.module"
import { LinkHeightAndColorMetricButtonComponent } from "./linkHeightAndColorMetricButton.component"

@NgModule({
imports: [CommonModule, MaterialModule],
declarations: [LinkHeightAndColorMetricButtonComponent],
exports: [LinkHeightAndColorMetricButtonComponent]
})
export class LinkHeightAndColorMetricButtonModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@
></cc-height-settings-panel>
</mat-card>

<mat-card class="link-metrics-card">
<div class="section">
<div class="section-header">
<cc-link-height-and-color-metric-button></cc-link-height-and-color-metric-button>
</div>
<span class="section-title no-hover">{{ (isHeightAndColorMetricLinked$ | async) ? "Unlink Metrics" : "Link Metrics" }}</span>
</div>
</mat-card>

<mat-card
*ngIf="!(isDeltaState$ | async)"
id="color-metric-card"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ cc-ribbon-bar {
min-width: 120px;
}

mat-card.scenario-card {
mat-card.scenario-card,
mat-card.link-metrics-card {
max-width: 100px;
min-width: 100px;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { experimentalFeaturesEnabledSelector } from "../../state/store/appSettin
import { isDeltaStateSelector } from "../../state/selectors/isDeltaState.selector"
import { edgeMetricDataSelector } from "../../state/selectors/accumulatedData/metricData/edgeMetricData.selector"
import { map } from "rxjs"
import { isHeightAndColorMetricLinkedSelector } from "../../state/store/appSettings/isHeightAndColorMetricLinked/isHeightAndColorMetricLinked.selector"

type PanelSelection = "NONE" | "AREA_PANEL_OPEN" | "HEIGHT_PANEL_OPEN" | "COLOR_PANEL_OPEN" | "EDGE_PANEL_OPEN"

Expand All @@ -17,7 +18,7 @@ export class RibbonBarComponent implements OnInit, OnDestroy {
experimentalFeaturesEnabled$ = this.store.select(experimentalFeaturesEnabledSelector)
isDeltaState$ = this.store.select(isDeltaStateSelector)
hasEdgeMetric$ = this.store.select(edgeMetricDataSelector).pipe(map(edgeMetricData => edgeMetricData.length > 0))

isHeightAndColorMetricLinked$ = this.store.select(isHeightAndColorMetricLinkedSelector)
constructor(@Inject(Store) private store: Store) {}

ngOnInit(): void {
Expand Down
2 changes: 2 additions & 0 deletions visualization/app/codeCharta/ui/ribbonBar/ribbonBar.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { HeightSettingsPanelModule } from "./heightSettingsPanel/heightSettingsP
import { ColorSettingsPanelModule } from "./colorSettingsPanel/colorSettingsPanel.module"
import { CommonModule } from "@angular/common"
import { MaterialModule } from "../../../material/material.module"
import { LinkHeightAndColorMetricButtonModule } from "./linkHeightAndColorMetricButton/linkHeightAndColorMetricButton.module"

@NgModule({
imports: [
Expand All @@ -27,6 +28,7 @@ import { MaterialModule } from "../../../material/material.module"
AreaSettingsPanelModule,
HeightSettingsPanelModule,
HeightMetricChooserModule,
LinkHeightAndColorMetricButtonModule,
ColorMetricChooserModule,
ColorSettingsPanelModule,
EdgeMetricChooserModule,
Expand Down
1 change: 1 addition & 0 deletions visualization/app/codeCharta/util/customConfigBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ function initializeAppSettings(target: CustomConfig) {
layoutAlgorithm: undefined,
maxTreeMapFiles: 0,
sharpnessMode: undefined,
Hall-Ma marked this conversation as resolved.
Show resolved Hide resolved
isHeightAndColorMetricLinked: false,
mapColors: {
labelColorAndAlpha: { alpha: 0, rgb: "" },
base: "",
Expand Down
2 changes: 2 additions & 0 deletions visualization/app/codeCharta/util/dataMocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1579,6 +1579,7 @@ export const STATE: State = {
isEdgeMetricVisible: true,
dynamicMargin: true,
isWhiteBackground: false,
isHeightAndColorMetricLinked: false,
mapColors: {
positive: "#69AE40",
neutral: "#ddcc00",
Expand Down Expand Up @@ -1635,6 +1636,7 @@ export const DEFAULT_STATE: State = {
invertArea: false,
isEdgeMetricVisible: true,
isWhiteBackground: false,
isHeightAndColorMetricLinked: false,
mapColors: {
base: "#666666",
flat: "#AAAAAA",
Expand Down