Upgrades Lead Assist Dashboard to SPFx v1.16.0-rc.0 (#3150)

This commit is contained in:
Waldek Mastykarz 2022-11-15 16:04:25 +01:00 committed by GitHub
parent 9196b2c604
commit 4523a4969c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 51096 additions and 10276 deletions

View File

@ -0,0 +1,5 @@
require('@rushstack/eslint-config/patch/modern-module-resolution');
module.exports = {
extends: ['@microsoft/eslint-config-spfx/lib/profiles/react'],
parserOptions: { tsconfigRootDir: __dirname }
};

View File

@ -31,3 +31,5 @@ obj
# Styles Generated Code
*.scss.ts
.heft

View File

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

View File

@ -1,12 +1,17 @@
{
"@microsoft/generator-sharepoint": {
"version": "1.12.1",
"version": "1.16.0-rc.0",
"libraryName": "lead-assist",
"libraryId": "c311a0fc-3dcb-4316-a798-fd7d8a6d5344",
"environment": "spo",
"nodeVersion": "16.17.0",
"packageManager": "npm",
"isCreatingSolution": false,
"isDomainIsolated": false,
"componentType": "webpart"
"componentType": "webpart",
"sdkVersions": {
"@microsoft/microsoft-graph-client": "3.0.2",
"@microsoft/teams-js": "2.4.1"
}
}
}

View File

@ -1,4 +1,4 @@
http://aka.ms/m365devprogramhttp://aka.ms/m365devprogramhttp://aka.ms/m365devprogramhttp://aka.ms/m365devprogram# Lead Assist Dashboard
# Lead Assist Dashboard
## Summary
@ -9,12 +9,12 @@ This sample shows how to integrate SharePoint Framework, PnP React Controls, and
## Compatibility
![SPFx 1.12.1](https://img.shields.io/badge/SPFx-1.12.1-green.svg)
![SPFx 1.16.0-rc.0](https://img.shields.io/badge/SPFx-1.16.0--rc.0-green.svg)
![Node.js v14 | v12 | v10](https://img.shields.io/badge/Node.js-v14%20%7C%20v12%20%7C%20v10-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)
![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 Compatible](https://img.shields.io/badge/Local%20Workbench-Compatible-green.svg)
![Local Workbench Incompatible](https://img.shields.io/badge/Local%20Workbench-Incompatible-red.svg)
![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)
@ -22,7 +22,7 @@ This sample shows how to integrate SharePoint Framework, PnP React Controls, and
- [SharePoint Framework](https://aka.ms/spfx)
- [Microsoft 365 tenant](https://learn.microsoft.com/sharepoint/dev/spfx/set-up-your-developer-tenant)
- [Microsoft Teams](https://www.microsoft.com/en-ww/microsoft-teams)
- [Microsoft Teams](https://www.microsoft.com/microsoft-teams)
> Get your own free development tenant by subscribing to [Microsoft 365 developer program](http://aka.ms/o365devprogram)
@ -36,6 +36,7 @@ Lead Assist Dashboard | [PnP](https://pnp.github.io/)
Version|Date|Comments
-------|----|--------
1.0.1|November 15, 2022|Upgraded to SPFx v1.16.0-rc.0
1.0.0|October 5, 2021|Initial release
## Minimal Path to Awesome
@ -83,8 +84,7 @@ This web part illustrates the following concepts:
- [Building for Microsoft Teams](https://learn.microsoft.com/sharepoint/dev/spfx/build-for-teams-overview)
- [Use Microsoft Graph in your solution](https://learn.microsoft.com/sharepoint/dev/spfx/web-parts/get-started/using-microsoft-graph-apis)
- [Publish SharePoint Framework applications to the Marketplace](https://learn.microsoft.com/sharepoint/dev/spfx/publish-to-marketplace-overview)
- [The easiest way to store user settings of your Microsoft 365 app
](https://blog.mastykarz.nl/easiest-store-user-settings-microsoft-365-app/ )
- [The easiest way to store user settings of your Microsoft 365 app](https://blog.mastykarz.nl/easiest-store-user-settings-microsoft-365-app/ )
- [Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp)
## Disclaimer

View File

@ -1,4 +0,0 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/copy-assets.schema.json",
"deployCdnPath": "./release/assets/"
}

View File

@ -3,7 +3,7 @@
"solution": {
"name": "lead-assist-client-side-solution",
"id": "c311a0fc-3dcb-4316-a798-fd7d8a6d5344",
"version": "1.0.13.0",
"version": "1.0.14.0",
"includeClientSideAssets": true,
"skipFeatureDeployment": true,
"isDomainIsolated": false,
@ -18,7 +18,7 @@
},
{
"resource": "Microsoft Graph",
"scope": "Files.ReadWrite.AppFolder"
"scope": "Files.ReadWrite.All"
}
],
"developer": {
@ -27,6 +27,17 @@
"privacyUrl": "https://pnp.github.io/",
"termsOfUseUrl": "https://pnp.github.io/",
"mpnId": ""
},
"metadata": {
"shortDescription": {
"default": "lead-assist description"
},
"longDescription": {
"default": "lead-assist description"
},
"screenshotPaths": [],
"videoUrl": "",
"categories": []
}
},
"paths": {

View File

@ -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://enter-your-SharePoint-site/_layouts/workbench.aspx"
}

File diff suppressed because it is too large Load Diff

View File

@ -3,6 +3,9 @@
"version": "1.0.13",
"private": true,
"main": "lib/index.js",
"engines": {
"node": ">=16.13.0 <17.0.0"
},
"scripts": {
"build": "gulp bundle",
"clean": "gulp clean",
@ -12,29 +15,32 @@
"dependencies": {
"@microsoft/mgt-react": "^2.2.0",
"@microsoft/mgt-spfx": "^2.2.0",
"@microsoft/sp-core-library": "1.12.1",
"@microsoft/sp-lodash-subset": "1.12.1",
"@microsoft/sp-office-ui-fabric-core": "1.12.1",
"@microsoft/sp-property-pane": "1.12.1",
"@microsoft/sp-webpart-base": "1.12.1",
"@microsoft/sp-core-library": "1.16.0-rc.0",
"@microsoft/sp-lodash-subset": "1.16.0-rc.0",
"@microsoft/sp-office-ui-fabric-core": "1.16.0-rc.0",
"@microsoft/sp-property-pane": "1.16.0-rc.0",
"@microsoft/sp-webpart-base": "1.16.0-rc.0",
"@pnp/sp": "^2.7.0",
"@pnp/spfx-controls-react": "3.1.0",
"office-ui-fabric-react": "7.156.0",
"react": "16.9.0",
"react-dom": "16.9.0"
"@pnp/spfx-controls-react": "3.11.0",
"@pnp/spfx-property-controls": "3.10.0",
"office-ui-fabric-react": "7.199.1",
"react": "17.0.1",
"react-dom": "17.0.1",
"tslib": "2.3.1"
},
"devDependencies": {
"@microsoft/rush-stack-compiler-3.7": "0.2.3",
"@microsoft/sp-build-web": "1.12.1",
"@microsoft/sp-module-interfaces": "1.12.1",
"@microsoft/sp-tslint-rules": "1.12.1",
"@microsoft/sp-webpart-workbench": "1.12.1",
"@pnp/spfx-property-controls": "^3.2.0",
"@types/react": "16.9.36",
"@types/react-dom": "16.9.8",
"@microsoft/eslint-plugin-spfx": "1.16.0-rc.0",
"@microsoft/eslint-config-spfx": "1.16.0-rc.0",
"@microsoft/rush-stack-compiler-4.5": "0.2.2",
"@microsoft/sp-build-web": "1.16.0-rc.0",
"@microsoft/sp-module-interfaces": "1.16.0-rc.0",
"@rushstack/eslint-config": "2.5.1",
"@types/react": "17.0.45",
"@types/react-dom": "17.0.17",
"@types/webpack-env": "1.13.1",
"ajv": "~5.2.2",
"gulp": "~4.0.2",
"sp-pnp-js": "^3.0.10"
"eslint": "8.7.0",
"eslint-plugin-react-hooks": "4.3.0",
"gulp": "~4.0.2"
}
}

View File

@ -1,4 +1,4 @@
import { HttpClient, MSGraphClient } from "@microsoft/sp-http";
import { HttpClient, MSGraphClientV3 } from "@microsoft/sp-http";
export default class SettingsService {
/**
@ -8,7 +8,7 @@ export default class SettingsService {
* @param settingsFilename Name of the file to read the settings from
* @returns Object representing the JSON settings file
*/
public static async getSettings(graphClient: MSGraphClient, httpClient: HttpClient, settingsFilename: string): Promise<any> {
public static async getSettings(graphClient: MSGraphClientV3, httpClient: HttpClient, settingsFilename: string): Promise<any> {
// Get approot files
const approotFiles = await graphClient
.api(`/me/drive/special/approot/children?$filter=name%20eq%20'${settingsFilename}'`)
@ -36,7 +36,7 @@ export default class SettingsService {
* @param settings Object representing the settings to be saved on the JSON settings file
* @param settingsFilename Name of the file to store the settings on
*/
public static async saveSettings(graphClient: MSGraphClient, settings: any, settingsFilename: string) {
public static async saveSettings(graphClient: MSGraphClientV3, settings: any, settingsFilename: string) {
// Save the settings in the application dedicated folder
await graphClient
.api(`/me/drive/special/approot:/${settingsFilename}:/content`)

View File

@ -14,16 +14,17 @@ import { ILeadAssistDashboardProps } from './components/ILeadAssistDashboardProp
import { Providers, SharePointProvider } from '@microsoft/mgt-spfx';
import { sp } from "@pnp/sp/presets/all";
import DataService from '../../services/DataService';
import { MSGraphClient } from "@microsoft/sp-http";
import { MSGraphClientV3 } from "@microsoft/sp-http";
import SettingsService from '../../services/SettingsService';
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface ILeadAssistDashboardWebPartProps {
}
export default class LeadAssistDashboardWebPart extends BaseClientSideWebPart<ILeadAssistDashboardWebPartProps> {
private isTeamsContext: boolean;
private siteUrl: string;
private graphClient: MSGraphClient;
private graphClient: MSGraphClientV3;
protected async onInit() {
// Determine if we are in the Teams context
@ -36,7 +37,7 @@ export default class LeadAssistDashboardWebPart extends BaseClientSideWebPart<IL
}
// Create the Microsoft Graph client
this.graphClient = await this.context.msGraphClientFactory.getClient();
this.graphClient = await this.context.msGraphClientFactory.getClient('3');
// Get the settings
const settings = await SettingsService.getSettings(this.graphClient, this.context.httpClient, 'lead_dashboard_settings.json');
@ -57,7 +58,7 @@ export default class LeadAssistDashboardWebPart extends BaseClientSideWebPart<IL
if (this.siteUrl && this.siteUrl.length > 0) {
// Setup the SharePoint client
sp.setup({
spfxContext: this.context,
spfxContext: this.context as any,
sp: {
baseUrl: this.siteUrl
}

View File

@ -1,6 +1,6 @@
import { MSGraphClient } from "@microsoft/sp-http";
import { MSGraphClientV3 } from "@microsoft/sp-http";
export interface ILeadAssistDashboardProps {
isTeamsContext: boolean;
siteUrl: string;
graphClient: MSGraphClient;
graphClient: MSGraphClientV3;
}

View File

@ -1,4 +1,4 @@
@import '~office-ui-fabric-react/dist/sass/References.scss';
@import '~@fluentui/react/dist/sass/References.scss';
@import '../../../common/colors.module.scss';
@import '../../../common/Global.dark.module.scss';
@import '../../../common/Global.default.module.scss';

View File

@ -410,8 +410,8 @@ export default class LeadAssistDashboard extends React.Component<ILeadAssistDash
name: "buttonColumn",
displayName: " ",
minWidth: 50,
render: (item?: any, index?: number, column?: IColumn) => {
var content = <div></div>;
render: (item?: any, index?: number, column?: any) => {
let content = <div></div>;
// If the element exists
if (item) {
// Create an clickable icon to open the SharePoint list item
@ -420,7 +420,7 @@ export default class LeadAssistDashboard extends React.Component<ILeadAssistDash
onClick={() => {
const addSlash = this.props.siteUrl.endsWith("/") == false;
var tempLink = document.createElement('a');
const tempLink = document.createElement('a');
tempLink.href = this.props.siteUrl + ((addSlash == true) ? "/" : "") + "Lists/" + DataService.RecentlyDoneSalesContractsListName + "/DispForm.aspx?ID=" + item.id;
tempLink.target = "_blank";
tempLink.click();
@ -544,8 +544,8 @@ export default class LeadAssistDashboard extends React.Component<ILeadAssistDash
return 0;
}
var valueA = a[columnName];
var valueB = b[columnName];
let valueA = a[columnName];
let valueB = b[columnName];
// If it's a complex property
if (properties && properties.length > 0) {
@ -553,8 +553,8 @@ export default class LeadAssistDashboard extends React.Component<ILeadAssistDash
valueB = b[properties[0]][properties[1]];
}
var dateValueB = new Date(valueB.toString());
var dateValueA = new Date(valueA.toString());
const dateValueB = new Date(valueB.toString());
const dateValueA = new Date(valueA.toString());
// Check if the value is a date
if ((Object.prototype.toString.call(dateValueA) === "[object Date]" && !isNaN(dateValueA.getTime()))

View File

@ -12,6 +12,7 @@ import LeadAssistDashboardSettings from './components/LeadAssistDashboardSetting
import { ILeadAssistDashboardSettingsProps } from './components/ILeadAssistDashboardSettingsProps';
import SettingsService from '../../services/SettingsService';
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface ILeadAssistDashboardSettingsWebPartProps {
}
@ -25,7 +26,7 @@ export default class LeadAssistDashboardSettingsWebPart extends BaseClientSideWe
this.context.sdks.microsoftTeams.teamsJs.registerOnThemeChangeHandler(this.applyTheme);
}
const graphClient = await this.context.msGraphClientFactory.getClient();
const graphClient = await this.context.msGraphClientFactory.getClient('3');
// Get the settings
const settings = await SettingsService.getSettings(graphClient, this.context.httpClient, 'lead_dashboard_settings.json');
@ -40,7 +41,7 @@ export default class LeadAssistDashboardSettingsWebPart extends BaseClientSideWe
if (this.siteUrl && this.siteUrl.length > 0) {
// Setup the SharePoint client
sp.setup({
spfxContext: this.context,
spfxContext: this.context as any,
sp: {
baseUrl: this.siteUrl
}

View File

@ -1,4 +1,4 @@
@import '~office-ui-fabric-react/dist/sass/References.scss';
@import '~@fluentui/react/dist/sass/References.scss';
.leadAssistDashboardSettings {
.container {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -1,7 +1,7 @@
{
"$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.9/MicrosoftTeams.schema.json",
"manifestVersion": "1.9",
"version": "1.0.0",
"$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.14/MicrosoftTeams.schema.json",
"manifestVersion": "1.14",
"version": "1.0.1",
"showLoadingIndicator": false,
"id": "1c198bf5-aae4-497a-ac0f-74b78a77b0aa",
"packageName": "com.pnp.leadassistdashboard",
@ -20,8 +20,8 @@
"full": "PnP Lead Assist Dashboard"
},
"description": {
"short": "Example short description",
"full": "Exampe full description"
"short": "Lead Assist Dashboard",
"full": "Shows dashboard for helping the sales team"
},
"accentColor": "#FFFFFF",
"staticTabs": [

Binary file not shown.

Before

Width:  |  Height:  |  Size: 383 B

After

Width:  |  Height:  |  Size: 452 B

View File

@ -1,5 +1,5 @@
{
"extends": "./node_modules/@microsoft/rush-stack-compiler-3.7/includes/tsconfig-web.json",
"extends": "./node_modules/@microsoft/rush-stack-compiler-4.5/includes/tsconfig-web.json",
"compilerOptions": {
"target": "es5",
"forceConsistentCasingInFileNames": true,

View File

@ -1,30 +0,0 @@
{
"extends": "./node_modules/@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
}
}