This commit is contained in:
Nick Brown 2023-05-15 20:25:51 +01:00
commit 9574051b8f
119 changed files with 97416 additions and 45486 deletions

1
.gitignore vendored
View File

@ -54,3 +54,4 @@ samples/**/release/
samples/**/node_modules samples/**/node_modules
samples/react-kiota-custom-api-client/TeamifiedApi/appsettings.Development.json samples/react-kiota-custom-api-client/TeamifiedApi/appsettings.Development.json
samples/react-kiota-custom-api-client/teamified-client/package-lock.json samples/react-kiota-custom-api-client/teamified-client/package-lock.json

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@
"zone.js": "^0.8.26" "zone.js": "^0.8.26"
}, },
"devDependencies": { "devDependencies": {
"@microsoft/sp-build-web": "~1.15.2", "@microsoft/sp-build-web": "~1.17.2",
"@microsoft/sp-module-interfaces": "~1.4.1", "@microsoft/sp-module-interfaces": "~1.4.1",
"@microsoft/sp-webpart-workbench": "~1.12.1", "@microsoft/sp-webpart-workbench": "~1.12.1",
"@types/chai": ">=3.4.34 <3.6.0", "@types/chai": ">=3.4.34 <3.6.0",

View File

@ -73,9 +73,9 @@
} }
}, },
"@azure/core-http": { "@azure/core-http": {
"version": "2.3.1", "version": "2.3.2",
"resolved": "https://registry.npmjs.org/@azure/core-http/-/core-http-2.3.1.tgz", "resolved": "https://registry.npmjs.org/@azure/core-http/-/core-http-2.3.2.tgz",
"integrity": "sha512-cur03BUwV0Tbv81bQBOLafFB02B6G++K6F2O3IMl8pSE2QlXm3cu11bfyBNlDUKi5U+xnB3GC63ae3athhkx6Q==", "integrity": "sha512-Z4dfbglV9kNZO177CNx4bo5ekFuYwwsvjLiKdZI4r84bYGv3irrbQz7JC3/rUfFH2l4T/W6OFleJaa2X0IaQqw==",
"dev": true, "dev": true,
"requires": { "requires": {
"@azure/abort-controller": "^1.0.0", "@azure/abort-controller": "^1.0.0",
@ -92,7 +92,7 @@
"tslib": "^2.2.0", "tslib": "^2.2.0",
"tunnel": "^0.0.6", "tunnel": "^0.0.6",
"uuid": "^8.3.0", "uuid": "^8.3.0",
"xml2js": "^0.4.19" "xml2js": "^0.5.0"
}, },
"dependencies": { "dependencies": {
"@azure/core-tracing": { "@azure/core-tracing": {
@ -106,9 +106,9 @@
} }
}, },
"@types/node-fetch": { "@types/node-fetch": {
"version": "2.6.2", "version": "2.6.3",
"resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.2.tgz", "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.3.tgz",
"integrity": "sha512-DHqhlq5jeESLy19TYhLakJ07kNumXWjcDdxXsLUMJZ6ue8VZJj4kLPQVE/2mdHh3xZziNF1xppu5lwmS53HR+A==", "integrity": "sha512-ETTL1mOEdq/sxUtgtOhKjyB2Irra4cjxksvcMUR5Zr4n+PxVhsCD9WS46oPbHL3et9Zde7CNRr+WUNlcHvsX+w==",
"dev": true, "dev": true,
"requires": { "requires": {
"@types/node": "*", "@types/node": "*",
@ -140,9 +140,9 @@
} }
}, },
"node-fetch": { "node-fetch": {
"version": "2.6.7", "version": "2.6.11",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.11.tgz",
"integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", "integrity": "sha512-4I6pdBY1EthSqDmJkiNk3JIT8cswwR9nfeW/cPdUagJYEQG7R95WRH74wpz7ma8Gh/9dI9FP+OU+0E4FvtA55w==",
"dev": true, "dev": true,
"requires": { "requires": {
"whatwg-url": "^5.0.0" "whatwg-url": "^5.0.0"
@ -161,9 +161,9 @@
} }
}, },
"tslib": { "tslib": {
"version": "2.4.1", "version": "2.5.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz",
"integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==", "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==",
"dev": true "dev": true
}, },
"universalify": { "universalify": {
@ -187,6 +187,16 @@
"tr46": "~0.0.3", "tr46": "~0.0.3",
"webidl-conversions": "^3.0.0" "webidl-conversions": "^3.0.0"
} }
},
"xml2js": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.5.0.tgz",
"integrity": "sha512-drPFnkQJik/O+uPKpqSgr22mpuFHqKdbS835iAQrUC73L2F5WkboIRd63ai/2Yg6I1jzifPFKH2NTK+cfglkIA==",
"dev": true,
"requires": {
"sax": ">=0.6.0",
"xmlbuilder": "~11.0.0"
}
} }
} }
}, },
@ -27761,16 +27771,6 @@
"integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==", "integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==",
"dev": true "dev": true
}, },
"xml2js": {
"version": "0.4.23",
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz",
"integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==",
"dev": true,
"requires": {
"sax": ">=0.6.0",
"xmlbuilder": "~11.0.0"
}
},
"xmlbuilder": { "xmlbuilder": {
"version": "11.0.1", "version": "11.0.1",
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz", "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz",

File diff suppressed because it is too large Load Diff

View File

@ -21,7 +21,7 @@
"jquery": "^3.5.0" "jquery": "^3.5.0"
}, },
"devDependencies": { "devDependencies": {
"@microsoft/sp-build-web": "1.15.2", "@microsoft/sp-build-web": "1.17.2",
"@microsoft/sp-module-interfaces": "1.7.0", "@microsoft/sp-module-interfaces": "1.7.0",
"@microsoft/sp-webpart-workbench": "1.12.1", "@microsoft/sp-webpart-workbench": "1.12.1",
"@types/chai": "3.4.34", "@types/chai": "3.4.34",

File diff suppressed because it is too large Load Diff

View File

@ -11,7 +11,7 @@
"@types/webpack-env": ">=1.12.1 <1.14.0" "@types/webpack-env": ">=1.12.1 <1.14.0"
}, },
"devDependencies": { "devDependencies": {
"@microsoft/sp-build-web": "~1.15.2", "@microsoft/sp-build-web": "~1.17.2",
"@microsoft/sp-module-interfaces": "~1.1.1", "@microsoft/sp-module-interfaces": "~1.1.1",
"@microsoft/sp-webpart-workbench": "~1.12.1", "@microsoft/sp-webpart-workbench": "~1.12.1",
"gulp": "~3.9.1", "gulp": "~3.9.1",

File diff suppressed because it is too large Load Diff

View File

@ -21,7 +21,7 @@
"react-dom": "16.3.2" "react-dom": "16.3.2"
}, },
"devDependencies": { "devDependencies": {
"@microsoft/sp-build-web": "1.15.2", "@microsoft/sp-build-web": "1.17.2",
"@microsoft/sp-module-interfaces": "1.7.1", "@microsoft/sp-module-interfaces": "1.7.1",
"@microsoft/sp-webpart-workbench": "1.12.1", "@microsoft/sp-webpart-workbench": "1.12.1",
"gulp": "~3.9.1", "gulp": "~3.9.1",

File diff suppressed because it is too large Load Diff

View File

@ -25,7 +25,7 @@
"@microsoft/eslint-config-spfx": "1.15.2", "@microsoft/eslint-config-spfx": "1.15.2",
"@microsoft/eslint-plugin-spfx": "1.15.2", "@microsoft/eslint-plugin-spfx": "1.15.2",
"@microsoft/rush-stack-compiler-4.5": "0.2.2", "@microsoft/rush-stack-compiler-4.5": "0.2.2",
"@microsoft/sp-build-web": "1.15.2", "@microsoft/sp-build-web": "1.17.2",
"@microsoft/sp-module-interfaces": "1.15.2", "@microsoft/sp-module-interfaces": "1.15.2",
"@rushstack/eslint-config": "2.5.1", "@rushstack/eslint-config": "2.5.1",
"@types/react": "16.9.51", "@types/react": "16.9.51",
@ -38,7 +38,7 @@
"gulp-postcss": "^9.0.1", "gulp-postcss": "^9.0.1",
"postcss": "^8.4.18", "postcss": "^8.4.18",
"postcss-import": "^15.0.0", "postcss-import": "^15.0.0",
"spfx-fast-serve-helpers": "~1.15.0", "spfx-fast-serve-helpers": "~1.17.0",
"tailwindcss": "^3.1.8", "tailwindcss": "^3.1.8",
"typescript": "4.5.5" "typescript": "4.5.5"
} }

View File

