From 6549bedc471c6b21cf2cb9cc17f320399c3ea5d5 Mon Sep 17 00:00:00 2001 From: Abderahman88 Date: Wed, 22 Sep 2021 23:37:51 +0200 Subject: [PATCH 1/2] fix sitepages query --- samples/react-advanced-page-properties/README.md | 4 +++- .../config/package-solution.json | 2 +- .../AdvancedPagePropertiesWebPart.ts | 4 ++-- .../components/AdvancedPageProperties.tsx | 7 +++---- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/samples/react-advanced-page-properties/README.md b/samples/react-advanced-page-properties/README.md index 48714f1f8..119784d62 100644 --- a/samples/react-advanced-page-properties/README.md +++ b/samples/react-advanced-page-properties/README.md @@ -38,12 +38,14 @@ None Solution|Author(s) --------|--------- src/react-advanced-page-properties | [Mike Homol](https://homol.work), Principal Consultant, [ThreeWill](https://threewill.com/) +react-advanced-page-properties | Abderahman Moujahid ## Version history Version|Date|Comments -------|----|-------- -1.0|March 30, 2021|Initial release +1.0.0|March 30, 2021|Initial release +1.0.1|September 22, 2021|Added support for multi-language sites ## Disclaimer diff --git a/samples/react-advanced-page-properties/config/package-solution.json b/samples/react-advanced-page-properties/config/package-solution.json index 5cb8b1629..b96b110d7 100644 --- a/samples/react-advanced-page-properties/config/package-solution.json +++ b/samples/react-advanced-page-properties/config/package-solution.json @@ -3,7 +3,7 @@ "solution": { "name": "Advanced Page Properties", "id": "daae06a2-8599-445c-93c0-3bd739305f56", - "version": "1.0.0.0", + "version": "1.0.1.0", "includeClientSideAssets": true, "isDomainIsolated": false, "developer": { diff --git a/samples/react-advanced-page-properties/src/webparts/advancedPageProperties/AdvancedPagePropertiesWebPart.ts b/samples/react-advanced-page-properties/src/webparts/advancedPageProperties/AdvancedPagePropertiesWebPart.ts index e37295473..ebe204a94 100644 --- a/samples/react-advanced-page-properties/src/webparts/advancedPageProperties/AdvancedPagePropertiesWebPart.ts +++ b/samples/react-advanced-page-properties/src/webparts/advancedPageProperties/AdvancedPagePropertiesWebPart.ts @@ -68,13 +68,13 @@ export default class AdvancedPagePropertiesWebPart extends BaseClientSideWebPart private async getPageProperties(): Promise { Log.Write("Getting Site Page fields..."); - const list = sp.web.lists.getByTitle("Site Pages"); + const list = await sp.web.lists.ensureSiteAssetsLibrary(); const fi = await list.fields(); this.availableProperties = []; Log.Write(`${fi.length.toString()} fields retrieved!`); fi.forEach((f) => { - if (!f.FromBaseType && !f.Hidden && !f.Sealed && f.SchemaXml.indexOf("ShowInListSettings=\"FALSE\"") === -1 + if (!f.FromBaseType && !f.Hidden && f.SchemaXml.indexOf("ShowInListSettings=\"FALSE\"") === -1 && f.TypeAsString !== "Boolean" && f.TypeAsString !== "Note" && f.TypeAsString !== "User") { this.availableProperties.push({ key: f.InternalName, text: f.Title }); Log.Write(f.TypeAsString); diff --git a/samples/react-advanced-page-properties/src/webparts/advancedPageProperties/components/AdvancedPageProperties.tsx b/samples/react-advanced-page-properties/src/webparts/advancedPageProperties/components/AdvancedPageProperties.tsx index 6c5debd4e..b7f82838a 100644 --- a/samples/react-advanced-page-properties/src/webparts/advancedPageProperties/components/AdvancedPageProperties.tsx +++ b/samples/react-advanced-page-properties/src/webparts/advancedPageProperties/components/AdvancedPageProperties.tsx @@ -42,9 +42,9 @@ const AdvancedPageProperties: React.FunctionComponent { - console.log(prop); var retVal = _.map(prop.values, (val) => { if (val !== null) { switch (prop.info.TypeAsString) { From 9f5f60e582a39cc00c9257da449f3154488cd95d Mon Sep 17 00:00:00 2001 From: Hugo Bernier Date: Thu, 23 Sep 2021 02:13:23 -0400 Subject: [PATCH 2/2] Updated readme and sample.json --- samples/react-advanced-page-properties/README.md | 12 ++---------- .../assets/sample.json | 8 +++++++- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/samples/react-advanced-page-properties/README.md b/samples/react-advanced-page-properties/README.md index 119784d62..2fc57c355 100644 --- a/samples/react-advanced-page-properties/README.md +++ b/samples/react-advanced-page-properties/README.md @@ -47,12 +47,6 @@ Version|Date|Comments 1.0.0|March 30, 2021|Initial release 1.0.1|September 22, 2021|Added support for multi-language sites -## Disclaimer - -**THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.** - ---- - ## Minimal Path to Awesome - Clone this repository @@ -61,17 +55,15 @@ Version|Date|Comments - **npm install** - **gulp serve** -> Include any additional steps as needed. - ## Features -> Add the part +### Add the part Once the solution is installed in the app catalog and the app has been added to the site, you should see it available to a page. ![add the part](./assets/add-to-page.png) -> Familiarity is key +### Familiarity is key This web part tries to mimic the original Page Properties web part as much as possible. You should recognize the functionality of the property setup. diff --git a/samples/react-advanced-page-properties/assets/sample.json b/samples/react-advanced-page-properties/assets/sample.json index 20188a357..1fc69c091 100644 --- a/samples/react-advanced-page-properties/assets/sample.json +++ b/samples/react-advanced-page-properties/assets/sample.json @@ -15,7 +15,7 @@ "- Improved support for dates" ], "creationDateTime": "2021-03-30", - "updateDateTime": "2021-03-30", + "updateDateTime": "2021-09-22", "products": [ "SharePoint", "Office" @@ -57,6 +57,12 @@ "pictureUrl": "https://github.com/mhomol.png", "name": "Mike Homol", "twitter": "homol" + }, + { + "gitHubAccount": "Abderahman88", + "company": "", + "pictureUrl": "https://avatars.githubusercontent.com/u/36161889?s=460\u0026u=afdd5f6681bc375ee3811482dec79824c12d8170\u0026v=4", + "name": "Abderahman Moujahid" } ], "references": [