Merge pull request #1278 from harshdamaniahd/dev
This commit is contained in:
commit
3fde16eb7e
|
@ -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,32 @@
|
|||
# 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
|
||||
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.10.0",
|
||||
"libraryName": "my-subscriptions",
|
||||
"libraryId": "15867796-91b4-48ce-b74a-4f031aea702a",
|
||||
"packageManager": "npm",
|
||||
"isDomainIsolated": false,
|
||||
"componentType": "webpart"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
---
|
||||
page_type: sample
|
||||
products:
|
||||
- office-sp
|
||||
languages:
|
||||
- javascript
|
||||
- typescript
|
||||
extensions:
|
||||
contentType: samples
|
||||
technologies:
|
||||
- SharePoint Framework
|
||||
- Microsoft Graph
|
||||
platforms:
|
||||
- React
|
||||
createdDate: 5/5/2020 12:00:00 AM
|
||||
---
|
||||
|
||||
## my-subscriptions
|
||||
|
||||
|
||||
## Summary
|
||||
|
||||
We now have audiences in modern SharePoint. The most benefit from this feature is that we can target News/ Article
|
||||
to different users groups.
|
||||
So the idea was to use the concept of audiences and build something called as subscription, when the user subscribes he/she becomes member of that group i.e office 365 groups
|
||||
Thus giving end users the opportunity on what kind of news/article they would be intrested in.
|
||||
|
||||
Please note: This is only applicable to public office 365 groups (Audiences).
|
||||
|
||||
|
||||
![Demo](./assets/example.gif)
|
||||
|
||||
Now the user determines what kind of news/article , he wants to see
|
||||
|
||||
Requirements
|
||||
1. Graph API to fetch groups I am a member of
|
||||
2. Graph API to add/remove current user from office 365 public group
|
||||
![Demo](./assets/graph.JPG)
|
||||
3. A SharePoint list to maintain a group of audiences
|
||||
|
||||
![Demo](./assets/list.JPG)
|
||||
Please create list in the following structure, all are text columns.
|
||||
|
||||
Also we can use high lighted content webpart to show all subscribed audience news/articles by using following query :
|
||||
![Demo](./assets/highlisghtedWP.JPG)
|
||||
|
||||
## Used SharePoint Framework Version 1.10
|
||||
|
||||
|
||||
## Applies to
|
||||
|
||||
* [SharePoint Framework](https:/dev.office.com/sharepoint)
|
||||
|
||||
|
||||
## 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 bundle --ship`
|
||||
* `gulp package-solution --ship`
|
||||
* Add the package to your app catalog
|
||||
* Approve the Graph API permissions in the SharePoint admin center
|
||||
* Add the webpart to your page
|
||||
|
||||
|
||||
## Features
|
||||
|
||||
### Building the code
|
||||
|
||||
```bash
|
||||
git clone the repo
|
||||
npm i
|
||||
npm i -g gulp
|
||||
gulp
|
||||
```
|
||||
|
||||
This package produces the following:
|
||||
|
||||
* lib/* - intermediate-stage commonjs build artifacts
|
||||
* dist/* - the bundled script, along with other resources
|
||||
* deploy/* - all resources which should be uploaded to a CDN.
|
||||
|
||||
### Build options
|
||||
|
||||
gulp clean - TODO
|
||||
gulp test - TODO
|
||||
gulp serve - TODO
|
||||
gulp bundle - TODO
|
||||
gulp package-solution - TODO
|
||||
|
||||
<img src="https://telemetry.sharepointpnp.com/sp-dev-fx-webparts/samples/react-mysubscription" />
|
Binary file not shown.
After Width: | Height: | Size: 3.2 MiB |
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
Binary file not shown.
After Width: | Height: | Size: 25 KiB |
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/config.2.0.schema.json",
|
||||
"version": "2.0",
|
||||
"bundles": {
|
||||
"my-subscriptions-web-part": {
|
||||
"components": [
|
||||
{
|
||||
"entrypoint": "./lib/webparts/mySubscriptions/MySubscriptionsWebPart.js",
|
||||
"manifest": "./src/webparts/mySubscriptions/MySubscriptionsWebPart.manifest.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"externals": {},
|
||||
"localizedResources": {
|
||||
"MySubscriptionsWebPartStrings": "lib/webparts/mySubscriptions/loc/{locale}.js",
|
||||
"ControlStrings": "node_modules/@pnp/spfx-controls-react/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": "my-subscriptions",
|
||||
"accessKey": "<!-- ACCESS KEY -->"
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/package-solution.schema.json",
|
||||
"solution": {
|
||||
"name": "Microsoft 365 - My Subscriptions",
|
||||
"id": "15867796-91b4-48ce-b74a-4f031aea702a",
|
||||
"version": "1.0.0.0",
|
||||
"supportedLocales": ["en","no"],
|
||||
"includeClientSideAssets": true,
|
||||
"isDomainIsolated": false,
|
||||
"webApiPermissionRequests": [
|
||||
{
|
||||
"resource": "Microsoft Graph",
|
||||
"scope": "User.Read"
|
||||
},
|
||||
{
|
||||
"resource": "Microsoft Graph",
|
||||
"scope": "GroupMember.ReadWrite.All"
|
||||
}
|
||||
|
||||
]
|
||||
},
|
||||
|
||||
"paths": {
|
||||
"zippedPackage": "solution/my-subscriptions.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'));
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,46 @@
|
|||
{
|
||||
"name": "my-subscriptions",
|
||||
"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.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/sp": "^2.0.4",
|
||||
"@pnp/spfx-controls-react": "1.17.0",
|
||||
"@types/es6-promise": "0.0.33",
|
||||
"@types/react": "16.8.8",
|
||||
"@types/react-dom": "16.8.3",
|
||||
"@types/webpack-env": "1.13.1",
|
||||
"@uifabric/fluent-theme": "^7.1.54",
|
||||
"office-ui-fabric-react": "6.189.2",
|
||||
"react": "16.8.5",
|
||||
"react-dom": "16.8.5"
|
||||
},
|
||||
"resolutions": {
|
||||
"@types/react": "16.8.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@microsoft/microsoft-graph-types": "^1.12.0",
|
||||
"@microsoft/rush-stack-compiler-3.3": "0.3.5",
|
||||
"@microsoft/sp-build-web": "1.10.0",
|
||||
"@microsoft/sp-module-interfaces": "1.10.0",
|
||||
"@microsoft/sp-tslint-rules": "1.10.0",
|
||||
"@microsoft/sp-webpart-workbench": "1.10.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,13 @@
|
|||
|
||||
export class ConstantsMySubscription{
|
||||
|
||||
|
||||
public static webpartName="MySubscriptions";
|
||||
|
||||
}
|
||||
export interface IMySubscriptionsListConfig {
|
||||
SiteUrl: string;
|
||||
ListName: string;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/spfx/client-side-web-part-manifest.schema.json",
|
||||
"id": "c4718e00-78f7-4ebe-8093-e5fe0ae84f62",
|
||||
"alias": "MySubscriptionsWebPart",
|
||||
"componentType": "WebPart",
|
||||
"supportsThemeVariants": true,
|
||||
|
||||
// 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
|
||||
"group": { "default": "Other" },
|
||||
"title": { "default": "My Subscriptions" },
|
||||
"description": { "default": "Shows the list of audiences, user has sybscribed to" },
|
||||
"officeFabricIconFontName": "ReminderGroup",
|
||||
"properties": {
|
||||
"description": "Shows the list of audiences, user has subscribed to"
|
||||
}
|
||||
}]
|
||||
}
|
|
@ -0,0 +1,107 @@
|
|||
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 MySubscriptions from './components/MySubscriptions';
|
||||
import { IMySubscriptionsProps } from './components/IMySubscriptionsProps';
|
||||
import { ThemeProvider, ThemeChangedEventArgs, IReadonlyTheme } from '@microsoft/sp-component-base';
|
||||
import { getLanguage } from './services/Local';
|
||||
|
||||
|
||||
export interface IMySubscriptionsWebPartProps {
|
||||
siteurl: string;
|
||||
listname:string;
|
||||
|
||||
}
|
||||
|
||||
export default class MySubscriptionsWebPart extends BaseClientSideWebPart <IMySubscriptionsWebPartProps> {
|
||||
private _themeProvider: ThemeProvider;
|
||||
private _themeVariant: IReadonlyTheme | undefined;
|
||||
public strings;
|
||||
public render(): void {
|
||||
const element: React.ReactElement<IMySubscriptionsProps> = React.createElement(
|
||||
MySubscriptions,
|
||||
{
|
||||
siteurl: this.properties.siteurl,
|
||||
context: this.context,
|
||||
themeVariant: this._themeVariant,
|
||||
listname:this.properties.listname,
|
||||
displayMode: this.displayMode,
|
||||
strings:this.strings
|
||||
|
||||
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
ReactDom.render(element, this.domElement);
|
||||
}
|
||||
protected get disableReactivePropertyChanges(): boolean {
|
||||
return true;
|
||||
}
|
||||
protected async onInit(): Promise<void> {
|
||||
// Consume the new ThemeProvider service
|
||||
this._themeProvider = this.context.serviceScope.consume(ThemeProvider.serviceKey);
|
||||
|
||||
// If it exists, get the theme variant
|
||||
this._themeVariant = this._themeProvider.tryGetTheme();
|
||||
|
||||
// Register a handler to be notified if the theme variant changes
|
||||
this._themeProvider.themeChangedEvent.add(this, this._handleThemeChangedEvent);
|
||||
this.strings = await getLanguage.getUserBrowserLanguage();
|
||||
|
||||
return super.onInit();
|
||||
}
|
||||
/**
|
||||
* Update the current theme variant reference and re-render.
|
||||
*
|
||||
* @param args The new theme
|
||||
*/
|
||||
private _handleThemeChangedEvent(args: ThemeChangedEventArgs): void {
|
||||
this._themeVariant = args.theme;
|
||||
this.render();
|
||||
}
|
||||
|
||||
protected onDispose(): void {
|
||||
ReactDom.unmountComponentAtNode(this.domElement);
|
||||
}
|
||||
|
||||
protected get dataVersion(): Version {
|
||||
return Version.parse('1.0');
|
||||
}
|
||||
|
||||
protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration {
|
||||
return {
|
||||
pages: [
|
||||
{
|
||||
header: {
|
||||
description: "We now have audiences in modern sharepoint. The most benefit from this feature is that we can target News/ Article to different users groups. So the idea was to use the concept of audiences and build something called as subscription, when the user subscribes he/she becomes member of that group i.e office 365 groups Thus giving end users the opportunity on what kind of news/article they would be intrested in."
|
||||
},
|
||||
groups: [
|
||||
{
|
||||
groupName: "List Audience Configurations",
|
||||
groupFields: [
|
||||
PropertyPaneTextField('siteurl', {
|
||||
label:"Site URL",
|
||||
description:"For eg : https://demo.sharepoint.com/sites/common",
|
||||
|
||||
}),
|
||||
PropertyPaneTextField('listname', {
|
||||
label:"List Name",
|
||||
description:"For eg: Audiences",
|
||||
|
||||
}),
|
||||
|
||||
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
import { WebPartContext } from '@microsoft/sp-webpart-base';
|
||||
import { DisplayMode } from '@microsoft/sp-core-library';
|
||||
|
||||
export interface IMySubscriptionsProps {
|
||||
siteurl: string;
|
||||
context: WebPartContext;
|
||||
themeVariant: any;
|
||||
listname:string;
|
||||
displayMode: DisplayMode;
|
||||
strings:any;
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
import { IGroup } from "./interface/IGroup";
|
||||
|
||||
export interface IMySubscriptionState {
|
||||
groups:IGroup[];
|
||||
showMessageBar:boolean;
|
||||
message:string;
|
||||
messageBarType:string;
|
||||
isdataLoaded:boolean;
|
||||
isdataLoadedMessage:string;
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
@import "~office-ui-fabric-react/dist/sass/References.scss";
|
||||
|
||||
.mySubscriptions {
|
||||
.container {
|
||||
width: 100%;
|
||||
margin: 0px auto;
|
||||
border-bottom-style: solid;
|
||||
border-bottom-width: 1px;
|
||||
border-bottom-color: darkgray;
|
||||
}
|
||||
|
||||
.row {
|
||||
//box-shadow: 0 3px 6px 0 rgba(0, 0, 0, 0.16);
|
||||
//border-bottom: 1px solid #a9a9a9;
|
||||
float: left;
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
flex-direction: column;
|
||||
min-width: 176px;
|
||||
height: 100%;
|
||||
max-width: 176px;
|
||||
margin-inline-start: 20px;
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
border-image: initial;
|
||||
border-color: rgb(234, 234, 234) !important;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.title {
|
||||
padding: 12px;
|
||||
box-sizing: border-box;
|
||||
margin-right: 0px;
|
||||
margin-left: 0px;
|
||||
font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI",
|
||||
-apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
color:"[theme: themePrimary]";
|
||||
height: 90px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.subTitle {
|
||||
color: grey;
|
||||
text-align: center;
|
||||
font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI",
|
||||
-apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
font-size: 12px;
|
||||
font-weight: 400;
|
||||
display: inline-block;
|
||||
color:"[theme: neutralSecondary]";
|
||||
padding: 6px;
|
||||
height: 60px;
|
||||
border-top: 1px solid;
|
||||
border-top-color:"[theme: neutralTertiaryAlt]" ;
|
||||
}
|
||||
|
||||
.subscribedButton{
|
||||
background-color:"[theme:buttonBackgroundDisabled]";
|
||||
color:"[theme:neutralPrimary]"
|
||||
}
|
||||
.subscribedButtonRed{
|
||||
background-color: #e32c22;
|
||||
}
|
||||
.subscribe {
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
padding: 6px;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,329 @@
|
|||
import * as React from "react";
|
||||
import styles from "./MySubscriptions.module.scss";
|
||||
import { IMySubscriptionsProps } from "./IMySubscriptionsProps";
|
||||
import { MSGraphClient } from "@microsoft/sp-http";
|
||||
import { MSGraphService } from "../services/GroupService";
|
||||
import * as MicrosoftGraph from "@microsoft/microsoft-graph-types";
|
||||
import { IReadonlyTheme } from "@microsoft/sp-component-base";
|
||||
import { Label } from "office-ui-fabric-react/lib/Label";
|
||||
|
||||
import {
|
||||
FocusZone,
|
||||
List,
|
||||
autobind,
|
||||
MessageBar,
|
||||
MessageBarType,
|
||||
PrimaryButton,
|
||||
Shimmer,
|
||||
ShimmerElementType,
|
||||
} from "office-ui-fabric-react";
|
||||
import { IGroup } from "./interface/IGroup";
|
||||
import { IIconProps } from "office-ui-fabric-react";
|
||||
import { IGroupMember } from "./interface/IGroupMember";
|
||||
import { IMySubscriptionState } from "./IMySubscriptionsState";
|
||||
import {
|
||||
ConstantsMySubscription,
|
||||
IMySubscriptionsListConfig,
|
||||
} from "../Constants";
|
||||
|
||||
import { Placeholder } from "@pnp/spfx-controls-react/lib/Placeholder";
|
||||
import { DisplayMode } from "@microsoft/sp-core-library";
|
||||
|
||||
const Checkbox: IIconProps = { iconName: "Checkbox" };
|
||||
const CheckboxComposite: IIconProps = { iconName: "CheckboxComposite" };
|
||||
|
||||
export default class MySubscriptions extends React.Component<
|
||||
IMySubscriptionsProps,
|
||||
IMySubscriptionState
|
||||
> {
|
||||
public _originalItems: IGroup[];
|
||||
public _mySubscribedItems: IGroupMember[];
|
||||
public userId: any;
|
||||
public listConfig: IMySubscriptionsListConfig;
|
||||
constructor(props: IMySubscriptionsProps) {
|
||||
super(props);
|
||||
this.state = {
|
||||
groups: [],
|
||||
showMessageBar: false,
|
||||
message: "",
|
||||
messageBarType: "",
|
||||
isdataLoaded: false,
|
||||
isdataLoadedMessage: this.props.strings.PleaseWait,
|
||||
};
|
||||
|
||||
this._onRenderCell = this._onRenderCell.bind(this);
|
||||
this._joinGroup_leaveGRoup = this._joinGroup_leaveGRoup.bind(this);
|
||||
}
|
||||
public render(): React.ReactElement<IMySubscriptionsProps> {
|
||||
const messageBarType = this.state.messageBarType;
|
||||
const { semanticColors }: IReadonlyTheme = this.props.themeVariant;
|
||||
if (
|
||||
this.props.siteurl == undefined ||
|
||||
(this.props.siteurl.trim() == "" && this.props.listname == undefined) ||
|
||||
this.props.listname.trim() == ""
|
||||
) {
|
||||
return (
|
||||
<FocusZone>
|
||||
<Placeholder
|
||||
iconName="Edit"
|
||||
iconText="Configure your web part"
|
||||
description="Please configure the web part."
|
||||
buttonLabel="Configure"
|
||||
hideButton={this.props.displayMode === DisplayMode.Read}
|
||||
onConfigure={this._onConfigure}
|
||||
/>
|
||||
</FocusZone>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<FocusZone>
|
||||
<div
|
||||
style={{ backgroundColor: semanticColors.bodyBackground }}
|
||||
className={styles.mySubscriptions}
|
||||
>
|
||||
<Label
|
||||
style={{ display: this.state.isdataLoaded ? "none" : "block" }}
|
||||
className={styles.title}
|
||||
>
|
||||
{this.state.isdataLoadedMessage}
|
||||
</Label>
|
||||
|
||||
<Shimmer
|
||||
isDataLoaded={this.state.isdataLoaded}
|
||||
shimmerColors={{
|
||||
shimmer: semanticColors.listItemBackgroundChecked,
|
||||
shimmerWave: semanticColors.listItemBackgroundCheckedHovered,
|
||||
background: semanticColors.bodyBackground, // to match the background color of the containing div
|
||||
}}
|
||||
shimmerElements={[
|
||||
{ type: ShimmerElementType.line, height: 100 },
|
||||
{ type: ShimmerElementType.gap, width: "4%" },
|
||||
{ type: ShimmerElementType.line, height: 100 },
|
||||
{ type: ShimmerElementType.gap, width: "4%" },
|
||||
{ type: ShimmerElementType.line, height: 100 },
|
||||
{ type: ShimmerElementType.gap, width: "4%" },
|
||||
{ type: ShimmerElementType.line, height: 100 },
|
||||
]}
|
||||
/>
|
||||
|
||||
{this.state.showMessageBar && (
|
||||
<MessageBar
|
||||
messageBarType={
|
||||
messageBarType == "success"
|
||||
? MessageBarType.success
|
||||
: messageBarType == "warning"
|
||||
? MessageBarType.warning
|
||||
: MessageBarType.error
|
||||
}
|
||||
isMultiline={false}
|
||||
onDismiss={() => this.closeMessageBar()}
|
||||
dismissButtonAriaLabel="Close"
|
||||
>
|
||||
{this.state.message}
|
||||
</MessageBar>
|
||||
)}
|
||||
|
||||
<List items={this.state.groups} onRenderCell={this._onRenderCell} />
|
||||
</div>
|
||||
</FocusZone>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public async componentDidUpdate(
|
||||
prevProps: IMySubscriptionsProps,
|
||||
prevState: IMySubscriptionState
|
||||
) {
|
||||
try {
|
||||
if (
|
||||
this.props.siteurl !== prevProps.siteurl ||
|
||||
this.props.listname !== prevProps.listname
|
||||
) {
|
||||
await this.componentDidMount();
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
console.log("MySubscriptions.componentDidMount Error: ", error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the message bar ....
|
||||
*/
|
||||
protected closeMessageBar = () => {
|
||||
this.setState({ showMessageBar: false });
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param item : each item
|
||||
* @param index : index
|
||||
*/
|
||||
private _onRenderCell(item: IGroup, index: number | undefined): JSX.Element {
|
||||
//const { semanticColors }: IReadonlyTheme = this.props.themeVariant;
|
||||
|
||||
return (
|
||||
<div
|
||||
className={styles.row}
|
||||
style={{ minWidth: window.innerWidth < 480 ? "250px" : "176px" }}
|
||||
>
|
||||
<span className={styles.title}>{item.Title}</span>
|
||||
<span className={styles.subTitle}>{item.description.slice(0, 99)}</span>
|
||||
|
||||
<div className={styles.subscribe}>
|
||||
{!item.subscribe ? (
|
||||
<PrimaryButton
|
||||
className={styles.subscribedButtonRed}
|
||||
iconProps={Checkbox}
|
||||
text={this.props.strings.SubscribeLabel}
|
||||
id={item.groupid}
|
||||
onClick={() => {
|
||||
this._joinGroup_leaveGRoup(
|
||||
item.groupid,
|
||||
item.subscribe,
|
||||
item.Title
|
||||
);
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<PrimaryButton
|
||||
className={styles.subscribedButton}
|
||||
iconProps={CheckboxComposite}
|
||||
text={this.props.strings.SubscribedLabel}
|
||||
id={item.groupid}
|
||||
onClick={() => {
|
||||
this._joinGroup_leaveGRoup(
|
||||
item.groupid,
|
||||
item.subscribe,
|
||||
item.Title
|
||||
);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
private _onConfigure = () => {
|
||||
// Context of the web part
|
||||
this.props.context.propertyPane.open();
|
||||
}
|
||||
/**
|
||||
* Join or leave a group
|
||||
*/
|
||||
@autobind
|
||||
private async _joinGroup_leaveGRoup(
|
||||
groupID: string,
|
||||
subscribe: boolean,
|
||||
title: string
|
||||
) {
|
||||
try {
|
||||
if (this.userId == undefined || this.userId == "") {
|
||||
let response = await MSGraphService.getUserID(this.props.context);
|
||||
this.userId = response["id"];
|
||||
}
|
||||
|
||||
//If subscribed already, that means unsubscribe operation will be performed.
|
||||
if (subscribe) {
|
||||
let response = await MSGraphService.removeMember(
|
||||
groupID,
|
||||
this.userId,
|
||||
this.props.context
|
||||
);
|
||||
//if response was successfull.
|
||||
if (typeof response == "undefined") {
|
||||
this.setState({
|
||||
groups: await MSGraphService.mutateList(
|
||||
this.state.groups,
|
||||
groupID,
|
||||
false
|
||||
),
|
||||
});
|
||||
this.setState({ messageBarType: "warning" });
|
||||
this.setState({ showMessageBar: true });
|
||||
this.setState({
|
||||
message: this.props.strings.UnsubscribedSuccessMsg + title,
|
||||
});
|
||||
} else {
|
||||
this.setState({ showMessageBar: true });
|
||||
this.setState({ messageBarType: "error" });
|
||||
this.setState({ message: this.props.strings.ErrorMessage1 });
|
||||
}
|
||||
}
|
||||
//If unsubscribed already, that means subscribe operation will be performed.
|
||||
else {
|
||||
let response = await MSGraphService.addMember(
|
||||
groupID,
|
||||
this.userId,
|
||||
this.props.context
|
||||
);
|
||||
if (typeof response == "undefined") {
|
||||
this.setState({
|
||||
groups: await MSGraphService.mutateList(
|
||||
this.state.groups,
|
||||
groupID,
|
||||
true
|
||||
),
|
||||
});
|
||||
this.setState({ messageBarType: "success" });
|
||||
this.setState({ showMessageBar: true });
|
||||
this.setState({
|
||||
message: this.props.strings.SubscriptionSuccessMsg + title,
|
||||
});
|
||||
} else {
|
||||
this.setState({ showMessageBar: true });
|
||||
this.setState({ messageBarType: "error" });
|
||||
this.setState({ message: this.props.strings.ErrorMessage1 });
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
console.log("MySubscriptions._joinGroup_leaveGRoup: ", error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called on page load are the various functions
|
||||
*
|
||||
*/
|
||||
public async componentDidMount() {
|
||||
try {
|
||||
//Get list configuration i.e the place where audiences are stored.
|
||||
let start1 = performance.now();
|
||||
let start, end;
|
||||
start = performance.now();
|
||||
end = performance.now();
|
||||
console.log(end - start + ": getUserBrowserLanguage");
|
||||
//Gets all group ids where i am member
|
||||
start = performance.now();
|
||||
this._mySubscribedItems = await MSGraphService.getGroupsIAmMemberOf(
|
||||
this.props.context
|
||||
);
|
||||
end = performance.now();
|
||||
console.log(end - start + ": getGroupsIAmMemberOf");
|
||||
//Get all audiences/groups
|
||||
start = performance.now();
|
||||
this._originalItems = await MSGraphService.getAllAudiences(
|
||||
this.props.siteurl,
|
||||
this.props.listname
|
||||
);
|
||||
end = performance.now();
|
||||
console.log(end - start + ": getAllAudiences");
|
||||
//get mysubscriptions i.e which audience I have subscribed to
|
||||
start = performance.now();
|
||||
this._originalItems = await MSGraphService.mySubscriptions(
|
||||
this._originalItems,
|
||||
this._mySubscribedItems
|
||||
);
|
||||
end = performance.now();
|
||||
console.log(end - start + ": mySubscriptions");
|
||||
this.setState({ isdataLoaded: true });
|
||||
this.setState({ groups: this._originalItems });
|
||||
let end1 = performance.now();
|
||||
console.log(end1 - start1, ":End");
|
||||
} catch (error) {
|
||||
|
||||
console.log("MySubscriptions.componentDidMount Error: ", error);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
export interface IGroup {
|
||||
groupid: string;
|
||||
mail: string;
|
||||
Title: string;
|
||||
visibility: string;
|
||||
description:string;
|
||||
subscribe:boolean;
|
||||
}
|
||||
|
||||
export interface IGroupCollection {
|
||||
value?: IGroup[];
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
export interface IGroupMember {
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface IGroupMemberCollection {
|
||||
value?: IGroupMember[];
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
define([], function() {
|
||||
return {
|
||||
"PropertyPaneDescription": "Description",
|
||||
"BasicGroupName": "Group Name",
|
||||
"DescriptionFieldLabel": "Description Field",
|
||||
"SubscribeLabel":"Subscribe",
|
||||
"SubscribedLabel":"Subscribed"
|
||||
}
|
||||
});
|
12
samples/react-MySubscription/src/webparts/mySubscriptions/loc/mystrings.d.ts
vendored
Normal file
12
samples/react-MySubscription/src/webparts/mySubscriptions/loc/mystrings.d.ts
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
declare interface IMySubscriptionsWebPartStrings {
|
||||
PropertyPaneDescription: string;
|
||||
BasicGroupName: string;
|
||||
DescriptionFieldLabel: string;
|
||||
SubscribeLabel:string;
|
||||
SubscribedLabel:string;
|
||||
}
|
||||
|
||||
declare module 'MySubscriptionsWebPartStrings' {
|
||||
const strings: IMySubscriptionsWebPartStrings;
|
||||
export = strings;
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
define([], function() {
|
||||
return {
|
||||
"PropertyPaneDescription": "Description",
|
||||
"BasicGroupName": "Group Name",
|
||||
"DescriptionFieldLabel": "Description Field",
|
||||
"SubscribeLabel":"Abonner",
|
||||
"SubscribedLabel":"Abonnerer"
|
||||
}
|
||||
});
|
|
@ -0,0 +1,220 @@
|
|||
import { WebPartContext } from "@microsoft/sp-webpart-base";
|
||||
import { MSGraphClient } from "@microsoft/sp-http";
|
||||
import { IGroup } from "../components/interface/IGroup";
|
||||
import { IGroupMember } from "../components/interface/IGroupMember";
|
||||
import { ConstantsMySubscription, IMySubscriptionsListConfig } from "../Constants";
|
||||
import { Web } from "@pnp/sp/webs";
|
||||
import { sp } from "@pnp/sp";
|
||||
import "@pnp/sp/webs";
|
||||
import "@pnp/sp/lists";
|
||||
import "@pnp/sp/items";
|
||||
export class MSGraphService {
|
||||
/**
|
||||
*
|
||||
* @param context : A Webpart context needed to get current context
|
||||
* Gets a list of audiences from sharepoint list
|
||||
*/
|
||||
public static async getAllAudiences(siteurl:string,listname:string): Promise<any[]> {
|
||||
let groups: any[] = [];
|
||||
let body: any;
|
||||
try {
|
||||
const w = Web(siteurl.trim());
|
||||
groups = await w.lists
|
||||
.getByTitle(listname.trim())
|
||||
.select("Title", "description", "groupid", "mail")
|
||||
.items.filter("groupid ne null").get();
|
||||
}
|
||||
catch (error)
|
||||
{
|
||||
console.log("MSGraphService.getAllAudiences Error: ", error);
|
||||
}
|
||||
return groups;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param context : A Webpart context needed to get current context
|
||||
* Gets a list of all groups user is a member of using graph api.
|
||||
*/
|
||||
public static async getAllGroups(context:WebPartContext):Promise<any[]>{
|
||||
let groups: string[] = [];
|
||||
try {
|
||||
let client: MSGraphClient = await context.msGraphClientFactory
|
||||
.getClient()
|
||||
.then();
|
||||
let response = await client
|
||||
.api(`groups`)
|
||||
.version("v1.0")
|
||||
.get();
|
||||
response.value.map((item: any) => {
|
||||
debugger;
|
||||
groups.push(item);
|
||||
});
|
||||
}
|
||||
catch (error) {
|
||||
console.log("MSGraphService.getGroupsIAmMemberOf Error: ", error);
|
||||
}
|
||||
return groups;
|
||||
}
|
||||
public static async getGroupsIAmMemberOf(context: WebPartContext): Promise<any[]> {
|
||||
let groups: string[] = [];
|
||||
try {
|
||||
let client: MSGraphClient = await context.msGraphClientFactory
|
||||
.getClient()
|
||||
.then();
|
||||
let response = await client
|
||||
.api(`/me/memberOf?$select=id`)
|
||||
.version("v1.0")
|
||||
.get();
|
||||
response.value.map((item: any) => {
|
||||
groups.push(item);
|
||||
});
|
||||
}
|
||||
catch (error) {
|
||||
console.log("MSGraphService.getGroupsIAmMemberOf Error: ", error);
|
||||
}
|
||||
return groups;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param orgItems : A list of all audiences we have in sharepoint list
|
||||
* @param subsribedItems : A list of all items I have subscribed to in office 365
|
||||
* Code maps and finds out list of groups user has subscribed to from orgItems i.e list of audiences.
|
||||
*/
|
||||
public static async mySubscriptions(orgItems: IGroup[],subsribedItems: IGroupMember[]): Promise<any[]> {
|
||||
try{
|
||||
var groups:any = [];
|
||||
let mysubscribedAudiencesID: any = subsribedItems.map((d: IGroupMember) => {
|
||||
return d.id;
|
||||
});
|
||||
orgItems.forEach((element) => {
|
||||
let obj;
|
||||
if (mysubscribedAudiencesID.includes(element.groupid) == true) {
|
||||
obj = {
|
||||
groupid: element.groupid,
|
||||
Title: element.Title,
|
||||
mail: element.mail,
|
||||
visibility: element.visibility,
|
||||
description: element.description,
|
||||
subscribe: true,
|
||||
};
|
||||
groups.push(obj);
|
||||
} else {
|
||||
obj = {
|
||||
groupid: element.groupid,
|
||||
Title: element.Title,
|
||||
mail: element.mail,
|
||||
visibility: element.visibility,
|
||||
description: element.description,
|
||||
subscribe: false,
|
||||
};
|
||||
groups.push(obj);
|
||||
}
|
||||
});
|
||||
groups.sort((a, b) => b.subscribe - a.subscribe);
|
||||
}
|
||||
catch(error)
|
||||
{
|
||||
console.log("MSGraphService.mySubscriptions Error: ", error);
|
||||
|
||||
}
|
||||
return groups;
|
||||
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param orgItems : Gets all audiences we have in sharepoint list
|
||||
* @param groupID : Gets the updated subscription groupID
|
||||
* @param subscribe : Sets the value if subscribed yes/no
|
||||
* Mutates i.e updates the array when subscription is turned on or off based on group id for current user.
|
||||
*/
|
||||
public static async mutateList(orgItems: IGroup[],groupID: string,subscribe: boolean): Promise<any[]> {
|
||||
let group = [];
|
||||
try{
|
||||
orgItems.map((item: IGroup) => {
|
||||
if (groupID === item.groupid) {
|
||||
item.subscribe = subscribe;
|
||||
}
|
||||
});
|
||||
orgItems.forEach((element) => {
|
||||
group.push(element);
|
||||
});
|
||||
}
|
||||
catch(error){
|
||||
console.log("MSGraphService.mutateList Error: ", error);
|
||||
}
|
||||
|
||||
return group;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param context : A Webpart context needed to get current context
|
||||
* Gets the current user ID.
|
||||
*/
|
||||
public static async getUserID(context: WebPartContext): Promise<any[]> {
|
||||
let userID: any;
|
||||
try {
|
||||
let client: MSGraphClient = await context.msGraphClientFactory
|
||||
.getClient()
|
||||
.then();
|
||||
let response = await client
|
||||
.api(`me?$Select=Id`)
|
||||
.version("v1.0")
|
||||
.get();
|
||||
userID = response;
|
||||
}
|
||||
catch (error) {
|
||||
console.log("MSGraphService.getUserID Error: ", error);
|
||||
}
|
||||
return userID;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param groupId : Group if of the group which current user subscribes
|
||||
* @param userId : Current user id
|
||||
* @param context : A Webpart context needed to get current context
|
||||
* Add the current user to Office 365 group
|
||||
*/
|
||||
public static async addMember(groupId: string,userId: string,context: WebPartContext): Promise<any[]> {
|
||||
let response;
|
||||
try {
|
||||
|
||||
const graphClient: MSGraphClient = await context.msGraphClientFactory.getClient();
|
||||
var body: string = `{"@odata.id": "https://graph.microsoft.com/v1.0/directoryObjects/${userId}"}`;
|
||||
response = await graphClient
|
||||
.api(`https://graph.microsoft.com/v1.0/groups/${groupId}/members/$ref`)
|
||||
.post(body);
|
||||
}
|
||||
catch (error) {
|
||||
response = error;
|
||||
console.log("MSGraphService.addMember Error: ", error);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param groupId : Group if of the group which current user subscribes
|
||||
* @param userId : Current user id
|
||||
* @param context : A Webpart context needed to get current context
|
||||
*/
|
||||
public static async removeMember(groupId: string,userId: string,context: WebPartContext): Promise<any[]> {
|
||||
let response;
|
||||
try {
|
||||
debugger;
|
||||
const graphClient: MSGraphClient = await context.msGraphClientFactory.getClient();
|
||||
var body: string = `{"@odata.id": "https://graph.microsoft.com/v1.0/directoryObjects/${userId}"}`;
|
||||
response = await graphClient
|
||||
.api(
|
||||
`https://graph.microsoft.com/v1.0/groups/${groupId}/members/${userId}/$ref`
|
||||
)
|
||||
.delete();
|
||||
}
|
||||
catch (error) {
|
||||
response = error;
|
||||
console.log("MSGraphService.removeMember Error: ", error);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
declare interface IMySubscriptionsWebPartStrings {
|
||||
PropertyPaneDescription: string;
|
||||
BasicGroupName: string;
|
||||
DescriptionFieldLabel: string;
|
||||
SubscribeLabel: string;
|
||||
SubscriptionSuccessMsg:string;
|
||||
UnsubscribedSuccessMsg:string;
|
||||
ErrorMessage1:string;
|
||||
PleaseWait:string;
|
||||
}
|
||||
|
||||
export class getLanguage {
|
||||
public static async getUserBrowserLanguage(): Promise<any> {
|
||||
debugger;
|
||||
switch (navigator.language) {
|
||||
case "en":
|
||||
return {
|
||||
SubscribeLabel: "Subscribe",
|
||||
SubscribedLabel: "Subscribed",
|
||||
SubscriptionSuccessMsg:"Thank you, you have subscribed to: ",
|
||||
UnsubscribedSuccessMsg:"Thank you, you have unsubscribed to: ",
|
||||
ErrorMessage1:"Something went wrong when performing the operation.Please close the browser and try again.",
|
||||
PleaseWait:"Please wait, while we load subscriptions for you ..."
|
||||
};
|
||||
break;
|
||||
case "no":
|
||||
return {
|
||||
SubscribeLabel: "Abonner",
|
||||
|
||||
SubscribedLabel: "Abonnerer",
|
||||
SubscriptionSuccessMsg:"Takk, du har abonnert på: ",
|
||||
UnsubscribedSuccessMsg:"Takk, du er fjernet fra abonnementet: ",
|
||||
ErrorMessage1:"Noe gikk galt da du utførte operasjonen. Lukk nettleseren og prøv igjen.",
|
||||
PleaseWait:"Vent, mens vi laster abonnement for deg ..."
|
||||
|
||||
};
|
||||
break;
|
||||
default:
|
||||
return {
|
||||
SubscribeLabel: "Subscribe",
|
||||
SubscribedLabel: "Subscribed",
|
||||
SubscriptionSuccessMsg:"Thank you, you have subscribed to: ",
|
||||
UnsubscribedSuccessMsg:"Thank you, you have unsubscribed to: ",
|
||||
ErrorMessage1:"Something went wrong when performing the operation.Please close the browser and try again.",
|
||||
PleaseWait:"Please wait, while we load subscriptions for you ..."
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 3.0 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"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"
|
||||
],
|
||||
"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