@ -73,9 +73,9 @@
} }
}, },
"@azure/core-http": { "@azure/core-http": {
"version": "2.3.1", "version": "2.3.2",
"resolved": "https://registry.npmjs.org/@azure/core-http/-/core-http-2.3.1.tgz", "resolved": "https://registry.npmjs.org/@azure/core-http/-/core-http-2.3.2.tgz",
"integrity": "sha512-cur03BUwV0Tbv81bQBOLafFB02B6G++K6F2O3IMl8pSE2QlXm3cu11bfyBNlDUKi5U+xnB3GC63ae3athhkx6Q==", "integrity": "sha512-Z4dfbglV9kNZO177CNx4bo5ekFuYwwsvjLiKdZI4r84bYGv3irrbQz7JC3/rUfFH2l4T/W6OFleJaa2X0IaQqw==",
"dev": true, "dev": true,
"requires": { "requires": {
"@azure/abort-controller": "^1.0.0", "@azure/abort-controller": "^1.0.0",
@ -92,7 +92,7 @@
"tslib": "^2.2.0", "tslib": "^2.2.0",
"tunnel": "^0.0.6", "tunnel": "^0.0.6",
"uuid": "^8.3.0", "uuid": "^8.3.0",
"xml2js": "^0.4.19" "xml2js": "^0.5.0"
}, },
"dependencies": { "dependencies": {
"@azure/core-tracing": { "@azure/core-tracing": {
@ -106,9 +106,9 @@
} }
}, },
"@types/node-fetch": { "@types/node-fetch": {
"version": "2.6.2", "version": "2.6.3",
"resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.2.tgz", "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.3.tgz",
"integrity": "sha512-DHqhlq5jeESLy19TYhLakJ07kNumXWjcDdxXsLUMJZ6ue8VZJj4kLPQVE/2mdHh3xZziNF1xppu5lwmS53HR+A==", "integrity": "sha512-ETTL1mOEdq/sxUtgtOhKjyB2Irra4cjxksvcMUR5Zr4n+PxVhsCD9WS46oPbHL3et9Zde7CNRr+WUNlcHvsX+w==",
"dev": true, "dev": true,
"requires": { "requires": {
"@types/node": "*", "@types/node": "*",
@ -140,9 +140,9 @@
} }
}, },
"node-fetch": { "node-fetch": {
"version": "2.6.7", "version": "2.6.11",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.11.tgz",
"integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", "integrity": "sha512-4I6pdBY1EthSqDmJkiNk3JIT8cswwR9nfeW/cPdUagJYEQG7R95WRH74wpz7ma8Gh/9dI9FP+OU+0E4FvtA55w==",
"dev": true, "dev": true,
"requires": { "requires": {
"whatwg-url": "^5.0.0" "whatwg-url": "^5.0.0"
@ -161,9 +161,9 @@
} }
}, },
"tslib": { "tslib": {
"version": "2.4.1", "version": "2.5.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz",
"integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==", "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==",
"dev": true "dev": true
}, },
"universalify": { "universalify": {
@ -187,6 +187,16 @@
"tr46": "~0.0.3", "tr46": "~0.0.3",
"webidl-conversions": "^3.0.0" "webidl-conversions": "^3.0.0"
} }
},
"xml2js": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.5.0.tgz",
"integrity": "sha512-drPFnkQJik/O+uPKpqSgr22mpuFHqKdbS835iAQrUC73L2F5WkboIRd63ai/2Yg6I1jzifPFKH2NTK+cfglkIA==",
"dev": true,
"requires": {
"sax": ">=0.6.0",
"xmlbuilder": "~11.0.0"
}
} }
} }
}, },
@ -25073,16 +25083,6 @@
"integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==", "integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==",
"dev": true "dev": true
}, },
"xml2js": {
"version": "0.4.23",
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz",
"integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==",
"dev": true,
"requires": {
"sax": ">=0.6.0",
"xmlbuilder": "~11.0.0"
}
},
"xmlbuilder": { "xmlbuilder": {
"version": "11.0.1", "version": "11.0.1",
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz", "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz",

View File

@ -98,9 +98,9 @@
} }
}, },
"node_modules/@azure/core-http": { "node_modules/@azure/core-http": {
"version": "2.3.1", "version": "2.3.2",
"resolved": "https://registry.npmjs.org/@azure/core-http/-/core-http-2.3.1.tgz", "resolved": "https://registry.npmjs.org/@azure/core-http/-/core-http-2.3.2.tgz",
"integrity": "sha512-cur03BUwV0Tbv81bQBOLafFB02B6G++K6F2O3IMl8pSE2QlXm3cu11bfyBNlDUKi5U+xnB3GC63ae3athhkx6Q==", "integrity": "sha512-Z4dfbglV9kNZO177CNx4bo5ekFuYwwsvjLiKdZI4r84bYGv3irrbQz7JC3/rUfFH2l4T/W6OFleJaa2X0IaQqw==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@azure/abort-controller": "^1.0.0", "@azure/abort-controller": "^1.0.0",
@ -117,7 +117,7 @@
"tslib": "^2.2.0", "tslib": "^2.2.0",
"tunnel": "^0.0.6", "tunnel": "^0.0.6",
"uuid": "^8.3.0", "uuid": "^8.3.0",
"xml2js": "^0.4.19" "xml2js": "^0.5.0"
}, },
"engines": { "engines": {
"node": ">=14.0.0" "node": ">=14.0.0"
@ -31211,9 +31211,9 @@
"dev": true "dev": true
}, },
"node_modules/xml2js": { "node_modules/xml2js": {
"version": "0.4.23", "version": "0.5.0",
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz", "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.5.0.tgz",
"integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==", "integrity": "sha512-drPFnkQJik/O+uPKpqSgr22mpuFHqKdbS835iAQrUC73L2F5WkboIRd63ai/2Yg6I1jzifPFKH2NTK+cfglkIA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"sax": ">=0.6.0", "sax": ">=0.6.0",
@ -31583,9 +31583,9 @@
} }
}, },
"@azure/core-http": { "@azure/core-http": {
"version": "2.3.1", "version": "2.3.2",
"resolved": "https://registry.npmjs.org/@azure/core-http/-/core-http-2.3.1.tgz", "resolved": "https://registry.npmjs.org/@azure/core-http/-/core-http-2.3.2.tgz",
"integrity": "sha512-cur03BUwV0Tbv81bQBOLafFB02B6G++K6F2O3IMl8pSE2QlXm3cu11bfyBNlDUKi5U+xnB3GC63ae3athhkx6Q==", "integrity": "sha512-Z4dfbglV9kNZO177CNx4bo5ekFuYwwsvjLiKdZI4r84bYGv3irrbQz7JC3/rUfFH2l4T/W6OFleJaa2X0IaQqw==",
"dev": true, "dev": true,
"requires": { "requires": {
"@azure/abort-controller": "^1.0.0", "@azure/abort-controller": "^1.0.0",
@ -31602,7 +31602,7 @@
"tslib": "^2.2.0", "tslib": "^2.2.0",
"tunnel": "^0.0.6", "tunnel": "^0.0.6",
"uuid": "^8.3.0", "uuid": "^8.3.0",
"xml2js": "^0.4.19" "xml2js": "^0.5.0"
}, },
"dependencies": { "dependencies": {
"@types/node-fetch": { "@types/node-fetch": {
@ -56656,9 +56656,9 @@
"dev": true "dev": true
}, },
"xml2js": { "xml2js": {
"version": "0.4.23", "version": "0.5.0",
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz", "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.5.0.tgz",
"integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==", "integrity": "sha512-drPFnkQJik/O+uPKpqSgr22mpuFHqKdbS835iAQrUC73L2F5WkboIRd63ai/2Yg6I1jzifPFKH2NTK+cfglkIA==",
"dev": true, "dev": true,
"requires": { "requires": {
"sax": ">=0.6.0", "sax": ">=0.6.0",

File diff suppressed because it is too large Load Diff

View File

@ -28,7 +28,7 @@
"@microsoft/eslint-config-spfx": "1.15.2", "@microsoft/eslint-config-spfx": "1.15.2",
"@microsoft/eslint-plugin-spfx": "1.15.2", "@microsoft/eslint-plugin-spfx": "1.15.2",
"@microsoft/rush-stack-compiler-4.5": "0.2.2", "@microsoft/rush-stack-compiler-4.5": "0.2.2",
"@microsoft/sp-build-web": "1.15.2", "@microsoft/sp-build-web": "1.17.2",
"@microsoft/sp-module-interfaces": "1.15.2", "@microsoft/sp-module-interfaces": "1.15.2",
"@rushstack/eslint-config": "2.5.1", "@rushstack/eslint-config": "2.5.1",
"@types/react": "16.9.51", "@types/react": "16.9.51",

View File

@ -73,9 +73,9 @@
} }
}, },
"@azure/core-http": { "@azure/core-http": {
"version": "2.3.1", "version": "2.3.2",
"resolved": "https://registry.npmjs.org/@azure/core-http/-/core-http-2.3.1.tgz", "resolved": "https://registry.npmjs.org/@azure/core-http/-/core-http-2.3.2.tgz",
"integrity": "sha512-cur03BUwV0Tbv81bQBOLafFB02B6G++K6F2O3IMl8pSE2QlXm3cu11bfyBNlDUKi5U+xnB3GC63ae3athhkx6Q==", "integrity": "sha512-Z4dfbglV9kNZO177CNx4bo5ekFuYwwsvjLiKdZI4r84bYGv3irrbQz7JC3/rUfFH2l4T/W6OFleJaa2X0IaQqw==",
"dev": true, "dev": true,
"requires": { "requires": {
"@azure/abort-controller": "^1.0.0", "@azure/abort-controller": "^1.0.0",
@ -92,7 +92,7 @@
"tslib": "^2.2.0", "tslib": "^2.2.0",
"tunnel": "^0.0.6", "tunnel": "^0.0.6",
"uuid": "^8.3.0", "uuid": "^8.3.0",
"xml2js": "^0.4.19" "xml2js": "^0.5.0"
}, },
"dependencies": { "dependencies": {
"@azure/core-tracing": { "@azure/core-tracing": {
@ -106,9 +106,9 @@
} }
}, },
"@types/node-fetch": { "@types/node-fetch": {
"version": "2.6.2", "version": "2.6.3",
"resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.2.tgz", "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.3.tgz",
"integrity": "sha512-DHqhlq5jeESLy19TYhLakJ07kNumXWjcDdxXsLUMJZ6ue8VZJj4kLPQVE/2mdHh3xZziNF1xppu5lwmS53HR+A==", "integrity": "sha512-ETTL1mOEdq/sxUtgtOhKjyB2Irra4cjxksvcMUR5Zr4n+PxVhsCD9WS46oPbHL3et9Zde7CNRr+WUNlcHvsX+w==",
"dev": true, "dev": true,
"requires": { "requires": {
"@types/node": "*", "@types/node": "*",
@ -140,9 +140,9 @@
} }
}, },
"node-fetch": { "node-fetch": {
"version": "2.6.7", "version": "2.6.11",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.11.tgz",
"integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", "integrity": "sha512-4I6pdBY1EthSqDmJkiNk3JIT8cswwR9nfeW/cPdUagJYEQG7R95WRH74wpz7ma8Gh/9dI9FP+OU+0E4FvtA55w==",
"dev": true, "dev": true,
"requires": { "requires": {
"whatwg-url": "^5.0.0" "whatwg-url": "^5.0.0"
@ -161,9 +161,9 @@
} }
}, },
"tslib": { "tslib": {
"version": "2.4.1", "version": "2.5.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz",
"integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==", "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==",
"dev": true "dev": true
}, },
"universalify": { "universalify": {
@ -187,6 +187,16 @@
"tr46": "~0.0.3", "tr46": "~0.0.3",
"webidl-conversions": "^3.0.0" "webidl-conversions": "^3.0.0"
} }
},
"xml2js": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.5.0.tgz",
"integrity": "sha512-drPFnkQJik/O+uPKpqSgr22mpuFHqKdbS835iAQrUC73L2F5WkboIRd63ai/2Yg6I1jzifPFKH2NTK+cfglkIA==",
"dev": true,
"requires": {
"sax": ">=0.6.0",
"xmlbuilder": "~11.0.0"
}
} }
} }
}, },
@ -29623,16 +29633,6 @@
"integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==", "integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==",
"dev": true "dev": true
}, },
"xml2js": {
"version": "0.4.23",
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz",
"integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==",
"dev": true,
"requires": {
"sax": ">=0.6.0",
"xmlbuilder": "~11.0.0"
}
},
"xmlbuilder": { "xmlbuilder": {
"version": "11.0.1", "version": "11.0.1",
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz", "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz",

View File

@ -109,9 +109,9 @@
} }
}, },
"node_modules/@azure/core-http": { "node_modules/@azure/core-http": {
"version": "2.3.1", "version": "2.3.2",
"resolved": "https://registry.npmjs.org/@azure/core-http/-/core-http-2.3.1.tgz", "resolved": "https://registry.npmjs.org/@azure/core-http/-/core-http-2.3.2.tgz",
"integrity": "sha512-cur03BUwV0Tbv81bQBOLafFB02B6G++K6F2O3IMl8pSE2QlXm3cu11bfyBNlDUKi5U+xnB3GC63ae3athhkx6Q==", "integrity": "sha512-Z4dfbglV9kNZO177CNx4bo5ekFuYwwsvjLiKdZI4r84bYGv3irrbQz7JC3/rUfFH2l4T/W6OFleJaa2X0IaQqw==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@azure/abort-controller": "^1.0.0", "@azure/abort-controller": "^1.0.0",
@ -128,7 +128,7 @@
"tslib": "^2.2.0", "tslib": "^2.2.0",
"tunnel": "^0.0.6", "tunnel": "^0.0.6",
"uuid": "^8.3.0", "uuid": "^8.3.0",
"xml2js": "^0.4.19" "xml2js": "^0.5.0"
}, },
"engines": { "engines": {
"node": ">=14.0.0" "node": ">=14.0.0"
@ -31185,9 +31185,9 @@
"dev": true "dev": true
}, },
"node_modules/xml2js": { "node_modules/xml2js": {
"version": "0.4.23", "version": "0.5.0",
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz", "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.5.0.tgz",
"integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==", "integrity": "sha512-drPFnkQJik/O+uPKpqSgr22mpuFHqKdbS835iAQrUC73L2F5WkboIRd63ai/2Yg6I1jzifPFKH2NTK+cfglkIA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"sax": ">=0.6.0", "sax": ">=0.6.0",
@ -31557,9 +31557,9 @@
} }
}, },
"@azure/core-http": { "@azure/core-http": {
"version": "2.3.1", "version": "2.3.2",
"resolved": "https://registry.npmjs.org/@azure/core-http/-/core-http-2.3.1.tgz", "resolved": "https://registry.npmjs.org/@azure/core-http/-/core-http-2.3.2.tgz",
"integrity": "sha512-cur03BUwV0Tbv81bQBOLafFB02B6G++K6F2O3IMl8pSE2QlXm3cu11bfyBNlDUKi5U+xnB3GC63ae3athhkx6Q==", "integrity": "sha512-Z4dfbglV9kNZO177CNx4bo5ekFuYwwsvjLiKdZI4r84bYGv3irrbQz7JC3/rUfFH2l4T/W6OFleJaa2X0IaQqw==",
"dev": true, "dev": true,
"requires": { "requires": {
"@azure/abort-controller": "^1.0.0", "@azure/abort-controller": "^1.0.0",
@ -31576,7 +31576,7 @@
"tslib": "^2.2.0", "tslib": "^2.2.0",
"tunnel": "^0.0.6", "tunnel": "^0.0.6",
"uuid": "^8.3.0", "uuid": "^8.3.0",
"xml2js": "^0.4.19" "xml2js": "^0.5.0"
}, },
"dependencies": { "dependencies": {
"@types/node-fetch": { "@types/node-fetch": {
@ -56600,9 +56600,9 @@
"dev": true "dev": true
}, },
"xml2js": { "xml2js": {
"version": "0.4.23", "version": "0.5.0",
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz", "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.5.0.tgz",
"integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==", "integrity": "sha512-drPFnkQJik/O+uPKpqSgr22mpuFHqKdbS835iAQrUC73L2F5WkboIRd63ai/2Yg6I1jzifPFKH2NTK+cfglkIA==",
"dev": true, "dev": true,
"requires": { "requires": {
"sax": ">=0.6.0", "sax": ">=0.6.0",

View File

@ -121,9 +121,9 @@
} }
}, },
"node_modules/@azure/core-http": { "node_modules/@azure/core-http": {
"version": "2.3.1", "version": "2.3.2",
"resolved": "https://registry.npmjs.org/@azure/core-http/-/core-http-2.3.1.tgz", "resolved": "https://registry.npmjs.org/@azure/core-http/-/core-http-2.3.2.tgz",
"integrity": "sha512-cur03BUwV0Tbv81bQBOLafFB02B6G++K6F2O3IMl8pSE2QlXm3cu11bfyBNlDUKi5U+xnB3GC63ae3athhkx6Q==", "integrity": "sha512-Z4dfbglV9kNZO177CNx4bo5ekFuYwwsvjLiKdZI4r84bYGv3irrbQz7JC3/rUfFH2l4T/W6OFleJaa2X0IaQqw==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@azure/abort-controller": "^1.0.0", "@azure/abort-controller": "^1.0.0",
@ -140,7 +140,7 @@
"tslib": "^2.2.0", "tslib": "^2.2.0",
"tunnel": "^0.0.6", "tunnel": "^0.0.6",
"uuid": "^8.3.0", "uuid": "^8.3.0",
"xml2js": "^0.4.19" "xml2js": "^0.5.0"
}, },
"engines": { "engines": {
"node": ">=14.0.0" "node": ">=14.0.0"
@ -38732,9 +38732,9 @@
"dev": true "dev": true
}, },
"node_modules/xml2js": { "node_modules/xml2js": {
"version": "0.4.23", "version": "0.5.0",
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz", "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.5.0.tgz",
"integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==", "integrity": "sha512-drPFnkQJik/O+uPKpqSgr22mpuFHqKdbS835iAQrUC73L2F5WkboIRd63ai/2Yg6I1jzifPFKH2NTK+cfglkIA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"sax": ">=0.6.0", "sax": ">=0.6.0",
@ -39119,9 +39119,9 @@
} }
}, },
"@azure/core-http": { "@azure/core-http": {
"version": "2.3.1", "version": "2.3.2",
"resolved": "https://registry.npmjs.org/@azure/core-http/-/core-http-2.3.1.tgz", "resolved": "https://registry.npmjs.org/@azure/core-http/-/core-http-2.3.2.tgz",
"integrity": "sha512-cur03BUwV0Tbv81bQBOLafFB02B6G++K6F2O3IMl8pSE2QlXm3cu11bfyBNlDUKi5U+xnB3GC63ae3athhkx6Q==", "integrity": "sha512-Z4dfbglV9kNZO177CNx4bo5ekFuYwwsvjLiKdZI4r84bYGv3irrbQz7JC3/rUfFH2l4T/W6OFleJaa2X0IaQqw==",
"dev": true, "dev": true,
"requires": { "requires": {
"@azure/abort-controller": "^1.0.0", "@azure/abort-controller": "^1.0.0",
@ -39138,7 +39138,7 @@
"tslib": "^2.2.0", "tslib": "^2.2.0",
"tunnel": "^0.0.6", "tunnel": "^0.0.6",
"uuid": "^8.3.0", "uuid": "^8.3.0",
"xml2js": "^0.4.19" "xml2js": "^0.5.0"
}, },
"dependencies": { "dependencies": {
"@types/node-fetch": { "@types/node-fetch": {
@ -69856,9 +69856,9 @@
"dev": true "dev": true
}, },
"xml2js": { "xml2js": {
"version": "0.4.23", "version": "0.5.0",
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz", "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.5.0.tgz",
"integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==", "integrity": "sha512-drPFnkQJik/O+uPKpqSgr22mpuFHqKdbS835iAQrUC73L2F5WkboIRd63ai/2Yg6I1jzifPFKH2NTK+cfglkIA==",
"dev": true, "dev": true,
"requires": { "requires": {
"sax": ">=0.6.0", "sax": ">=0.6.0",

View File

@ -73,9 +73,9 @@
} }
}, },
"@azure/core-http": { "@azure/core-http": {
"version": "2.3.1", "version": "2.3.2",
"resolved": "https://registry.npmjs.org/@azure/core-http/-/core-http-2.3.1.tgz", "resolved": "https://registry.npmjs.org/@azure/core-http/-/core-http-2.3.2.tgz",
"integrity": "sha512-cur03BUwV0Tbv81bQBOLafFB02B6G++K6F2O3IMl8pSE2QlXm3cu11bfyBNlDUKi5U+xnB3GC63ae3athhkx6Q==", "integrity": "sha512-Z4dfbglV9kNZO177CNx4bo5ekFuYwwsvjLiKdZI4r84bYGv3irrbQz7JC3/rUfFH2l4T/W6OFleJaa2X0IaQqw==",
"dev": true, "dev": true,
"requires": { "requires": {
"@azure/abort-controller": "^1.0.0", "@azure/abort-controller": "^1.0.0",
@ -92,7 +92,7 @@
"tslib": "^2.2.0", "tslib": "^2.2.0",
"tunnel": "^0.0.6", "tunnel": "^0.0.6",
"uuid": "^8.3.0", "uuid": "^8.3.0",
"xml2js": "^0.4.19" "xml2js": "^0.5.0"
}, },
"dependencies": { "dependencies": {
"@azure/core-tracing": { "@azure/core-tracing": {
@ -106,9 +106,9 @@
} }
}, },
"@types/node-fetch": { "@types/node-fetch": {
"version": "2.6.2", "version": "2.6.3",
"resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.2.tgz", "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.3.tgz",
"integrity": "sha512-DHqhlq5jeESLy19TYhLakJ07kNumXWjcDdxXsLUMJZ6ue8VZJj4kLPQVE/2mdHh3xZziNF1xppu5lwmS53HR+A==", "integrity": "sha512-ETTL1mOEdq/sxUtgtOhKjyB2Irra4cjxksvcMUR5Zr4n+PxVhsCD9WS46oPbHL3et9Zde7CNRr+WUNlcHvsX+w==",
"dev": true, "dev": true,
"requires": { "requires": {
"@types/node": "*", "@types/node": "*",
@ -140,9 +140,9 @@
} }
}, },
"node-fetch": { "node-fetch": {
"version": "2.6.7", "version": "2.6.11",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.11.tgz",
"integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", "integrity": "sha512-4I6pdBY1EthSqDmJkiNk3JIT8cswwR9nfeW/cPdUagJYEQG7R95WRH74wpz7ma8Gh/9dI9FP+OU+0E4FvtA55w==",
"dev": true, "dev": true,
"requires": { "requires": {
"whatwg-url": "^5.0.0" "whatwg-url": "^5.0.0"
@ -161,9 +161,9 @@
} }
}, },
"tslib": { "tslib": {
"version": "2.4.1", "version": "2.5.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz",
"integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==", "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==",
"dev": true "dev": true
}, },
"universalify": { "universalify": {
@ -187,6 +187,16 @@
"tr46": "~0.0.3", "tr46": "~0.0.3",
"webidl-conversions": "^3.0.0" "webidl-conversions": "^3.0.0"
} }
},
"xml2js": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.5.0.tgz",
"integrity": "sha512-drPFnkQJik/O+uPKpqSgr22mpuFHqKdbS835iAQrUC73L2F5WkboIRd63ai/2Yg6I1jzifPFKH2NTK+cfglkIA==",
"dev": true,
"requires": {
"sax": ">=0.6.0",
"xmlbuilder": "~11.0.0"
}
} }
} }
}, },
@ -25377,16 +25387,6 @@
"integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==", "integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==",
"dev": true "dev": true
}, },
"xml2js": {
"version": "0.4.23",
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz",
"integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==",
"dev": true,
"requires": {
"sax": ">=0.6.0",
"xmlbuilder": "~11.0.0"
}
},
"xmlbuilder": { "xmlbuilder": {
"version": "11.0.1", "version": "11.0.1",
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz", "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz",

View File

@ -0,0 +1,39 @@
// For more information on how to run this SPFx project in a VS Code Remote Container, please visit https://aka.ms/spfx-devcontainer
{
"name": "SPFx 1.11.0",
"image": "docker.io/m365pnp/spfx:1.11.0",
// Set *default* container specific settings.json values on container create.
"settings": {},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"editorconfig.editorconfig",
"dbaeumer.vscode-eslint"
],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [
4321,
35729,
5432
],
"portsAttributes": {
"4321": {
"protocol": "https",
"label": "Manifest",
"onAutoForward": "silent",
"requireLocalPort": true
},
"5432": {
"protocol": "https",
"label": "Workbench",
"onAutoForward": "silent"
},
"35729": {
"protocol": "https",
"label": "LiveReload",
"onAutoForward": "silent",
"requireLocalPort": true
}
},
"postCreateCommand": "bash .devcontainer/spfx-startup.sh",
"remoteUser": "node"
}

View File

@ -0,0 +1,31 @@
echo
echo -e "\e[1;94mInstalling Node dependencies\e[0m"
npm install
## commands to create dev certificate and copy it to the root folder of the project
echo
echo -e "\e[1;94mGenerating dev certificate\e[0m"
gulp trust-dev-cert
cp ~/.gcb-serve-data/gcb-serve.cer ./spfx-dev-cert.cer
cp ~/.gcb-serve-data/gcb-serve.cer ./spfx-dev-cert.pem
## add *.cer to .gitignore to prevent certificates from being saved in repo
if ! grep -Fxq '*.cer' ./.gitignore
then
echo "# .CER Certificates" >> .gitignore
echo "*.cer" >> .gitignore
fi
## add *.pem to .gitignore to prevent certificates from being saved in repo
if ! grep -Fxq '*.pem' ./.gitignore
then
echo "# .PEM Certificates" >> .gitignore
echo "*.pem" >> .gitignore
fi
echo
echo -e "\e[1;92mReady!\e[0m"
echo -e "\n\e[1;94m**********\nOptional: if you plan on using gulp serve, don't forget to add the container certificate to your local machine. Please visit https://aka.ms/spfx-devcontainer for more information\n**********"

View File

@ -4,13 +4,12 @@
> **NOTE:** This web part was built with SPFx 1.11.0, making it only compatible with SharePoint Online. If you wish, you can use [an earlier version of this web part](../react-content-query-onprem/README.md) which is compatible on-premises versions of SharePoint. > **NOTE:** This web part was built with SPFx 1.11.0, making it only compatible with SharePoint Online. If you wish, you can use [an earlier version of this web part](../react-content-query-onprem/README.md) which is compatible on-premises versions of SharePoint.
The **Content Query web part** is a modern version of the good old **Content by Query web part** that was introduced in SharePoint 2007. Built for Office 365, this modern version is built using the **SharePoint Framework (SPFx)** and uses the latest *Web Stack* practices. The **Content Query web part** is a modern version of the good old **Content by Query web part** that was introduced in SharePoint 2007. Built for Office 365, this modern version is built using the **SharePoint Framework (SPFx)** and uses the latest *Web Stack* practices.
While the original web part was based on an **XSLT** templating engine, this *React* web part is based on the well known [Handlebars templating engine](http://handlebarsjs.com), which empowers users to create simple, yet powerful **HTML** templates for rendering the queried content. This new version also lets the user query *any site collections* which resides on the same domain URL, add *unlimited filters*, query `DateTime` fields to the *nearest minute* rather than being limited to a day, and much more. While the original web part was based on an **XSLT** templating engine, this *React* web part is based on the well known [Handlebars templating engine](http://handlebarsjs.com), which empowers users to create simple, yet powerful **HTML** templates for rendering the queried content. This new version also lets the user query *any site collections* which resides on the same domain URL, add *unlimited filters*, query `DateTime` fields to the *nearest minute* rather than being limited to a day, and much more.
![Web Part Preview](assets/toolpart.gif) ![Web Part Preview](assets/toolpart.gif)
## Compatibility ## Compatibility
| :warning: Important | | :warning: Important |
@ -38,6 +37,7 @@ While the original web part was based on an **XSLT** templating engine, this *Re
* [Paolo Pialorsi](https://github.com/PaoloPia) * [Paolo Pialorsi](https://github.com/PaoloPia)
* [Simon-Pierre Plante](https://github.com/spplante) * [Simon-Pierre Plante](https://github.com/spplante)
* [Abderahman Moujahid](https://github.com/Abderahman88) * [Abderahman Moujahid](https://github.com/Abderahman88)
* [Chris Lizon](https://github.com/ChrisLizon)
## Version history ## Version history
@ -46,8 +46,8 @@ Version|Date|Comments
1.0.0|May 04, 2017|Initial release 1.0.0|May 04, 2017|Initial release
1.0.1|July 23rd 15, 2017|Updated to GA Version 1.0.1|July 23rd 15, 2017|Updated to GA Version
1.0.3|August 12, 2017|Added external scripts functionality 1.0.3|August 12, 2017|Added external scripts functionality
1.0.4|August 31, 2017|Fixed a bug where tenant sites/sub-sites were missing from the **Web Url** dropdown 1.0.4|August 31, 2017|Fixed a bug where tenant sites/sub-sites were missing from the **Web URL** dropdown
1.0.5|September 1st, 2017|Added a **Site Url** parameter next to the **Web Url** parameter in order to narrow down the results 1.0.5|September 1st, 2017|Added a **Site URL** parameter next to the **Web URL** parameter in order to narrow down the results
1.0.6|September 19, 2017|Upgraded to SharePoint drop 1.2.0 and added the site URL and web URL preselection when adding the web part for the first time on a page. Also fixed a bug with fields that had spaces in their internal names (automatically replaced with `_x0020_` by SharePoint). 1.0.6|September 19, 2017|Upgraded to SharePoint drop 1.2.0 and added the site URL and web URL preselection when adding the web part for the first time on a page. Also fixed a bug with fields that had spaces in their internal names (automatically replaced with `_x0020_` by SharePoint).
1.0.7|November 17, 2017|Reverted to drop 1.1.0 in order to keep compatibility for SP2016 on-premise 1.0.7|November 17, 2017|Reverted to drop 1.1.0 in order to keep compatibility for SP2016 on-premise
1.0.8|March 17, 2018|Updated to store the selected list using its ID instead of its title, so the web part keeps working if the list title gets updated. 1.0.8|March 17, 2018|Updated to store the selected list using its ID instead of its title, so the web part keeps working if the list title gets updated.
@ -65,7 +65,7 @@ Version|Date|Comments
### Global dependencies ### Global dependencies
> This sample can also be opened with [VS Code Remote Development](https://code.visualstudio.com/docs/remote/remote-overview). Visit https://aka.ms/spfx-devcontainer for further instructions. > This sample can also be opened with [VS Code Remote Development](https://code.visualstudio.com/docs/remote/remote-overview). Visit https://aka.ms/spfx-devcontainer for further instructions.
Requires Gulp globally installed: Requires Gulp globally installed:
@ -81,14 +81,17 @@ Download & install all dependencies, build, bundle & package the project
# download & install dependencies # download & install dependencies
npm install npm install
#If you receive an error Cannot find module 'worker_threads' you will need to tell Node 10 to use the experiemental worker features via environment variable. In Powershell this is accomplished like this:
$env:NODE_OPTIONS="--experimental-worker"
# transpile all TypeScript & SCSS => JavaScript & CSS # transpile all TypeScript & SCSS => JavaScript & CSS
gulp build gulp build
# create component bundle & manifest # create component bundle & manifest
gulp bundle gulp bundle --ship
# create SharePoint package # create SharePoint package
gulp package-solution gulp package-solution --ship
``` ```
These commands produce the following: These commands produce the following:
@ -285,7 +288,6 @@ Property | Description
`{{MyField.jsonValue}}` | Returns a JSON object value of the field. For example, an *Image* field JSON value would return a JSON object which contains the `serverRelativeUrl` property `{{MyField.jsonValue}}` | Returns a JSON object value of the field. For example, an *Image* field JSON value would return a JSON object which contains the `serverRelativeUrl` property
`{{MyField.personValue}}` | Returns an object value of a person field. The `personValue` property provides `email`, `displayName` and `image` properties. The `image` property contains `small`, `medium`, and `large` properties, each of which pointing to the profile image URL for the small, medium, and large profile images. `{{MyField.personValue}}` | Returns an object value of a person field. The `personValue` property provides `email`, `displayName` and `image` properties. The `image` property contains `small`, `medium`, and `large` properties, each of which pointing to the profile image URL for the small, medium, and large profile images.
##### Handlebars ##### Handlebars
```handlebars ```handlebars
@ -341,7 +343,6 @@ If you need custom logic files that can interact precisely **before** or **after
```javascript ```javascript
ReactContentQuery.ExternalScripts.MyScriptFile = { ReactContentQuery.ExternalScripts.MyScriptFile = {
onPreRender: function(wpContext, handlebarsContext) { onPreRender: function(wpContext, handlebarsContext) {
// Do something before rendering (ie: adding a custom block helper) // Do something before rendering (ie: adding a custom block helper)
}, },
@ -349,7 +350,6 @@ ReactContentQuery.ExternalScripts.MyScriptFile = {
onPostRender: function(wpContext, handlebarsContext) { onPostRender: function(wpContext, handlebarsContext) {
// Do something after rendering (ie: calling a plugin on the generated HTML) // Do something after rendering (ie: calling a plugin on the generated HTML)
} }
} }
``` ```
@ -426,7 +426,6 @@ If you have a SharePoint list containing a user field (like a **Created By** or
For example, to use the `mgt-person` component with a person field called `MyPersonField`, you would use the following template: For example, to use the `mgt-person` component with a person field called `MyPersonField`, you would use the following template:
```handlebars ```handlebars
<mgt-person person-query="{{MyPersonField.personValue.email}}" view="twoLines"></mgt-person> <mgt-person person-query="{{MyPersonField.personValue.email}}" view="twoLines"></mgt-person>
``` ```
@ -495,10 +494,8 @@ For questions regarding this sample, [create a new question](https://github.com/
Finally, if you have an idea for improvement, [make a suggestion](https://github.com/pnp/sp-dev-fx-webparts/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Aenhancement%2Csample%3A%20react-content-query-online&template=question.yml&sample=react-content-query-online&authors=@YOURGITHUBUSERNAME&title=react-content-query-online%20-%20). Finally, if you have an idea for improvement, [make a suggestion](https://github.com/pnp/sp-dev-fx-webparts/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Aenhancement%2Csample%3A%20react-content-query-online&template=question.yml&sample=react-content-query-online&authors=@YOURGITHUBUSERNAME&title=react-content-query-online%20-%20).
## Disclaimer ## 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.** **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.**
<img src="https://m365-visitor-stats.azurewebsites.net/sp-dev-fx-webparts/samples/react-content-query-online" /> <img src="https://m365-visitor-stats.azurewebsites.net/sp-dev-fx-webparts/samples/react-content-query-online" />

View File

@ -9,7 +9,7 @@
"The React Content Query Web Part is a modern version of the good old Content by Query Web Part that was introduced in SharePoint 2007. Built for SharePoint Online, this modern version is built against the new SharePoint Framework (SPFx) and uses the latest Web Stack practices. While the original Web Part was based on a XSLT templating engine, this React Web Part is based on the well known Handlebars templating engine, which empowers users to create simple, yet powerfull HTML templates for rendering the queried content. This new version also lets the user query any site collections which resides on the same domain url, add unlimited filters, query DateTime fields to the nearest minute rather than being limited to a day, and much more." "The React Content Query Web Part is a modern version of the good old Content by Query Web Part that was introduced in SharePoint 2007. Built for SharePoint Online, this modern version is built against the new SharePoint Framework (SPFx) and uses the latest Web Stack practices. While the original Web Part was based on a XSLT templating engine, this React Web Part is based on the well known Handlebars templating engine, which empowers users to create simple, yet powerfull HTML templates for rendering the queried content. This new version also lets the user query any site collections which resides on the same domain url, add unlimited filters, query DateTime fields to the nearest minute rather than being limited to a day, and much more."
], ],
"creationDateTime": "2021-01-07", "creationDateTime": "2021-01-07",
"updateDateTime": "2021-01-07", "updateDateTime": "2023-05-04",
"products": [ "products": [
"SharePoint" "SharePoint"
], ],
@ -20,7 +20,7 @@
}, },
{ {
"key": "SPFX-VERSION", "key": "SPFX-VERSION",
"value": "1.10.0" "value": "1.11.0"
} }
], ],
"thumbnails": [ "thumbnails": [
@ -136,7 +136,12 @@
"company": "", "company": "",
"pictureUrl": "https://avatars.githubusercontent.com/u/36161889?s=460\u0026u=afdd5f6681bc375ee3811482dec79824c12d8170\u0026v=4", "pictureUrl": "https://avatars.githubusercontent.com/u/36161889?s=460\u0026u=afdd5f6681bc375ee3811482dec79824c12d8170\u0026v=4",
"name": "Abderahman Moujahid" "name": "Abderahman Moujahid"
} },
{
"gitHubAccount": "ChrisLizon",
"name": "Chris Lizon",
"pictureUrl": "https://github.com/ChrisLizon.png"
}
], ],
"references": [ "references": [
{ {

File diff suppressed because it is too large Load Diff

View File

@ -13,12 +13,13 @@
}, },
"dependencies": { "dependencies": {
"@microsoft/mgt": "^2.0.1", "@microsoft/mgt": "^2.0.1",
"@microsoft/sp-build-web": "1.11.0",
"@microsoft/sp-core-library": "1.11.0", "@microsoft/sp-core-library": "1.11.0",
"@microsoft/sp-lodash-subset": "1.11.0", "@microsoft/sp-lodash-subset": "1.11.0",
"@microsoft/sp-office-ui-fabric-core": "1.11.0", "@microsoft/sp-office-ui-fabric-core": "1.11.0",
"@microsoft/sp-property-pane": "1.11.0", "@microsoft/sp-property-pane": "1.11.0",
"@microsoft/sp-webpart-base": "1.11.0", "@microsoft/sp-webpart-base": "1.11.0",
"@pnp/spfx-controls-react": "^2.3.0", "@pnp/spfx-controls-react": "2.3.0",
"@pnp/spfx-property-controls": "2.2.0", "@pnp/spfx-property-controls": "2.2.0",
"@types/handlebars": "4.0.32", "@types/handlebars": "4.0.32",
"acorn": ">=5.7.4", "acorn": ">=5.7.4",
@ -65,7 +66,6 @@
"devDependencies": { "devDependencies": {
"@microsoft/rush-stack-compiler-2.9": "0.7.16", "@microsoft/rush-stack-compiler-2.9": "0.7.16",
"@microsoft/rush-stack-compiler-3.3": "0.3.5", "@microsoft/rush-stack-compiler-3.3": "0.3.5",
"@microsoft/sp-build-web": "1.16.1",
"@microsoft/sp-module-interfaces": "1.11.0", "@microsoft/sp-module-interfaces": "1.11.0",
"@microsoft/sp-tslint-rules": "1.11.0", "@microsoft/sp-tslint-rules": "1.11.0",
"@microsoft/sp-webpart-workbench": "1.12.1", "@microsoft/sp-webpart-workbench": "1.12.1",
@ -81,7 +81,7 @@
"gulp-sequence": "1.0.0", "gulp-sequence": "1.0.0",
"gulp-stylelint": "^13.0.0", "gulp-stylelint": "^13.0.0",
"jest": "^23.6.0", "jest": "^23.6.0",
"stylelint": "^15.6.0", "stylelint": "14.16.1",
"stylelint-config-standard": "^20.0.0", "stylelint-config-standard": "^20.0.0",
"stylelint-scss": "^3.14.2", "stylelint-scss": "^3.14.2",
"tslint-microsoft-contrib": "^5.0.0", "tslint-microsoft-contrib": "^5.0.0",

File diff suppressed because it is too large Load Diff

View File

@ -30,7 +30,7 @@
"@types/webpack-env": ">=1.12.1 <1.14.0" "@types/webpack-env": ">=1.12.1 <1.14.0"
}, },
"devDependencies": { "devDependencies": {
"@microsoft/sp-build-web": "~1.15.2", "@microsoft/sp-build-web": "~1.17.2",
"@microsoft/sp-module-interfaces": "~1.1.0", "@microsoft/sp-module-interfaces": "~1.1.0",
"@microsoft/sp-webpart-workbench": "~1.12.1", "@microsoft/sp-webpart-workbench": "~1.12.1",
"gulp": "~4.0.2", "gulp": "~4.0.2",

View File

@ -0,0 +1,39 @@
// For more information on how to run this SPFx project in a VS Code Remote Container, please visit https://aka.ms/spfx-devcontainer
{
"name": "SPFx 1.16.1",
"image": "docker.io/m365pnp/spfx:1.16.1",
// Set *default* container specific settings.json values on container create.
"settings": {},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"editorconfig.editorconfig",
"dbaeumer.vscode-eslint"
],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [
4321,
35729
],
"portsAttributes": {
"4321": {
"protocol": "https",
"label": "Manifest",
"onAutoForward": "silent",
"requireLocalPort": true
},
// Not needed for SPFx>= 1.12.1
// "5432": {
// "protocol": "https",
// "label": "Workbench",
// "onAutoForward": "silent"
// },
"35729": {
"protocol": "https",
"label": "LiveReload",
"onAutoForward": "silent",
"requireLocalPort": true
}
},
"postCreateCommand": "bash .devcontainer/spfx-startup.sh",
"remoteUser": "node"
}

View File

@ -0,0 +1,33 @@
echo
echo -e "\e[1;94mInstalling Node dependencies\e[0m"
npm install
## commands to create dev certificate and copy it to the root folder of the project
echo
echo -e "\e[1;94mGenerating dev certificate\e[0m"
gulp trust-dev-cert
# Convert the generated PEM certificate to a CER certificate
openssl x509 -inform PEM -in ~/.rushstack/rushstack-serve.pem -outform DER -out ./spfx-dev-cert.cer
# Copy the PEM ecrtificate for non-Windows hosts
cp ~/.rushstack/rushstack-serve.pem ./spfx-dev-cert.pem
## add *.cer to .gitignore to prevent certificates from being saved in repo
if ! grep -Fxq '*.cer' ./.gitignore
then
echo "# .CER Certificates" >> .gitignore
echo "*.cer" >> .gitignore
fi
## add *.pem to .gitignore to prevent certificates from being saved in repo
if ! grep -Fxq '*.pem' ./.gitignore
then
echo "# .PEM Certificates" >> .gitignore
echo "*.pem" >> .gitignore
fi
echo
echo -e "\e[1;92mReady!\e[0m"
echo -e "\n\e[1;94m**********\nOptional: if you plan on using gulp serve, don't forget to add the container certificate to your local machine. Please visit https://aka.ms/spfx-devcontainer for more information\n**********"

View File

@ -0,0 +1,352 @@
require('@rushstack/eslint-config/patch/modern-module-resolution');
module.exports = {
extends: ['@microsoft/eslint-config-spfx/lib/profiles/react'],
parserOptions: { tsconfigRootDir: __dirname },
overrides: [
{
files: ['*.ts', '*.tsx'],
parser: '@typescript-eslint/parser',
'parserOptions': {
'project': './tsconfig.json',
'ecmaVersion': 2018,
'sourceType': 'module'
},
rules: {
// Prevent usage of the JavaScript null value, while allowing code to access existing APIs that may require null. https://www.npmjs.com/package/@rushstack/eslint-plugin
'@rushstack/no-new-null': 1,
// Require Jest module mocking APIs to be called before any other statements in their code block. https://www.npmjs.com/package/@rushstack/eslint-plugin
'@rushstack/hoist-jest-mock': 1,
// Require regular expressions to be constructed from string constants rather than dynamically building strings at runtime. https://www.npmjs.com/package/@rushstack/eslint-plugin-security
'@rushstack/security/no-unsafe-regexp': 1,
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
'@typescript-eslint/adjacent-overload-signatures': 1,
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
//
// CONFIGURATION: By default, these are banned: String, Boolean, Number, Object, Symbol
'@typescript-eslint/ban-types': [
1,
{
'extendDefaults': false,
'types': {
'String': {
'message': 'Use \'string\' instead',
'fixWith': 'string'
},
'Boolean': {
'message': 'Use \'boolean\' instead',
'fixWith': 'boolean'
},
'Number': {
'message': 'Use \'number\' instead',
'fixWith': 'number'
},
'Object': {
'message': 'Use \'object\' instead, or else define a proper TypeScript type:'
},
'Symbol': {
'message': 'Use \'symbol\' instead',
'fixWith': 'symbol'
},
'Function': {
'message': 'The \'Function\' type accepts any function-like value.\nIt provides no type safety when calling the function, which can be a common source of bugs.\nIt also accepts things like class declarations, which will throw at runtime as they will not be called with \'new\'.\nIf you are expecting the function to accept certain arguments, you should explicitly define the function shape.'
}
}
}
],
// RATIONALE: Code is more readable when the type of every variable is immediately obvious.
// Even if the compiler may be able to infer a type, this inference will be unavailable
// to a person who is reviewing a GitHub diff. This rule makes writing code harder,
// but writing code is a much less important activity than reading it.
//
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
'@typescript-eslint/explicit-function-return-type': [
1,
{
'allowExpressions': true,
'allowTypedFunctionExpressions': true,
'allowHigherOrderFunctions': false
}
],
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
// Rationale to disable: although this is a recommended rule, it is up to dev to select coding style.
// Set to 1 (warning) or 2 (error) to enable.
'@typescript-eslint/explicit-member-accessibility': 0,
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
'@typescript-eslint/no-array-constructor': 1,
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
//
// RATIONALE: The "any" keyword disables static type checking, the main benefit of using TypeScript.
// This rule should be suppressed only in very special cases such as JSON.stringify()
// where the type really can be anything. Even if the type is flexible, another type
// may be more appropriate such as "unknown", "{}", or "Record<k,V>".
'@typescript-eslint/no-explicit-any': 1,
// RATIONALE: The #1 rule of promises is that every promise chain must be terminated by a catch()
// handler. Thus wherever a Promise arises, the code must either append a catch handler,
// or else return the object to a caller (who assumes this responsibility). Unterminated
// promise chains are a serious issue. Besides causing errors to be silently ignored,
// they can also cause a NodeJS process to terminate unexpectedly.
'@typescript-eslint/no-floating-promises': 2,
// RATIONALE: Catches a common coding mistake.
'@typescript-eslint/no-for-in-array': 2,
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
'@typescript-eslint/no-misused-new': 2,
// RATIONALE: The "namespace" keyword is not recommended for organizing code because JavaScript lacks
// a "using" statement to traverse namespaces. Nested namespaces prevent certain bundler
// optimizations. If you are declaring loose functions/variables, it's better to make them
// static members of a class, since classes support property getters and their private
// members are accessible by unit tests. Also, the exercise of choosing a meaningful
// class name tends to produce more discoverable APIs: for example, search+replacing
// the function "reverse()" is likely to return many false matches, whereas if we always
// write "Text.reverse()" is more unique. For large scale organization, it's recommended
// to decompose your code into separate NPM packages, which ensures that component
// dependencies are tracked more conscientiously.
//
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
'@typescript-eslint/no-namespace': [
1,
{
'allowDeclarations': false,
'allowDefinitionFiles': false
}
],
// RATIONALE: Parameter properties provide a shorthand such as "constructor(public title: string)"
// that avoids the effort of declaring "title" as a field. This TypeScript feature makes
// code easier to write, but arguably sacrifices readability: In the notes for
// "@typescript-eslint/member-ordering" we pointed out that fields are central to
// a class's design, so we wouldn't want to bury them in a constructor signature
// just to save some typing.
//
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
// Set to 1 (warning) or 2 (error) to enable the rule
'@typescript-eslint/no-parameter-properties': 0,
// RATIONALE: When left in shipping code, unused variables often indicate a mistake. Dead code
// may impact performance.
//
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
'@typescript-eslint/no-unused-vars': [
1,
{
'vars': 'all',
// Unused function arguments often indicate a mistake in JavaScript code. However in TypeScript code,
// the compiler catches most of those mistakes, and unused arguments are fairly common for type signatures
// that are overriding a base class method or implementing an interface.
'args': 'none'
}
],
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
'@typescript-eslint/no-use-before-define': [
2,
{
'functions': false,
'classes': true,
'variables': true,
'enums': true,
'typedefs': true
}
],
// Disallows require statements except in import statements.
// In other words, the use of forms such as var foo = require("foo") are banned. Instead use ES6 style imports or import foo = require("foo") imports.
'@typescript-eslint/no-var-requires': 'error',
// RATIONALE: The "module" keyword is deprecated except when describing legacy libraries.
//
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
'@typescript-eslint/prefer-namespace-keyword': 1,
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
// Rationale to disable: it's up to developer to decide if he wants to add type annotations
// Set to 1 (warning) or 2 (error) to enable the rule
'@typescript-eslint/no-inferrable-types': 0,
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
// Rationale to disable: declaration of empty interfaces may be helpful for generic types scenarios
'@typescript-eslint/no-empty-interface': 0,
// RATIONALE: This rule warns if setters are defined without getters, which is probably a mistake.
'accessor-pairs': 1,
// RATIONALE: In TypeScript, if you write x["y"] instead of x.y, it disables type checking.
'dot-notation': [
1,
{
'allowPattern': '^_'
}
],
// RATIONALE: Catches code that is likely to be incorrect
'eqeqeq': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'for-direction': 1,
// RATIONALE: Catches a common coding mistake.
'guard-for-in': 2,
// RATIONALE: If you have more than 2,000 lines in a single source file, it's probably time
// to split up your code.
'max-lines': ['warn', { max: 2000 }],
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-async-promise-executor': 2,
// RATIONALE: Deprecated language feature.
'no-caller': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-compare-neg-zero': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-cond-assign': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-constant-condition': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-control-regex': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-debugger': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-delete-var': 2,
// RATIONALE: Catches code that is likely to be incorrect
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-duplicate-case': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-empty': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-empty-character-class': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-empty-pattern': 1,
// RATIONALE: Eval is a security concern and a performance concern.
'no-eval': 1,
// RATIONALE: Catches code that is likely to be incorrect
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-ex-assign': 2,
// RATIONALE: System types are global and should not be tampered with in a scalable code base.
// If two different libraries (or two versions of the same library) both try to modify
// a type, only one of them can win. Polyfills are acceptable because they implement
// a standardized interoperable contract, but polyfills are generally coded in plain
// JavaScript.
'no-extend-native': 1,
// Disallow unnecessary labels
'no-extra-label': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-fallthrough': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-func-assign': 1,
// RATIONALE: Catches a common coding mistake.
'no-implied-eval': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-invalid-regexp': 2,
// RATIONALE: Catches a common coding mistake.
'no-label-var': 2,
// RATIONALE: Eliminates redundant code.
'no-lone-blocks': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-misleading-character-class': 2,
// RATIONALE: Catches a common coding mistake.
'no-multi-str': 2,
// RATIONALE: It's generally a bad practice to call "new Thing()" without assigning the result to
// a variable. Either it's part of an awkward expression like "(new Thing()).doSomething()",
// or else implies that the constructor is doing nontrivial computations, which is often
// a poor class design.
'no-new': 1,
// RATIONALE: Obsolete language feature that is deprecated.
'no-new-func': 2,
// RATIONALE: Obsolete language feature that is deprecated.
'no-new-object': 2,
// RATIONALE: Obsolete notation.
'no-new-wrappers': 1,
// RATIONALE: Catches code that is likely to be incorrect
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-octal': 2,
// RATIONALE: Catches code that is likely to be incorrect
'no-octal-escape': 2,
// RATIONALE: Catches code that is likely to be incorrect
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-regex-spaces': 2,
// RATIONALE: Catches a common coding mistake.
'no-return-assign': 2,
// RATIONALE: Security risk.
'no-script-url': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-self-assign': 2,
// RATIONALE: Catches a common coding mistake.
'no-self-compare': 2,
// RATIONALE: This avoids statements such as "while (a = next(), a && a.length);" that use
// commas to create compound expressions. In general code is more readable if each
// step is split onto a separate line. This also makes it easier to set breakpoints
// in the debugger.
'no-sequences': 1,
// RATIONALE: Catches code that is likely to be incorrect
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-shadow-restricted-names': 2,
// RATIONALE: Obsolete language feature that is deprecated.
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-sparse-arrays': 2,
// RATIONALE: Although in theory JavaScript allows any possible data type to be thrown as an exception,
// such flexibility adds pointless complexity, by requiring every catch block to test
// the type of the object that it receives. Whereas if catch blocks can always assume
// that their object implements the "Error" contract, then the code is simpler, and
// we generally get useful additional information like a call stack.
'no-throw-literal': 2,
// RATIONALE: Catches a common coding mistake.
'no-unmodified-loop-condition': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-unsafe-finally': 2,
// RATIONALE: Catches a common coding mistake.
'no-unused-expressions': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-unused-labels': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-useless-catch': 1,
// RATIONALE: Avoids a potential performance problem.
'no-useless-concat': 1,
// RATIONALE: The "var" keyword is deprecated because of its confusing "hoisting" behavior.
// Always use "let" or "const" instead.
//
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
'no-var': 2,
// RATIONALE: Generally not needed in modern code.
'no-void': 1,
// RATIONALE: Obsolete language feature that is deprecated.
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-with': 2,
// RATIONALE: Makes logic easier to understand, since constants always have a known value
// @typescript-eslint\eslint-plugin\dist\configs\eslint-recommended.js
'prefer-const': 1,
// RATIONALE: Catches a common coding mistake where "resolve" and "reject" are confused.
'promise/param-names': 2,
// RATIONALE: Catches code that is likely to be incorrect
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'require-atomic-updates': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'require-yield': 1,
// "Use strict" is redundant when using the TypeScript compiler.
'strict': [
2,
'never'
],
// RATIONALE: Catches code that is likely to be incorrect
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'use-isnan': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
// Set to 1 (warning) or 2 (error) to enable.
// Rationale to disable: !!{}
'no-extra-boolean-cast': 0,
// ====================================================================
// @microsoft/eslint-plugin-spfx
// ====================================================================
'@microsoft/spfx/import-requires-chunk-name': 1,
'@microsoft/spfx/no-require-ensure': 2,
'@microsoft/spfx/pair-react-dom-render-unmount': 1
}
},
{
// For unit tests, we can be a little bit less strict. The settings below revise the
// defaults specified in the extended configurations, as well as above.
files: [
// Test files
'*.test.ts',
'*.test.tsx',
'*.spec.ts',
'*.spec.tsx',
// Facebook convention
'**/__mocks__/*.ts',
'**/__mocks__/*.tsx',
'**/__tests__/*.ts',
'**/__tests__/*.tsx',
// Microsoft convention
'**/test/*.ts',
'**/test/*.tsx'
],
rules: {}
}
]
};

View File

@ -0,0 +1,34 @@
# Logs
logs
*.log
npm-debug.log*
# Dependency directories
node_modules
# Build generated files
dist
lib
release
solution
temp
*.sppkg
.heft
# Coverage directory used by tools like istanbul
coverage
# OSX
.DS_Store
# Visual Studio files
.ntvs_analysis.dat
.vs
bin
obj
# Resx Generated Code
*.resx.ts
# Styles Generated Code
*.scss.ts

View File

@ -0,0 +1,16 @@
!dist
config
gulpfile.js
release
src
temp
tsconfig.json
tslint.json
*.log
.yo-rc.json
.vscode

View File

@ -0,0 +1,21 @@
{
"@microsoft/generator-sharepoint": {
"plusBeta": false,
"isCreatingSolution": true,
"nodeVersion": "14.15.0",
"sdksVersions": {
"@microsoft/microsoft-graph-client": "3.0.2",
"@microsoft/teams-js": "2.4.1"
},
"version": "1.16.1",
"libraryName": "azure-apps",
"libraryId": "2236ddb2-5c5e-4dca-992d-b772027a6d60",
"environment": "spo",
"packageManager": "npm",
"solutionName": "azureApps",
"solutionShortDescription": "azureApps description",
"skipFeatureDeployment": true,
"isDomainIsolated": false,
"componentType": "webpart"
}
}

View File

@ -0,0 +1,79 @@
# Azure Apps
## Summary
This sample web part shows list of Azure apps in your tenant. A new Azure application can also be registered and can be edited using this web part.
![Add Azure App](./assets/Add-New-App.gif)
![Edit Azure App](./assets/Edit-App.gif)
## Compatibility
| :warning: Important |
|:---------------------------|
| Every SPFx version is only compatible with specific version(s) of Node.js. In order to be able to build this sample, please ensure that the version of Node on your workstation matches one of the versions listed in this section. This sample will not work on a different version of Node.|
|Refer to <https://aka.ms/spfx-matrix> for more information on SPFx compatibility. |
![SPFx 1.16.1](https://img.shields.io/badge/SPFx-1.16.1-green.svg)
![Node.js v14 | v12](https://img.shields.io/badge/Node.js-v14%20%7C%20v12-green.svg)
![Compatible with SharePoint Online](https://img.shields.io/badge/SharePoint%20Online-Compatible-green.svg)
![Does not work with SharePoint 2019](https://img.shields.io/badge/SharePoint%20Server%202019-Incompatible-red.svg "SharePoint Server 2019 requires SPFx 1.4.1 or lower")
![Does not work with SharePoint 2016 (Feature Pack 2)](https://img.shields.io/badge/SharePoint%20Server%202016%20(Feature%20Pack%202)-Incompatible-red.svg "SharePoint Server 2016 Feature Pack 2 requires SPFx 1.1")
![Local Workbench Unsupported](https://img.shields.io/badge/Local%20Workbench-Unsupported-red.svg "Local workbench is no longer available as of SPFx 1.13 and above")
![Hosted Workbench Compatible](https://img.shields.io/badge/Hosted%20Workbench-Compatible-green.svg)
![Compatible with Remote Containers](https://img.shields.io/badge/Remote%20Containers-Compatible-green.svg)
## Applies to
- [SharePoint Framework](https://aka.ms/spfx)
- [Microsoft 365 tenant](https://learn.microsoft.com/sharepoint/dev/spfx/set-up-your-developer-tenant)
## Contributors
- [Diksha Bhura](https://github.com/Diksha-Bhura)
## Version history
| Version | Date | Comments |
| ------- | ---------------- | --------------- |
| 1.0 | April 18, 2023 | Initial release |
## Minimal Path to awesome
- Clone this repository
- In the command-line run:
- `npm install`
- `gulp bundle`
- `gulp package-solution`
- Deploy the package to your app catalog
- Approve the API permission request from the SharePoint admin
- Add the web part to a page
- In the command-line run:
- `gulp serve --nobrowser`
> This sample can also be opened with [VS Code Remote Development](https://code.visualstudio.com/docs/remote/remote-overview). Visit <https://aka.ms/spfx-devcontainer> for further instructions.
## Help
We do not support samples, but this community is always willing to help, and we want to improve these samples. We use GitHub to track issues, which makes it easy for community members to volunteer their time and help resolve issues.
If you're having issues building the solution, please run [spfx doctor](https://pnp.github.io/cli-microsoft365/cmd/spfx/spfx-doctor/) from within the solution folder to diagnose incompatibility issues with your environment.
You can try looking at [issues related to this sample](https://github.com/pnp/sp-dev-fx-webparts/issues?q=label%3A%22sample%3A%20react-graph-azureapps%22) to see if anybody else is having the same issues.
You can also try looking at [discussions related to this sample](https://github.com/pnp/sp-dev-fx-webparts/discussions?discussions_q=react-graph-azureapps) and see what the community is saying.
If you encounter any issues using this sample, [create a new issue](https://github.com/pnp/sp-dev-fx-webparts/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Abug-suspected%2Csample%3A%20react-graph-azureapps&template=bug-report.yml&sample=react-graph-azureapps&authors=@Diksha-Bhura&title=react-graph-azureapps%20-%20).
For questions regarding this sample, [create a new question](https://github.com/pnp/sp-dev-fx-webparts/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Aquestion%2Csample%3A%20react-graph-azureapps&template=question.yml&sample=react-graph-azureapps&authors=@Diksha-Bhura&title=react-graph-azureapps%20-%20).
Finally, if you have an idea for improvement, [make a suggestion](https://github.com/pnp/sp-dev-fx-webparts/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Aenhancement%2Csample%3A%20react-graph-azureapps&template=suggestion.yml&sample=react-graph-azureapps&authors=@Diksha-Bhura&title=react-graph-azureapps%20-%20).
## 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.**
<img src="https://m365-visitor-stats.azurewebsites.net/sp-dev-fx-webparts/samples/react-graph-azureapps" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 725 KiB

View File

@ -0,0 +1,56 @@
[
{
"name": "pnp-sp-dev-spfx-web-parts-react-graph-azureapps",
"source": "pnp",
"title": "Azure Apps",
"shortDescription": "This sample web part shows list of Azure apps in your tenant. A new Azure application can also be registered and can be edited using this web part.",
"url": "https://github.com/pnp/sp-dev-fx-webparts/tree/main/samples/react-graph-azureapps",
"downloadUrl": "https://pnp.github.io/download-partial/?url=https://github.com/pnp/sp-dev-fx-webparts/tree/main/samples/react-graph-azureapps",
"longDescription": [
"This sample web part shows list of Azure apps in your tenant. A new Azure application can also be registered and can be edited using this web part."
],
"creationDateTime": "2023-05-07",
"updateDateTime": "2023-05-07",
"products": [
"SharePoint"
],
"metadata": [
{
"key": "CLIENT-SIDE-DEV",
"value": "React"
},
{
"key": "SPFX-VERSION",
"value": "1.16.1"
}
],
"thumbnails": [
{
"type": "image",
"order": 100,
"url": "https://github.com/pnp/sp-dev-fx-webparts/raw/main/samples/react-graph-azureapps/assets/Add-New-App.gif",
"alt": "Web Part Preview"
},
{
"type": "image",
"order": 101,
"url": "https://github.com/pnp/sp-dev-fx-webparts/raw/main/samples/react-graph-azureapps/assets/Edit-App.gif",
"alt": "Web Part Preview"
}
],
"authors": [
{
"gitHubAccount": "Diksha-Bhura",
"pictureUrl": "https://github.com/Diksha-Bhura.png",
"name": "Diksha Bhura"
}
],
"references": [
{
"name": "Build your first SharePoint client-side web part",
"description": "Client-side web parts are client-side components that run in the context of a SharePoint page. Client-side web parts can be deployed to SharePoint environments that support the SharePoint Framework. You can also use modern JavaScript web frameworks, tools, and libraries to build them.",
"url": "https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/get-started/build-a-hello-world-web-part"
}
]
}
]

View File

@ -0,0 +1,18 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/config.2.0.schema.json",
"version": "2.0",
"bundles": {
"azure-apps-web-part": {
"components": [
{
"entrypoint": "./lib/webparts/azureApps/AzureAppsWebPart.js",
"manifest": "./src/webparts/azureApps/AzureAppsWebPart.manifest.json"
}
]
}
},
"externals": {},
"localizedResources": {
"AzureAppsWebPartStrings": "lib/webparts/azureApps/loc/{locale}.js"
}
}

View File

@ -0,0 +1,7 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/deploy-azure-storage.schema.json",
"workingDir": "./release/assets/",
"account": "<!-- STORAGE ACCOUNT NAME -->",
"container": "azure-apps",
"accessKey": "<!-- ACCESS KEY -->"
}

View File

@ -0,0 +1,50 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/package-solution.schema.json",
"solution": {
"name": "Azure Apps",
"id": "2236ddb2-5c5e-4dca-992d-b772027a6d60",
"version": "1.0.0.0",
"includeClientSideAssets": true,
"skipFeatureDeployment": true,
"isDomainIsolated": false,
"webApiPermissionRequests": [
{
"resource": "Microsoft Graph",
"scope": "Application.ReadWrite.All"
},
{
"resource": "Microsoft Graph",
"scope": "User.ReadBasic.All"
}
],
"developer": {
"name": "",
"websiteUrl": "",
"privacyUrl": "",
"termsOfUseUrl": "",
"mpnId": "Undefined-1.16.1"
},
"metadata": {
"shortDescription": {
"default": "Showing all Azure apps and able to register new app."
},
"longDescription": {
"default": "Showing all Azure apps and able to register new app."
},
"screenshotPaths": [],
"videoUrl": "",
"categories": []
},
"features": [
{
"title": "azure-apps Feature",
"description": "The feature that activates elements of the azure-apps solution.",
"id": "a199d780-f3ef-41e7-b712-b50780ec8320",
"version": "1.0.0.0"
}
]
},
"paths": {
"zippedPackage": "solution/azure-apps.sppkg"
}
}

View File

@ -0,0 +1,3 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/core-build/sass.schema.json"
}

View File

@ -0,0 +1,6 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/spfx-serve.schema.json",
"port": 4321,
"https": true,
"initialPage": "https://pc45.sharepoint.com/_layouts/workbench.aspx"
}

View File

@ -0,0 +1,4 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/write-manifests.schema.json",
"cdnBasePath": "<!-- PATH TO CDN -->"
}

View File

@ -0,0 +1,16 @@
'use strict';
const build = require('@microsoft/sp-build-web');
build.addSuppression(`Warning - [sass] The local CSS class 'ms-Grid' is not camelCase and will not be type-safe.`);
var getTasks = build.rig.getTasks;
build.rig.getTasks = function () {
var result = getTasks.call(build.rig);
result.set('serve', result.get('serve-deprecated'));
return result;
};
build.initialize(require('gulp'));

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,41 @@
{
"name": "azure-apps",
"version": "0.0.1",
"private": true,
"engines": {
"node": ">=16.13.0 <17.0.0"
},
"main": "lib/index.js",
"scripts": {
"build": "gulp bundle",
"clean": "gulp clean",
"test": "gulp test"
},
"dependencies": {
"@microsoft/sp-core-library": "1.16.1",
"@microsoft/sp-lodash-subset": "1.16.1",
"@microsoft/sp-office-ui-fabric-core": "1.16.1",
"@microsoft/sp-property-pane": "1.16.1",
"@microsoft/sp-webpart-base": "1.16.1",
"moment": "^2.29.4",
"office-ui-fabric-react": "^7.199.1",
"react": "17.0.1",
"react-dom": "17.0.1",
"tslib": "2.3.1"
},
"devDependencies": {
"@microsoft/rush-stack-compiler-4.5": "0.2.2",
"@rushstack/eslint-config": "2.5.1",
"@microsoft/eslint-plugin-spfx": "1.16.1",
"@microsoft/eslint-config-spfx": "1.16.1",
"@microsoft/sp-build-web": "1.16.1",
"@types/webpack-env": "~1.15.2",
"ajv": "^6.12.5",
"gulp": "4.0.2",
"typescript": "4.5.5",
"@types/react": "17.0.45",
"@types/react-dom": "17.0.17",
"eslint-plugin-react-hooks": "4.3.0",
"@microsoft/sp-module-interfaces": "1.16.1"
}
}

View File

@ -0,0 +1,9 @@
import { MSGraphClientV3 } from '@microsoft/sp-http';
export interface IRegisterAppProps {
graphClient: MSGraphClientV3,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
modal: () => any,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
callBack: (latestapp: any) => any,
}

View File

@ -0,0 +1,4 @@
export interface IRegisterAppState{
appName: string;
signInAudience: string;
}

View File

@ -0,0 +1,18 @@
@import '~@fluentui/react/dist/sass/References.scss';
.container {
height: 400px !important;
width: 100% !important;
border-width: 0px !important;
padding: 20px;
box-sizing: border-box;
}
.subLabel{
font-weight: 10;
font-size: small;
}
.label{
margin-top: -50px;
}

View File

@ -0,0 +1,112 @@
import { ChoiceGroup, IChoiceGroupOption, Label, PrimaryButton, TextField } from 'office-ui-fabric-react';
import * as React from 'react';
import styles from './RegisterApp.module.scss';
import { IRegisterAppProps } from './IRegisterAppProps';
import { IRegisterAppState } from './IRegisterAppState';
import { cloneDeep } from '@microsoft/sp-lodash-subset';
import { IAppModel } from '../models/IAppModel';
import * as moment from 'moment';
export default class RegisterApp extends React.Component<IRegisterAppProps, IRegisterAppState>{
constructor(props: IRegisterAppProps, state: IRegisterAppState) {
super(props);
this.state = {
appName: "",
signInAudience: "AzureADMyOrg",
};
}
private onNameChanged = (event: React.FormEvent<HTMLInputElement | HTMLTextAreaElement>, newValue?: string): void => {
this.setState((prevState: IRegisterAppState, nextState: IRegisterAppState): IRegisterAppState => {
nextState = cloneDeep(prevState);
nextState.appName = newValue;
return nextState;
});
}
private onSupportedAccountChanged(ev: React.FormEvent<HTMLInputElement>, option: IChoiceGroupOption): void {
this.setState((prevState: IRegisterAppState, nextState: IRegisterAppState): IRegisterAppState => {
nextState = cloneDeep(prevState);
nextState.signInAudience = option.key;
return nextState;
});
}
private onRegisterApp = (): Promise<void> => {
// eslint-disable-next-line no-async-promise-executor
return new Promise(async (resolve, reject) => {
try {
const newAppDetails = {
"displayName": this.state.appName,
"signInAudience": this.state.signInAudience
}
const result = await this.props.graphClient
.api("/applications")
.post(newAppDetails);
if (result.id) {
const app: IAppModel = {
Id: "",
appId: "",
displayName: "",
createdDateTime: null,
users: []
};
app.Id = result.id;
app.appId = result.appId;
app.displayName = result.displayName;
app.createdDateTime = moment(new Date(result.createdDateTime)).format("llll");
this.props.callBack(app);
resolve();
} else {
reject();
}
console.log(result);
}
catch (exception) {
// do nothing
}
})
}
private handlerRegisterClick = (): void => {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.onRegisterApp().then(
this.props.modal()
)
}
public render(): React.ReactElement<IRegisterAppProps> {
const options: IChoiceGroupOption[] = [
{ key: 'AzureADMyOrg', text: 'Accounts in this organizational directory only (MSFT only - Single tenant)' },
{ key: 'AzureADMultipleOrgs', text: 'Accounts in any organizational directory (Any Azure AD directory - Multitenant)' },
{ key: 'AzureADandPersonalMicrosoftAccount', text: 'Accounts in any organizational directory (Any Azure AD directory - Multitenant) and personal Microsoft accounts (e.g. Skype, Xbox)' },
{ key: 'PersonalMicrosoftAccount', text: 'Personal Microsoft accounts only' },
];
return (
<div className={styles.container}>
<h2 className={styles.label}>Registering an application</h2>
<Label required>Name</Label>
<Label className={styles.subLabel}>The user-facing display name for this application (this can be changed later).</Label>
<TextField required onChange={(event, value) => this.onNameChanged(event, value)} />
<br />
<br />
<Label>Supported account types</Label>
<Label className={styles.subLabel}>Who can use this application or access this API?</Label>
<ChoiceGroup defaultSelectedKey="AzureADMyOrg" options={options} onChange={this.onSupportedAccountChanged.bind(this)} />
<br />
<PrimaryButton text='Register' disabled={this.state.appName !== "" ? false : true} onClick={this.handlerRegisterClick.bind(this)} />
</div>
);
}
}

View File

@ -0,0 +1,18 @@
import { IDocumentCardActivityPerson } from "@fluentui/react";
export interface IAppModel{
Id: string;
displayName: string;
appId: string,
createdDateTime: string;
users: IDocumentCardActivityPerson[],
}
export interface IAppModels{
value: IAppModel[],
}
export interface IUserDetails{
displayName: string;
upn: string;
}

View File

@ -0,0 +1 @@
// A file is required to be in the root of the /src directory by the TypeScript compiler

View File

@ -0,0 +1,28 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx/client-side-web-part-manifest.schema.json",
"id": "0bb9dd02-3098-4a9e-b418-7f8218af82c2",
"alias": "AzureAppsWebPart",
"componentType": "WebPart",
// The "*" signifies that the version should be taken from the package.json
"version": "*",
"manifestVersion": 2,
// If true, the component can only be installed on sites where Custom Script is allowed.
// Components that allow authors to embed arbitrary script code should set this to true.
// https://support.office.com/en-us/article/Turn-scripting-capabilities-on-or-off-1f2c515f-5d7e-448a-9fd7-835da935584f
"requiresCustomScript": false,
"supportedHosts": ["SharePointWebPart", "TeamsPersonalApp", "TeamsTab", "SharePointFullPage"],
"supportsThemeVariants": true,
"preconfiguredEntries": [{
"groupId": "5c03119e-3074-46fd-976b-c60198311f70", // Advanced
"group": { "default": "Advanced" },
"title": { "default": "AzureApps" },
"description": { "default": "AzureApps description" },
"officeFabricIconFontName": "Page",
"properties": {
"description": "AzureApps"
}
}]
}

View File

@ -0,0 +1,74 @@
import * as React from 'react';
import * as ReactDom from 'react-dom';
import { Version } from '@microsoft/sp-core-library';
import {
IPropertyPaneConfiguration,
PropertyPaneTextField
} from '@microsoft/sp-property-pane';
import { BaseClientSideWebPart } from '@microsoft/sp-webpart-base';
import * as strings from 'AzureAppsWebPartStrings';
import azureApps from './components/AzureApps';
import { IAzureAppsProps } from './components/IAzureAppsProps';
import { MSGraphClientV3 } from '@microsoft/sp-http';
export interface IazureAppsWebPartProps {
description: string;
}
export default class azureAppsWebPart extends BaseClientSideWebPart<IazureAppsWebPartProps> {
private graphClient: MSGraphClientV3;
protected onInit(): Promise<void> {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return new Promise<void>((resolve: () => void, reject: (error: any) => void): void => {
this.context.msGraphClientFactory
.getClient("3")
.then((client: MSGraphClientV3): void => {
this.graphClient = client;
resolve();
}, err => reject(err));
})
}
public render(): void {
const element: React.ReactElement<IAzureAppsProps> = React.createElement(
azureApps,
{
graphClient: this.graphClient
}
);
ReactDom.render(element, this.domElement);
}
protected onDispose(): void {
ReactDom.unmountComponentAtNode(this.domElement);
}
protected get dataVersion(): Version {
return Version.parse('1.0');
}
protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration {
return {
pages: [
{
header: {
description: strings.PropertyPaneDescription
},
groups: [
{
groupName: strings.BasicGroupName,
groupFields: [
PropertyPaneTextField('description', {
label: strings.DescriptionFieldLabel
})
]
}
]
}
]
};
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -0,0 +1,62 @@
@import '~@fluentui/react/dist/sass/References.scss';
.AzureApps {
overflow: hidden;
padding: 1em;
color: "[theme:bodyText, default: #323130]";
color: var(--bodyText);
&.teams {
font-family: $ms-font-family-fallbacks;
}
}
.welcome {
text-align: center;
}
.mainarea{
height: 200px;
width: 400px !important;
}
.scrollPane{
width: 400px;
}
.iconButtonStyles {
margin-left: 840px !important;
//padding: 20px 20px 0;
//@at-root: 750px !important;
color: black;
}
.welcomeImage {
width: 100%;
max-width: 420px;
}
.documentCard{
width: 300px;
margin-top: 10px;
}
.refreshDialog{
height: 150px !important;
}
.documentCardTitle {
text-decoration: none;
font-size: 16px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color:inherit;
// color: "[theme:link, default:#03787c]";
color: #03787c;
//color: var(--link);
&:hover {
text-decoration: underline;
color: #014446;//"[theme:linkHovered, default: #014446]";
//color: var(--linkHovered);
}
}

View File

@ -0,0 +1,264 @@
import * as React from 'react';
import { IAzureAppsProps } from './IAzureAppsProps';
import { IAppModel } from '../../../common/models/IAppModel';
import { IAzureAppsState } from './IAzureAppsState';
import { DefaultButton, Dialog, DialogFooter, DocumentCard, DocumentCardActivity, DocumentCardDetails, DocumentCardTitle, DocumentCardType, IButtonStyles, IconButton, IDocumentCardActivityPerson, Modal, ScrollablePane, Spinner, Sticky, StickyPositionType } from 'office-ui-fabric-react';
import { cloneDeep } from '@microsoft/sp-lodash-subset';
import RegisterApp from '../../../common/components/RegisterApp';
import styles from './AzureApps.module.scss';
import * as _ from 'lodash';
import * as moment from 'moment';
export default class azureApps extends React.Component<IAzureAppsProps, IAzureAppsState> {
private appEditLink = "https://portal.azure.com/#view/Microsoft_AAD_RegisteredApps/ApplicationMenuBlade/~/Overview/appId/";
constructor(props: IAzureAppsProps, state: IAzureAppsState) {
super(props);
this.state = {
apps: [],
loading: true,
error: "",
isModalOpen: false,
isDialogHidden: true,
isRefreshed: true,
}
}
componentDidMount(): void {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.getApps().then((retrievedApps) => {
retrievedApps.forEach(async currentApp => {
await this.getAllOwners(currentApp.Id).then((users) => {
currentApp.users = users;
});
this.setState((prevState: IAzureAppsState, nextState: IAzureAppsState): IAzureAppsState => {
nextState = cloneDeep(prevState);
nextState.apps = retrievedApps;
nextState.error = "";
nextState.loading = false;
return nextState;
})
});
})
}
private getApps = (): Promise<IAppModel[]> => {
// eslint-disable-next-line no-async-promise-executor
return new Promise<IAppModel[]>(async (resolve, reject) => {
try {
const retrievedApps: IAppModel[] = [];
const result = await this.props.graphClient
.api("applications")
.get();
if (result && result.value && result.value.length > 0) {
for (let index = 0; index < result.value.length; index++) {
const currApp = result.value[index];
if (currApp.createdDateTime !== null) {
const app: IAppModel = {
Id: "",
appId: "",
displayName: "",
createdDateTime: null,
users: []
};
app.Id = currApp.id;
app.appId = currApp.appId;
app.displayName = currApp.displayName;
app.createdDateTime = moment(new Date(currApp.createdDateTime)).format("LLLL");
retrievedApps.push(app);
}
}
resolve(retrievedApps);
}
else {
this.setState({
loading: false
});
}
}
catch (Exception) {
console.log("error");
reject();
}
})
}
private getAllOwners = (id: string): Promise<IDocumentCardActivityPerson[]> => {
const users: IDocumentCardActivityPerson[] = [];
// eslint-disable-next-line no-async-promise-executor
return new Promise(async (resolve, reject) => {
try {
const result = await this.props.graphClient
.api("/applications/" + id + "/owners").
get();
if (result && result.value && result.value.length) {
for (let index = 0; index < result.value.length; index++) {
const currentUser = result.value[index]
const userDetails: IDocumentCardActivityPerson = {
name: "",
profileImageSrc: ""
};
userDetails.name = currentUser.displayName;
userDetails.profileImageSrc = '';
users.push(userDetails);
}
resolve(users);
}
}
catch (Exception) {
reject();
}
});
}
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
public refreshCallback = async (latestapp: IAppModel) => {
const apps = this.state.apps;
apps.push(latestapp);
console.log("Apps on callback: " + this.state.apps.length);
await this.setState((prevState: IAzureAppsState, newState: IAzureAppsState) => {
newState = cloneDeep(prevState);
newState.apps.push(latestapp);
newState.isRefreshed = false;
return newState;
})
}
public ModalAction(): void {
this.setState((prevState: IAzureAppsState, newState: IAzureAppsState) => {
newState = cloneDeep(prevState);
newState.isModalOpen = !this.state.isModalOpen;
return newState;
})
}
private handlerRefreshClick = (): void => {
window.location.reload();
this.setState((prevState: IAzureAppsState, newState: IAzureAppsState): IAzureAppsState => {
newState = cloneDeep(prevState);
newState.isRefreshed = true;
return newState;
})
}
public render(): React.ReactElement<IAzureAppsProps> {
const iconStyles: Partial<IButtonStyles> = {
root: {
//color: black,
marginLeft: '650px',
marginTop: '4px',
},
rootHovered: {
//color: theme.palette.neutralDark,
},
};
_.orderBy(this.state.apps, function (o) {
return moment(new Date(o.createdDateTime)).format("hh:mm:ss")
}, ['desc']);
return (
<div className={styles.mainarea}>
{
this.state.loading ?
<div>
<Spinner hidden={this.state.loading} label="Loading Data..." ariaLive="assertive" labelPosition="top" />
</div> :
<ScrollablePane className={styles.scrollPane}>
<Sticky stickyPosition={StickyPositionType.Header}>
<DefaultButton text='Register App' onClick={this.ModalAction.bind(this)} />
</Sticky>
{
this.state.apps.length ?
this.state.apps.map(currentApp => (
<div key={currentApp.Id}>
{currentApp.users.length ?
<DocumentCard
className={styles.documentCard}
type={DocumentCardType.compact}
onClickHref={this.appEditLink + currentApp.appId}
onClickTarget='_blank'>
<DocumentCardDetails>
<DocumentCardTitle title={currentApp.displayName} className={styles.documentCardTitle} />
<DocumentCardActivity activity={currentApp.createdDateTime.toString()} people={currentApp.users.slice(0, currentApp.users.length)} />
</DocumentCardDetails>
</DocumentCard>
:
<div />
}
</div>
))
:
<h4>No apps found</h4>
}
</ScrollablePane>
}
{/* Modal to register new app. */}
<div>
<Modal isOpen={this.state.isModalOpen}>
<div>
{/* <div className={styles.iconButtonStyles}> */}
<div>
<IconButton
className={styles.iconButtonStyles}
styles={iconStyles}
iconProps={{ iconName: 'Cancel' }}
ariaLabel="Close popup modal"
onClick={this.ModalAction.bind(this)}
/>
</div>
<RegisterApp
graphClient={this.props.graphClient}
modal={this.ModalAction.bind(this)}
callBack={this.refreshCallback.bind(this)} />
</div>
</Modal>
</div>
{/* Dialog to reload page. */}
<div>
<Dialog dialogContentProps={{
title: "Refresh to get the latest app."
}}
styles={{
main: {
maxHeight: '150px !important',
minHeight: '150px !important'
}
}}
hidden={this.state.isRefreshed}>
<DialogFooter>
<DefaultButton text='Refresh' onClick={this.handlerRefreshClick.bind(this)} />
</DialogFooter>
</Dialog>
</div>
</div>
);
}
}

View File

@ -0,0 +1,4 @@
import { MSGraphClientV3 } from '@microsoft/sp-http';
export interface IAzureAppsProps {
graphClient: MSGraphClientV3;
}

View File

@ -0,0 +1,10 @@
import { IAppModel } from "../../../common/models/IAppModel";
export interface IAzureAppsState {
error: string;
apps: IAppModel[];
loading: boolean;
isModalOpen: boolean;
isDialogHidden: boolean;
isRefreshed: boolean;
}

View File

@ -0,0 +1,15 @@
define([], function() {
return {
"PropertyPaneDescription": "Description",
"BasicGroupName": "Group Name",
"DescriptionFieldLabel": "Description Field",
"AppLocalEnvironmentSharePoint": "The app is running on your local environment as SharePoint web part",
"AppLocalEnvironmentTeams": "The app is running on your local environment as Microsoft Teams app",
"AppLocalEnvironmentOffice": "The app is running on your local environment in office.com",
"AppLocalEnvironmentOutlook": "The app is running on your local environment in Outlook",
"AppSharePointEnvironment": "The app is running on SharePoint page",
"AppTeamsTabEnvironment": "The app is running in Microsoft Teams",
"AppOfficeEnvironment": "The app is running in office.com",
"AppOutlookEnvironment": "The app is running in Outlook"
}
});

View File

@ -0,0 +1,18 @@
declare interface IAzureAppsWebPartStrings {
PropertyPaneDescription: string;
BasicGroupName: string;
DescriptionFieldLabel: string;
AppLocalEnvironmentSharePoint: string;
AppLocalEnvironmentTeams: string;
AppLocalEnvironmentOffice: string;
AppLocalEnvironmentOutlook: string;
AppSharePointEnvironment: string;
AppTeamsTabEnvironment: string;
AppOfficeEnvironment: string;
AppOutlookEnvironment: string;
}
declare module 'AzureAppsWebPartStrings' {
const strings: IAzureAppsWebPartStrings;
export = strings;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 542 B

View File

@ -0,0 +1,36 @@
{
"extends": "./node_modules/@microsoft/rush-stack-compiler-4.5/includes/tsconfig-web.json",
"compilerOptions": {
"target": "es5",
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"moduleResolution": "node",
"jsx": "react",
"declaration": true,
"sourceMap": true,
"experimentalDecorators": true,
"skipLibCheck": true,
"outDir": "lib",
"inlineSources": false,
"strictNullChecks": false,
"noImplicitAny": true,
"typeRoots": [
"./node_modules/@types",
"./node_modules/@microsoft"
],
"types": [
"webpack-env"
],
"lib": [
"es5",
"dom",
"es2015.collection",
"es2015.promise"
]
},
"include": [
"src/**/*.ts",
"src/**/*.tsx"
]
}

View File

@ -0,0 +1,39 @@
// For more information on how to run this SPFx project in a VS Code Remote Container, please visit https://aka.ms/spfx-devcontainer
{
"name": "SPFx 1.17.1",
"image": "docker.io/m365pnp/spfx:1.17.1",
// Set *default* container specific settings.json values on container create.
"settings": {},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"editorconfig.editorconfig",
"dbaeumer.vscode-eslint"
],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [
4321,
35729
],
"portsAttributes": {
"4321": {
"protocol": "https",
"label": "Manifest",
"onAutoForward": "silent",
"requireLocalPort": true
},
// Not needed for SPFx>= 1.12.1
// "5432": {
// "protocol": "https",
// "label": "Workbench",
// "onAutoForward": "silent"
// },
"35729": {
"protocol": "https",
"label": "LiveReload",
"onAutoForward": "silent",
"requireLocalPort": true
}
},
"postCreateCommand": "bash .devcontainer/spfx-startup.sh",
"remoteUser": "node"
}

View File

@ -0,0 +1,33 @@
echo
echo -e "\e[1;94mInstalling Node dependencies\e[0m"
npm install
## commands to create dev certificate and copy it to the root folder of the project
echo
echo -e "\e[1;94mGenerating dev certificate\e[0m"
gulp trust-dev-cert
# Convert the generated PEM certificate to a CER certificate
openssl x509 -inform PEM -in ~/.rushstack/rushstack-serve.pem -outform DER -out ./spfx-dev-cert.cer
# Copy the PEM ecrtificate for non-Windows hosts
cp ~/.rushstack/rushstack-serve.pem ./spfx-dev-cert.pem
## add *.cer to .gitignore to prevent certificates from being saved in repo
if ! grep -Fxq '*.cer' ./.gitignore
then
echo "# .CER Certificates" >> .gitignore
echo "*.cer" >> .gitignore
fi
## add *.pem to .gitignore to prevent certificates from being saved in repo
if ! grep -Fxq '*.pem' ./.gitignore
then
echo "# .PEM Certificates" >> .gitignore
echo "*.pem" >> .gitignore
fi
echo
echo -e "\e[1;92mReady!\e[0m"
echo -e "\n\e[1;94m**********\nOptional: if you plan on using gulp serve, don't forget to add the container certificate to your local machine. Please visit https://aka.ms/spfx-devcontainer for more information\n**********"

View File

@ -0,0 +1,352 @@
require('@rushstack/eslint-config/patch/modern-module-resolution');
module.exports = {
extends: ['@microsoft/eslint-config-spfx/lib/profiles/react'],
parserOptions: { tsconfigRootDir: __dirname },
overrides: [
{
files: ['*.ts', '*.tsx'],
parser: '@typescript-eslint/parser',
'parserOptions': {
'project': './tsconfig.json',
'ecmaVersion': 2018,
'sourceType': 'module'
},
rules: {
// Prevent usage of the JavaScript null value, while allowing code to access existing APIs that may require null. https://www.npmjs.com/package/@rushstack/eslint-plugin
'@rushstack/no-new-null': 1,
// Require Jest module mocking APIs to be called before any other statements in their code block. https://www.npmjs.com/package/@rushstack/eslint-plugin
'@rushstack/hoist-jest-mock': 1,
// Require regular expressions to be constructed from string constants rather than dynamically building strings at runtime. https://www.npmjs.com/package/@rushstack/eslint-plugin-security
'@rushstack/security/no-unsafe-regexp': 1,
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
'@typescript-eslint/adjacent-overload-signatures': 1,
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
//
// CONFIGURATION: By default, these are banned: String, Boolean, Number, Object, Symbol
'@typescript-eslint/ban-types': [
1,
{
'extendDefaults': false,
'types': {
'String': {
'message': 'Use \'string\' instead',
'fixWith': 'string'
},
'Boolean': {
'message': 'Use \'boolean\' instead',
'fixWith': 'boolean'
},
'Number': {
'message': 'Use \'number\' instead',
'fixWith': 'number'
},
'Object': {
'message': 'Use \'object\' instead, or else define a proper TypeScript type:'
},
'Symbol': {
'message': 'Use \'symbol\' instead',
'fixWith': 'symbol'
},
'Function': {
'message': 'The \'Function\' type accepts any function-like value.\nIt provides no type safety when calling the function, which can be a common source of bugs.\nIt also accepts things like class declarations, which will throw at runtime as they will not be called with \'new\'.\nIf you are expecting the function to accept certain arguments, you should explicitly define the function shape.'
}
}
}
],
// RATIONALE: Code is more readable when the type of every variable is immediately obvious.
// Even if the compiler may be able to infer a type, this inference will be unavailable
// to a person who is reviewing a GitHub diff. This rule makes writing code harder,
// but writing code is a much less important activity than reading it.
//
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
'@typescript-eslint/explicit-function-return-type': [
1,
{
'allowExpressions': true,
'allowTypedFunctionExpressions': true,
'allowHigherOrderFunctions': false
}
],
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
// Rationale to disable: although this is a recommended rule, it is up to dev to select coding style.
// Set to 1 (warning) or 2 (error) to enable.
'@typescript-eslint/explicit-member-accessibility': 0,
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
'@typescript-eslint/no-array-constructor': 1,
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
//
// RATIONALE: The "any" keyword disables static type checking, the main benefit of using TypeScript.
// This rule should be suppressed only in very special cases such as JSON.stringify()
// where the type really can be anything. Even if the type is flexible, another type
// may be more appropriate such as "unknown", "{}", or "Record<k,V>".
'@typescript-eslint/no-explicit-any': 1,
// RATIONALE: The #1 rule of promises is that every promise chain must be terminated by a catch()
// handler. Thus wherever a Promise arises, the code must either append a catch handler,
// or else return the object to a caller (who assumes this responsibility). Unterminated
// promise chains are a serious issue. Besides causing errors to be silently ignored,
// they can also cause a NodeJS process to terminate unexpectedly.
'@typescript-eslint/no-floating-promises': 2,
// RATIONALE: Catches a common coding mistake.
'@typescript-eslint/no-for-in-array': 2,
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
'@typescript-eslint/no-misused-new': 2,
// RATIONALE: The "namespace" keyword is not recommended for organizing code because JavaScript lacks
// a "using" statement to traverse namespaces. Nested namespaces prevent certain bundler
// optimizations. If you are declaring loose functions/variables, it's better to make them
// static members of a class, since classes support property getters and their private
// members are accessible by unit tests. Also, the exercise of choosing a meaningful
// class name tends to produce more discoverable APIs: for example, search+replacing
// the function "reverse()" is likely to return many false matches, whereas if we always
// write "Text.reverse()" is more unique. For large scale organization, it's recommended
// to decompose your code into separate NPM packages, which ensures that component
// dependencies are tracked more conscientiously.
//
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
'@typescript-eslint/no-namespace': [
1,
{
'allowDeclarations': false,
'allowDefinitionFiles': false
}
],
// RATIONALE: Parameter properties provide a shorthand such as "constructor(public title: string)"
// that avoids the effort of declaring "title" as a field. This TypeScript feature makes
// code easier to write, but arguably sacrifices readability: In the notes for
// "@typescript-eslint/member-ordering" we pointed out that fields are central to
// a class's design, so we wouldn't want to bury them in a constructor signature
// just to save some typing.
//
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
// Set to 1 (warning) or 2 (error) to enable the rule
'@typescript-eslint/no-parameter-properties': 0,
// RATIONALE: When left in shipping code, unused variables often indicate a mistake. Dead code
// may impact performance.
//
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
'@typescript-eslint/no-unused-vars': [
1,
{
'vars': 'all',
// Unused function arguments often indicate a mistake in JavaScript code. However in TypeScript code,
// the compiler catches most of those mistakes, and unused arguments are fairly common for type signatures
// that are overriding a base class method or implementing an interface.
'args': 'none'
}
],
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
'@typescript-eslint/no-use-before-define': [
2,
{
'functions': false,
'classes': true,
'variables': true,
'enums': true,
'typedefs': true
}
],
// Disallows require statements except in import statements.
// In other words, the use of forms such as var foo = require("foo") are banned. Instead use ES6 style imports or import foo = require("foo") imports.
'@typescript-eslint/no-var-requires': 'error',
// RATIONALE: The "module" keyword is deprecated except when describing legacy libraries.
//
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
'@typescript-eslint/prefer-namespace-keyword': 1,
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
// Rationale to disable: it's up to developer to decide if he wants to add type annotations
// Set to 1 (warning) or 2 (error) to enable the rule
'@typescript-eslint/no-inferrable-types': 0,
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
// Rationale to disable: declaration of empty interfaces may be helpful for generic types scenarios
'@typescript-eslint/no-empty-interface': 0,
// RATIONALE: This rule warns if setters are defined without getters, which is probably a mistake.
'accessor-pairs': 1,
// RATIONALE: In TypeScript, if you write x["y"] instead of x.y, it disables type checking.
'dot-notation': [
1,
{
'allowPattern': '^_'
}
],
// RATIONALE: Catches code that is likely to be incorrect
'eqeqeq': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'for-direction': 1,
// RATIONALE: Catches a common coding mistake.
'guard-for-in': 2,
// RATIONALE: If you have more than 2,000 lines in a single source file, it's probably time
// to split up your code.
'max-lines': ['warn', { max: 2000 }],
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-async-promise-executor': 2,
// RATIONALE: Deprecated language feature.
'no-caller': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-compare-neg-zero': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-cond-assign': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-constant-condition': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-control-regex': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-debugger': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-delete-var': 2,
// RATIONALE: Catches code that is likely to be incorrect
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-duplicate-case': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-empty': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-empty-character-class': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-empty-pattern': 1,
// RATIONALE: Eval is a security concern and a performance concern.
'no-eval': 1,
// RATIONALE: Catches code that is likely to be incorrect
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-ex-assign': 2,
// RATIONALE: System types are global and should not be tampered with in a scalable code base.
// If two different libraries (or two versions of the same library) both try to modify
// a type, only one of them can win. Polyfills are acceptable because they implement
// a standardized interoperable contract, but polyfills are generally coded in plain
// JavaScript.
'no-extend-native': 1,
// Disallow unnecessary labels
'no-extra-label': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-fallthrough': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-func-assign': 1,
// RATIONALE: Catches a common coding mistake.
'no-implied-eval': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-invalid-regexp': 2,
// RATIONALE: Catches a common coding mistake.
'no-label-var': 2,
// RATIONALE: Eliminates redundant code.
'no-lone-blocks': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-misleading-character-class': 2,
// RATIONALE: Catches a common coding mistake.
'no-multi-str': 2,
// RATIONALE: It's generally a bad practice to call "new Thing()" without assigning the result to
// a variable. Either it's part of an awkward expression like "(new Thing()).doSomething()",
// or else implies that the constructor is doing nontrivial computations, which is often
// a poor class design.
'no-new': 1,
// RATIONALE: Obsolete language feature that is deprecated.
'no-new-func': 2,
// RATIONALE: Obsolete language feature that is deprecated.
'no-new-object': 2,
// RATIONALE: Obsolete notation.
'no-new-wrappers': 1,
// RATIONALE: Catches code that is likely to be incorrect
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-octal': 2,
// RATIONALE: Catches code that is likely to be incorrect
'no-octal-escape': 2,
// RATIONALE: Catches code that is likely to be incorrect
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-regex-spaces': 2,
// RATIONALE: Catches a common coding mistake.
'no-return-assign': 2,
// RATIONALE: Security risk.
'no-script-url': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-self-assign': 2,
// RATIONALE: Catches a common coding mistake.
'no-self-compare': 2,
// RATIONALE: This avoids statements such as "while (a = next(), a && a.length);" that use
// commas to create compound expressions. In general code is more readable if each
// step is split onto a separate line. This also makes it easier to set breakpoints
// in the debugger.
'no-sequences': 1,
// RATIONALE: Catches code that is likely to be incorrect
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-shadow-restricted-names': 2,
// RATIONALE: Obsolete language feature that is deprecated.
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-sparse-arrays': 2,
// RATIONALE: Although in theory JavaScript allows any possible data type to be thrown as an exception,
// such flexibility adds pointless complexity, by requiring every catch block to test
// the type of the object that it receives. Whereas if catch blocks can always assume
// that their object implements the "Error" contract, then the code is simpler, and
// we generally get useful additional information like a call stack.
'no-throw-literal': 2,
// RATIONALE: Catches a common coding mistake.
'no-unmodified-loop-condition': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-unsafe-finally': 2,
// RATIONALE: Catches a common coding mistake.
'no-unused-expressions': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-unused-labels': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-useless-catch': 1,
// RATIONALE: Avoids a potential performance problem.
'no-useless-concat': 1,
// RATIONALE: The "var" keyword is deprecated because of its confusing "hoisting" behavior.
// Always use "let" or "const" instead.
//
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
'no-var': 2,
// RATIONALE: Generally not needed in modern code.
'no-void': 1,
// RATIONALE: Obsolete language feature that is deprecated.
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-with': 2,
// RATIONALE: Makes logic easier to understand, since constants always have a known value
// @typescript-eslint\eslint-plugin\dist\configs\eslint-recommended.js
'prefer-const': 1,
// RATIONALE: Catches a common coding mistake where "resolve" and "reject" are confused.
'promise/param-names': 2,
// RATIONALE: Catches code that is likely to be incorrect
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'require-atomic-updates': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'require-yield': 1,
// "Use strict" is redundant when using the TypeScript compiler.
'strict': [
2,
'never'
],
// RATIONALE: Catches code that is likely to be incorrect
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'use-isnan': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
// Set to 1 (warning) or 2 (error) to enable.
// Rationale to disable: !!{}
'no-extra-boolean-cast': 0,
// ====================================================================
// @microsoft/eslint-plugin-spfx
// ====================================================================
'@microsoft/spfx/import-requires-chunk-name': 1,
'@microsoft/spfx/no-require-ensure': 2,
'@microsoft/spfx/pair-react-dom-render-unmount': 1
}
},
{
// For unit tests, we can be a little bit less strict. The settings below revise the
// defaults specified in the extended configurations, as well as above.
files: [
// Test files
'*.test.ts',
'*.test.tsx',
'*.spec.ts',
'*.spec.tsx',
// Facebook convention
'**/__mocks__/*.ts',
'**/__mocks__/*.tsx',
'**/__tests__/*.ts',
'**/__tests__/*.tsx',
// Microsoft convention
'**/test/*.ts',
'**/test/*.tsx'
],
rules: {}
}
]
};

View File

@ -0,0 +1,34 @@
# Logs
logs
*.log
npm-debug.log*
# Dependency directories
node_modules
# Build generated files
dist
lib
release
solution
temp
*.sppkg
.heft
# Coverage directory used by tools like istanbul
coverage
# OSX
.DS_Store
# Visual Studio files
.ntvs_analysis.dat
.vs
bin
obj
# Resx Generated Code
*.resx.ts
# Styles Generated Code
*.scss.ts

View File

@ -0,0 +1,16 @@
!dist
config
gulpfile.js
release
src
temp
tsconfig.json
tslint.json
*.log
.yo-rc.json
.vscode

View File

@ -0,0 +1,21 @@
{
"@microsoft/generator-sharepoint": {
"plusBeta": false,
"isCreatingSolution": true,
"nodeVersion": "14.18.2",
"sdksVersions": {
"@microsoft/microsoft-graph-client": "3.0.2",
"@microsoft/teams-js": "2.4.1"
},
"version": "1.16.1",
"libraryName": "react-graph-webpart-report",
"libraryId": "d5339db5-8abe-451a-8afe-57a16de5d286",
"environment": "spo",
"packageManager": "npm",
"solutionName": "react-graph-webpart-report",
"solutionShortDescription": "react-graph-webpart-report description",
"skipFeatureDeployment": true,
"isDomainIsolated": false,
"componentType": "webpart"
}
}

View File

@ -0,0 +1,108 @@
# Web Part Report
## Summary
This sample web part shows a report of the web parts used on the current site.
![Chart View](./assets/chartView.png)
![List View](./assets/listView.png)
![Animated](./assets/Animated.gif)
Compatibility
| :warning: Important |
|:---------------------------|
| Every SPFx version is optimally compatible with specific versions of Node.js. In order to be able to build this sample, you need to ensure that the version of Node on your workstation matches one of the versions listed in this section. This sample will not work on a different version of Node.|
|Refer to <https://aka.ms/spfx-matrix> for more information on SPFx compatibility. |
This sample is optimally compatible with the following environment configuration:
![SPFx 1.17.1](https://img.shields.io/badge/SPFx-1.17.1-green.svg)
![Node.js v16.13+](https://img.shields.io/badge/Node.js-v16.13+-green.svg)
![Compatible with SharePoint Online](https://img.shields.io/badge/SharePoint%20Online-Compatible-green.svg)
![Does not work with SharePoint 2019](https://img.shields.io/badge/SharePoint%20Server%202019-Incompatible-red.svg "SharePoint Server 2019 requires SPFx 1.4.1 or lower")
![Does not work with SharePoint 2016 (Feature Pack 2)](https://img.shields.io/badge/SharePoint%20Server%202016%20(Feature%20Pack%202)-Incompatible-red.svg "SharePoint Server 2016 Feature Pack 2 requires SPFx 1.1")
![Local Workbench Unsupported](https://img.shields.io/badge/Local%20Workbench-Unsupported-red.svg "Local workbench is no longer available as of SPFx 1.13 and above")
![Hosted Workbench Compatible](https://img.shields.io/badge/Hosted%20Workbench-Compatible-green.svg)
![Compatible with Remote Containers](https://img.shields.io/badge/Remote%20Containers-Compatible-green.svg)
## Applies to
* [SharePoint Framework](https://learn.microsoft.com/sharepoint/dev/spfx/sharepoint-framework-overview)
* [Microsoft 365 tenant](https://learn.microsoft.com/sharepoint/dev/spfx/set-up-your-development-environment)
> Get your own free development tenant by subscribing to [Microsoft 365 developer program](http://aka.ms/m365devprogram)
## Prerequisites
Microsoft Graph permission:
* Sites.Read.All
## Contributors
* [Aimery Thomas](https://github.com/a1mery) |
## Version history
| Version | Date | Comments |
| ------- | ---------------- | --------------- |
| 1.0 | March 23, 2023 | Initial release |
## Minimal Path to Awesome
* Clone this repository (or [download this solution as a .ZIP file](https://pnp.github.io/download-partial/?url=https://github.com/pnp/sp-dev-fx-webparts/tree/main/samples/react-graph-webpart-report) then unzip it)
* From your command line, change your current directory to the directory containing this sample (`react-graph-webpart-report`, located under `samples`)
* in the command line run:
* `npm install`
- `gulp bundle`
- `gulp package-solution`
- Deploy the package to your app catalog
- Approve the API permission request from the SharePoint admin
- Add the web part to a page
- In the command-line run:
- `gulp serve --nobrowser`
## Features
This web part illustrates the following concepts:
- Consume the Microsoft Graph API from SPFx web part
- Use of the SharePoint Pages Microsoft Graph API
- Use of [@pnp/spfx-property-controls](https://pnp.github.io/sp-dev-fx-property-controls/) (ListView and CharControl)
- Use of Top Actions
## References
- [Getting started with SharePoint Framework](https://docs.microsoft.com/en-us/sharepoint/dev/spfx/set-up-your-developer-tenant)
- [Use Microsoft Graph in your solution](https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/get-started/using-microsoft-graph-apis)
- [Adding support for web part Top Actions](https://learn.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/guidance/getting-started-with-top-actions)
- [Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp) - Guidance, tooling, samples and open-source controls for your Microsoft 365 development
- [@pnp/spfx-controls-react](https://pnp.github.io/sp-dev-fx-controls-react/)
## Help
We do not support samples, but this community is always willing to help, and we want to improve these samples. We use GitHub to track issues, which makes it easy for community members to volunteer their time and help resolve issues.
If you're having issues building the solution, please run [spfx doctor](https://pnp.github.io/cli-microsoft365/cmd/spfx/spfx-doctor/) from within the solution folder to diagnose incompatibility issues with your environment.
You can try looking at [issues related to this sample](https://github.com/pnp/sp-dev-fx-webparts/issues?q=label%3A%22sample%3A%20react-graph-webpart-report%22) to see if anybody else is having the same issues.
You can also try looking at [discussions related to this sample](https://github.com/pnp/sp-dev-fx-webparts/discussions?discussions_q=react-graph-webpart-report) and see what the community is saying.
If you encounter any issues using this sample, [create a new issue](https://github.com/pnp/sp-dev-fx-webparts/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Abug-suspected%2Csample%3A%20react-graph-webpart-report&template=bug-report.yml&sample=react-graph-webpart-report&authors=@a1mery&title=react-graph-webpart-report%20-%20).
For questions regarding this sample, [create a new question](https://github.com/pnp/sp-dev-fx-webparts/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Aquestion%2Csample%3A%20react-graph-webpart-report&template=question.yml&sample=react-graph-webpart-report&authors=@a1mery&title=react-graph-webpart-report%20-%20).
Finally, if you have an idea for improvement, [make a suggestion](https://github.com/pnp/sp-dev-fx-webparts/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Aenhancement%2Csample%3A%20react-graph-webpart-report&template=suggestion.yml&sample=react-graph-webpart-report&authors=@a1mery&title=react-graph-webpart-report%20-%20).
## 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.**
<img src="https://m365-visitor-stats.azurewebsites.net/sp-dev-fx-webparts/samples/react-graph-webpart-report" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

View File

@ -0,0 +1,50 @@
[
{
"name": "pnp-sp-dev-spfx-web-parts-react-graph-webpart-report",
"source": "pnp",
"title": "Web Part Report",
"shortDescription": "This sample web part shows a report of the web parts used on the current site.",
"url": "https://github.com/pnp/sp-dev-fx-webparts/tree/main/samples/react-graph-webpart-report",
"downloadUrl": "https://pnp.github.io/download-partial/?url=https://github.com/pnp/sp-dev-fx-webparts/tree/main/samples/react-graph-webpart-report",
"longDescription": [
"This sample web part shows a report of the web parts used on the current site."
],
"creationDateTime": "2023-05-13",
"updateDateTime": "2023-05-13",
"products": [
"SharePoint"
],
"metadata": [
{
"key": "CLIENT-SIDE-DEV",
"value": "React"
},
{
"key": "SPFX-VERSION",
"value": "1.17.1"
}
],
"thumbnails": [
{
"type": "image",
"order": 100,
"url": "https://github.com/pnp/sp-dev-fx-webparts/raw/main/samples/react-graph-webpart-report/assets/YOUR-IMAGE-NAME-HERE",
"alt": "Web Part Preview"
}
],
"authors": [
{
"gitHubAccount": "a1mery",
"pictureUrl": "https://github.com/a1mery.png",
"name": "Aimery Thomas"
}
],
"references": [
{
"name": "Build your first SharePoint client-side web part",
"description": "Client-side web parts are client-side components that run in the context of a SharePoint page. Client-side web parts can be deployed to SharePoint environments that support the SharePoint Framework. You can also use modern JavaScript web frameworks, tools, and libraries to build them.",
"url": "https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/get-started/build-a-hello-world-web-part"
}
]
}
]

View File

@ -0,0 +1,19 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/config.2.0.schema.json",
"version": "2.0",
"bundles": {
"web-part-report-web-part": {
"components": [
{
"entrypoint": "./lib/webparts/webPartReport/WebPartReportWebPart.js",
"manifest": "./src/webparts/webPartReport/WebPartReportWebPart.manifest.json"
}
]
}
},
"externals": {},
"localizedResources": {
"WebPartReportWebPartStrings": "lib/webparts/webPartReport/loc/{locale}.js",
"ControlStrings": "node_modules/@pnp/spfx-controls-react/lib/loc/{locale}.js"
}
}

View File

@ -0,0 +1,7 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/deploy-azure-storage.schema.json",
"workingDir": "./release/assets/",
"account": "<!-- STORAGE ACCOUNT NAME -->",
"container": "react-graph-webpart-report",
"accessKey": "<!-- ACCESS KEY -->"
}

View File

@ -0,0 +1,46 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/package-solution.schema.json",
"solution": {
"name": "react-graph-webpart-report-client-side-solution",
"id": "d5339db5-8abe-451a-8afe-57a16de5d286",
"version": "1.0.0.0",
"includeClientSideAssets": true,
"skipFeatureDeployment": true,
"isDomainIsolated": false,
"developer": {
"name": "",
"websiteUrl": "",
"privacyUrl": "",
"termsOfUseUrl": "",
"mpnId": "Undefined-1.16.1"
},
"webApiPermissionRequests": [
{
"resource": "Microsoft Graph",
"scope": "Sites.Read.All"
}
],
"metadata": {
"shortDescription": {
"default": "react-graph-webpart-report description"
},
"longDescription": {
"default": "react-graph-webpart-report description"
},
"screenshotPaths": [],
"videoUrl": "",
"categories": []
},
"features": [
{
"title": "react-graph-webpart-report Feature",
"description": "The feature that activates elements of the react-graph-webpart-report solution.",
"id": "92ec592f-2701-406a-8984-3f9229c345a6",
"version": "1.0.0.0"
}
]
},
"paths": {
"zippedPackage": "solution/react-graph-webpart-report.sppkg"
}
}

View File

@ -0,0 +1,3 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/core-build/sass.schema.json"
}

View File

@ -0,0 +1,6 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/spfx-serve.schema.json",
"port": 4321,
"https": true,
"initialPage": "https://enter-your-SharePoint-site/_layouts/workbench.aspx"
}

View File

@ -0,0 +1,4 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/write-manifests.schema.json",
"cdnBasePath": "<!-- PATH TO CDN -->"
}

View File

@ -0,0 +1,16 @@
'use strict';
const build = require('@microsoft/sp-build-web');
build.addSuppression(`Warning - [sass] The local CSS class 'ms-Grid' is not camelCase and will not be type-safe.`);
var getTasks = build.rig.getTasks;
build.rig.getTasks = function () {
var result = getTasks.call(build.rig);
result.set('serve', result.get('serve-deprecated'));
return result;
};
build.initialize(require('gulp'));

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,44 @@
{
"name": "react-graph-webpart-report",
"version": "0.0.1",
"private": true,
"engines": {
"node": ">=16.13.0 <17.0.0"
},
"main": "lib/index.js",
"scripts": {
"build": "gulp bundle",
"clean": "gulp clean",
"test": "gulp test"
},
"dependencies": {
"@fluentui/react": "^8.108.1",
"@microsoft/sp-core-library": "^1.17.1",
"@microsoft/sp-http": "^1.17.1",
"@microsoft/sp-lodash-subset": "^1.17.1",
"@microsoft/sp-office-ui-fabric-core": "^1.17.1",
"@microsoft/sp-property-pane": "^1.17.1",
"@microsoft/sp-top-actions": "^1.17.1",
"@microsoft/sp-webpart-base": "^1.17.1",
"@pnp/spfx-controls-react": "^3.13.0",
"chart.js": "^4.2.1",
"react": "17.0.1",
"react-dom": "17.0.1",
"tslib": "2.3.1"
},
"devDependencies": {
"@microsoft/eslint-config-spfx": "^1.17.1",
"@microsoft/eslint-plugin-spfx": "^1.17.1",
"@microsoft/rush-stack-compiler-4.5": "0.2.2",
"@microsoft/sp-build-web": "^1.17.1",
"@microsoft/sp-module-interfaces": "^1.17.1",
"@rushstack/eslint-config": "2.5.1",
"@types/react": "17.0.45",
"@types/react-dom": "17.0.17",
"@types/webpack-env": "~1.15.2",
"ajv": "^6.12.5",
"eslint-plugin-react-hooks": "4.3.0",
"gulp": "4.0.2",
"typescript": "4.5.5"
}
}

View File

@ -0,0 +1 @@
// A file is required to be in the root of the /src directory by the TypeScript compiler

View File

@ -0,0 +1,62 @@
import { MSGraphClientV3 } from "@microsoft/sp-http";
import { SitePage } from "./types";
export interface IGraphService {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
GetWebParts(client: MSGraphClientV3, siteId: string, pageId: string): Promise<any>;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
GetSitePages(client: MSGraphClientV3, siteId: string): Promise<any>;
}
class GraphService implements IGraphService {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public async GetWebParts(client: MSGraphClientV3, siteId: string, pageId: string): Promise<any> {
try{
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const rawWebParts: any = await this.GET(client, "sites/" + siteId + "/pages/" + pageId + "/webparts","","");
return rawWebParts;
} catch (error){
return null;
}
}
public async GetSitePages(client: MSGraphClientV3, siteId: string): Promise<SitePage[]> {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const rawPages: any = await this.GET(client, "sites/" + siteId + "/pages", "", "id,title");
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return rawPages.value.flatMap((rawPage: any) => (
[
{
id: rawPage.id,
title: rawPage.title
}
]
));
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
private GET(client: MSGraphClientV3, api: string, filter?: string, select?: string, top?: number, responseType?: any): Promise<any> {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return new Promise<any>((resolve, reject) => {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
client.api(api).version("beta").select(select).filter(filter).responseType(responseType)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
.get((error: any, response: any) => {
if (error) {
reject(error);
return;
}
resolve(response);
});
});
}
}
export const GraphServiceInstance = new GraphService();

View File

@ -0,0 +1,37 @@
import { SitePage, WebPart } from "./types";
import { GraphServiceInstance } from "./GraphService";
import { MSGraphClientV3 } from "@microsoft/sp-http";
export async function _getSiteWebParts(graphClient: MSGraphClientV3, siteId: string): Promise<WebPart[]> {
try {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const siteWebParts: any = [];
const sitePages: SitePage[] = await GraphServiceInstance.GetSitePages(graphClient, siteId);
for (let i: number = 0; i<sitePages.length-1; i++){
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const r: any = await GraphServiceInstance.GetWebParts(graphClient, siteId, sitePages[i].id);
if (r !== null){
siteWebParts.push(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
r.value.flatMap((siteWebPart: any) => ([
{
siteId: siteId,
pageTitle: sitePages[i].title,
id: siteWebPart.id,
title: siteWebPart.data.title,
}
]))
);
}
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return siteWebParts.flatMap((t: any)=>t);
} catch (error) {
console.error(error);
return null;
}
}

View File

@ -0,0 +1,27 @@
export type WebPart = {
siteId: string;
pageTitle: string;
id: string;
title: string;
}
export type AggredatedWebParts = {
titles: string[];
count: number[];
}
export type SitePage = {
id: string;
title: string;
}
export type ChartDataCustom = {
labels: string[];
datasets: DataSet[];
}
export type DataSet = {
label: string;
data: number [];
//backgroundColor: string[];
}

View File

@ -0,0 +1,29 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx/client-side-web-part-manifest.schema.json",
"id": "47ebcd69-ff9f-4889-9586-dee8716703c3",
"alias": "WebPartReportWebPart",
"componentType": "WebPart",
// The "*" signifies that the version should be taken from the package.json
"version": "*",
"manifestVersion": 2,
// If true, the component can only be installed on sites where Custom Script is allowed.
// Components that allow authors to embed arbitrary script code should set this to true.
// https://support.office.com/en-us/article/Turn-scripting-capabilities-on-or-off-1f2c515f-5d7e-448a-9fd7-835da935584f
"requiresCustomScript": false,
"supportedHosts": ["SharePointWebPart"],
"supportsThemeVariants": true,
"preconfiguredEntries": [{
"groupId": "5c03119e-3074-46fd-976b-c60198311f70", // Advanced
"group": { "default": "Advanced" },
"title": { "default": "Web Part Report" },
"description": { "default": "Web Part Report description" },
"officeFabricIconFontName": "AnalyticsReport",
"properties": {
"description": "Web Part Report",
"displayOption": "1"
}
}]
}

View File

@ -0,0 +1,131 @@
import * as React from 'react';
import * as ReactDom from 'react-dom';
import { Version } from '@microsoft/sp-core-library';
import {
IPropertyPaneConfiguration,
PropertyPaneTextField
} from '@microsoft/sp-property-pane';
import { BaseClientSideWebPart } from '@microsoft/sp-webpart-base';
import { IReadonlyTheme } from '@microsoft/sp-component-base';
import * as strings from 'WebPartReportWebPartStrings';
import WebPartReport from './components/WebPartReport';
import { IWebPartReportProps } from './components/IWebPartReportProps';
import { ITopActions, TopActionsFieldType } from '@microsoft/sp-top-actions';
import { MSGraphClientV3 } from "@microsoft/sp-http";
export interface IWebPartReportWebPartProps {
description: string;
displayOption: string;
}
export default class WebPartReportWebPart extends BaseClientSideWebPart<IWebPartReportWebPartProps> {
private graphClient: MSGraphClientV3;
private _isDarkTheme: boolean = false;
public render(): void {
const element: React.ReactElement<IWebPartReportProps> = React.createElement(
WebPartReport,
{
description: this.properties.description,
displayOption : this.properties.displayOption,
isDarkTheme: this._isDarkTheme,
hasTeamsContext: !!this.context.sdks.microsoftTeams,
userDisplayName: this.context.pageContext.user.displayName,
siteId: this.context.pageContext.site.id.toString(),
graphClient: this.graphClient
}
);
ReactDom.render(element, this.domElement);
}
protected async onInit(): Promise<void> {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return new Promise<void>((resolve: () => void, reject: (error: any) => void): void => {
this.context.msGraphClientFactory
.getClient("3")
.then((client: MSGraphClientV3): void => {
this.graphClient = client;
resolve();
}, err => reject(err));
});
}
protected onThemeChanged(currentTheme: IReadonlyTheme | undefined): void {
if (!currentTheme) {
return;
}
this._isDarkTheme = !!currentTheme.isInverted;
const {
semanticColors
} = currentTheme;
if (semanticColors) {
this.domElement.style.setProperty('--bodyText', semanticColors.bodyText || null);
this.domElement.style.setProperty('--link', semanticColors.link || null);
this.domElement.style.setProperty('--linkHovered', semanticColors.linkHovered || null);
}
}
protected onDispose(): void {
ReactDom.unmountComponentAtNode(this.domElement);
}
protected get dataVersion(): Version {
return Version.parse('1.0');
}
protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration {
return {
pages: [
{
header: {
description: strings.PropertyPaneDescription
},
groups: [
{
groupName: strings.BasicGroupName,
groupFields: [
PropertyPaneTextField('description', {
label: strings.DescriptionFieldLabel
})
]
}
]
}
]
};
}
public getTopActionsConfiguration(): ITopActions | undefined {
const {
displayOption
} = this.properties;
return {
topActions:[{
type: TopActionsFieldType.Dropdown,
title: 'Dropdown',
targetProperty: 'displayOption',
properties: {
options: [{
key: '1',
text: 'List',
checked: displayOption.toString() === "1" ? true : false
}, {
key: '2',
text: 'Chart',
checked: displayOption.toString() === "2" ? true : false
}]
}
}],
onExecute: (actionName, newValue) =>{
this.properties.displayOption = newValue;
console.log("test",displayOption.toString() === "1");
this.render();
}
};
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -0,0 +1,11 @@
import { MSGraphClientV3 } from "@microsoft/sp-http";
export interface IWebPartReportProps {
description: string;
displayOption: string;
isDarkTheme: boolean;
hasTeamsContext: boolean;
userDisplayName: string;
siteId: string;
graphClient: MSGraphClientV3;
}

View File

@ -0,0 +1,7 @@
import { AggredatedWebParts, WebPart } from "../../types";
export interface IWebPartReportWebPartState {
webPartList: WebPart[];
aggregatedWebPartList: AggredatedWebParts;
loading: boolean;
}

View File

@ -0,0 +1,44 @@
@import '~@fluentui/react/dist/sass/References.scss';
.webPartReport {
overflow: hidden;
padding: 1em;
color: "[theme:bodyText, default: #323130]";
color: var(--bodyText);
&.teams {
font-family: $ms-font-family-fallbacks;
}
}
.title {
@include ms-font-xl;
color: $ms-color-themeDark;
font-weight: bold;
}
.hiddenComponent {
display: none;
}
.welcome {
text-align: center;
}
.welcomeImage {
width: 100%;
max-width: 420px;
}
.links {
a {
text-decoration: none;
color: "[theme:link, default:#03787c]";
color: var(--link); // note: CSS Custom Properties support is limited to modern browsers only
&:hover {
text-decoration: underline;
color: "[theme:linkHovered, default: #014446]";
color: var(--linkHovered); // note: CSS Custom Properties support is limited to modern browsers only
}
}
}

View File

@ -0,0 +1,149 @@
import * as React from 'react';
import styles from './WebPartReport.module.scss';
import { IWebPartReportProps } from './IWebPartReportProps';
import { _getSiteWebParts } from '../../WebPartData';
import { WebPart } from '../../types';
import { ListView, IViewField } from "@pnp/spfx-controls-react/lib/ListView";
import { IWebPartReportWebPartState } from './IWebPartReportWebPartState';
import { ChartControl, ChartType } from '@pnp/spfx-controls-react/lib/ChartControl';
import { ChartData } from 'chart.js';
import { Spinner } from '@fluentui/react';
const _viewFields: IViewField[] = [
{
name: "title",
displayName: "Web Part type",
minWidth: 150,
maxWidth: 300
},
{
name: "id",
displayName: "Web Part ID",
minWidth: 150,
maxWidth: 300
},
{
name: "pageTitle",
displayName: "Page Title",
minWidth: 150,
maxWidth: 300
},
{
name: "siteId",
displayName: "Site ID",
minWidth: 250
}
];
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const options: any = {
legend: {
display: true,
position: "left"
},
title: {
display: true,
text: "Site web parts"
}
};
let siteWebParts: WebPart[];
let webPartsCounts: number[] = [];
let webPartsTitles: string[] = [];
const aggregatedWebPartData = new Map<string, number>();
export default class WebPartReport extends React.Component<IWebPartReportProps, IWebPartReportWebPartState> {
constructor(props: IWebPartReportProps) {
super(props);
this.state = {
loading: true,
webPartList: [],
aggregatedWebPartList: { titles: [], count: [] }
};
}
public async componentDidMount():Promise<void> {
await this._setChartData();
}
private loadingData(): Promise<ChartData> {
return new Promise<ChartData>((resolve, _reject) => {
let countWP:number[] = [];
countWP = this.state.aggregatedWebPartList.count
const data: ChartData =
{
labels: this.state.aggregatedWebPartList.titles.length > 0 ? this.state.aggregatedWebPartList.titles : [],
datasets: [{ label: "WebParts", data: countWP.length > 0 ? countWP : [] }]
};
resolve(data);
});
}
public async _setChartData(): Promise<void> {
webPartsCounts = [];
webPartsTitles = [];
aggregatedWebPartData.clear();
siteWebParts = await _getSiteWebParts(this.props.graphClient, this.props.siteId.toString());
siteWebParts.forEach(e => {
if (!aggregatedWebPartData.has(e.title)) {
aggregatedWebPartData.set(e.title, 1);
} else {
aggregatedWebPartData.set(e.title, aggregatedWebPartData.get(e.title) + 1)
}
});
aggregatedWebPartData.forEach(a => {
webPartsCounts.push(a);
});
aggregatedWebPartData.forEach((value, key) => {
webPartsTitles.push(key);
});
this.setState({
webPartList: siteWebParts,
aggregatedWebPartList: {
titles: webPartsTitles,
count: webPartsCounts
},
loading: false
});
}
public render(): React.ReactElement<IWebPartReportProps> {
const {
hasTeamsContext,
displayOption
} = this.props;
return (
<section className={`${styles.webPartReport} ${hasTeamsContext ? styles.teams : ''}`}>
<div className={this.state.loading ? styles.hiddenComponent : ''}>
<div className={displayOption.toString() === "2" ? styles.hiddenComponent : ''}>
<p className={styles.title}>Web parts list:</p>
<ListView
viewFields={_viewFields}
items={siteWebParts}
/>
</div>
<ChartControl
type={ChartType.Doughnut}
datapromise={this.loadingData()}
options={options}
className={displayOption.toString() === "1" ? styles.hiddenComponent : ''}
/>
</div>
<div className={!this.state.loading ? styles.hiddenComponent : ''}>
<Spinner label="Loading web parts..." />
</div>
</section>
);
}
}

View File

@ -0,0 +1,15 @@
define([], function() {
return {
"PropertyPaneDescription": "This webpart shows a report of webparts used in current site.",
"BasicGroupName": "Group Name",
"DescriptionFieldLabel": "Description Field",
"AppLocalEnvironmentSharePoint": "The app is running on your local environment as SharePoint web part",
"AppLocalEnvironmentTeams": "The app is running on your local environment as Microsoft Teams app",
"AppLocalEnvironmentOffice": "The app is running on your local environment in office.com",
"AppLocalEnvironmentOutlook": "The app is running on your local environment in Outlook",
"AppSharePointEnvironment": "The app is running on SharePoint page",
"AppTeamsTabEnvironment": "The app is running in Microsoft Teams",
"AppOfficeEnvironment": "The app is running in office.com",
"AppOutlookEnvironment": "The app is running in Outlook"
}
});

View File

@ -0,0 +1,11 @@
declare interface IWebPartReportWebPartStrings {
PropertyPaneDescription: string;
BasicGroupName: string;
DescriptionFieldLabel: string;
}
declare module 'WebPartReportWebPartStrings' {
const strings: IWebPartReportWebPartStrings;
export = strings;
}

Some files were not shown because too many files have changed in this diff Show More