Skip to content

Conversation

DevOps-zhuang
Copy link
Contributor

@DevOps-zhuang DevOps-zhuang commented Jun 21, 2024

Add seat analysis support for Github Enterprise, since newly released Github API support enterprise level seat information in 6/21, thanks for check.

https://docs.github.com/en/rest/copilot/copilot-user-management?apiVersion=2022-11-28#list-all-copilot-seat-assignments-for-an-enterprise

Updates to the README:

  • README.md: The image source and some descriptions in the Seat Analysis section have been updated to reflect the current state of the project.

Changes to the getSeatsApi function:

  • src/api/ExtractSeats.ts: The getSeatsApi function has been modified to handle both "organization" and "enterprise" scopes. It now constructs the API URL based on the VUE_APP_SCOPE environment variable. The function also uses the VUE_APP_GITHUB_TOKEN environment variable and throws an error if it's not set. [1] [2] [3]

Changes to the Seat model:

Changes to the sample response data:

  • src/assets/enterprise_response_sample_seats.json and src/assets/organization_response_sample_seats.json: The login property of the assignee object has been updated in the sample response data. [1] [2] [3]

Changes to the Vue components:

  • src/components/SeatsAnalysisViewer.vue: The team property has been added to the table in the SeatsAnalysisViewer component. [1] [2]
  • src/components/ApiResponse.vue and src/components/MainComponent.vue: Some conditional rendering based on the vueAppScope and isScopeOrganization properties have been commented out. [1] [2] [3] [4]

… Github API support enterprise level seat information in 6/21, thanks for check.
@DevOps-zhuang
Copy link
Contributor Author

@martedesco could you please help check it? I already test it for real orgs. and mock data with both enterprise and orgs. since I don't have a formal copilot enabled github enterprise, I didn't test that scenarios. hope it works, since the only difference is the API URL. thanks! :-)

README.md Outdated
@@ -72,11 +72,11 @@ The language breakdown analysis tab also displays a table showing the Accepted P

## Seat Analysis

