fix sorting tabs, added webApiPermissionRequests

This commit is contained in:
fredupstair 2019-10-30 20:49:41 +01:00
parent c62c5e01eb
commit 2dd81b2df4
2 changed files with 22 additions and 2 deletions

View File

@ -3,8 +3,14 @@
"solution": {
"name": "react-teams-tabs-pnpjs-client-side-solution",
"id": "1e68649b-930f-4502-a858-12aa997bda01",
"version": "1.0.0.0",
"includeClientSideAssets": true
"version": "3.0.0.0",
"includeClientSideAssets": true,
"webApiPermissionRequests": [
{
"resource": "Microsoft Graph",
"scope": "Group.ReadWrite.All"
}
]
},
"paths": {
"zippedPackage": "solution/react-teams-tabs-pnpjs.sppkg"

View File

@ -60,6 +60,7 @@ export default class ReactTeamsTabsPnpjs extends React.Component<IReactTeamsTabs
tmpTabs.push({ key: tab.id, name: tab.displayName, url: tab.webUrl, target: '_blank' });
});
tmpChannels.push({ name: channel.displayName + " (" + tmpTabs.length + ")", links: tmpTabs });
tmpChannels.sort(this.mySorter);
this.setState({ pivotArray: tmpChannels });
});
});
@ -73,4 +74,17 @@ export default class ReactTeamsTabsPnpjs extends React.Component<IReactTeamsTabs
}
public mySorter(a: any, b: any) {
var x = a.name.toLowerCase();
var y = b.name.toLowerCase();
//fix to manage general channel at first position, like Teams order
//verify language general label
if (x.startsWith("general")) {
return -1;
} else if (y.startsWith("general")) {
return 1;
}
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
}
}