Fixed security issues with react-project-online
This commit is contained in:
parent
3636f967ab
commit
ea9d3fa209
|
@ -2,10 +2,11 @@
|
|||
"@microsoft/generator-sharepoint": {
|
||||
"isCreatingSolution": true,
|
||||
"environment": "spo",
|
||||
"version": "1.6.0",
|
||||
"version": "1.10.0",
|
||||
"libraryName": "react-project-online",
|
||||
"libraryId": "d6729fd9-103c-42c8-8ee5-17760e4ab92f",
|
||||
"libraryId": "9a8c9f6c-e756-49cc-bc51-75a9a6c57dce",
|
||||
"packageManager": "npm",
|
||||
"isDomainIsolated": false,
|
||||
"componentType": "webpart"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -24,7 +24,7 @@ The web part is currently returning project tasks as a simple proof of concept.
|
|||
![Demo](./assets/Preview.gif)
|
||||
|
||||
## Used SharePoint Framework Version
|
||||
![drop](https://img.shields.io/badge/drop-1.6.0-green.svg)
|
||||
![1.10.0](https://img.shields.io/badge/drop-1.10.0-green.svg)
|
||||
|
||||
## Applies to
|
||||
|
||||
|
@ -49,6 +49,7 @@ react-project-online|Joel Rodrigues
|
|||
|
||||
Version|Date|Comments
|
||||
-------|----|--------
|
||||
1.4|April 12, 2020|Updated to SPFx 1.10.0
|
||||
1.3|October 03, 2018|Updated to SPFx 1.6.0
|
||||
1.2|March 16, 2018|Updated to SPFx 1.4.1
|
||||
1.1|January 22, 2018|Updated to SPFx 1.4.0
|
||||
|
|
|
@ -14,6 +14,6 @@
|
|||
"externals": {},
|
||||
"localizedResources": {
|
||||
"ReactProjectOnlineWebPartStrings": "lib/webparts/reactProjectOnline/loc/{locale}.js",
|
||||
"ControlStrings": "./node_modules/@pnp/spfx-controls-react/lib/loc/{locale}.js"
|
||||
"ControlStrings": "node_modules/@pnp/spfx-controls-react/lib/loc/{locale}.js"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,4 +4,4 @@
|
|||
"account": "<!-- STORAGE ACCOUNT NAME -->",
|
||||
"container": "react-project-online",
|
||||
"accessKey": "<!-- ACCESS KEY -->"
|
||||
}
|
||||
}
|
|
@ -2,10 +2,10 @@
|
|||
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/package-solution.schema.json",
|
||||
"solution": {
|
||||
"name": "react-project-online-client-side-solution",
|
||||
"id": "d6729fd9-103c-42c8-8ee5-17760e4ab92f",
|
||||
"version": "1.3.0.0",
|
||||
"id": "9a8c9f6c-e756-49cc-bc51-75a9a6c57dce",
|
||||
"version": "1.0.0.0",
|
||||
"includeClientSideAssets": true,
|
||||
"skipFeatureDeployment": true
|
||||
"isDomainIsolated": false
|
||||
},
|
||||
"paths": {
|
||||
"zippedPackage": "solution/react-project-online.sppkg"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/write-manifests.schema.json",
|
||||
"cdnBasePath": "<!-- PATH TO CDN -->"
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
const gulp = require('gulp');
|
||||
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.`);
|
||||
|
||||
build.initialize(gulp);
|
||||
build.initialize(require('gulp'));
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,7 +1,8 @@
|
|||
{
|
||||
"name": "react-project-online",
|
||||
"version": "1.3.0",
|
||||
"version": "0.0.1",
|
||||
"private": true,
|
||||
"main": "lib/index.js",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
|
@ -11,27 +12,34 @@
|
|||
"test": "gulp test"
|
||||
},
|
||||
"dependencies": {
|
||||
"@microsoft/sp-core-library": "1.6.0",
|
||||
"@microsoft/sp-lodash-subset": "1.6.0",
|
||||
"@microsoft/sp-office-ui-fabric-core": "1.6.0",
|
||||
"@microsoft/sp-webpart-base": "1.6.0",
|
||||
"@pnp/spfx-controls-react": "1.1.3",
|
||||
"@microsoft/sp-core-library": "1.10.0",
|
||||
"@microsoft/sp-lodash-subset": "1.10.0",
|
||||
"@microsoft/sp-office-ui-fabric-core": "1.10.0",
|
||||
"@microsoft/sp-property-pane": "1.10.0",
|
||||
"@microsoft/sp-webpart-base": "1.10.0",
|
||||
"@pnp/logging": "^2.0.4",
|
||||
"@pnp/sp": "^2.0.4",
|
||||
"@pnp/spfx-controls-react": "^1.17.0",
|
||||
"@types/es6-promise": "0.0.33",
|
||||
"@types/react": "15.6.6",
|
||||
"@types/react-dom": "15.5.6",
|
||||
"@types/react": "16.8.8",
|
||||
"@types/react-dom": "16.8.3",
|
||||
"@types/webpack-env": "1.13.1",
|
||||
"react": "15.6.2",
|
||||
"react-dom": "15.6.2",
|
||||
"sp-pnp-js": "^3.0.4"
|
||||
"office-ui-fabric-react": "6.189.2",
|
||||
"react": "16.8.5",
|
||||
"react-dom": "16.8.5"
|
||||
},
|
||||
"resolutions": {
|
||||
"@types/react": "16.8.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@microsoft/sp-build-web": "1.6.0",
|
||||
"@microsoft/sp-module-interfaces": "1.6.0",
|
||||
"@microsoft/sp-webpart-workbench": "1.6.0",
|
||||
"@microsoft/sp-build-web": "1.10.0",
|
||||
"@microsoft/sp-tslint-rules": "1.10.0",
|
||||
"@microsoft/sp-module-interfaces": "1.10.0",
|
||||
"@microsoft/sp-webpart-workbench": "1.10.0",
|
||||
"@microsoft/rush-stack-compiler-3.3": "0.3.5",
|
||||
"gulp": "~3.9.1",
|
||||
"@types/chai": "3.4.34",
|
||||
"@types/mocha": "2.2.38",
|
||||
"ajv": "~5.2.2",
|
||||
"gulp": "~3.9.1",
|
||||
"tslint-microsoft-contrib": "5.0.0"
|
||||
"ajv": "~5.2.2"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,605 +0,0 @@
|
|||
# Upgrade project C:\Users\Joel.Rodrigues\Documents\GitHub\sp-dev-fx-webparts\samples\react-project-online to v1.6.0
|
||||
|
||||
Date: 2018-10-3
|
||||
|
||||
## Findings
|
||||
|
||||
Following is the list of steps required to upgrade your project to SharePoint Framework version 1.6.0.
|
||||
|
||||
### FN001001 @microsoft/sp-core-library | Required
|
||||
|
||||
Upgrade SharePoint Framework dependency package @microsoft/sp-core-library
|
||||
|
||||
Execute the following command:
|
||||
|
||||
```sh
|
||||
npm i @microsoft/sp-core-library@1.6.0 -SE
|
||||
```
|
||||
|
||||
File: [./package.json](./package.json)
|
||||
|
||||
### FN001002 @microsoft/sp-lodash-subset | Required
|
||||
|
||||
Upgrade SharePoint Framework dependency package @microsoft/sp-lodash-subset
|
||||
|
||||
Execute the following command:
|
||||
|
||||
```sh
|
||||
npm i @microsoft/sp-lodash-subset@1.6.0 -SE
|
||||
```
|
||||
|
||||
File: [./package.json](./package.json)
|
||||
|
||||
### FN001003 @microsoft/sp-office-ui-fabric-core | Required
|
||||
|
||||
Upgrade SharePoint Framework dependency package @microsoft/sp-office-ui-fabric-core
|
||||
|
||||
Execute the following command:
|
||||
|
||||
```sh
|
||||
npm i @microsoft/sp-office-ui-fabric-core@1.6.0 -SE
|
||||
```
|
||||
|
||||
File: [./package.json](./package.json)
|
||||
|
||||
### FN001004 @microsoft/sp-webpart-base | Required
|
||||
|
||||
Upgrade SharePoint Framework dependency package @microsoft/sp-webpart-base
|
||||
|
||||
Execute the following command:
|
||||
|
||||
```sh
|
||||
npm i @microsoft/sp-webpart-base@1.6.0 -SE
|
||||
```
|
||||
|
||||
File: [./package.json](./package.json)
|
||||
|
||||
### FN002001 @microsoft/sp-build-web | Required
|
||||
|
||||
Upgrade SharePoint Framework dev dependency package @microsoft/sp-build-web
|
||||
|
||||
Execute the following command:
|
||||
|
||||
```sh
|
||||
npm i @microsoft/sp-build-web@1.6.0 -DE
|
||||
```
|
||||
|
||||
File: [./package.json](./package.json)
|
||||
|
||||
### FN002002 @microsoft/sp-module-interfaces | Required
|
||||
|
||||
Upgrade SharePoint Framework dev dependency package @microsoft/sp-module-interfaces
|
||||
|
||||
Execute the following command:
|
||||
|
||||
```sh
|
||||
npm i @microsoft/sp-module-interfaces@1.6.0 -DE
|
||||
```
|
||||
|
||||
File: [./package.json](./package.json)
|
||||
|
||||
### FN002003 @microsoft/sp-webpart-workbench | Required
|
||||
|
||||
Upgrade SharePoint Framework dev dependency package @microsoft/sp-webpart-workbench
|
||||
|
||||
Execute the following command:
|
||||
|
||||
```sh
|
||||
npm i @microsoft/sp-webpart-workbench@1.6.0 -DE
|
||||
```
|
||||
|
||||
File: [./package.json](./package.json)
|
||||
|
||||
### FN002008 tslint-microsoft-contrib | Required
|
||||
|
||||
Install SharePoint Framework dev dependency package tslint-microsoft-contrib
|
||||
|
||||
Execute the following command:
|
||||
|
||||
```sh
|
||||
npm i tslint-microsoft-contrib@5.0.0 -DE
|
||||
```
|
||||
|
||||
File: [./package.json](./package.json)
|
||||
|
||||
### FN010001 .yo-rc.json version | Recommended
|
||||
|
||||
Update version in .yo-rc.json
|
||||
|
||||
In file [./.yo-rc.json](./.yo-rc.json) update the code as follows:
|
||||
|
||||
```json
|
||||
{
|
||||
"@microsoft/generator-sharepoint": {
|
||||
"version": "1.6.0"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
File: [./.yo-rc.json](./.yo-rc.json)
|
||||
|
||||
### FN012011 tsconfig.json compiler options outDir | Required
|
||||
|
||||
Update tsconfig.json outDir value
|
||||
|
||||
In file [./tsconfig.json](./tsconfig.json) update the code as follows:
|
||||
|
||||
```json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"outDir": "lib"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
File: [./tsconfig.json](./tsconfig.json)
|
||||
|
||||
### FN012012 tsconfig.json include property | Required
|
||||
|
||||
Update tsconfig.json include property
|
||||
|
||||
In file [./tsconfig.json](./tsconfig.json) update the code as follows:
|
||||
|
||||
```json
|
||||
{
|
||||
"include": [
|
||||
"src/**/*.ts"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
File: [./tsconfig.json](./tsconfig.json)
|
||||
|
||||
### FN012013 tsconfig.json exclude property | Required
|
||||
|
||||
Update tsconfig.json exclude property
|
||||
|
||||
In file [./tsconfig.json](./tsconfig.json) update the code as follows:
|
||||
|
||||
```json
|
||||
{
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"lib"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
File: [./tsconfig.json](./tsconfig.json)
|
||||
|
||||
### FN015004 ./config/tslint.json | Required
|
||||
|
||||
Remove file ./config/tslint.json
|
||||
|
||||
Execute the following command:
|
||||
|
||||
```sh
|
||||
rm ./config/tslint.json
|
||||
```
|
||||
|
||||
File: [./config/tslint.json](./config/tslint.json)
|
||||
|
||||
### FN015005 ./src/index.ts | Required
|
||||
|
||||
Add file ./src/index.ts
|
||||
|
||||
Execute the following command:
|
||||
|
||||
```sh
|
||||
cat > ./src/index.ts << EOF
|
||||
// A file is required to be in the root of the /src directory by the TypeScript compiler
|
||||
|
||||
EOF
|
||||
```
|
||||
|
||||
File: [./src/index.ts](./src/index.ts)
|
||||
|
||||
### FN001007 @types/webpack-env | Required
|
||||
|
||||
Upgrade SharePoint Framework dependency package @types/webpack-env
|
||||
|
||||
Execute the following command:
|
||||
|
||||
```sh
|
||||
npm i @types/webpack-env@1.13.1 -SE
|
||||
```
|
||||
|
||||
File: [./package.json](./package.json)
|
||||
|
||||
### FN001010 @types/es6-promise | Required
|
||||
|
||||
Install SharePoint Framework dependency package @types/es6-promise
|
||||
|
||||
Execute the following command:
|
||||
|
||||
```sh
|
||||
npm i @types/es6-promise@0.0.33 -SE
|
||||
```
|
||||
|
||||
File: [./package.json](./package.json)
|
||||
|
||||
### FN002005 @types/chai | Required
|
||||
|
||||
Upgrade SharePoint Framework dev dependency package @types/chai
|
||||
|
||||
Execute the following command:
|
||||
|
||||
```sh
|
||||
npm i @types/chai@3.4.34 -DE
|
||||
```
|
||||
|
||||
File: [./package.json](./package.json)
|
||||
|
||||
### FN002006 @types/mocha | Required
|
||||
|
||||
Upgrade SharePoint Framework dev dependency package @types/mocha
|
||||
|
||||
Execute the following command:
|
||||
|
||||
```sh
|
||||
npm i @types/mocha@2.2.38 -DE
|
||||
```
|
||||
|
||||
File: [./package.json](./package.json)
|
||||
|
||||
### FN003001 config.json schema | Required
|
||||
|
||||
Update config.json schema URL
|
||||
|
||||
In file [./config/config.json](./config/config.json) update the code as follows:
|
||||
|
||||
```json
|
||||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/config.2.0.schema.json"
|
||||
}
|
||||
```
|
||||
|
||||
File: [./config/config.json](./config/config.json)
|
||||
|
||||
### FN004001 copy-assets.json schema | Required
|
||||
|
||||
Update copy-assets.json schema URL
|
||||
|
||||
In file [./config/copy-assets.json](./config/copy-assets.json) update the code as follows:
|
||||
|
||||
```json
|
||||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/copy-assets.schema.json"
|
||||
}
|
||||
```
|
||||
|
||||
File: [./config/copy-assets.json](./config/copy-assets.json)
|
||||
|
||||
### FN005001 deploy-azure-storage.json schema | Required
|
||||
|
||||
Update deploy-azure-storage.json schema URL
|
||||
|
||||
In file [./config/deploy-azure-storage.json](./config/deploy-azure-storage.json) update the code as follows:
|
||||
|
||||
```json
|
||||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/deploy-azure-storage.schema.json"
|
||||
}
|
||||
```
|
||||
|
||||
File: [./config/deploy-azure-storage.json](./config/deploy-azure-storage.json)
|
||||
|
||||
### FN006001 package-solution.json schema | Required
|
||||
|
||||
Update package-solution.json schema URL
|
||||
|
||||
In file [./config/package-solution.json](./config/package-solution.json) update the code as follows:
|
||||
|
||||
```json
|
||||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/package-solution.schema.json"
|
||||
}
|
||||
```
|
||||
|
||||
File: [./config/package-solution.json](./config/package-solution.json)
|
||||
|
||||
### FN007001 serve.json schema | Required
|
||||
|
||||
Update serve.json schema URL
|
||||
|
||||
In file [./config/serve.json](./config/serve.json) update the code as follows:
|
||||
|
||||
```json
|
||||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/core-build/serve.schema.json"
|
||||
}
|
||||
```
|
||||
|
||||
File: [./config/serve.json](./config/serve.json)
|
||||
|
||||
### FN008001 tslint.json schema | Required
|
||||
|
||||
Update tslint.json schema URL
|
||||
|
||||
In file [./config/tslint.json](./config/tslint.json) update the code as follows:
|
||||
|
||||
```json
|
||||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/core-build/tslint.schema.json"
|
||||
}
|
||||
```
|
||||
|
||||
File: [./config/tslint.json](./config/tslint.json)
|
||||
|
||||
### FN009001 write-manifests.json schema | Required
|
||||
|
||||
Update write-manifests.json schema URL
|
||||
|
||||
In file [./config/write-manifests.json](./config/write-manifests.json) update the code as follows:
|
||||
|
||||
```json
|
||||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/write-manifests.schema.json"
|
||||
}
|
||||
```
|
||||
|
||||
File: [./config/write-manifests.json](./config/write-manifests.json)
|
||||
|
||||
### FN010002 .yo-rc.json isCreatingSolution | Recommended
|
||||
|
||||
Update isCreatingSolution in .yo-rc.json
|
||||
|
||||
In file [./.yo-rc.json](./.yo-rc.json) update the code as follows:
|
||||
|
||||
```json
|
||||
{
|
||||
"@microsoft/generator-sharepoint": {
|
||||
"isCreatingSolution": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
File: [./.yo-rc.json](./.yo-rc.json)
|
||||
|
||||
### FN010003 .yo-rc.json packageManager | Recommended
|
||||
|
||||
Update packageManager in .yo-rc.json
|
||||
|
||||
In file [./.yo-rc.json](./.yo-rc.json) update the code as follows:
|
||||
|
||||
```json
|
||||
{
|
||||
"@microsoft/generator-sharepoint": {
|
||||
"packageManager": "npm"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
File: [./.yo-rc.json](./.yo-rc.json)
|
||||
|
||||
### FN010004 .yo-rc.json componentType | Recommended
|
||||
|
||||
Update componentType in .yo-rc.json
|
||||
|
||||
In file [./.yo-rc.json](./.yo-rc.json) update the code as follows:
|
||||
|
||||
```json
|
||||
{
|
||||
"@microsoft/generator-sharepoint": {
|
||||
"componentType": "webpart"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
File: [./.yo-rc.json](./.yo-rc.json)
|
||||
|
||||
### FN011001 Web part manifest schema | Required
|
||||
|
||||
Update schema in manifest
|
||||
|
||||
In file [src\webparts\reactProjectOnline\ReactProjectOnlineWebPart.manifest.json](src\webparts\reactProjectOnline\ReactProjectOnlineWebPart.manifest.json) update the code as follows:
|
||||
|
||||
```json
|
||||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/spfx/client-side-web-part-manifest.schema.json"
|
||||
}
|
||||
```
|
||||
|
||||
File: [src\webparts\reactProjectOnline\ReactProjectOnlineWebPart.manifest.json](src\webparts\reactProjectOnline\ReactProjectOnlineWebPart.manifest.json)
|
||||
|
||||
### FN012001 tsconfig.json module | Required
|
||||
|
||||
Update module type in tsconfig.json
|
||||
|
||||
In file [./tsconfig.json](./tsconfig.json) update the code as follows:
|
||||
|
||||
```json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "esnext"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
File: [./tsconfig.json](./tsconfig.json)
|
||||
|
||||
### FN012002 tsconfig.json moduleResolution | Required
|
||||
|
||||
Update moduleResolution in tsconfig.json
|
||||
|
||||
In file [./tsconfig.json](./tsconfig.json) update the code as follows:
|
||||
|
||||
```json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"moduleResolution": "node"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
File: [./tsconfig.json](./tsconfig.json)
|
||||
|
||||
### FN017001 Run npm dedupe | Optional
|
||||
|
||||
If, after upgrading npm packages, when building the project you have errors similar to: "error TS2345: Argument of type 'SPHttpClientConfiguration' is not assignable to parameter of type 'SPHttpClientConfiguration'", try running 'npm dedupe' to cleanup npm packages.
|
||||
|
||||
Execute the following command:
|
||||
|
||||
```sh
|
||||
npm dedupe
|
||||
```
|
||||
|
||||
File: [./package.json](./package.json)
|
||||
|
||||
## Summary
|
||||
|
||||
### Execute script
|
||||
|
||||
```sh
|
||||
npm i @microsoft/sp-core-library@1.6.0 @microsoft/sp-lodash-subset@1.6.0 @microsoft/sp-office-ui-fabric-core@1.6.0 @microsoft/sp-webpart-base@1.6.0 @types/webpack-env@1.13.1 @types/es6-promise@0.0.33 -SE
|
||||
npm i @microsoft/sp-build-web@1.6.0 @microsoft/sp-module-interfaces@1.6.0 @microsoft/sp-webpart-workbench@1.6.0 tslint-microsoft-contrib@5.0.0 @types/chai@3.4.34 @types/mocha@2.2.38 -DE
|
||||
rm ./config/tslint.json
|
||||
cat > ./src/index.ts << EOF
|
||||
// A file is required to be in the root of the /src directory by the TypeScript compiler
|
||||
|
||||
EOF
|
||||
npm dedupe
|
||||
```
|
||||
|
||||
### Modify files
|
||||
|
||||
#### [./.yo-rc.json](./.yo-rc.json)
|
||||
|
||||
```json
|
||||
{
|
||||
"@microsoft/generator-sharepoint": {
|
||||
"version": "1.6.0"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"@microsoft/generator-sharepoint": {
|
||||
"isCreatingSolution": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"@microsoft/generator-sharepoint": {
|
||||
"packageManager": "npm"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"@microsoft/generator-sharepoint": {
|
||||
"componentType": "webpart"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### [./tsconfig.json](./tsconfig.json)
|
||||
|
||||
```json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"outDir": "lib"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"include": [
|
||||
"src/**/*.ts"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"lib"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "esnext"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"moduleResolution": "node"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### [./config/config.json](./config/config.json)
|
||||
|
||||
```json
|
||||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/config.2.0.schema.json"
|
||||
}
|
||||
```
|
||||
|
||||
#### [./config/copy-assets.json](./config/copy-assets.json)
|
||||
|
||||
```json
|
||||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/copy-assets.schema.json"
|
||||
}
|
||||
```
|
||||
|
||||
#### [./config/deploy-azure-storage.json](./config/deploy-azure-storage.json)
|
||||
|
||||
```json
|
||||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/deploy-azure-storage.schema.json"
|
||||
}
|
||||
```
|
||||
|
||||
#### [./config/package-solution.json](./config/package-solution.json)
|
||||
|
||||
```json
|
||||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/package-solution.schema.json"
|
||||
}
|
||||
```
|
||||
|
||||
#### [./config/serve.json](./config/serve.json)
|
||||
|
||||
```json
|
||||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/core-build/serve.schema.json"
|
||||
}
|
||||
```
|
||||
|
||||
#### [./config/tslint.json](./config/tslint.json)
|
||||
|
||||
```json
|
||||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/core-build/tslint.schema.json"
|
||||
}
|
||||
```
|
||||
|
||||
#### [./config/write-manifests.json](./config/write-manifests.json)
|
||||
|
||||
```json
|
||||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/write-manifests.schema.json"
|
||||
}
|
||||
```
|
||||
|
||||
#### [src\webparts\reactProjectOnline\ReactProjectOnlineWebPart.manifest.json](src\webparts\reactProjectOnline\ReactProjectOnlineWebPart.manifest.json)
|
||||
|
||||
```json
|
||||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/spfx/client-side-web-part-manifest.schema.json"
|
||||
}
|
||||
```
|
|
@ -1,2 +1 @@
|
|||
// A file is required to be in the root of the /src directory by the TypeScript compiler
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import {
|
|||
Logger,
|
||||
ConsoleListener,
|
||||
LogLevel
|
||||
} from 'sp-pnp-js';
|
||||
} from "@pnp/logging";
|
||||
|
||||
import { IPODataService } from ".";
|
||||
import { IPOTask } from "./../interfaces";
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import {
|
||||
Logger,
|
||||
ConsoleListener,
|
||||
LogLevel
|
||||
} from 'sp-pnp-js';
|
||||
Logger,
|
||||
ConsoleListener,
|
||||
LogLevel
|
||||
} from "@pnp/logging";
|
||||
|
||||
import { IPODataService } from ".";
|
||||
import { IPOTask } from "./../interfaces";
|
||||
|
@ -23,4 +23,4 @@ export class POMockDataService implements IPODataService {
|
|||
private async _getListItems(webUrl: string, projectId: string, selectFields: string[], filter: string, orderBy: string, top: number): Promise<IPOTask[]> {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,21 @@
|
|||
|
||||
import { sp } from "@pnp/sp";
|
||||
import "@pnp/sp/search";
|
||||
import {
|
||||
ISearchQuery,
|
||||
SearchResults
|
||||
} from '@pnp/sp/search';
|
||||
|
||||
import "@pnp/sp/webs";
|
||||
import {
|
||||
Logger,
|
||||
ConsoleListener,
|
||||
LogLevel,
|
||||
sp,
|
||||
SearchQuery,
|
||||
SearchResults,
|
||||
Web,
|
||||
ItemAddResult
|
||||
} from 'sp-pnp-js';
|
||||
} from '@pnp/sp/webs';
|
||||
|
||||
import {
|
||||
Logger,
|
||||
ConsoleListener,
|
||||
LogLevel
|
||||
} from "@pnp/logging";
|
||||
|
||||
import { ISPDataService } from ".";
|
||||
|
||||
|
@ -25,7 +33,7 @@ export class SPDataService implements ISPDataService {
|
|||
}
|
||||
|
||||
private async _getWebProperties(webUrl: string, selectFields: string[]): Promise<any> {
|
||||
let web = new Web(webUrl);
|
||||
let web = Web(webUrl);
|
||||
let data: any = null;
|
||||
// prefix all properties with the expanded field
|
||||
selectFields.forEach((value, index, array) => {
|
||||
|
@ -45,4 +53,4 @@ export class SPDataService implements ISPDataService {
|
|||
}
|
||||
return data.AllProperties;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ import {
|
|||
Logger,
|
||||
ConsoleListener,
|
||||
LogLevel
|
||||
} from 'sp-pnp-js';
|
||||
} from "@pnp/logging";
|
||||
|
||||
import { ISPDataService } from ".";
|
||||
|
||||
|
@ -22,4 +22,4 @@ export class SPMockDataService implements ISPDataService {
|
|||
private async _getWebProperties(webUrl: string, selectFields: string[]): Promise<any> {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { LogLevel } from 'sp-pnp-js';
|
||||
import { LogLevel } from "@pnp/logging";
|
||||
|
||||
export interface IReactProjectOnlineWebPartProps {
|
||||
dataSourceId: string;
|
||||
logLevel: LogLevel;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,24 +1,21 @@
|
|||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/spfx/client-side-web-part-manifest.schema.json",
|
||||
"id": "9dd62689-0ed4-4b35-82e0-848742751bdc",
|
||||
"id": "8f307e34-3031-40bd-afd4-327edb2cd1ed",
|
||||
"alias": "ReactProjectOnlineWebPart",
|
||||
"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"],
|
||||
|
||||
"preconfiguredEntries": [{
|
||||
"groupId": "5c03119e-3074-46fd-976b-c60198311f70", // Other
|
||||
"groupId": "5c03119e-3074-46fd-976b-c60198311f70",
|
||||
"group": { "default": "Other" },
|
||||
"title": { "default": "React Project Online Sample" },
|
||||
"description": { "default": "Sample web part to demonstrate how to retrieve Project Online data using REST" },
|
||||
"officeFabricIconFontName": "Page",
|
||||
"iconImageUrl": "data:image/svg+xml,%3Csvg fill='%23000000' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 50 50' width='50px' height='50px'%3E%3Cpath d='M 28.875 0 C 28.855469 0.0078125 28.832031 0.0195313 28.8125 0.03125 L 0.8125 5.34375 C 0.335938 5.433594 -0.0078125 5.855469 0 6.34375 L 0 43.65625 C -0.0078125 44.144531 0.335938 44.566406 0.8125 44.65625 L 28.8125 49.96875 C 29.101563 50.023438 29.402344 49.949219 29.632813 49.761719 C 29.859375 49.574219 29.996094 49.296875 30 49 L 30 44 L 47 44 C 48.09375 44 49 43.09375 49 42 L 49 8 C 49 6.90625 48.09375 6 47 6 L 30 6 L 30 1 C 30.003906 0.710938 29.878906 0.4375 29.664063 0.246094 C 29.449219 0.0546875 29.160156 -0.0351563 28.875 0 Z M 28 2.1875 L 28 6.6875 C 27.941406 6.882813 27.941406 7.085938 28 7.28125 L 28 42.8125 C 27.972656 42.945313 27.972656 43.085938 28 43.21875 L 28 47.8125 L 2 42.84375 L 2 7.15625 Z M 30 8 L 47 8 L 47 42 L 30 42 L 30 35.5 L 31.5 37 L 36.5 32 L 31.5 27 L 30 28.5 L 30 15 L 38 15 L 38 23 L 34 23 L 39 28 L 44 23 L 40 23 L 40 13 L 30 13 Z M 9.15625 15.65625 L 9.15625 34.375 L 13.375 34.375 L 13.375 27.9375 L 15.375 27.9375 C 17.636719 27.9375 19.460938 27.347656 20.8125 26.1875 C 22.164063 25.027344 22.84375 23.503906 22.84375 21.625 C 22.84375 17.648438 20.464844 15.65625 15.75 15.65625 Z M 13.375 18.90625 L 15.03125 18.90625 C 17.273438 18.90625 18.40625 19.859375 18.40625 21.78125 C 18.40625 23.746094 17.273438 24.71875 15.03125 24.71875 L 13.375 24.71875 Z'/%3E%3C/svg%3E",
|
||||
"properties": {
|
||||
"logLevel": 99
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import {
|
|||
PropertyPaneTextField,
|
||||
PropertyPaneDropdown
|
||||
} from '@microsoft/sp-webpart-base';
|
||||
import { LogLevel } from 'sp-pnp-js';
|
||||
import { LogLevel } from "@pnp/logging";
|
||||
|
||||
import * as strings from 'ReactProjectOnlineWebPartStrings';
|
||||
import { IReactProjectOnlineWebPartProps } from './IReactProjectOnlineWebPartProps';
|
||||
|
@ -117,7 +117,6 @@ export default class ReactProjectOnlineWebPart extends BaseClientSideWebPart<IRe
|
|||
let id: string = null;
|
||||
const webUrl = this.context.pageContext.web.absoluteUrl;
|
||||
const selectWebProperties = ['MSPWAPROJUID'];
|
||||
|
||||
try {
|
||||
// get project ID
|
||||
const projectUID: any = await this._spDataService.GetWebProperties(webUrl, selectWebProperties);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import * as React from 'react';
|
||||
import { Util } from 'sp-pnp-js';
|
||||
import { stringIsNullOrEmpty } from "@pnp/common";
|
||||
|
||||
import * as strings from 'ReactProjectOnlineWebPartStrings';
|
||||
import styles from './ReactProjectOnline.module.scss';
|
||||
|
@ -21,7 +21,7 @@ export default class ReactProjectOnline extends React.Component<IReactProjectOnl
|
|||
super(props);
|
||||
|
||||
// evaluate if configuration is required, and if so, display a placeholder
|
||||
const showPlaceHolder = Util.stringIsNullOrEmpty(this.props.baseProperties.dataSourceId);
|
||||
const showPlaceHolder = stringIsNullOrEmpty(this.props.baseProperties.dataSourceId);
|
||||
|
||||
// initialise state
|
||||
this.state = {
|
||||
|
@ -41,7 +41,7 @@ export default class ReactProjectOnline extends React.Component<IReactProjectOnl
|
|||
this.props.webPartContext.statusRenderer.displayLoadingIndicator(document.getElementsByClassName(styles.reactProjectOnline)[0], strings.TitleFieldLabel);
|
||||
|
||||
// load data and update state
|
||||
if (!Util.stringIsNullOrEmpty(this.props.baseProperties.dataSourceId)) {
|
||||
if (!stringIsNullOrEmpty(this.props.baseProperties.dataSourceId)) {
|
||||
this._taskItems = await this._getTaskItems();
|
||||
this.setState({
|
||||
dataLoaded: true
|
||||
|
@ -55,7 +55,7 @@ export default class ReactProjectOnline extends React.Component<IReactProjectOnl
|
|||
// state transitions using this.setState() in this method.
|
||||
public async componentWillReceiveProps(props: IReactProjectOnlineProps) {
|
||||
// load data and update state
|
||||
if (!Util.stringIsNullOrEmpty(this.props.baseProperties.dataSourceId)) {
|
||||
if (!stringIsNullOrEmpty(this.props.baseProperties.dataSourceId)) {
|
||||
this._taskItems = await this._getTaskItems();
|
||||
this.setState({
|
||||
showPlaceHolder: false,
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 3.0 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"extends": "./node_modules/@microsoft/rush-stack-compiler-3.3/includes/tsconfig-web.json",
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
|
@ -10,6 +11,9 @@
|
|||
"experimentalDecorators": true,
|
||||
"skipLibCheck": true,
|
||||
"outDir": "lib",
|
||||
"inlineSources": false,
|
||||
"strictNullChecks": false,
|
||||
"noUnusedLocals": false,
|
||||
"typeRoots": [
|
||||
"./node_modules/@types",
|
||||
"./node_modules/@microsoft"
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
{
|
||||
"rulesDirectory": [
|
||||
"tslint-microsoft-contrib"
|
||||
],
|
||||
"extends": "@microsoft/sp-tslint-rules/base-tslint.json",
|
||||
"rules": {
|
||||
"class-name": false,
|
||||
"export-name": false,
|
||||
|
|
Loading…
Reference in New Issue