Adds m365 spo page control set. Closes #1934#1935
Adds m365 spo page control set. Closes #1934#1935estruyf wants to merge 5 commits intopnp:masterfrom
m365 spo page control set. Closes #1934#1935Conversation
m365 spo page control set. Closes #1934m365 spo page control set. Closes #1934
|
Nice! We'll review it shortly 👏 |
waldekmastykarz
left a comment
There was a problem hiding this comment.
Would you mind adding an .md file with command's help and linking to it from mkdocs.yml?
|
@waldekmastykarz added the documentation page. |
Accidentally made the optional properties `webPartData` and `webPartProperties` required.
waldekmastykarz
left a comment
There was a problem hiding this comment.
Very nicely done with a few minor fixes I've done when merging the PR 👏
| @@ -0,0 +1,114 @@ | |||
| export const mockPage = { | |||
There was a problem hiding this comment.
We should exclude this file from our coverage testing. It doesn't influence the coverage right now, but you never know 🙂
| resolve(ClientSidePage.fromHtml(res.ListItemAllFields.CanvasContent1)); | ||
| } | ||
| catch (e) { | ||
| } catch (e) { |
There was a problem hiding this comment.
Let's not reformat code if not necessary
| logger.log(`Checking out ${name} page...`); | ||
| } | ||
|
|
||
| let pageName: string = this.getPageNameWithExtension(name); |
There was a problem hiding this comment.
Since pageName is not re-assigned, it could be const
| return; | ||
| } | ||
|
|
||
| let pageName: string = this.getPageNameWithExtension(name); |
There was a problem hiding this comment.
Since pageName is not re-assigned, it could be const
| Page | ||
| .getPage(args.options.name, args.options.webUrl, logger, this.debug, this.verbose) | ||
| .then((clientSidePage: ClientSidePage): Promise<ClientSidePageProperties> => { | ||
| let control: ClientSidePart | null = clientSidePage.findControlById(args.options.id); |
There was a problem hiding this comment.
Since control is not re-assigned it could be const
| }; | ||
|
|
||
| if (this.verbose) { | ||
| logger.log('Updated webpart data:'); |
There was a problem hiding this comment.
Let's spell web part as two words consistently
|
|
||
| if (args.options.webPartProperties) { | ||
| if (this.verbose) { | ||
| logger.log('webPartProperties data:'); |
There was a problem hiding this comment.
Let's spell web part as two words consistently
| }; | ||
|
|
||
| if (this.verbose) { | ||
| logger.log('Updated webpart properties:'); |
There was a problem hiding this comment.
Let's spell web part as two words consistently
| @@ -0,0 +1,55 @@ | |||
| # spo page control set | |||
|
|
|||
| Allows you to set or update control web part data or properties on a modern page. | |||
There was a problem hiding this comment.
In the context of CLI set and update are the same, so let's use just update for simplicity and consistency with other set commands
|
|
||
| `--webPartProperties [webPartProperties]` | ||
| : JSON string with web part data as retrieved from the web part maintenance mode. Specify webPartProperties or webPartData but not both | ||
|
|
There was a problem hiding this comment.
Missing query and output properties
|
Merged manually. Thank you! 👏 |
Closes #1934
This PR contains the new command to set the control properties / data on a modern page.
Usage:
m365 spo page control set --webUrl <siteUrl> --name <name> --id <control id> --webPartData '{}'