Added sample.json and updated readme

This commit is contained in:
Hugo Bernier 2021-08-26 00:56:48 -04:00
parent dae966b91a
commit a17e0704ed
6 changed files with 305 additions and 18 deletions

View File

@ -0,0 +1,104 @@
{
"bundles": {
"fluent-ui-theme-variant-web-part": {
"dependencies": [
{
"componentId": "f9e737b7-f0df-4597-ba8c-3060f82380db",
"componentName": "@microsoft/sp-property-pane",
"componentVersion": "1.12.1",
"isDirectDependency": true
},
{
"componentId": "1c6c9123-7aac-41f3-a376-3caea41ed83f",
"componentName": "@microsoft/sp-loader",
"componentVersion": "1.12.1",
"isDirectDependency": false
},
{
"componentId": "8217e442-8ed3-41fd-957d-b112e841286a",
"componentName": "@ms/sp-telemetry",
"componentVersion": "0.19.2",
"isDirectDependency": false
},
{
"componentId": "e40f8203-b39d-425a-a957-714852e33b79",
"componentName": "@microsoft/sp-dynamic-data",
"componentVersion": "1.12.1",
"isDirectDependency": false
},
{
"componentId": "73e1dc6c-8441-42cc-ad47-4bd3659f8a3a",
"componentName": "@microsoft/sp-lodash-subset",
"componentVersion": "1.12.1",
"isDirectDependency": false
},
{
"componentId": "7263c7d0-1d6a-45ec-8d85-d4d1d234171b",
"componentName": "@microsoft/sp-core-library",
"componentVersion": "1.12.1",
"isDirectDependency": false
},
{
"componentId": "01c4df03-e775-48cb-aa14-171ee5199a15",
"componentName": "tslib",
"componentVersion": "1.10.0",
"isDirectDependency": false
},
{
"componentId": "2e09fb9b-13bb-48f2-859f-97d6fff71176",
"componentName": "@ms/odsp-core-bundle",
"componentVersion": "1.1.13",
"isDirectDependency": false
},
{
"componentId": "78359e4b-07c2-43c6-8d0b-d060b4d577e8",
"componentName": "@microsoft/sp-diagnostics",
"componentVersion": "1.12.1",
"isDirectDependency": false
},
{
"componentId": "1c4541f7-5c31-41aa-9fa8-fbc9dc14c0a8",
"componentName": "@microsoft/sp-page-context",
"componentVersion": "1.12.1",
"isDirectDependency": false
},
{
"componentId": "229b8d08-79f3-438b-8c21-4613fc877abd",
"componentName": "@microsoft/load-themed-styles",
"componentVersion": "0.1.2",
"isDirectDependency": false
},
{
"componentId": "c07208f0-ea3b-4c1a-9965-ac1b825211a6",
"componentName": "@microsoft/sp-http",
"componentVersion": "1.12.1",
"isDirectDependency": false
},
{
"componentId": "0d910c1c-13b9-4e1c-9aa4-b008c5e42d7d",
"componentName": "react",
"componentVersion": "16.9.0",
"isDirectDependency": false
},
{
"componentId": "aa0a46ec-1505-43cd-a44a-93f3a5aa460a",
"componentName": "react-dom",
"componentVersion": "16.9.0",
"isDirectDependency": false
},
{
"componentId": "467dc675-7cc5-4709-8aac-78e3b71bd2f6",
"componentName": "@microsoft/sp-component-base",
"componentVersion": "1.12.1",
"isDirectDependency": true
},
{
"componentId": "974a7777-0990-4136-8fa6-95d80114c2e0",
"componentName": "@microsoft/sp-webpart-base",
"componentVersion": "1.12.1",
"isDirectDependency": true
}
]
}
}
}

View File

