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

Freeze pallet proposal creation #4625

Merged
merged 12 commits into from
Nov 14, 2023
Merged

Conversation

vrrayz
Copy link
Contributor

@vrrayz vrrayz commented Nov 10, 2023

Create proposal for freeze pallet #4557

> Designs
> Story
> Preview

┆Issue is synchronized with this Asana task by Unito

Copy link

vercel bot commented Nov 10, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
dao ✅ Ready (Inspect) Visit Preview Nov 14, 2023 9:36am
pioneer-2 ✅ Ready (Inspect) Visit Preview Nov 14, 2023 9:36am
pioneer-2-storybook ✅ Ready (Inspect) Visit Preview Nov 14, 2023 9:36am


const setPalletFrozenStatus = (selected: PalletFrozenStatus) => {
if (selected === 'Enabled') {
setValue('updatePalletFrozenStatus.frozen', true, { shouldValidate: true })
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So based on this:
image

"Enabled" should mean frozen to false and "Disabled" frozen to true

Since a toggle should used instead of a select (see: #4625 (comment)) this isn't so relevant anymore but keep this in mind when labeling the toggle. It's kinda counterintuitive.

Copy link
Member

@thesan thesan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last thing:

...defaultProposalValues,
updatePalletFrozenStatus: {
pallet: 'ProjectToken',
frozen: !palletFrozenStatus,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this doesn't work:
Screenshot from 2023-11-13 09-02-13

packages/ui/src/mocks/helpers/asChainData.ts Show resolved Hide resolved
@@ -20,3 +20,19 @@ export const isValidCSV = (message: string): Yup.TestConfig<any, AnyObject> => (
return true
},
})
export const differentFromContext = (msg: string, type?: string): Yup.TestConfig<any, AnyObject> => ({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make things more reusable:

  1. add a contextPath: string argument just like in maxContext for example.
    Then the validation code becomes:
    const validationValue = get(this.options.context, contextPath).toJSON()
    if (validationValue === value) {
  2. Make the msg into a function: msg: (value: any) => string.
    So the returned message becomes: message: msg(value)

With this differentFromContext becomes:

differentFromContext(
  (isFrozen) => `The ProjectToken pallet is currently ${isFrozen ? 'disabled' : enabled}, so presently this proposal would fail due to execution constraints.`,
  'palletFrozenStatus',
  'execution'
)

@thesan thesan changed the title Issue 4557 proposal type Freeze pallet proposal creation Nov 14, 2023
@thesan thesan added the nara-network Nara Network label Nov 14, 2023
@thesan thesan merged commit 68fb187 into Joystream:nara Nov 14, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community-dev issue suitable for community-dev pipeline jsg-code-review nara-network Nara Network
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants