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

fix: recognize when a SET_FILE Action changes standard/delta mode #2937

Merged
merged 2 commits into from
Aug 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/)
- Fix SonarImporter requesting no metrics from SonarQube when the list of metrics was left empty [#2913](https://github.com/MaibornWolff/codecharta/pull/2913)
- Exclude edge metrics from custom scenarios, when there are no edge metrics available. Before it was impossible to apply those custom configs [#2928](https://github.com/MaibornWolff/codecharta/pull/2928)
- Fix of NoSuchMethodException due to a call of method `readNBytes()` that is not available in Java 9 with replacement call `read()` [#2930](https://github.com/MaibornWolff/codecharta/pull/2930)
- Update UI correctly when toggling between standard and delta mode [#2937](https://github.com/MaibornWolff/codecharta/pull/2937)

## [1.101.1] - 2022-07-27

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ export enum FilesSelectionActions {
SET_ALL = "SET_ALL",
SET_DELTA = "SET_DELTA",
SET_DELTA_REFERENCE = "SET_DELTA_REFERENCE",
SET_DELTA_COMPARISON = "SET_DELTA_COMPARISON"
SET_DELTA_COMPARISON = "SET_DELTA_COMPARISON",
SET_FILES = "SET_FILES"
}

export enum NewFilesImportedActions {
SET_FILES = "SET_FILES",
ADD_FILE = "ADD_FILE",
REMOVE_FILE = "REMOVE_FILE"
}

export interface SetFilesAction extends CCAction {
type: NewFilesImportedActions.SET_FILES
type: FilesSelectionActions.SET_FILES
payload: FileState[]
}

Expand Down Expand Up @@ -79,7 +79,7 @@ export type FilesAction =

export function setFiles(files: FileState[] = defaultFiles): SetFilesAction {
return {
type: NewFilesImportedActions.SET_FILES,
type: FilesSelectionActions.SET_FILES,
payload: files
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
addFile,
defaultFiles,
FilesAction,
FilesSelectionActions,
invertStandard,
removeFile,
setAll,
Expand All @@ -17,6 +18,7 @@ import files from "./files.reducer"
import { isDeltaState, isPartialState } from "../../../model/files/files.helper"
import { FileSelectionState, FileState } from "../../../model/files/files"
import { clone } from "../../../util/clone"
import { isActionOfType } from "../../../util/reduxHelper"

describe("files", () => {
let state: FileState[] = []
Expand Down Expand Up @@ -49,6 +51,10 @@ describe("files", () => {

expect(result).toEqual(defaultFiles)
})

it("should be a file selection action, as file selections changes when all files are set", () => {
expect(isActionOfType(setFiles().type, FilesSelectionActions)).toBe(true)
})
})

describe("Action: SET_DELTA", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { isEqual } from "../../../model/files/files.helper"

export default function files(state = setFiles().payload, action: FilesAction) {
switch (action.type) {
case NewFilesImportedActions.SET_FILES:
case FilesSelectionActions.SET_FILES:
return action.payload
case NewFilesImportedActions.ADD_FILE:
return [...state, { file: action.payload, selectedAs: FileSelectionState.None }]
Expand Down