Skip to content

Commit

Permalink
Merge pull request #4752 from Paxol/paxol/react-organization-chart
Browse files Browse the repository at this point in the history
react-organization-chart: Added guest filter + update to latest sharepoint web part template
  • Loading branch information
hugoabernier authored Mar 10, 2024
2 parents 7536d89 + d463d11 commit 40a35a2
Show file tree
Hide file tree
Showing 38 changed files with 32,462 additions and 19,158 deletions.
75 changes: 37 additions & 38 deletions samples/react-organization-chart/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,39 +1,38 @@
// 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.4.1",
"image": "docker.io/m365pnp/spfx:1.4.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,
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"
}
"name": "SPFx 1.18.2",
"image": "docker.io/m365pnp/spfx:1.18.2",
"customizations": {
"vscode": {
"extensions": [
"editorconfig.editorconfig",
"dbaeumer.vscode-eslint"
]
}
},
"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"
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ 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

cp ~/.gcb-serve-data/gcb-serve.cer ./spfx-dev-cert.cer
cp ~/.gcb-serve-data/gcb-serve.cer ./spfx-dev-cert.pem
# 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
Expand Down
352 changes: 352 additions & 0 deletions samples/react-organization-chart/.eslintrc.js

Large diffs are not rendered by default.

27 changes: 0 additions & 27 deletions samples/react-organization-chart/.eslintrc.json

This file was deleted.

6 changes: 6 additions & 0 deletions samples/react-organization-chart/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ node_modules
# Build generated files
dist
lib
release
solution
temp
*.sppkg
.heft

# Coverage directory used by tools like istanbul
coverage
Expand All @@ -30,3 +32,7 @@ obj

# Styles Generated Code
*.scss.ts
# .CER Certificates
*.cer
# .PEM Certificates
*.pem
16 changes: 16 additions & 0 deletions samples/react-organization-chart/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
!dist
config

gulpfile.js

release
src
temp

tsconfig.json
tslint.json

*.log

.yo-rc.json
.vscode
1 change: 1 addition & 0 deletions samples/react-organization-chart/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v18.19.1
13 changes: 10 additions & 3 deletions samples/react-organization-chart/.yo-rc.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
{
"@microsoft/generator-sharepoint": {
"plusBeta": false,
"isCreatingSolution": true,
"environment": "onprem19",
"version": "1.12.0",
"nodeVersion": "18.19.1",
"sdksVersions": {
"@microsoft/microsoft-graph-client": "3.0.2",
"@microsoft/teams-js": "2.12.0"
},
"version": "1.18.2",
"libraryName": "react-organization-chart",
"libraryId": "0b4a3e5d-123f-41ea-96c4-538c6a19932b",
"environment": "onprem19",
"packageManager": "npm",
"solutionName": "react-organization-chart",
"componentType": "webpart"
}
}
}
26 changes: 16 additions & 10 deletions samples/react-organization-chart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,18 @@ This web part shows an organization chart based on specified user, and user can

| :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.|
| 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. |

