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

Format client side component properties for SPFx commands in SharePoint #5975

Open
4 tasks done
milanholemans opened this issue Apr 10, 2024 · 5 comments · May be fixed by #6051
Open
4 tasks done

Format client side component properties for SPFx commands in SharePoint #5975

milanholemans opened this issue Apr 10, 2024 · 5 comments · May be fixed by #6051

Comments

@milanholemans
Copy link
Contributor

milanholemans commented Apr 10, 2024

We currently have a few commands in spo that do stuff with SPFx solutions (spo applicationcustomizer, spo commandset, ...). These are great commands to do stuff with your deployed SPFx solutions.
For example: it's really easy to see which properties are set on the SPFx custom action. One annoying thing here is that the properties are string escaped, so the result looks like this:

{
   "ClientSideComponentProperties": "{\"sampleTextOne\":\"One item is selected in the list.\", \"sampleTextTwo\":\"This command is always visible.\"}",
}

It would improve the readability a lot if you could specify a flag so that only the client-side properties are printed as JSON:

{
  "sampleTextOne": "One item is selected in the list.",
  "sampleTextTwo": "This command is always visible."
}

So, I suggest that we add a new flag to a few SPO SPFx commands:

Option Description
-p, --clientSideComponentProperties Only output the client-side component properties.

Commands to update:

  • spo applicationcustomizer get
  • spo commandset get
  • spo tenant applicationcustomizer get
  • spo tenant commandset get
@milanholemans milanholemans added enhancement needs peer review Needs second pair of eyes to review the spec or PR labels Apr 10, 2024
@waldekmastykarz
Copy link
Member

--properties as a flag seems too vague. It doesn't convey what its purpose is without looking at the docs and at the first glance could be confused for specifying which properties you want to retrieve.
Something along the lines of --parseProperties or --onlyProperties would be clearer.

The question is, if we should replace the output with just the properties, or should we add a new property named ClientSideComponentPropertiesParsed and attached the parsed object to it, so that user can use --query to select what they want without us forcing only a part of the output.

@waldekmastykarz waldekmastykarz added needs discussion and removed needs peer review Needs second pair of eyes to review the spec or PR labels Apr 13, 2024
@milanholemans
Copy link
Contributor Author

We have a few commands that do something similar. They have a flag that replaces the entire output. Example: spo sitescript get for example. So for the sake of consistency, my vote would go to replacing the entire output.

@waldekmastykarz
Copy link
Member

We have a few commands that do something similar. They have a flag that replaces the entire output. Example: spo sitescript get for example. So for the sake of consistency, my vote would go to replacing the entire output.

Hmmm, good point. For consistency, shall we then use the full property name, ie. --clientSideComponentProperties?

@milanholemans
Copy link
Contributor Author

Ok, updated the spec.

@Jwaegebaert
Copy link
Contributor

Great enhancement, specs look clear to me so let's open it up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants