-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
179 additions
and
218 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
1 change: 0 additions & 1 deletion
1
..._modules/capture-core/components/WidgetsChangelog/common/Changelog/Changelog.constants.js
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,5 +1,4 @@ | ||
// @flow | ||
|
||
export const CHANGE_TYPES = Object.freeze({ | ||
CREATED: 'CREATE', | ||
DELETED: 'DELETE', | ||
|
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
53 changes: 26 additions & 27 deletions
53
...core_modules/capture-core/components/WidgetsChangelog/common/Changelog/Changelog.types.js
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,80 +1,79 @@ | ||
// @flow | ||
import { CHANGE_TYPES } from './Changelog.constants'; | ||
import { dataElementTypes } from '../../../../metaData'; | ||
import { CHANGE_TYPES } from './Changelog.constants'; | ||
|
||
type CreatedChange = {| | ||
type: typeof CHANGE_TYPES.CREATED, | ||
dataElement?: string, | ||
attribute?: string, | ||
field?: string, | ||
currentValue: any, | ||
|} | ||
|
||
|}; | ||
type UpdatedChange = {| | ||
type: typeof CHANGE_TYPES.UPDATED, | ||
dataElement?: string, | ||
attribute?: string, | ||
field?: string, | ||
previousValue: any, | ||
currentValue: any, | ||
|} | ||
|
||
|}; | ||
type DeletedChange = {| | ||
type: typeof CHANGE_TYPES.DELETED, | ||
dataElement?: string, | ||
attribute?: string, | ||
field?: string, | ||
previousValue: any, | ||
|} | ||
|}; | ||
|
||
export type Change = CreatedChange | DeletedChange | UpdatedChange; | ||
|
||
export type ItemDefinition = { | ||
id: string, | ||
name: string, | ||
type: $Keys<typeof dataElementTypes>, | ||
optionSet?: string, | ||
options?: Array<{ code: string, name: string }>, | ||
}; | ||
|
||
export type ItemDefinitions = { | ||
[key: string]: { | ||
id: string, | ||
name: string, | ||
type: $Keys<typeof dataElementTypes>, | ||
optionSet?: string, | ||
options?: Array<{ code: string, name: string }> | ||
}, | ||
} | ||
[key: string]: ItemDefinition, | ||
}; | ||
|
||
export type SortDirection = 'default' | 'asc' | 'desc'; | ||
|
||
export type SetSortDirection = (SortDirection) => void; | ||
|
||
type Pager = { | ||
export type Pager = { | ||
page: number, | ||
pageSize: number, | ||
nextPage: string, | ||
previous: string, | ||
} | ||
}; | ||
|
||
export type ChangelogRecord = { | ||
reactKey: string, | ||
date: string, | ||
user: string, | ||
username: string, | ||
dataItemId: string, | ||
dataItemLabel: string, | ||
changeType: string, | ||
previousValue: string, | ||
newValue: string | ||
} | ||
currentValue: string, | ||
}; | ||
|
||
export type ChangelogProps = { | ||
isOpen: boolean, | ||
close: () => void, | ||
pager: ?Pager, | ||
records: ?Array<ChangelogRecord>, | ||
pager?: Pager, | ||
records?: Array<ChangelogRecord>, | ||
setPage: (number) => void, | ||
setPageSize: (number) => void, | ||
columnToSortBy: string, | ||
setColumnToSortBy: (string) => void, | ||
sortDirection: SortDirection, | ||
setSortDirection: SetSortDirection, | ||
columnToFilterBy: string | null, | ||
setColumnToFilterBy: (string) => void, | ||
filterValue: string, | ||
setFilterValue: (string) => void, | ||
fieldToFilterBy?: string | null, | ||
setfieldToFilterBy: (string | null) => void, | ||
filterValue: any, | ||
setFilterValue: (any) => void, | ||
dataItemDefinitions: ItemDefinitions, | ||
} | ||
}; |
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
Oops, something went wrong.