![image](https://github.com/DevOps-zhuang/copilot-metrics-viewer/assets/54096296/d1fa9d1d-4fab-4e87-84ba-7be189dd4dd0)
![image](https://private-user-images.githubusercontent.com/54096296/334353713-d1fa9d1d-4fab-4e87-84ba-7be189dd4dd0.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTg5ODc0MTYsIm5iZiI6MTcxODk4NzExNiwicGF0aCI6Ii81NDA5NjI5Ni8zMzQzNTM3MTMtZDFmYTlkMWQtNGZhYi00ZTg3LTg0YmEtN2JlMTg5ZGQ0ZGQwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjIxVDE2MjUxNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTE1MWE2YmEwYThkODU5MGVmZDc1MDZjNWY5M2MzNzQzNzFjNTZjNjA1Njk0ZDdhZjc1ZjQ5YWJhYjcxMmRiYmEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.rjuRIhggtvKfIXZxCnQQSsDqrhOt1_jK3jdbbDvn2_A)
Copy link
Contributor

Choose a reason for hiding this comment

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

Apparently I don't have access to https://private-user-images.githubusercontent.com/54096296/334353713-d1fa9d1d-4fab-4e87-84ba-7be189dd4dd0.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTg5ODc0MTYsIm5iZiI6MTcxODk4NzExNiwicGF0aCI6Ii81NDA5NjI5Ni8zMzQzNTM3MTMtZDFmYTlkMWQtNGZhYi00ZTg3LTg0YmEtN2JlMTg5ZGQ0ZGQwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjIxVDE2MjUxNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTE1MWE2YmEwYThkODU5MGVmZDc1MDZjNWY5M2MzNzQzNzFjNTZjNjA1Njk0ZDdhZjc1ZjQ5YWJhYjcxMmRiYmEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.rjuRIhggtvKfIXZxCnQQSsDqrhOt1_jK3jdbbDvn2_A I assume this might apply to other users as well.
Please consider either including the image file in the repo or embedding the image as a base64 encoded string.

Copy link
Contributor Author

@DevOps-zhuang DevOps-zhuang Jun 24, 2024

Choose a reason for hiding this comment

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

Thanks, and I want to follow the format like 'https://github.com/github-copilot-resources/copilot-metrics-viewer/assets/3329307/79867d5f-8933-4509-a58a-8c6deeb47536', however, didn't find the assets folder in the repo. I guess it is from the other way to update the image files, then used in readme? thanks.

I tried to post the files here, and then get the url, will try use it in readme. though not sure whether it is a popular way :-)

image

@AdrianDsg
Copy link
Contributor

Thanks @DevOps-zhuang for providing these valuable contributions to the project as a reaction to my message in #41.

Maybe there's also the chance to provide analytics for the assigning GitHub Enterprise team(s) (assigning_team)?

{
  "total_seats": 1,
  "seats": [
    {
      "created_at": "2021-08-03T18:00:00-06:00",
      "updated_at": "2021-09-23T15:00:00-06:00",
      "pending_cancellation_date": null,
      "last_activity_at": "2021-10-14T00:53:32-06:00",
      "last_activity_editor": "vscode/1.77.3/copilot/1.86.82",
      "assignee": {
        "login": "octocat",
        "id": 1,
        "node_id": "MDQ6VXNlcjE=",
        // ...
        "type": "User",
        "site_admin": false
      },
      "assigning_team": {
        "id": 1,
        "node_id": "MDQ6VGVhbTE=",
        "url": "https://api.github.com/teams/1",
        "html_url": "https://github.com/orgs/github/teams/justice-league",
        "name": "Justice League",
        "slug": "justice-league",
        "description": "A great team.",
        "privacy": "closed",
        "notification_setting": "notifications_enabled",
        "permission": "admin",
        "members_url": "https://api.github.com/teams/1/members{/member}",
        "repositories_url": "https://api.github.com/teams/1/repos",
        "parent": null
      }
   }
]

@DevOps-zhuang
Copy link
Contributor Author

Thanks @DevOps-zhuang for providing these valuable contributions to the project as a reaction to my message in #41.

Maybe there's also the chance to provide analytics for the assigning GitHub Enterprise team(s) (assigning_team)?

{
  "total_seats": 1,
  "seats": [
    {
      "created_at": "2021-08-03T18:00:00-06:00",
      "updated_at": "2021-09-23T15:00:00-06:00",
      "pending_cancellation_date": null,
      "last_activity_at": "2021-10-14T00:53:32-06:00",
      "last_activity_editor": "vscode/1.77.3/copilot/1.86.82",
      "assignee": {
        "login": "octocat",
        "id": 1,
        "node_id": "MDQ6VXNlcjE=",
        // ...
        "type": "User",
        "site_admin": false
      },
      "assigning_team": {
        "id": 1,
        "node_id": "MDQ6VGVhbTE=",
        "url": "https://api.github.com/teams/1",
        "html_url": "https://github.com/orgs/github/teams/justice-league",
        "name": "Justice League",
        "slug": "justice-league",
        "description": "A great team.",
        "privacy": "closed",
        "notification_setting": "notifications_enabled",
        "permission": "admin",
        "members_url": "https://api.github.com/teams/1/members{/member}",
        "repositories_url": "https://api.github.com/teams/1/repos",
        "parent": null
      }
   }
]

thanks for suggesiton, It is a good suggesiton, and I just added 'seat' support for seat analysis in my local environemtn, it works for the mock data. then when I swith to real org, it is just blank, I just found there is no "assigning_team" returned in my environment at all, though there are 16 teams, almost every developer are within one team. and I am checking with Github team for it, not sure whether it is data error. will keep monitoring it.

@DevOps-zhuang
Copy link
Contributor Author

Thanks @DevOps-zhuang for providing these valuable contributions to the project as a reaction to my message in #41.

Maybe there's also the chance to provide analytics for the assigning GitHub Enterprise team(s) (assigning_team)?

{
  "total_seats": 1,
  "seats": [
    {
      "created_at": "2021-08-03T18:00:00-06:00",
      "updated_at": "2021-09-23T15:00:00-06:00",
      "pending_cancellation_date": null,
      "last_activity_at": "2021-10-14T00:53:32-06:00",
      "last_activity_editor": "vscode/1.77.3/copilot/1.86.82",
      "assignee": {
        "login": "octocat",
        "id": 1,
        "node_id": "MDQ6VXNlcjE=",
        // ...
        "type": "User",
        "site_admin": false
      },
      "assigning_team": {
        "id": 1,
        "node_id": "MDQ6VGVhbTE=",
        "url": "https://api.github.com/teams/1",
        "html_url": "https://github.com/orgs/github/teams/justice-league",
        "name": "Justice League",
        "slug": "justice-league",
        "description": "A great team.",
        "privacy": "closed",
        "notification_setting": "notifications_enabled",
        "permission": "admin",
        "members_url": "https://api.github.com/teams/1/members{/member}",
        "repositories_url": "https://api.github.com/teams/1/repos",
        "parent": null
      }
   }
]

checked with GitHub experts. The explanation for the team is provided below
"assigning_team": {"description": "The team through which the assignee is granted access to GitHub Copilot, if applicable.",....} so the 'assigning_team' here means 'the team where the user was assigned/received copilot license', not the team the user belongs to...so if the account was not assigned copilot through teams, the assigin-team here is blank, so I am doubting whether it is worth adding the teams here, it will create more confusion... your suggestion? thanks.

The code changes include updating the `SeatsAnalysisViewer.vue` component to display the assigning team of each seat. This is achieved by adding a new table column and binding the `item.team` property to it.

This commit message follows the conventional format of starting with a type (`feat` for feature) followed by a concise and descriptive summary of the changes.
@romeroej-inch
Copy link

why hasnt this been merged. it works beautifully :D

@AdrianDsg
Copy link
Contributor

@martedesco please consider looking into this any time soon

@martedesco martedesco merged commit 6de1abe into github-copilot-resources:main Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants