Skip to content

Add multi teams support and update seat management tab to suppoft filter when clicking a card. #177

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 35 commits into
base: main
Choose a base branch
from

Conversation

DevOps-zhuang
Copy link
Contributor

1, add teams support like multi-team dashboards.
2, for seat managemnet, display more cards and when click a card, it will filter the data, only show filter data in below tables.

image
image

This pull request introduces several changes to the project, focusing on adding support for multiple teams, improving error handling, and updating configurations. The most important changes include updates to environment variables, modifications to the Dockerfile, enhancements in API handling, and new components for multi-team metrics.

Environment Variable Updates:

  • .env: Updated VUE_APP_GITHUB_ORG to CopilotDemo and added VUE_APP_SHOW_MULTIPLE_TEAMS to support multiple teams. [1] [2]
  • README.md: Documented the new VUE_APP_SHOW_MULTIPLE_TEAMS environment variable.

Dockerfile Modifications:

  • Dockerfile: Changed the base image to node:22, added commands to update the caniuse-lite database, fix ESLint errors, and handle build errors.
  • Dockerfile: Added command to start the Nginx server.

API Enhancements:

  • src/api/GitHubApi.ts: Refactored API calls to handle multiple teams, added error handling, and improved the fetching of team metrics. [1] [2]

Component Updates for Multi-Team Support:

Minor Updates:

DevOps-zhuang and others added 13 commits January 15, 2025 23:17
pull reqeust for new metric support
Add support for multiple teams in the metrics viewer.

* **API Changes**:
  - Modify `getTeams` function in `src/api/GitHubApi.ts` to return team names.
  - Update `getTeamMetricsApi` to handle multiple teams.
  - Add `getMultipleTeamsMetricsApi` function to fetch metrics for multiple teams.

* **Component Changes**:
  - Add a dropdown menu in `src/components/MainComponent.vue` to select multiple teams.
  - Update `setup` function to fetch and display metrics data for selected teams.
  - Add a new component `MultiTeamsMetricsViewer.vue` to display multi-teams metrics information.

* **Configuration Changes**:
  - Add support for multiple teams configuration in `src/config.ts`.
  - Add a new boolean parameter `VUE_APP_SHOW_MULTIPLE_TEAMS` in `.env` and `src/config.ts`.

* **Documentation**:
  - Update `README.md` to describe metrics for multiple teams and the new `VUE_APP_SHOW_MULTIPLE_TEAMS` parameter.
…etrics viewer (docker env and display rows)
…s and improve metrics fetching logic,so it support non-unicode team names.
@karpikpl
Copy link
Collaborator

I'll work on the merge

@paobulas
Copy link

Hi @DevOps-zhuang,

I was trying to use multi teams support which is implemented in this branch before it gets merged into the main branch. While attempting to build a Docker image using the code from this branch, I encountered the following error:

[nuxi]  ERROR  Nuxt Build Error: Could not resolve "../api/GitHubApi" from "app/components/MultiTeamsMetricsViewer.vue?vue&type=script&lang.ts"
10.89 file: /app/app/components/MultiTeamsMetricsViewer.vue?vue&type=script&lang.ts
10.89 
10.89     file: app/components/MultiTeamsMetricsViewer.vue?vue&type=script&lang.ts
10.89     at getRollupError (node_modules/rollup/dist/es/shared/parseAst.js:396:41)
10.89     at error (node_modules/rollup/dist/es/shared/parseAst.js:392:42)
10.89     at ModuleLoader.handleInvalidResolvedId (node_modules/rollup/dist/es/shared/node-entry.js:20212:24)
10.89     at node_modules/rollup/dist/es/shared/node-entry.js:20172:26

Could you please look into this and suggest a resolution? Alternatively, let me know if any dependencies or configurations need to be updated for this feature to work seamlessly when building Docker images.

Thanks & Regards,
Satish

@karpikpl
Copy link
Collaborator

the merge is not complete on this, it needs more changes

@DevOps-zhuang
Copy link
Contributor Author

DevOps-zhuang commented Mar 24, 2025 via email

@paobulas
Copy link

paobulas commented Mar 24, 2025

@DevOps-zhuang could you please share me the docker image?

@DevOps-zhuang
Copy link
Contributor Author

@DevOps-zhuang could you please share me the docker image?

will send you

@DevOps-zhuang could you please share me the docker image?

docker login -u metricviewer -p +zyKpRFjw8A/PnQY9Rh0uThb1Z0yzxxsNUCQdbIlCV+ACRAsWd2z copilotx.azurecr.io

docker pull copilotx.azurecr.io/copilot/copilot-metrics-viewer:2025-0226-MultiTeamsSupport

@paobulas
Copy link

Hi @DevOps-zhuang,

Thank you for sharing the Docker image.

Unfortunately, I am unable to get any output from the web page when using your Docker image (copilotx.azurecr.io/copilot/copilot-metrics-viewer:2025-0226-MultiTeamsSupport).

Docker output log:

paobulas@ubuntu ~/workspace/GitHub-Copilot-Metrics/copilot-metrics-viewer-zhuang
 % docker run -p 8080:80 --env-file ./.env copilotx.azurecr.io/copilot/copilot-metrics-viewer:2025-0226-MultiTeamsSupport 
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
/docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/99-config-app.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
2025/03/27 16:00:59 [notice] 1#1: using the "epoll" event method
2025/03/27 16:00:59 [notice] 1#1: nginx/1.27.2
2025/03/27 16:00:59 [notice] 1#1: built by gcc 12.2.0 (Debian 12.2.0-14) 
2025/03/27 16:00:59 [notice] 1#1: OS: Linux 6.8.0-1021-azure
2025/03/27 16:00:59 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2025/03/27 16:00:59 [notice] 1#1: start worker processes
2025/03/27 16:00:59 [notice] 1#1: start worker process 31
2025/03/27 16:00:59 [notice] 1#1: start worker process 32
2025/03/27 16:00:59 [notice] 1#1: start worker process 33
2025/03/27 16:00:59 [notice] 1#1: start worker process 34
2025/03/27 16:00:59 [notice] 1#1: start worker process 35
2025/03/27 16:00:59 [notice] 1#1: start worker process 36
2025/03/27 16:00:59 [notice] 1#1: start worker process 37
2025/03/27 16:00:59 [notice] 1#1: start worker process 38
2025/03/27 16:00:59 [notice] 1#1: start worker process 39
2025/03/27 16:00:59 [notice] 1#1: start worker process 40
2025/03/27 16:00:59 [notice] 1#1: start worker process 41
2025/03/27 16:00:59 [notice] 1#1: start worker process 42
172.17.0.1 - - [27/Mar/2025:16:01:05 +0000] "GET /assets/app-config.js HTTP/1.1" 200 447 "http://localhost:8080/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36" "-"
172.17.0.1 - - [27/Mar/2025:16:02:03 +0000] "GET /assets/app-config.js HTTP/1.1" 304 0 "http://localhost:8080/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36" "-"
172.17.0.1 - - [27/Mar/2025:16:07:07 +0000] "GET /assets/app-config.js HTTP/1.1" 304 0 "http://localhost:8080/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36" "-"
172.17.0.1 - - [27/Mar/2025:16:08:25 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36" "-"
172.17.0.1 - - [27/Mar/2025:16:08:25 +0000] "GET /assets/app-config.js HTTP/1.1" 304 0 "http://localhost:8080/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36" "-"

Screenshot from 2025-03-27 21-37-22

Could you please help me resolve this issue? Or have I missed something here?

@DevOps-zhuang
Copy link
Contributor Author

DevOps-zhuang commented Mar 28, 2025 via email

…and loading states

- Updated MultiTeamsMetricsViewer.vue to display organization name in the title and improved team selection logic.
- Added loading state for metrics fetching and improved error handling.
- Introduced API endpoint for fetching team metrics with support for mocked data.
- Refactored team fetching logic to handle both configured and API-fetched teams.
- Improved metrics calculation and display logic for better user experience.
- Updated nuxt.config.ts to support environment variable overrides for configuration.
@paobulas
Copy link

@DevOps-zhuang,

I am using it for organization only. Still I am unable to see any metrics.

Please find my .env file details below:

# Determines if mocked data should be used instead of making API calls.
NUXT_PUBLIC_IS_DATA_MOCKED=false

# Determines the scope of the API calls. 
# Can be 'enterprise' or 'organization' to target API calls to an enterprise or an organization respectively.
NUXT_PUBLIC_SCOPE=organization

# Determines the enterprise or organization name to target API calls.
NUXT_PUBLIC_GITHUB_ORG=<My organization name>

NUXT_PUBLIC_GITHUB_ENT=

# Determines the team name if exists to target API calls.
NUXT_PUBLIC_GITHUB_TEAM=

NUXT_PUBLIC_USING_GITHUB_AUTH=false

# Determines the GitHub Personal Access Token to use for API calls.
# Create with scopes copilot, manage_billing:copilot or manage_billing:enterprise, read:enterprise AND read:org
NUXT_GITHUB_TOKEN=<my pat token>

NUXT_SESSION_PASSWORD=TOUXIQsPl5kbCJ0qnBV2R7i56Nft42Gl

# for Github OAuth
# NUXT_OAUTH_GITHUB_CLIENT_ID=
# NUXT_OAUTH_GITHUB_CLIENT_SECRET=

# Determines if the application should support multiple teams.
VUE_APP_SHOW_MULTIPLE_TEAMS=true
# to use a corporate proxy
# HTTP_PROXY=http://proxy.company.com:8080

@DevOps-zhuang
Copy link
Contributor Author

@karpikpl @paobulas Thanks's for your support, I just update the latest code to support NUXT, it works on my machines now, can you check the latest code? the branch is same:
https://github.com/DevOps-zhuang/copilot-metrics-viewer/tree/add-multi-teams-support

image

@DevOps-zhuang
Copy link
Contributor Author

@paobulas thanks's for your patience, for the docker image I provides, please use the old .env, which is like below.
and I just updated my branch to support NUXT, hope it can run on your environment with the latest change as well, thanks.
Uploading .env.md…

@DevOps-zhuang
Copy link
Contributor Author

docke image is also built based on this branch, I already tested it, it works.
https://github.com/DevOps-zhuang/copilot-metrics-viewer/pkgs/container/copilot-metrics-viewer/385109083?tag=add-multi-teams-support

@VNSRAVIS
Copy link

VNSRAVIS commented Apr 1, 2025

@DevOps-zhuang i tested changes from your branch and the data is displayed in table. However it was observed that panels below the table are not reflecting as per selection.

@DevOps-zhuang
Copy link
Contributor Author

@DevOps-zhuang i tested changes from your branch and the data is displayed in table. However it was observed that panels below the table are not reflecting as per selection.

Thanks, you found a bug! it worked in non-Nuxt version, and for Nuxt version, I need to do some changes, I am fixing it now, thanks for your test!

@paobulas
Copy link

@DevOps-zhuang
During testing I found differnce between 'Total Suggestions' in Home page and in 'Multi-Teams' page and corresponding metrics.

I’m unable to find an API that lists teams in GitHub Enterprise to find Teams slug. Is this the reason to not support 'Multi-Teams' at enterprise level? Any idea if the API is in development?

@DevOps-zhuang
Copy link
Contributor Author

DevOps-zhuang commented Apr 11, 2025

@DevOps-zhuang During testing I found differnce between 'Total Suggestions' in Home page and in 'Multi-Teams' page and corresponding metrics.
Yes, it is always different, for organization level. the 'Total Suggestions' in Home (Metric Page) is always grater than the one in 'Mulit-Teams' page. the main scenarios are not limited to below:

  1. there are copilot seats belong to Organization directly, not belong to team.
    2)for some teams, or some days for some teams, there are less than 5 copilot seats, so there is no metric fetched from github API, so it is not counted in team level, however, such data are in organization level.

I’m unable to find an API that lists teams in GitHub Enterprise to find Teams slug. Is this the reason to not support 'Multi-Teams' at enterprise level? Any idea if the API is in development?
Yes, your observation is quite good! there is no API to get teams from enterprise level, since teams are always in organization level.
it is teams-->organization-->enterprise. so we don't support 'Multi-teams' against enterprise level.

but, there is one specified enterprise called dedicated enterprise/copilot standalone, with such enterprise, there is no organization at all. so teams are within enterprise level. I am considering adding support for it in future. need more design, since it takes effort to tell it is 'normal' enterprise or 'dedicated' enterprise.

And, since we support Nuxt now, you can change the URL in the brower to fetch for more organization, even special team. like
https://[youserver]/orgs/[yourorgname], it will show multi-teams support for specified org.

thanks for your test and observation!

…fetch logic for team data retrieval,so for team/org/enterprise level, the behavior is similar now
…ation and enhance toolbar styling for better visibility
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