Skip to content

New command graph teams tab list solving #849#896

Closed
thomyg wants to merge 5 commits intopnp:devfrom
thomyg:master
Closed

New command graph teams tab list solving #849#896
thomyg wants to merge 5 commits intopnp:devfrom
thomyg:master

Conversation

@thomyg
Copy link
Copy Markdown
Member

@thomyg thomyg commented Mar 28, 2019

Added new command for listing tabs in a Microsoft Teams channel.

Added:

  • command implementation
  • tests
  • doc file

Any feedback welcome! thx!

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 100.0% when pulling 204c0ca on thomyg:master into b4bf46b on pnp:dev.

@thomyg thomyg changed the title New command graph teams tab list New command graph teams tab list solvion #849 Mar 28, 2019
@thomyg thomyg changed the title New command graph teams tab list solvion #849 New command graph teams tab list solving #849 Mar 28, 2019
@waldekmastykarz
Copy link
Copy Markdown
Member

Hero! We're going to review it asap. Thank you! 👏

Copy link
Copy Markdown
Contributor

@VelinGeorgiev VelinGeorgiev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @thomyg, great first commit! Worked like charm! I did few minor changes before we can merge it. You can find my inline comments.
You can see the changes I made here: https://github.com/VelinGeorgiev/office365-cli/tree/thomy/master. Waldek will use that branch to merge it with the pnp one.

Two additional things:

  • When you do npm install, the npm-shrinkwrap.json file get changed. I usually do not include the changed file in the pull request and let Waldek make changes to the npm-shrinkwrap.json when needed.
  • I've added the teams-tab-list.md doc to the mkdocs.yaml file under the teams nodes. That is required as part of the pull request.

}

public get description(): string {
return 'Lists Tabs in a Microsoft Teams team.';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to Lists tabs in the specified Microsoft Teams channel

const options: CommandOption[] = [
{
option: '-i, --teamId <teamId>',
description: 'The ID of the team to list the tab of'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to The ID of the team of the specific channel

},
{
option: '-c, --channelId <channelId>',
description: 'The ID of the channel to list the tab of'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to The ID of the channel for which to list tabs


To list the tabs in a Microsoft Teams channel, you have to first log in to the Microsoft Graph using the [graph login](../login.md) command, eg. `graph login`.

## Examples
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Example removed since not part of this command

!!! important
Before using this command, log in to the Microsoft Graph, using the [graph login](../login.md) command

## Remarks
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remarks removed since it duplicates with another one bellow

}

interface Options extends GlobalOptions {
joined?: boolean;
Copy link
Copy Markdown
Contributor

@VelinGeorgiev VelinGeorgiev Mar 30, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

joined removed since it is not part of the command specification.

return 'Lists Tabs in a Microsoft Teams team.';
}

public getTelemetryProperties(args: CommandArgs): any {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getTelemetryProperties is removed since the command has two mandatory options teamId and channelId and they are tracked by default. We use the getTelemetryProperties method in a case of optional options.


public commandAction(cmd: CommandInstance, args: CommandArgs, cb: () => void): void {

let endpoint: string = `${auth.service.resource}/V1.0/teams/${args.options.teamId}/channels/${args.options.channelId}/tabs?$expand=teamsApp`;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

encodeURIComponent(args.options.channelId) instead of just args.options.channelId just to ensure no weird characters in the id can break the request.

Also V1.0 changed to v1.0.

List all tabs in a Microsoft Teams team
${chalk.grey(config.delimiter)} ${this.name} --teamId <teamId> --channelId <channelId>

Include the all the values from the tab configuration and associated teams app
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to Include all the values from the tab configuration and associated teams app to remove one unnecessary the and match the description in the MD file.


You can only see the tab list of a team you are a member of.

The tabs Conversations and Files are present in every team and therefor not provided as a
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo. therefor changed to therefore.

@thomyg
Copy link
Copy Markdown
Member Author

thomyg commented Mar 31, 2019

thx @VelinGeorgiev for your feedback! appreciated! Sorry for not adding the documentation in the yaml file, that is stated in the help an I missed it, sorry. All the other remarks will be taken into account for future commits, THX!

One more question, maybe not 100% only related to this PR, but I reached out to the Teams PG and the one responsible for the graph APIs and asked about how one could validate the channel ID. His answer basically was that he would only check for a "19:" on the begin of the string and the "@thread.skype.com" at the end. Everything else in between, that looks like a GUID without hyphens might change in the future. Details can be found in an NDA Teams team, so maybe ping me in private if you are interested.
Nevertheless, my point is, should there be a central utility that offers channel validation in the teams command section? Thinking of something like teams-utilities.ts for that. My argument is, that this validation is needed quite a few times as the --channelId is a parameter at some teams calls. If we would centralize the validation it could be easily adjusted in the future. What I have seen so far is, that most of the commands only check the existence of the parameter but not the actual content of the string. Opinions? Or do you already have that on the roadmap somewhere and I missed it?

@waldekmastykarz
Copy link
Copy Markdown
Member

@thomyg good suggestion! We shouldn't create a separate utils class for Teams but instead add it to the existing Utils class. Feel free to create a new issue for this improvement so that we can track it separately. We can then decide if you want to pick it up yourself or let others do it 👏

@waldekmastykarz
Copy link
Copy Markdown
Member

Merged manually. Thank you! 👏

@VelinGeorgiev
Copy link
Copy Markdown
Contributor

VelinGeorgiev commented Apr 2, 2019

Good stuff! I am not very concerned about strict validation on the channel id, because the request will fail when the one using the CLI has entered wrong input. However, I also agree that will be better experience if we provide more meaningful message if the garph apis do not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants