Merge pull request #1831 from techienickb/master
This commit is contained in:
commit
1dc4f02560
|
@ -0,0 +1,25 @@
|
|||
# EditorConfig helps developers define and maintain consistent
|
||||
# coding styles between different editors and IDEs
|
||||
# editorconfig.org
|
||||
|
||||
root = true
|
||||
|
||||
|
||||
[*]
|
||||
|
||||
# change these settings to your own preference
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
# we recommend you to keep these unchanged
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[{package,bower}.json]
|
||||
indent_style = space
|
||||
indent_size = 2
|
|
@ -0,0 +1,33 @@
|
|||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
|
||||
# Dependency directories
|
||||
node_modules
|
||||
|
||||
# Build generated files
|
||||
dist
|
||||
lib
|
||||
solution
|
||||
temp
|
||||
*.sppkg
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
|
||||
# OSX
|
||||
.DS_Store
|
||||
|
||||
# Visual Studio files
|
||||
.ntvs_analysis.dat
|
||||
.vs
|
||||
.vscode
|
||||
bin
|
||||
obj
|
||||
|
||||
# Resx Generated Code
|
||||
*.resx.ts
|
||||
|
||||
# Styles Generated Code
|
||||
*.scss.ts
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"@microsoft/generator-sharepoint": {
|
||||
"isCreatingSolution": true,
|
||||
"environment": "spo",
|
||||
"version": "1.11.0",
|
||||
"libraryName": "teams-membership-updater",
|
||||
"libraryId": "5da816cf-c693-4b88-b9bd-a9da3587f05c",
|
||||
"packageManager": "npm",
|
||||
"isDomainIsolated": false,
|
||||
"componentType": "webpart"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
# Teams Membership Updater
|
||||
|
||||
## Summary
|
||||
|
||||
Used to update the membership of a team based on the contents of a CSV file, can be hosted in a sharepoint site where a list can be defined for logging purposes or run inside teams as a personal app.
|
||||
|
||||
## Screen
|
||||
|
||||
![react-teams-membership-updater](./assets/Screenshot-2020-05-01.png "Preview")
|
||||
|
||||
![react-teams-membership-updater](./assets/teamsmembership.gif "Teams Membership Via Teams")
|
||||
|
||||
## Compatibility
|
||||
|
||||
![SPFx 1.11](https://img.shields.io/badge/SPFx-1.11.0-green.svg)
|
||||
![Node.js LTS 10.x](https://img.shields.io/badge/Node.js-LTS%2010.x-green.svg)
|
||||
![SharePoint Online](https://img.shields.io/badge/SharePoint-Online-yellow.svg)
|
||||
![Teams Yes: Designed for Microsoft Teams](https://img.shields.io/badge/Teams-Yes-green.svg "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")
|
||||
|
||||
## Applies to
|
||||
|
||||
* [SharePoint Online](https://docs.microsoft.com/sharepoint/dev/spfx/sharepoint-framework-overview)
|
||||
|
||||
## Solution
|
||||
|
||||
This web part can be deployed to a site or as a teams personal app. This does require graph permission granting in the Sharepoint Admin Center
|
||||
|
||||
Uses:
|
||||
|
||||
- PnP React Controls
|
||||
- PnP React Property Controls
|
||||
- React Papaparse (CSV parsing)
|
||||
|
||||
Solution|Author(s)
|
||||
--------|---------
|
||||
Teams Membership Updater Web Part|[Nick Brown](https://github.com/techienickb)
|
||||
|
||||
## Version history
|
||||
|
||||
Version|Date|Comments
|
||||
-------|----|--------
|
||||
1.0.0|April 27, 2020|Initial release
|
||||
1.0.2|May 1, 2020|Ability to disable Orphaned Member removals
|
||||
1.0.4|June 3, 2020|Switched to using Graph Batching
|
||||
1.0.7|April 20, 2021|Switched to using PnP's file picker and option to log to a configuration list
|
||||
|
||||
|
||||
## Disclaimer
|
||||
**THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.**
|
||||
|
||||
---
|
||||
|
||||
## Minimal Path to Awesome
|
||||
|
||||
- Clone this repository
|
||||
- in the command line run:
|
||||
- `npm install`
|
||||
- `gulp build`
|
||||
- `gulp bundle --ship`
|
||||
- `gulp package-solution --ship`
|
||||
- `Add to AppCatalog and deploy`
|
||||
|
||||
<img src="https://telemetry.sharepointpnp.com/sp-dev-fx-webparts/samples/react-teams-membership-updater />
|
Binary file not shown.
After Width: | Height: | Size: 45 KiB |
Binary file not shown.
After Width: | Height: | Size: 79 KiB |
|
@ -0,0 +1,63 @@
|
|||
[
|
||||
{
|
||||
"name": "pnp-sp-dev-spfx-web-parts-react-teams-membership-updater",
|
||||
"source": "pnp",
|
||||
"title": "Teams Membership Updater",
|
||||
"shortDescription": "Used to update the membership of a team based on the contents of a CSV file, can be hosted in a sharepoint site where a list can be defined for logging purposes or run inside teams as a personal app.",
|
||||
"url": "https://github.com/pnp/sp-dev-fx-webparts/tree/master/samples/react-teams-membership-updater",
|
||||
"longDescription": [
|
||||
"TODO"
|
||||
],
|
||||
"created": "2021-04-02",
|
||||
"modified": "2021-04-02",
|
||||
"products": [
|
||||
"SharePoint",
|
||||
"Office"
|
||||
],
|
||||
"metadata": [
|
||||
{
|
||||
"key": "CLIENT-SIDE-DEV",
|
||||
"value": "React"
|
||||
},
|
||||
{
|
||||
"key": "SPFX-VERSION",
|
||||
"value": "1.11.0"
|
||||
}
|
||||
],
|
||||
"thumbnails": [
|
||||
{
|
||||
"type": "image",
|
||||
"order": 100,
|
||||
"url": "https://github.com/pnp/sp-dev-fx-webparts/raw/master/samples/react-teams-membership-updater/assets/Screenshot-2020-05-01.png",
|
||||
"alt": "Web part in action"
|
||||
},
|
||||
{
|
||||
"type": "image",
|
||||
"order": 101,
|
||||
"url": "https://github.com/pnp/sp-dev-fx-webparts/raw/master/samples/react-teams-membership-updater/assets/teamsmembership.gif",
|
||||
"alt": "Web part in action"
|
||||
},
|
||||
{
|
||||
"type": "image",
|
||||
"order": 102,
|
||||
"url": "https://github.com/pnp/sp-dev-fx-webparts/raw/master/samples/react-teams-membership-updater/assets/72f2b53a-f9be-4344-8fec-f4a09961a25b.png",
|
||||
"alt": "Web part in action"
|
||||
}
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"gitHubAccount": "techienickb",
|
||||
"pictureUrl": "https://github.com/techienickb.png",
|
||||
"name": "Nick Brown",
|
||||
"twitter": "techienickb"
|
||||
}
|
||||
],
|
||||
"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"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
Binary file not shown.
After Width: | Height: | Size: 2.2 MiB |
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/config.2.0.schema.json",
|
||||
"version": "2.0",
|
||||
"bundles": {
|
||||
"teams-membership-updater-web-part": {
|
||||
"components": [
|
||||
{
|
||||
"entrypoint": "./lib/webparts/teamsMembershipUpdater/TeamsMembershipUpdaterWebPart.js",
|
||||
"manifest": "./src/webparts/teamsMembershipUpdater/TeamsMembershipUpdaterWebPart.manifest.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"externals": {},
|
||||
"localizedResources": {
|
||||
"TeamsMembershipUpdaterWebPartStrings": "lib/webparts/teamsMembershipUpdater/loc/{locale}.js",
|
||||
"ControlStrings": "node_modules/@pnp/spfx-controls-react/lib/loc/{locale}.js",
|
||||
"PropertyControlStrings": "node_modules/@pnp/spfx-property-controls/lib/loc/{locale}.js"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/copy-assets.schema.json",
|
||||
"deployCdnPath": "temp/deploy"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/deploy-azure-storage.schema.json",
|
||||
"workingDir": "./temp/deploy/",
|
||||
"account": "<!-- STORAGE ACCOUNT NAME -->",
|
||||
"container": "teams-membership-updater",
|
||||
"accessKey": "<!-- ACCESS KEY -->"
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/package-solution.schema.json",
|
||||
"solution": {
|
||||
"name": "Teams-membership-updater-client-side-solution",
|
||||
"title": "Teams Membership Updater",
|
||||
"id": "5da816cf-c693-4b88-b9bd-a9da3587f05c",
|
||||
"skipFeatureDeployment": true,
|
||||
"developer": {
|
||||
"name": "Nick Brown",
|
||||
"privacyUrl": "https://www.microsoft.com/privacy",
|
||||
"termsOfUseUrl": "https://www.microsoft.com/terms-of-use",
|
||||
"websiteUrl": "https://nbdev.uk",
|
||||
"mpnId": "000000"
|
||||
},
|
||||
"version": "1.0.0.8",
|
||||
"includeClientSideAssets": true,
|
||||
"isDomainIsolated": false,
|
||||
"webApiPermissionRequests": [
|
||||
{
|
||||
"resource": "Microsoft Graph",
|
||||
"scope": "User.Read.All"
|
||||
},
|
||||
{
|
||||
"resource": "Microsoft Graph",
|
||||
"scope": "GroupMember.ReadWrite.All"
|
||||
},
|
||||
{
|
||||
"resource": "Microsoft Graph",
|
||||
"scope": "Group.Read.All"
|
||||
}
|
||||
]
|
||||
},
|
||||
"paths": {
|
||||
"zippedPackage": "solution/teams-membership-updater.sppkg"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/core-build/serve.schema.json",
|
||||
"port": 4321,
|
||||
"https": true,
|
||||
"initialPage": "https://localhost:5432/workbench",
|
||||
"api": {
|
||||
"port": 5432,
|
||||
"entryPath": "node_modules/@microsoft/sp-webpart-workbench/lib/api/"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/write-manifests.schema.json",
|
||||
"cdnBasePath": "<!-- PATH TO CDN -->"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
'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.`);
|
||||
|
||||
build.initialize(require('gulp'));
|
Binary file not shown.
After Width: | Height: | Size: 52 KiB |
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
"name": "teams-membership-updater",
|
||||
"version": "0.0.1",
|
||||
"private": true,
|
||||
"main": "lib/index.js",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "gulp bundle",
|
||||
"clean": "gulp clean",
|
||||
"test": "gulp test"
|
||||
},
|
||||
"dependencies": {
|
||||
"@microsoft/sp-core-library": "1.11.0",
|
||||
"@microsoft/sp-http": "1.11.0",
|
||||
"@microsoft/sp-lodash-subset": "1.11.0",
|
||||
"@microsoft/sp-office-ui-fabric-core": "1.11.0",
|
||||
"@microsoft/sp-property-pane": "1.11.0",
|
||||
"@microsoft/sp-webpart-base": "1.11.0",
|
||||
"@pnp/spfx-controls-react": "^2.6.0",
|
||||
"@pnp/spfx-property-controls": "2.5.0",
|
||||
"office-ui-fabric-react": "^7.168.0",
|
||||
"react": "16.8.5",
|
||||
"react-dom": "16.8.5",
|
||||
"react-papaparse": "^3.12.1"
|
||||
},
|
||||
"resolutions": {
|
||||
"@types/react": "16.8.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@microsoft/microsoft-graph-types": "^1.35.0",
|
||||
"@microsoft/rush-stack-compiler-3.3": "0.3.5",
|
||||
"@microsoft/sp-build-web": "1.11.0",
|
||||
"@microsoft/sp-module-interfaces": "1.11.0",
|
||||
"@microsoft/sp-tslint-rules": "1.11.0",
|
||||
"@microsoft/sp-webpart-workbench": "1.11.0",
|
||||
"@types/chai": "3.4.34",
|
||||
"@types/mocha": "2.2.38",
|
||||
"ajv": "~5.2.2",
|
||||
"gulp": "~3.9.1"
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
// A file is required to be in the root of the /src directory by the TypeScript compiler
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/spfx/client-side-web-part-manifest.schema.json",
|
||||
"id": "8a901797-4600-476a-aa51-b2027a73715f",
|
||||
"alias": "TeamsMembershipUpdaterWebPart",
|
||||
"componentType": "WebPart",
|
||||
"version": "*",
|
||||
"manifestVersion": 2,
|
||||
"requiresCustomScript": false,
|
||||
"supportedHosts": ["TeamsPersonalApp", "SharePointWebPart"],
|
||||
|
||||
"preconfiguredEntries": [{
|
||||
"groupId": "5c03119e-3074-46fd-976b-c60198311f70",
|
||||
"group": { "default": "Other" },
|
||||
"title": { "default": "Teams Membership Updater" },
|
||||
"description": { "default": "Teams Membership Updater" },
|
||||
"officeFabricIconFontName": "UserSync",
|
||||
"properties": {
|
||||
"title": "Teams Membership Updater",
|
||||
"loglist": null
|
||||
}
|
||||
}]
|
||||
}
|
|
@ -0,0 +1,90 @@
|
|||
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, WebPartContext } from '@microsoft/sp-webpart-base';
|
||||
import * as strings from 'TeamsMembershipUpdaterWebPartStrings';
|
||||
import TeamsMembershipUpdater from './components/TeamsMembershipUpdater';
|
||||
import { ITeamsMembershipUpdaterProps } from './components/ITeamsMembershipUpdaterProps';
|
||||
import { IDropdownOption } from 'office-ui-fabric-react/lib/Dropdown';
|
||||
import { IPropertyFieldList, PropertyFieldListPicker, PropertyFieldListPickerOrderBy } from '@pnp/spfx-property-controls/lib/PropertyFieldListPicker';
|
||||
import { PropertyFieldMessage } from '@pnp/spfx-property-controls/lib/PropertyFieldMessage';
|
||||
import { MessageBarType } from 'office-ui-fabric-react';
|
||||
|
||||
export interface ITeamsMembershipUpdaterWebPartProps {
|
||||
title: string;
|
||||
items: IDropdownOption[];
|
||||
loglist: IPropertyFieldList;
|
||||
context: WebPartContext;
|
||||
}
|
||||
|
||||
|
||||
export default class TeamsMembershipUpdaterWebPart extends BaseClientSideWebPart <ITeamsMembershipUpdaterWebPartProps> {
|
||||
|
||||
public render(): void {
|
||||
const element: React.ReactElement<ITeamsMembershipUpdaterProps> = React.createElement(
|
||||
TeamsMembershipUpdater,
|
||||
{
|
||||
title: this.properties.title,
|
||||
items: [],
|
||||
loglist: this.properties.loglist,
|
||||
context: this.context
|
||||
}
|
||||
);
|
||||
|
||||
ReactDom.render(element, this.domElement);
|
||||
}
|
||||
|
||||
protected onDispose(): void {
|
||||
ReactDom.unmountComponentAtNode(this.domElement);
|
||||
}
|
||||
|
||||
protected get dataVersion(): Version {
|
||||
return Version.parse('1.0');
|
||||
}
|
||||
|
||||
protected async onInit(): Promise<void> {
|
||||
await super.onInit();
|
||||
}
|
||||
|
||||
protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration {
|
||||
return {
|
||||
pages: [
|
||||
{
|
||||
header: {
|
||||
description: strings.PropertyPaneDescription
|
||||
},
|
||||
groups: [
|
||||
{
|
||||
groupName: strings.BasicGroupName,
|
||||
groupFields: [
|
||||
PropertyPaneTextField('title', {
|
||||
label: strings.TitleFieldLabel
|
||||
}),
|
||||
PropertyFieldListPicker('loglist', { label: strings.LoglistFieldLabel,
|
||||
selectedList: this.properties.loglist,
|
||||
includeHidden: false,
|
||||
includeListTitleAndUrl: true,
|
||||
orderBy: PropertyFieldListPickerOrderBy.Title,
|
||||
disabled: false,
|
||||
onPropertyChange: this.onPropertyPaneFieldChanged.bind(this),
|
||||
properties: this.properties,
|
||||
context: this.context,
|
||||
onGetErrorMessage: null,
|
||||
deferredValidationTime: 0,
|
||||
key: 'listPickerFieldId',
|
||||
}),
|
||||
PropertyFieldMessage("", {
|
||||
key: "LogListDescription",
|
||||
text: strings.LoglistDescription,
|
||||
messageType: MessageBarType.info,
|
||||
isVisible: true,
|
||||
})
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
import { Guid } from '@microsoft/sp-core-library';
|
||||
import { IDropdownOption } from 'office-ui-fabric-react/lib/Dropdown';
|
||||
import { WebPartContext } from '@microsoft/sp-webpart-base';
|
||||
import { IPropertyFieldList } from '@pnp/spfx-property-controls/lib/PropertyFieldListPicker';
|
||||
|
||||
export interface IDetailsListItem {
|
||||
key: number;
|
||||
name: string;
|
||||
id: Guid;
|
||||
}
|
||||
|
||||
export interface ITeamsMembershipUpdaterProps {
|
||||
title: string;
|
||||
loglist: IPropertyFieldList;
|
||||
items: IDropdownOption[];
|
||||
context: WebPartContext;
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
import { Guid } from "@microsoft/sp-core-library";
|
||||
|
||||
export interface IUserItem {
|
||||
displayName: string;
|
||||
mail: string;
|
||||
userPrincipalName: string;
|
||||
id: Guid;
|
||||
}
|
||||
|
||||
export interface ITeamItem {
|
||||
id: Guid;
|
||||
displayName: string;
|
||||
}
|
||||
|
||||
export interface ILog {
|
||||
team: string;
|
||||
logs: Array<string>;
|
||||
errors: Array<string>;
|
||||
logurl: string;
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
@import '~office-ui-fabric-react/dist/sass/References.scss';
|
||||
|
||||
.teamsMembershipUpdater {
|
||||
.container {
|
||||
max-width: 700px;
|
||||
padding: 10px;
|
||||
margin: 0px auto;
|
||||
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2), 0 25px 50px 0 rgba(0, 0, 0, 0.1);
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.row {
|
||||
@include ms-Grid-row;
|
||||
@include ms-fontColor-white;
|
||||
background-color: $ms-color-themeDark;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.column {
|
||||
@include ms-Grid-col;
|
||||
@include ms-lg10;
|
||||
@include ms-xl8;
|
||||
@include ms-xlPush2;
|
||||
@include ms-lgPush1;
|
||||
}
|
||||
|
||||
.title {
|
||||
@include ms-font-xl;
|
||||
@include ms-fontColor-white;
|
||||
}
|
||||
|
||||
.callout {
|
||||
width: 320;
|
||||
padding: '20px 24px';
|
||||
}
|
||||
|
||||
.callouttitle {
|
||||
margin-bottom: 12;
|
||||
@include ms-fontWeight-semilight;
|
||||
}
|
||||
|
||||
.subTitle {
|
||||
@include ms-font-l;
|
||||
@include ms-fontColor-white;
|
||||
}
|
||||
|
||||
.description {
|
||||
@include ms-font-l;
|
||||
@include ms-fontColor-white;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,373 @@
|
|||
import * as React from 'react';
|
||||
import styles from './TeamsMembershipUpdater.module.scss';
|
||||
import { ITeamsMembershipUpdaterProps } from './ITeamsMembershipUpdaterProps';
|
||||
import { DetailsList, DetailsListLayoutMode, IColumn, SelectionMode, ProgressIndicator, Separator, PrimaryButton, MessageBar, MessageBarType, Link, Toggle, List, Dropdown, IDropdownOption, Text, TeachingBubble, Icon, Callout, mergeStyleSets, FontWeights } from 'office-ui-fabric-react';
|
||||
import { ITeamsMembershipUpdaterWebPartProps } from '../TeamsMembershipUpdaterWebPart';
|
||||
import { readString } from 'react-papaparse';
|
||||
import { MSGraphClient, SPHttpClient, SPHttpClientResponse } from '@microsoft/sp-http';
|
||||
import * as MicrosoftGraph from "@microsoft/microsoft-graph-types";
|
||||
import { FilePicker, IFilePickerResult } from '@pnp/spfx-controls-react';
|
||||
import * as strings from 'TeamsMembershipUpdaterWebPartStrings';
|
||||
import { emailColumnPlaceholder, selectTeamPlacehold } from 'TeamsMembershipUpdaterWebPartStrings';
|
||||
|
||||
export enum Stage {
|
||||
LoadingTeams,
|
||||
CheckingOwnership,
|
||||
LoadingCurrentMembers,
|
||||
ComparingMembers,
|
||||
RemovingOrphendMembers,
|
||||
AddingNewMembers,
|
||||
LoggingDone,
|
||||
Done,
|
||||
ErrorOwnership,
|
||||
Ready
|
||||
}
|
||||
|
||||
export interface ITeamsMembershipUpdaterState {
|
||||
items: IDropdownOption[];
|
||||
selectionDetails: IDropdownOption;
|
||||
csvdata: any[];
|
||||
csvcolumns: IColumn[];
|
||||
csvSelected: IDropdownOption;
|
||||
csvItems: IDropdownOption[];
|
||||
me: string;
|
||||
groupOwners: string[];
|
||||
groupMembers: Array<MicrosoftGraph.User>;
|
||||
stage: Stage;
|
||||
logs: Array<string>;
|
||||
errors: Array<string>;
|
||||
logurl: string;
|
||||
delete: boolean;
|
||||
orphanedMembersHelp: boolean;
|
||||
}
|
||||
|
||||
export interface IRequest {
|
||||
requests: any[];
|
||||
}
|
||||
|
||||
export default class TeamsMembershipUpdater extends React.Component<ITeamsMembershipUpdaterProps, ITeamsMembershipUpdaterState> {
|
||||
private _datacolumns: IColumn[];
|
||||
private _data: any[];
|
||||
|
||||
constructor(props: ITeamsMembershipUpdaterWebPartProps) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
items: props.items,
|
||||
selectionDetails: null,
|
||||
csvdata: null,
|
||||
csvcolumns: [],
|
||||
csvSelected: null,
|
||||
csvItems: [],
|
||||
me: null,
|
||||
groupOwners: [],
|
||||
groupMembers: [],
|
||||
stage: Stage.LoadingTeams,
|
||||
logs: [],
|
||||
errors: [],
|
||||
logurl: null,
|
||||
delete: true,
|
||||
orphanedMembersHelp: false
|
||||
};
|
||||
}
|
||||
|
||||
public addError = (e: string, o: any): void => {
|
||||
console.error(e, o);
|
||||
let _log: Array<string> = this.state.errors;
|
||||
_log.push(e);
|
||||
this.setState({ ...this.state, errors: _log });
|
||||
}
|
||||
|
||||
public addLog = (e: string): void => {
|
||||
let _log: Array<string> = this.state.logs;
|
||||
_log.push(e);
|
||||
this.setState({ ...this.state, logs: _log });
|
||||
}
|
||||
|
||||
public handleOnDrop = (data) => {
|
||||
var h = data[0].meta.fields;
|
||||
this._data = data.map(r => { return r.data; });
|
||||
this._datacolumns = h.map(r => { return { key: r.replace(' ', ''), name: r, fieldName: r, isResizable: true }; });
|
||||
this.setState({ ...this.state, csvcolumns: this._datacolumns, csvdata: this._data, csvItems: h.map(r => { return { key: r.replace(' ', ''), text: r }; }), logs: [], errors: [], logurl: null });
|
||||
}
|
||||
|
||||
public handleOnError = (err, file, inputElem, reason) => {
|
||||
console.error(err);
|
||||
}
|
||||
|
||||
public handleOnRemoveFile = (data) => {
|
||||
this._data = null;
|
||||
this.setState({ ...this.state, csvdata: null });
|
||||
}
|
||||
|
||||
private fileChange = (filePickerResult: IFilePickerResult) => {
|
||||
this.props.context.msGraphClientFactory.getClient().then((client: MSGraphClient): void => {
|
||||
filePickerResult.downloadFileContent().then((file) => {
|
||||
const reader = new FileReader();
|
||||
console.log(file);
|
||||
reader.readAsArrayBuffer(file);
|
||||
reader.onloadend = ((ev) => {
|
||||
let decodedString = new TextDecoder('utf-8').decode(new DataView(reader.result as ArrayBuffer));
|
||||
const csv = readString(decodedString, { header: true, skipEmptyLines: true });
|
||||
var h = csv.meta.fields;
|
||||
this._data = csv.data;
|
||||
this._datacolumns = h.map(r => { return { key: r.replace(' ', ''), name: r, fieldName: r, isResizable: true }; });
|
||||
this.setState({ ...this.state, csvcolumns: this._datacolumns, csvdata: this._data, csvItems: h.map(r => { return { key: r.replace(' ', ''), text: r }; }), logs: [], errors: [], logurl: null });
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public onChange = (event: React.FormEvent<HTMLDivElement>, item: IDropdownOption): void => {
|
||||
this.setState({ ...this.state, stage: Stage.CheckingOwnership, logs: [], errors: [], logurl: null });
|
||||
this.props.context.msGraphClientFactory.getClient().then((client: MSGraphClient): void => {
|
||||
client.api(`groups/${item.key}/owners`).version("v1.0").get((err, res) => {
|
||||
if (err) {
|
||||
this.addError(err.message, err);
|
||||
return;
|
||||
}
|
||||
let _owners: Array<string> = new Array<string>();
|
||||
let b: boolean = false;
|
||||
res.value.forEach(element => {
|
||||
_owners.push(element.userPrincipalName);
|
||||
if (element.userPrincipalName == this.state.me) b = true;
|
||||
});
|
||||
if (b) this.setState({ ...this.state, selectionDetails: item, groupOwners: _owners, stage: Stage.Ready });
|
||||
else this.setState({ ...this.state, stage: Stage.ErrorOwnership });
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public onEmailChange = (event: React.FormEvent<HTMLDivElement>, item: IDropdownOption): void => {
|
||||
this.setState({ ...this.state, csvSelected: item });
|
||||
}
|
||||
|
||||
public onToggleDelete = (ev: React.MouseEvent<HTMLElement>, checked: boolean): void => {
|
||||
this.setState({ ...this.state, delete: checked });
|
||||
}
|
||||
|
||||
public onRun = (e) => {
|
||||
this.setState({ ...this.state, stage: Stage.LoadingCurrentMembers });
|
||||
this.props.context.msGraphClientFactory.getClient().then((client: MSGraphClient): void => {
|
||||
client.api(`groups/${this.state.selectionDetails.key}/members`).version("v1.0").get(async (err, res) => {
|
||||
if (err) {
|
||||
this.addError(err.message, err);
|
||||
return;
|
||||
}
|
||||
|
||||
let _members: Array<MicrosoftGraph.User> = res.value;
|
||||
this.setState({ ...this.state, groupMembers: _members, stage: Stage.ComparingMembers });
|
||||
|
||||
this.addLog(`Found ${_members.length} members existing in the group`);
|
||||
|
||||
let _delete: Array<MicrosoftGraph.User> = new Array<MicrosoftGraph.User>();
|
||||
|
||||
_members = _members.filter(m => {
|
||||
if (this._data.some(value => value[this.state.csvSelected.text] === m.mail) || this.state.groupOwners.some(value => value === m.userPrincipalName)) return m;
|
||||
else { if (this.state.delete == true) { _delete.push(m); this.addLog(`Will delete ${m.mail}`); } }
|
||||
});
|
||||
|
||||
let reqs: IRequest[] = [];
|
||||
if (this.state.delete == true) {
|
||||
this.setState({ ...this.state, stage: Stage.RemovingOrphendMembers });
|
||||
let _i, _j, _k, temparray, chunk = 20;
|
||||
for (_i = 0, _j = _delete.length, _k = 0; _i < _j; _i += chunk) {
|
||||
temparray = _delete.slice(_i, _i + chunk);
|
||||
reqs.push({ requests: temparray.map(e1 => { _k++; return { id: `${_k}`, method: "DELETE", url: `groups/${this.state.selectionDetails.key}/members/${e1.id}/$ref` }; }) });
|
||||
}
|
||||
}
|
||||
|
||||
let newMembers: string[] = [];
|
||||
|
||||
this._data.forEach(async e2 => {
|
||||
if (_members.some(m => m.mail === e2[this.state.csvSelected.text]) == false) {
|
||||
newMembers.push(e2[this.state.csvSelected.text]);
|
||||
this.addLog(`Will add ${e2[this.state.csvSelected.text]}`);
|
||||
}
|
||||
});
|
||||
|
||||
if (reqs.length > 0) {
|
||||
this.addLog(`${reqs.length} Delete Batches Detected`);
|
||||
reqs.forEach(r => {
|
||||
if (r.requests.length > 0) {
|
||||
this.addLog(`Deleting ${r.requests.length} users as a batch`);
|
||||
client.api("$batch").version("v1.0").post(r, (er, re) => {
|
||||
if (err) { this.addError(err.message, err); return; }
|
||||
if (re) re.reponses.forEach(e3 => { if (e3.body.error) this.addError(e3.body.error.message, e3.body.error); });
|
||||
this.addLog(`Deleting Batch Done`);
|
||||
});
|
||||
}
|
||||
});
|
||||
if (newMembers.length == 0) this.Done();
|
||||
else this.addMembers(newMembers, client);
|
||||
}
|
||||
else if (newMembers.length == 0) this.Done();
|
||||
else this.addMembers(newMembers, client);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public Done = (): void => {
|
||||
this.setState({ ...this.state, stage: this.props.loglist !== null || this.props.loglist !== undefined ? Stage.LoggingDone : Stage.Done });
|
||||
if (this.props.loglist !== null || this.props.loglist !== undefined) {
|
||||
//If Log list provided place the log entries into the list
|
||||
this.props.context.spHttpClient.get(`${this.props.context.pageContext.web.absoluteUrl}/_api/web/lists/GetByTitle('${this.props.loglist.title}')?$select=ListItemEntityTypeFullName`, SPHttpClient.configurations.v1)
|
||||
.then((res: SPHttpClientResponse): Promise<{ ListItemEntityTypeFullName: string; }> => {
|
||||
return res.json();
|
||||
})
|
||||
.then((web: { ListItemEntityTypeFullName: string }): void => {
|
||||
const p = {
|
||||
//"__metadata": { "type": web.ListItemEntityTypeFullName },
|
||||
"Title": `${this.state.selectionDetails.text} update ${new Date().toString()}`,
|
||||
"Logs": this.state.logs.join(", \n"),
|
||||
"Errors": this.state.errors.join(", \n")
|
||||
};
|
||||
|
||||
this.props.context.spHttpClient.post(`${this.props.context.pageContext.web.absoluteUrl}/_api/web/lists/GetByTitle('${this.props.loglist.title}')/items`, SPHttpClient.configurations.v1, {
|
||||
body: JSON.stringify(p)
|
||||
}).then((res: SPHttpClientResponse): Promise<{ w: any; }> => {
|
||||
return res.json();
|
||||
}).then((w: any): void => {
|
||||
this.setState({ ...this.state, stage: Stage.Done, logurl: `${this.props.loglist.url}/my.aspx` });
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public addMembers = (newMembers: string[], client: MSGraphClient): void => {
|
||||
this.setState({ ...this.state, stage: Stage.AddingNewMembers });
|
||||
let reqs: IRequest[] = [];
|
||||
let _i, _j, _k, temparray, chunk = 20;
|
||||
for (_i = 0, _j = newMembers.length, _k = 0; _i < _j; _i += chunk) {
|
||||
temparray = newMembers.slice(_i, _i + chunk);
|
||||
reqs.push({ requests: temparray.map(e => { _k++; return { id: `${_k}`, method: "GET", url: `users/${e}?$select=id` }; }) });
|
||||
}
|
||||
|
||||
this.addLog(`Getting Object IDs for ${newMembers.length} Members to Add from Graph`);
|
||||
for (let i = 0; i < reqs.length; i++) {
|
||||
console.log("Starting batch job " + i);
|
||||
console.log(reqs[i]);
|
||||
client.api("$batch").version("v1.0").post(reqs[i], (er, re) => {
|
||||
console.log(re);
|
||||
if (er) { this.addError(er.message, er); return; }
|
||||
let newreq: IRequest = { requests: [] };
|
||||
if (re) {
|
||||
re.responses.forEach(e => {
|
||||
if (e.body.error) this.addError(e.body.error.message, e.body.error);
|
||||
else {
|
||||
newreq.requests.push({
|
||||
id: `${newreq.requests.length + 1}`,
|
||||
method: "POST",
|
||||
url: `groups/${this.state.selectionDetails.key}/members/$ref`,
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: { "@odata.id": `https://graph.microsoft.com/v1.0/directoryObjects/${e.body.id}` }
|
||||
});
|
||||
}
|
||||
});
|
||||
console.log("Adding");
|
||||
this.addLog(`Adding ${newreq.requests.length} Members`);
|
||||
client.api("$batch").version("v1.0").post(newreq, (err, res) => {
|
||||
if (err) { this.addError(err.message, err); return; }
|
||||
if (res) {
|
||||
res.responses.forEach(e => {
|
||||
if (e.body.error) this.addError(e.body.error.message, e.body.error);
|
||||
});
|
||||
this.addLog("Adding Done");
|
||||
this.Done();
|
||||
}
|
||||
this.addLog("Adding Done");
|
||||
this.Done();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public componentDidMount(): void {
|
||||
this.props.context.msGraphClientFactory.getClient().then((client: MSGraphClient): void => {
|
||||
let req = {
|
||||
requests: [
|
||||
{ id: "1", method: "GET", url: "me" },
|
||||
{ id: "2", method: "GET", url: "me/joinedTeams" }
|
||||
]
|
||||
};
|
||||
client.api("$batch").version("v1.0").post(req, (err, res) => {
|
||||
if (err) {
|
||||
this.addError(err.message, err);
|
||||
return;
|
||||
}
|
||||
let teams: Array<IDropdownOption> = res.responses[1].body.value.map((item: any) => {
|
||||
return { key: item.id, text: item.displayName };
|
||||
});
|
||||
this.setState({ ...this.state, me: res.responses[0].body.userPrincipalName, items: teams, stage: Stage.Ready });
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public render(): React.ReactElement<ITeamsMembershipUpdaterProps> {
|
||||
const { items, csvItems, orphanedMembersHelp, csvdata, csvcolumns, stage, csvSelected, logurl, logs, errors } = this.state;
|
||||
const mg = mergeStyleSets({
|
||||
callout: {
|
||||
width: 320,
|
||||
padding: '20px 24px',
|
||||
},
|
||||
title: {
|
||||
marginBottom: 12,
|
||||
fontWeight: FontWeights.semilight,
|
||||
}
|
||||
});
|
||||
return (
|
||||
<div className={styles.teamsMembershipUpdater}>
|
||||
<div className={styles.container}>
|
||||
<Text variant="xLarge">{this.props.title}</Text>
|
||||
{stage == Stage.Done && <MessageBar messageBarType={MessageBarType.success} isMultiline={false}>
|
||||
{strings.doneText}
|
||||
{logurl != null && <Link href={logurl}>{strings.doneHistory}</Link>}
|
||||
</MessageBar>}
|
||||
{stage == Stage.LoadingTeams && <ProgressIndicator label={strings.loadingTeams} description={strings.loadingTeamsDescription} />}
|
||||
{stage == Stage.LoadingCurrentMembers && <ProgressIndicator label={strings.loadingMembersLabel} description={strings.loadingMembersDescription} />}
|
||||
{stage == Stage.ComparingMembers && <ProgressIndicator label={strings.comparingMembers} description={strings.comparingMembersDescription} />}
|
||||
{stage == Stage.RemovingOrphendMembers && <ProgressIndicator label={strings.removingOrphend} description={strings.removingOrphendDescription} />}
|
||||
{stage == Stage.AddingNewMembers && <ProgressIndicator label={strings.addingNew} description={strings.addingNewDescription} />}
|
||||
{stage == Stage.LoggingDone && <ProgressIndicator label={strings.logging} description={strings.loggingDescription} />}
|
||||
<Dropdown label={strings.selectTeam} onChange={this.onChange} placeholder={selectTeamPlacehold} options={items} disabled={items.length == 0} />
|
||||
{stage == Stage.CheckingOwnership && <ProgressIndicator label={strings.checkingOwner} description={strings.checkingOwnerDescription} />}
|
||||
{stage == Stage.ErrorOwnership && <MessageBar messageBarType={MessageBarType.error} isMultiline={false}>You are not an owner of this group. Please select another.</MessageBar>}
|
||||
<FilePicker accepts={[".csv"]} buttonLabel={strings.selectFile} buttonIcon="ExcelDocument" label={strings.selectFileLabel}
|
||||
hideStockImages hideOrganisationalAssetTab hideSiteFilesTab hideWebSearchTab hideLinkUploadTab onSave={this.fileChange} onChange={this.fileChange} context={this.props.context} />
|
||||
<Dropdown label={strings.emailColumn} onChange={this.onEmailChange} placeholder={emailColumnPlaceholder} options={csvItems} disabled={!csvdata} />
|
||||
<Toggle label={<span>4. Remove Orphaned Members <Icon iconName="Info" onMouseEnter={() => this.setState({...this.state, orphanedMembersHelp: true})} id="orphanedMembers" /></span>} inlineLabel onText={strings.on} offText={strings.off} defaultChecked={true} onChange={this.onToggleDelete} />
|
||||
{orphanedMembersHelp && <Callout target="#orphanedMembers" className={mg.callout} onDismiss={() => this.setState({...this.state, orphanedMembersHelp: false})}>
|
||||
<Text block variant="xLarge" className={mg.title}>{strings.orphanedMembersTitle}</Text>
|
||||
{strings.orphanedMembersContent}
|
||||
</Callout>}
|
||||
<PrimaryButton text={strings.submitButton} onClick={this.onRun} allowDisabledFocus disabled={!csvdata || items.length == 0 || stage != Stage.Ready || !csvSelected} />
|
||||
|
||||
<Separator>CSV Preview</Separator>
|
||||
{csvdata && <DetailsList
|
||||
items={csvdata}
|
||||
columns={csvcolumns}
|
||||
setKey="set"
|
||||
layoutMode={DetailsListLayoutMode.justified}
|
||||
selectionMode={SelectionMode.none}
|
||||
/>}
|
||||
{logs.length > 0 && (<><Separator>Logs</Separator><List items={logs} onRenderCell={this._onRenderCell} /></>)}
|
||||
{errors.length > 0 && (<><Separator>Errors</Separator><List items={errors} onRenderCell={this._onRenderCell} /></>)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
private _onRenderCell = (item: any, index: number | undefined): JSX.Element => {
|
||||
return (
|
||||
<div data-is-focusable={true}>
|
||||
<div style={{ padding: 2 }}>
|
||||
{item}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
36
samples/react-teams-membership-updater/src/webparts/teamsMembershipUpdater/loc/en-us.js
vendored
Normal file
36
samples/react-teams-membership-updater/src/webparts/teamsMembershipUpdater/loc/en-us.js
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
define([], function() {
|
||||
return {
|
||||
"PropertyPaneDescription": "Description",
|
||||
"BasicGroupName": "Group Name",
|
||||
"TitleFieldLabel": "Title",
|
||||
"LoglistFieldLabel": "Log List",
|
||||
"LoglistDescription": "A list with 3 columns, Title, Logs (Multiline string), Errors (Multiline string). Create a View call My with filter on created by to [Me]",
|
||||
"loadingTeams": "Loading Teams",
|
||||
"loadingTeamsDescription": "Loading the teams you are a member of",
|
||||
"doneText": "Membership has been updated, it can take up to an hour for Teams to reflect this!",
|
||||
"doneHistory": "History",
|
||||
"loadingMembersLabel": "Loading Current Members",
|
||||
"loadingMembersDescription": "Generating a list of current members",
|
||||
"comparingMembers": "Comparing Current Members",
|
||||
"comparingMembersDescription": "Comparing the current members with the csv file",
|
||||
"removingOrphend": "Removing Orphaned Members",
|
||||
"removingOrphendDescription": "Removing members who are not owners or in the csv file (orphend)",
|
||||
"addingNew": "Adding New Members",
|
||||
"addingNewDescription": "Adding members who are new in the csv file",
|
||||
"logging": "Logging this request",
|
||||
"loggingDescription": "Logging this request for stats purposes",
|
||||
"selectTeam": "1. Select the Team (you need to be an owner, it will be checked)",
|
||||
"selectTeamPlacehold": "Select an option",
|
||||
"checkingOwner": "Checking Team Ownership",
|
||||
"checkingOwnerDescription": "Checking to make sure you are an owner of this team",
|
||||
"selectFile": "Select CSV file",
|
||||
"selectFileLabel": "2. Select a CSV file",
|
||||
"emailColumn": "3. Select the Email Addresss Column",
|
||||
"emailColumnPlaceholder": "Select an option",
|
||||
"submitButton": "5. Update Membership",
|
||||
"orphanedMembersTitle": "Remove Orphaned Members",
|
||||
"orphanedMembersContent": "Removes members who are not present in the CSV file. Owners are not effected",
|
||||
"on": "On",
|
||||
"off": "Off"
|
||||
}
|
||||
});
|
39
samples/react-teams-membership-updater/src/webparts/teamsMembershipUpdater/loc/mystrings.d.ts
vendored
Normal file
39
samples/react-teams-membership-updater/src/webparts/teamsMembershipUpdater/loc/mystrings.d.ts
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
declare interface ITeamsMembershipUpdaterWebPartStrings {
|
||||
PropertyPaneDescription: string;
|
||||
BasicGroupName: string;
|
||||
TitleFieldLabel: string;
|
||||
LoglistFieldLabel: string;
|
||||
LoglistDescription: string;
|
||||
loadingTeams: string;
|
||||
loadingTeamsDescription: string;
|
||||
doneText: string;
|
||||
doneHistory: string;
|
||||
loadingMembersLabel: string;
|
||||
loadingMembersDescription: string;
|
||||
comparingMembers: string;
|
||||
comparingMembersDescription: string;
|
||||
removingOrphend: string;
|
||||
removingOrphendDescription: string;
|
||||
addingNew: string;
|
||||
addingNewDescription: string;
|
||||
logging: string;
|
||||
loggingDescription: string;
|
||||
selectTeam: string;
|
||||
selectTeamPlacehold: string;
|
||||
checkingOwner: string;
|
||||
checkingOwnerDescription: string;
|
||||
selectFile: string;
|
||||
selectFileLabel: string;
|
||||
emailColumn: string;
|
||||
emailColumnPlaceholder: string;
|
||||
submitButton: string;
|
||||
orphanedMembersTitle: string;
|
||||
orphanedMembersContent: string;
|
||||
on: string;
|
||||
off: string;
|
||||
}
|
||||
|
||||
declare module 'TeamsMembershipUpdaterWebPartStrings' {
|
||||
const strings: ITeamsMembershipUpdaterWebPartStrings;
|
||||
export = strings;
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
"extends": "./node_modules/@microsoft/rush-stack-compiler-3.3/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,
|
||||
"noUnusedLocals": false,
|
||||
"typeRoots": [
|
||||
"./node_modules/@types",
|
||||
"./node_modules/@microsoft"
|
||||
],
|
||||
"types": [
|
||||
"es6-promise",
|
||||
"webpack-env"
|
||||
],
|
||||
"lib": [
|
||||
"es5",
|
||||
"dom",
|
||||
"es2015.collection"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"src/**/*.ts",
|
||||
"src/**/*.tsx"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"lib"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"extends": "@microsoft/sp-tslint-rules/base-tslint.json",
|
||||
"rules": {
|
||||
"class-name": false,
|
||||
"export-name": false,
|
||||
"forin": false,
|
||||
"label-position": false,
|
||||
"member-access": true,
|
||||
"no-arg": false,
|
||||
"no-console": false,
|
||||
"no-construct": false,
|
||||
"no-duplicate-variable": true,
|
||||
"no-eval": false,
|
||||
"no-function-expression": true,
|
||||
"no-internal-module": true,
|
||||
"no-shadowed-variable": true,
|
||||
"no-switch-case-fall-through": true,
|
||||
"no-unnecessary-semicolons": true,
|
||||
"no-unused-expression": true,
|
||||
"no-use-before-declare": true,
|
||||
"no-with-statement": true,
|
||||
"semicolon": true,
|
||||
"trailing-comma": false,
|
||||
"typedef": false,
|
||||
"typedef-whitespace": false,
|
||||
"use-named-parameter": true,
|
||||
"variable-name": false,
|
||||
"whitespace": false
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue