-
Notifications
You must be signed in to change notification settings - Fork 21
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
Custom export format #549
Custom export format #549
Conversation
@@ -295,3 +300,50 @@ export const isPeriodLatest = async ( | |||
|
|||
return false; | |||
}; | |||
|
|||
export const getSummarizedReceiverData = ( | |||
data: PeriodDetailsGiverReceiverDto[] | undefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try to avoid funcftions accepting undefined
if possible. Passing undefined
to a function only passes the "problem" to somewhere else in the code.
on: operateItem.on, | ||
}; | ||
}), | ||
// eslint-disable-next-line @typescript-eslint/no-implied-eval |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I simplefied this part and reworked implementation in jsonTransformer
slightly.
@@ -55,6 +57,14 @@ const FormFields = ( | |||
setting.valueRealized as string, | |||
disabled | |||
); | |||
else if (setting.type === 'Radio') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We cannot assume these are the two only possible values. Along with the settings definition we would need to store possible values. If this seems like too much work for now, just go with a plain string.
@@ -53,6 +56,10 @@ const SettingsPage = (): JSX.Element | null => { | |||
<NavItem to={`${url}/application`} description="Application" /> | |||
<NavItem to={`${url}/period`} description="Period Defaults" /> | |||
<NavItem to={`${url}/discord`} description="Discord Bot" /> | |||
<NavItem |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cusom export settings page doesn't render properly here.
"Rendered more hooks than during the previous render."
packages/frontend/package.json
Outdated
@@ -39,9 +39,11 @@ | |||
"env-cmd": "^10.1.0", | |||
"ethers": "^5.6.8", | |||
"final-form": "^4.20.4", | |||
"js-base64": "^3.7.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently unused.
packages/api/src/period/types.ts
Outdated
@@ -124,3 +125,9 @@ export interface ReplaceQuantifierRequestBody { | |||
currentQuantifierId: string; | |||
newQuantifierId: string; | |||
} | |||
|
|||
export interface SummarizedPeriodData { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This represents one interface for one custom export only. There will be many export types defined by .. whoever. There will be no export intefaces since everything is based just on the transformer json format.
@@ -89,6 +90,11 @@ export function isSettingValueAllowedBySettingType( | |||
return valid; | |||
} | |||
|
|||
if (this.type === 'Object') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not object
but JSON
, right?
packages/frontend/package.json
Outdated
@@ -58,6 +60,7 @@ | |||
"recoil": "^0.7.4", | |||
"recoil-nexus": "^0.4.0", | |||
"recoil-persist": "^4.2.0", | |||
"safe-eval": "^0.4.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do safe-eval
need to be imported in frontend?
…praise into enh/custom_export_formats
const fields = [ | ||
{ | ||
label: 'ADDRESS', | ||
value: 'address', | ||
}, | ||
{ | ||
label: 'AMOUNT', | ||
value: 'amount', | ||
}, | ||
{ | ||
label: 'TOKEN', | ||
value: 'tokenName', | ||
}, | ||
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Export should not assume these are the fields to export. Instead use the information in the transformer json: map.item
.
handleExport(); | ||
} else if (option.value === 'export-summary') { | ||
handleExport(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export-full
and export-summary
should not be the same.
if (!period) return undefined; | ||
|
||
const response = await apiAuthClient.get( | ||
`/admin/periods/${period._id}/exportSummary?context=${exportContext}&supportPercentage=${supportPercentage}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/exportSummary
returns summarised praise data for the period, basically the input to the custom export
New endpoint: /customExport
does what /exportSummary
currently does.
Co-authored-by: Nebs <nebojsa.stojanovic0@gmail.com>
@nebs-dev remove checkbox in the export dialog and instead just print message. If CS support percentage > 0: Thank your for supporting the continued development of Praise, 2% of the distribution will be donated to the Praise dev team. If CS support percentage = 0: Consider supporting the development of Praise by donating a small amount of the distribution to the Praise dev team. Settings: Custom token export |
- Removed unused types on other export endpoints
…in `budget`and `token`
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work with this issue Nebs! Merging now.
Resolves #532
Added:
/exportSummary
that i using export data transformer from any external url