@ -0,0 +1,113 @@
{
"id": "91003ade-424e-44d5-8c1e-af1273519a18",
"alias": "FluentUiThemeVariantWebPart",
"componentType": "WebPart",
"version": "0.0.1",
"manifestVersion": 2,
"requiresCustomScript": false,
"supportedHosts": [
"SharePointWebPart"
],
"supportsThemeVariants": true,
"preconfiguredEntries": [
{
"groupId": "5c03119e-3074-46fd-976b-c60198311f70",
"group": {
"default": "Other"
},
"title": {
"default": "Fluent UI Theme Variant"
},
"description": {
"default": "Example on how to apply Fluent UI theme variant not only at Section level but at Web Part level"
},
"officeFabricIconFontName": "BackgroundColor",
"properties": {}
}
],
"loaderConfig": {
"internalModuleBaseUrls": [
"<!-- PATH TO CDN -->"
],
"entryModuleId": "fluent-ui-theme-variant-web-part",
"scriptResources": {
"fluent-ui-theme-variant-web-part": {
"type": "path",
"path": "fluent-ui-theme-variant-web-part.js"
},
"FluentUiThemeVariantWebPartStrings": {
"type": "path",
"path": "FluentUiThemeVariantWebPartStrings_en-us.js"
},
"@microsoft/sp-property-pane": {
"type": "component",
"id": "f9e737b7-f0df-4597-ba8c-3060f82380db",
"version": "1.12.1"
},
"@microsoft/sp-component-base": {
"type": "component",
"id": "467dc675-7cc5-4709-8aac-78e3b71bd2f6",
"version": "1.12.1"
},
"@microsoft/sp-lodash-subset": {
"type": "component",
"id": "73e1dc6c-8441-42cc-ad47-4bd3659f8a3a",
"version": "1.12.1"
},
"@microsoft/sp-core-library": {
"type": "component",
"id": "7263c7d0-1d6a-45ec-8d85-d4d1d234171b",
"version": "1.12.1"
},
"@microsoft/sp-webpart-base": {
"type": "component",
"id": "974a7777-0990-4136-8fa6-95d80114c2e0",
"version": "1.12.1"
},
"react": {
"type": "component",
"id": "0d910c1c-13b9-4e1c-9aa4-b008c5e42d7d",
"version": "16.9.0"
},
"react-dom": {
"type": "component",
"id": "aa0a46ec-1505-43cd-a44a-93f3a5aa460a",
"version": "16.9.0"
},
"PropertyControlStrings": {
"type": "localizedPath",
"paths": {
"bg-BG": "PropertyControlStrings_bg-bg.js",
"ca-ES": "PropertyControlStrings_ca-es.js",
"da-DK": "PropertyControlStrings_da-dk.js",
"de-DE": "PropertyControlStrings_de-de.js",
"el-GR": "PropertyControlStrings_el-gr.js",
"en-US": "PropertyControlStrings_en-us.js",
"es-ES": "PropertyControlStrings_es-es.js",
"et-EE": "PropertyControlStrings_et-ee.js",
"fi-FI": "PropertyControlStrings_fi-fi.js",
"fr-FR": "PropertyControlStrings_fr-fr.js",
"it-IT": "PropertyControlStrings_it-it.js",
"ja-JP": "PropertyControlStrings_ja-jp.js",
"lt-LT": "PropertyControlStrings_lt-lt.js",
"lv-LV": "PropertyControlStrings_lv-lv.js",
"nb-NO": "PropertyControlStrings_nb-no.js",
"nl-NL": "PropertyControlStrings_nl-nl.js",
"no": "PropertyControlStrings_no.js",
"pl-PL": "PropertyControlStrings_pl-pl.js",
"pt-PT": "PropertyControlStrings_pt-pt.js",
"ro-RO": "PropertyControlStrings_ro-ro.js",
"ru-RU": "PropertyControlStrings_ru-ru.js",
"sk-SK": "PropertyControlStrings_sk-sk.js",
"sr-Latn-RS": "PropertyControlStrings_sr-latn-rs.js",
"sv-SE": "PropertyControlStrings_sv-se.js",
"tr-TR": "PropertyControlStrings_tr-tr.js",
"vi-VN": "PropertyControlStrings_vi-vn.js",
"zh-CN": "PropertyControlStrings_zh-cn.js",
"zh-TW": "PropertyControlStrings_zh-tw.js"
},
"defaultPath": "PropertyControlStrings_en-us.js"
}
}
}
}

View File