![SPFx 1.4.1](https://img.shields.io/badge/SPFx-1.4.1-green.svg)
![Node.js v6 | v8](https://img.shields.io/badge/Node.js-LTS%206.x%20%7C%20v8-green.svg)
![SharePoint 2019 | Online](https://img.shields.io/badge/SharePoint-2019%20%7C%20Online-yellow.svg)
![Teams No: Not designed for Microsoft Teams](https://img.shields.io/badge/Teams-No-red.svg "Not designed for Microsoft Teams")
![Workbench Hosted: Does not work with local workbench](https://img.shields.io/badge/Workbench-Hosted-yellow.svg "Does not work with local workbench")
This sample is optimally compatible with the following environment configuration:

![SPFx 1.18.2](https://img.shields.io/badge/SPFx-1.18.2-green.svg)
![Node.js v16 | v18](https://img.shields.io/badge/Node.js-v16%20%7C%20v18-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
Expand All @@ -30,13 +34,15 @@ This web part shows an organization chart based on specified user, and user can

## Contributors

* [João Mendes](https://github.com/joaojmendes), Storm Technology, ([@joaojmendes](https://twitter.com/joaojmendes))
- [João Mendes](https://github.com/joaojmendes)
- [Passoli Mirko](https://github.com/Paxol)

## Version history

Version|Date|Comments
-------|----|--------
1.0|May, 2021|Initial release
|Version|Date|Comments|
|-------|----|--------|
|1.1|Feb, 2024|Guest user filter + update to SPFx 1.18.2|
|1.0|May, 2021|Initial release|

## Prerequisites

Expand Down
8 changes: 6 additions & 2 deletions samples/react-organization-chart/assets/sample.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"Can be installed on SharePoint Server 2019, and SharePoint Online."
],
"creationDateTime": "2021-05-03",
"updateDateTime": "2021-05-03",
"updateDateTime": "2024-02-25",
"products": [
"SharePoint"
],
Expand All @@ -21,7 +21,7 @@
},
{
"key": "SPFX-VERSION",
"value": "1.4.1"
"value": "1.18.2"
}
],
"thumbnails": [
Expand Down Expand Up @@ -51,6 +51,10 @@
"pictureUrl": "https://github.com/joaojmendes.png",
"name": "João Mendes",
"twitter": "joaojmendes"
},
{
"gitHubAccount": "Paxol",
"pictureUrl": "https://github.com/Paxol.png"
}
],
"references": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
"solution": {
"name": "react-organization-chart",
"id": "0b4a3e5d-123f-41ea-96c4-538c6a19932b",
"version": "1.0.0.0",
"version": "1.1.0.0",
"includeClientSideAssets": true,
"skipFeatureDeployment": true


},
"paths": {
"zippedPackage": "solution/react-organization-chart.sppkg"
Expand Down
3 changes: 3 additions & 0 deletions samples/react-organization-chart/config/sass.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/core-build/sass.schema.json"
}
8 changes: 2 additions & 6 deletions samples/react-organization-chart/config/serve.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/core-build/serve.schema.json",
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/spfx-serve.schema.json",
"port": 4321,
"https": true,
"initialPage": "https://localhost:5432/workbench",
"api": {
"port": 5432,
"entryPath": "node_modules/@microsoft/sp-webpart-workbench/lib/api/"
}
"initialPage": "https://{tenantDomain}/_layouts/workbench.aspx"
}
57 changes: 8 additions & 49 deletions samples/react-organization-chart/gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,57 +1,16 @@
// gulpfile.js
'use strict';

const gulp = require('gulp');
const build = require('@microsoft/sp-build-web');
const merge = require('webpack-merge');
const TerserPlugin = require('terser-webpack-plugin-legacy');
build.addSuppression(/Warning - \[sass\] The local CSS class .* is not camelCase and will not be type-safe./gi);

// force use of projects specified typescript version
const typeScriptConfig = require('@microsoft/gulp-core-build-typescript/lib/TypeScriptConfiguration');
typeScriptConfig.TypeScriptConfiguration.setTypescriptCompiler(require('typescript'));
build.addSuppression(`Warning - [sass] The local CSS class 'ms-Grid' is not camelCase and will not be type-safe.`);

// disable tslint
build.tslint.enabled = false;
var getTasks = build.rig.getTasks;
build.rig.getTasks = function () {
var result = getTasks.call(build.rig);

const eslint = require('gulp-eslint');
result.set('serve', result.get('serve-deprecated'));

const eslintSubTask = build.subTask('eslint', function (gulp, buildOptions, done) {
return gulp.src(['src/**/*.{ts,tsx}'])
// eslint() attaches the lint output to the "eslint" property
// of the file object so it can be used by other modules.
.pipe(eslint())
// eslint.format() outputs the lint results to the console.
// Alternatively use eslint.formatEach() (see Docs).
.pipe(eslint.format())
// To have the process exit with an error code (1) on
// lint error, return the stream and pipe to failAfterError last.
.pipe(eslint.failAfterError());
});
return result;
};

build.rig.addPreBuildTask(build.task('eslint-task', eslintSubTask));
// force use of projects specified react version
build.configureWebpack.mergeConfig({

additionalConfiguration: (generatedConfiguration) => {
// force use of projects specified react version
generatedConfiguration.externals = generatedConfiguration.externals
.filter(name => !(["react", "react-dom"].includes(name)));
// force use TerserPlugIn (remove UglifyJs)
generatedConfiguration.plugins.forEach((plugin, i) => {
if (plugin.options && plugin.options.mangle) {
generatedConfiguration.plugins.splice(i, 1);
generatedConfiguration = merge(generatedConfiguration, {
plugins: [
new TerserPlugin()
]
});
}

});
return generatedConfiguration;
}
});


build.initialize(gulp);
build.initialize(require('gulp'));
Loading

0 comments on commit 40a35a2

Please sign in to comment.