Updated sample.json and fixed linting issues

This commit is contained in:
Hugo Bernier 2023-03-11 15:12:16 -05:00
parent 5dbd5bcdfa
commit a7f9d8183d
5 changed files with 81 additions and 84 deletions

View File

@ -1,19 +1,20 @@
# All Microsoft 365 Groups and Teams with SPFx # All Microsoft 365 Groups and Teams with SPFx
## Summary ## Summary
Web part pulls all Microsoft 365 Groups and Teams that the logged in user has access to view. Web part pulls all Microsoft 365 Groups and Teams that the logged in user has access to view.
- Toggle- View groups signed in user is a member of or all groups - Toggle- View groups signed in user is a member of or all groups
- Group Name (hover for group description) - Group Name (hover for group description)
- Link to Group email - Link to Group email
- Link to SharePoint site - Link to SharePoint site
- Link to calendar - Link to calendar
- Link to Planner plan (if available) - Link to Planner plan (if available)
- Group privacy filter (Private/Public/All) - Group privacy filter (Private/Public/All)
- Microsoft Teams team link for the Group - Microsoft Teams team link for the Group
- Pagination (breaks results into pages and displays page numbers) - Pagination (breaks results into pages and displays page numbers)
- Style toggle (Card/Table) - Style toggle (Card/Table)
- Group display selection - Group display selection
1. Select 5, 10, or 15 groups to display per page for the Table display style 1. Select 5, 10, or 15 groups to display per page for the Table display style
2. Select 6, 9, and 12 groups to display per page for the Card display style 2. Select 6, 9, and 12 groups to display per page for the Card display style
@ -34,14 +35,12 @@ Web part pulls all Microsoft 365 Groups and Teams that the logged in user has ac
## Applies to ## Applies to
* [SharePoint Framework Developer Preview](https://docs.microsoft.com/sharepoint/dev/spfx/sharepoint-framework-overview) - [SharePoint Framework Developer Preview](https://docs.microsoft.com/sharepoint/dev/spfx/sharepoint-framework-overview)
* [SharePoint Framework](https://docs.microsoft.com/sharepoint/dev/spfx/sharepoint-framework-overview) - [SharePoint Framework](https://docs.microsoft.com/sharepoint/dev/spfx/sharepoint-framework-overview)
## Solution ## Contributors
Solution|Author(s) * [Alison Collins](https://github.com/ReactIntern) ([Blog](https://graphgod.dev), [LinkedIn](https://www.linkedin.com/in/alison-collins-53192b219/))
--------|---------
React-Groups-Teams | [Alison Collins](https://github.com/ReactIntern) ([Blog](https://graphgod.dev), [LinkedIn](https://www.linkedin.com/in/alison-collins-53192b219/)) |
## Version history ## Version history
@ -82,7 +81,7 @@ React-Groups-Teams | [Alison Collins](https://github.com/ReactIntern) ([Blog](ht
- Open hosted workbench, i.e. `https://<tenant>.sharepoint.com/sites/<your site>/_layouts/15/workbench.aspx` - Open hosted workbench, i.e. `https://<tenant>.sharepoint.com/sites/<your site>/_layouts/15/workbench.aspx`
- Search and add `O365 Groups Manager` web part to see it in action - Search and add `O365 Groups Manager` web part to see it in action
> This sample can also be opened with [VS Code Remote Development](https://code.visualstudio.com/docs/remote/remote-overview). Visit https://aka.ms/spfx-devcontainer for further instructions. > This sample can also be opened with [VS Code Remote Development](https://code.visualstudio.com/docs/remote/remote-overview). Visit <https://aka.ms/spfx-devcontainer> for further instructions.
## Features ## Features
@ -116,10 +115,8 @@ For questions regarding this sample, [create a new question](https://github.com/
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%3Aenhancement%2Csample%3A%20react-groups-teams&template=question.yml&sample=react-groups-teams&authors=@ReactIntern&title=react-groups-teams%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%3Aenhancement%2Csample%3A%20react-groups-teams&template=question.yml&sample=react-groups-teams&authors=@ReactIntern&title=react-groups-teams%20-%20).
## Disclaimer ## 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.** **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.**
<img src="https://pnptelemetry.azurewebsites.net/sp-dev-fx-webparts/samples/react-groups-teams" /> <img src="https://pnptelemetry.azurewebsites.net/sp-dev-fx-webparts/samples/react-groups-teams" />

View File

@ -9,7 +9,7 @@
"Web part pulls all Microsoft 365 Groups and Teams that the logged in user has access to view." "Web part pulls all Microsoft 365 Groups and Teams that the logged in user has access to view."
], ],
"creationDateTime": "2021-05-06", "creationDateTime": "2021-05-06",
"updateDateTime": "2021-10-08", "updateDateTime": "2023-02-26",
"products": [ "products": [
"SharePoint" "SharePoint"
], ],

View File

@ -68,10 +68,10 @@ export default class MicrosoftGroups extends React.Component<IGraphConsumerProps
SwitchedValue = this.props.Allgroups.filter(item => item.Visibility === Switch); SwitchedValue = this.props.Allgroups.filter(item => item.Visibility === Switch);
} }
this.setState({ GroupResultsFiltered: SwitchedValue}); this.setState({ GroupResultsFiltered: SwitchedValue});
}; }
var nextVariable; var nextVariable;
if(this.state.GroupDisplay != undefined) { if(this.state.GroupDisplay != undefined) {
if(!(this.props.GroupDisplay === undefined)) {nextVariable = this.props.GroupDisplay} else {nextVariable = 5;} if(!(this.props.GroupDisplay === undefined)) {nextVariable = this.props.GroupDisplay;} else {nextVariable = 5;}
this.setState({ mode: Switch, Next:nextVariable, Min: 0}); this.setState({ mode: Switch, Next:nextVariable, Min: 0});
} }
else { else {
@ -81,10 +81,10 @@ export default class MicrosoftGroups extends React.Component<IGraphConsumerProps
public componentDidMount() { public componentDidMount() {
if (!(this.props.GroupDisplay === undefined || this.props.GroupDisplay ===null)){ if (!(this.props.GroupDisplay === undefined || this.props.GroupDisplay ===null)){
this.SwitchGroupList2(this.state.mode, this.state.title); this.SwitchGroupList2(this.state.mode, this.state.title);
this.setState({GroupDisplay: this.props.GroupDisplay, Min:0, Next: this.props.GroupDisplay}) } this.setState({GroupDisplay: this.props.GroupDisplay, Min:0, Next: this.props.GroupDisplay}); }
else { else {
this.SwitchGroupList2(this.state.mode, this.state.title); this.SwitchGroupList2(this.state.mode, this.state.title);
this.setState({GroupDisplay: 5, Min: 0, Next: 5}) this.setState({GroupDisplay: 5, Min: 0, Next: 5});
} }
} }
@ -124,7 +124,7 @@ That means if I were to go to the last page, my Next would be 15 and this statem
} }
else { else {
// for when it's not the last page we're going back from // for when it's not the last page we're going back from
max = this.state.Next - this.state.GroupDisplay max = this.state.Next - this.state.GroupDisplay;
min = max - this.state.GroupDisplay; min = max - this.state.GroupDisplay;
} }
GroupsFiltered.map(Group => { GroupsFiltered.map(Group => {
@ -203,7 +203,7 @@ public render(): React.ReactElement<IGraphConsumerProps> {
<Icon className={iconClass} style={{ color: '#424AB5', margin:'2px', marginTop:'10px' }} iconName="TeamsLogo"></Icon> <Icon className={iconClass} style={{ color: '#424AB5', margin:'2px', marginTop:'10px' }} iconName="TeamsLogo"></Icon>
</a>}</> </a>}</>
</div></DocumentCardDetails> </div></DocumentCardDetails>
</DocumentCard> </DocumentCard>;
}})} }})}
</div> </div>

