forked from kubernetes-sigs/release-notes
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add settings component and add pre-release option
This adds the new settings component and makes the display of pre-releases optional. Signed-off-by: Sascha Grunert <sgrunert@suse.com>
- Loading branch information
1 parent
d73d82d
commit 780c828
Showing
22 changed files
with
431 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
import { ActionReducerMap } from '@ngrx/store'; | ||
import { State as NotesState, notesReducer } from './notes/notes.reducer'; | ||
import { State as FilterState, filterReducer } from './filter/filter.reducer'; | ||
import { State as SettingsState, settingsReducer } from './settings/settings.reducer'; | ||
|
||
export interface State { | ||
filter: FilterState; | ||
notes: NotesState; | ||
settings: SettingsState; | ||
} | ||
|
||
export const reducers: ActionReducerMap<State> = { | ||
filter: filterReducer, | ||
notes: notesReducer, | ||
settings: settingsReducer, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { ActionTypes, UpdateSettings, UpdateSettingsSuccess, Failed } from './settings.actions'; | ||
import { Settings } from '@app/shared/model/settings.model'; | ||
|
||
describe('SettingsActions', () => { | ||
// Given | ||
const testSettings = new Settings(); | ||
|
||
it('should be able to create a Failed action', () => { | ||
// Given | ||
const error = 'error'; | ||
|
||
// When | ||
const action = new Failed(error); | ||
|
||
// Then | ||
expect({ ...action }).toEqual({ | ||
type: ActionTypes.Failed, | ||
error, | ||
}); | ||
}); | ||
|
||
it('should be able to create a UpdateSettings action', () => { | ||
// When | ||
const action = new UpdateSettings(testSettings); | ||
|
||
// Then | ||
expect({ ...action }).toEqual({ | ||
type: ActionTypes.UpdateSettings, | ||
settings: testSettings, | ||
}); | ||
}); | ||
|
||
it('should be able to create a UpdateSettingsSuccess action', () => { | ||
// When | ||
const action = new UpdateSettingsSuccess(testSettings); | ||
|
||
// Then | ||
expect({ ...action }).toEqual({ | ||
type: ActionTypes.UpdateSettingsSuccess, | ||
settings: testSettings, | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { Action } from '@ngrx/store'; | ||
import { Settings } from '@app/shared/model/settings.model'; | ||
|
||
export enum ActionTypes { | ||
Failed = '[Settings Component] Failed', | ||
|
||
UpdateSettings = '[Settings Component] Update Settings', | ||
UpdateSettingsSuccess = '[Settings Component] Update Settings Success', | ||
} | ||
|
||
export class Failed implements Action { | ||
readonly type = ActionTypes.Failed; | ||
constructor(public error: string) {} | ||
} | ||
|
||
export class UpdateSettings implements Action { | ||
readonly type = ActionTypes.UpdateSettings; | ||
constructor(public settings: Settings) {} | ||
} | ||
|
||
export class UpdateSettingsSuccess implements Action { | ||
readonly type = ActionTypes.UpdateSettingsSuccess; | ||
constructor(public settings: Settings) {} | ||
} | ||
|
||
export type SettingsAction = Failed | UpdateSettings | UpdateSettingsSuccess; |
Oops, something went wrong.