@ -1,27 +1,31 @@
# react-myonedrive
# My OneDrive
## Summary
This is a sample web part that displays currently logged in user's one drive's file,
This web part can be useful on the Intranet home page which can be added as My One Drive files for quick reference of user's one drive files.
This is a sample web part that displays currently logged in user's OneDrive's file,
This web part can be useful on the Intranet home page which can be added as My OneDrive files for quick reference of user's OneDrive files.
![WebPart in Action](./assets/MyOneDriveInAction.gif)
## Features
* Show Current logged in user's One Drive Files
* Show current user's OneDrive Files
* Browseable folder and files
* Support to display icons for most known file types.
* Breadcrum as in One Drive App to quickly navigate
* Breadcrum as in OneDrive App to quickly navigate
* Sorting based on Name and Modified Date column
* Options to choose fields to be displayed from Name, Modified, Modified By, File Size,Sharing
* Option to make Webpart title link clickalbe to send to One Drive URL
* Option to make web part title link clickalbe to send to OneDrive URL
## Compatibility
## Used SharePoint Framework Version
![version](https://img.shields.io/badge/version-1.12.1-green.svg)
![SPFx 1.12.1](https://img.shields.io/badge/SPFx-1.12.1-green.svg)
![Node.js LTS v14 | LTS v12 | LTS v10](https://img.shields.io/badge/Node.js-LTS%20v14%20%7C%20LTS%20v12%20%7C%20LTS%20v10-green.svg)
![SharePoint Online](https://img.shields.io/badge/SharePoint-Online-yellow.svg)
![Teams N/A: Untested with Microsoft Teams](https://img.shields.io/badge/Teams-N%2FA-lightgrey.svg "Untested with 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
@ -53,7 +57,7 @@ This web part can be useful on the Intranet home page which can be added as My O
Solution|Author(s)
--------|---------
react-myonedrive | Siddharth Vaghasia(@siddh_me)
react-myonedrive | [Siddharth Vaghasia](https://github.com/siddharth-vaghasia) ([@siddh_me](https://twitter.com/siddh_me))
## Version history
@ -85,4 +89,18 @@ Version|Date|Comments
- [Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp) - Guidance, tooling, samples and open-source controls for your Microsoft 365 development
- [Drive Graph END Point](https://docs.microsoft.com/en-us/graph/api/resources/driveitem?view=graph-rest-1.0)
## 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.**
## Help
We do not support samples, but we this community is always willing to help, and we want to improve these samples. We use GitHub to track issues, which makes it easy for community members to volunteer their time and help resolve issues.
If you encounter any issues while using this sample, [create a new issue](https://github.com/pnp/sp-dev-fx-webparts/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Abug-suspected&template=bug-report.yml&sample=react-myonedrive&authors=@YOURGITHUBUSERNAME&title=react-myonedrive%20-%20).
For questions regarding this sample, [create a new question](https://github.com/pnp/sp-dev-fx-webparts/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Abug-suspected&template=question.yml&sample=react-myonedrive&authors=@YOURGITHUBUSERNAME&title=react-myonedrive%20-%20).
Finally, if you have an idea for improvement, [make a suggestion](https://github.com/pnp/sp-dev-fx-webparts/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Abug-suspected&template=suggestion.yml&sample=react-myonedrive&authors=@YOURGITHUBUSERNAME&title=react-myonedrive%20-%20).
<img src="https://telemetry.sharepointpnp.com/sp-dev-fx-webparts/samples/react-myonedrive" />

View File

@ -0,0 +1,52 @@
[
{
"name": "pnp-sp-dev-spfx-web-parts-react-myonedrive",
"source": "pnp",
"title": "My OneDrive",
"shortDescription": "Displays currently logged in user's OneDrive's file",
"url": "https://github.com/pnp/sp-dev-fx-webparts/tree/main/samples/react-myonedrive",
"longDescription": [
"This is a sample web part that displays currently logged in user's OneDrive's file",
"This web part can be useful on the Intranet home page which can be added as My OneDrive files for quick reference of user's OneDrive files."
],
"creationDateTime": "2021-08-12",
"updateDateTime": "2021-08-12",
"products": [
"SharePoint",
"Office"
],
"metadata": [
{
"key": "CLIENT-SIDE-DEV",
"value": "React"
},
{
"key": "SPFX-VERSION",
"value": "1.12.1"
}
],
"thumbnails": [
{
"type": "image",
"order": 100,
"url": "https://github.com/pnp/sp-dev-fx-webparts/raw/main/samples/react-myonedrive/assets/MyOneDriveInAction.gif",
"alt": "react-myonedrive"
}
],
"authors": [
{
"gitHubAccount": "siddharth-vaghasia",
"company": "",
"pictureUrl": "https://github.com/siddharth-vaghasia.png",
"name": "Siddharth Vaghasia"
}
],
"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"
}
]
}
]

View File

@ -56,7 +56,7 @@ const columns: OneDriveTableColumn[] = [
function getIcon(fileName) {
var extension = fileName.substring(fileName.lastIndexOf('.'))
var extension = fileName.substring(fileName.lastIndexOf('.'));
if (!extension.includes('.'))
return <div className={styles.folderIcon}></div>;
if (extension == ".docx")
@ -158,7 +158,7 @@ export function OneDriveTableBody(props: { rows: any[], selectedFields: any[], o
}
function sortData(data: any[], orderBy: string, order: 'asc' | 'desc') {
const orderMultiplier = order === 'asc' ? 1 : -1
const orderMultiplier = order === 'asc' ? 1 : -1;
return data.sort((v1, v2) => ((v1[orderBy] > v2[orderBy]) ? 1 : -1) * orderMultiplier);
}
@ -172,7 +172,7 @@ export default function OneDriveTable(props: { data: any[], defaultSortKey?: str
let folders = [], files = [];
rows.forEach(r => {
r.folder ? folders.push(r) : files.push(r);
})
});
rows = [...folders, ...files];
@ -205,7 +205,7 @@ export default function OneDriveTable(props: { data: any[], defaultSortKey?: str
return <><ChevronRight color="disabled" />
<Link className={styles.breadcrumbLink}
onClick={() => breadcrumbClick(index)}>{folder}</Link>
</>
</>;
})
}
</div>
@ -225,5 +225,5 @@ export default function OneDriveTable(props: { data: any[], defaultSortKey?: str
</React.Fragment>
}
</React.Fragment>
)
}
);
}

View File

@ -28,7 +28,7 @@ export default class Myonedrivefiles extends React.Component<IMyonedrivefilesPro
}
public async componentDidMount() {
this.getDriveRootUrl()
this.getDriveRootUrl();
this.getmyDriveFiles();
}
@ -131,6 +131,6 @@ export default class Myonedrivefiles extends React.Component<IMyonedrivefilesPro
messageBarType={MessageBarType.warning}>
{strings.NoFieldsLabel}</MessageBar>
}
</>)
</>);
}
}