View File

@ -66,10 +66,10 @@ export default class MicrosoftGroups extends React.Component<IGraphConsumerProps
SwitchedValue = this.props.Allgroups.filter(item => item.Visibility === Switch); SwitchedValue = this.props.Allgroups.filter(item => item.Visibility === Switch);
} }
this.setState({ GroupResultsFiltered: SwitchedValue}); this.setState({ GroupResultsFiltered: SwitchedValue});
}; }
var nextVariable; var nextVariable;
if(this.state.GroupDisplay != undefined) { if(this.state.GroupDisplay != undefined) {
if(!(this.props.GroupDisplay === undefined)) {nextVariable = this.props.GroupDisplay} else {nextVariable = 5;} if(!(this.props.GroupDisplay === undefined)) {nextVariable = this.props.GroupDisplay;} else {nextVariable = 5;}
this.setState({ mode: Switch, Next:nextVariable, Min: 0}); this.setState({ mode: Switch, Next:nextVariable, Min: 0});
} }
else { else {
@ -79,10 +79,10 @@ export default class MicrosoftGroups extends React.Component<IGraphConsumerProps
public componentDidMount() { public componentDidMount() {
if (!(this.props.GroupDisplay === undefined || this.props.GroupDisplay ===null)){ if (!(this.props.GroupDisplay === undefined || this.props.GroupDisplay ===null)){
this.SwitchGroupList2(this.state.mode, this.state.title); this.SwitchGroupList2(this.state.mode, this.state.title);
this.setState({GroupDisplay: this.props.GroupDisplay, Min:0, Next: this.props.GroupDisplay}) } this.setState({GroupDisplay: this.props.GroupDisplay, Min:0, Next: this.props.GroupDisplay}); }
else { else {
this.SwitchGroupList2(this.state.mode, this.state.title); this.SwitchGroupList2(this.state.mode, this.state.title);
this.setState({GroupDisplay: 5, Min: 0, Next: 5}) this.setState({GroupDisplay: 5, Min: 0, Next: 5});
} }
} }
@ -122,7 +122,7 @@ That means if I were to go to the last page, my Next would be 15 and this statem
} }
else { else {
// for when it's not the last page we're going back from // for when it's not the last page we're going back from
max = this.state.Next - this.state.GroupDisplay max = this.state.Next - this.state.GroupDisplay;
min = max - this.state.GroupDisplay; min = max - this.state.GroupDisplay;
} }
GroupsFiltered.map(Group => { GroupsFiltered.map(Group => {
@ -202,7 +202,7 @@ public render(): React.ReactElement<IGraphConsumerProps> {debugger;
<Icon className={iconClass} style={{ color: '#424AB5' }} iconName="TeamsLogo"></Icon> <Icon className={iconClass} style={{ color: '#424AB5' }} iconName="TeamsLogo"></Icon>
</a>}</div> </a>}</div>
<div className={styles.Center} style={{ borderRight: 'none' }}>{Group.Visibility}</div> <div className={styles.Center} style={{ borderRight: 'none' }}>{Group.Visibility}</div>
</div>}})} </div>;}})}
</div> </div>
{this.state.GroupResultsFiltered.length === 0 ? <div>There are no items with the selected filters</div>:<></>} {this.state.GroupResultsFiltered.length === 0 ? <div>There are no items with the selected filters</div>:<></>}
<div className={styles.tableStyle}> <div className={styles.tableStyle}>

View File

@ -190,7 +190,7 @@ public componentDidUpdate(prevProps: Readonly<IMicrosoftGroupsProps>): void {
this.setState({GroupDisplayCard: this.props.GroupDisplayCard}); this.setState({GroupDisplayCard: this.props.GroupDisplayCard});
} }
if (prevProps.StyleToggle !== this.props.StyleToggle && this.props.StyleToggle!== undefined){ if (prevProps.StyleToggle !== this.props.StyleToggle && this.props.StyleToggle!== undefined){
this.setState({StyleToggle: this.props.StyleToggle}) this.setState({StyleToggle: this.props.StyleToggle});
} }
} }
@ -209,6 +209,6 @@ return <div>
Mygroups={this.state.MyGroupResults} Mygroups={this.state.MyGroupResults}
Allgroups={this.state.AllGroupsresults}/> Allgroups={this.state.AllGroupsresults}/>
} }
</div> </div>;
} }
} }