Skip to content

Commit e71aca7

Browse files
committed
team -> teams
1 parent ed8b3f9 commit e71aca7

File tree

7 files changed

+28
-61
lines changed

7 files changed

+28
-61
lines changed

DEPLOYMENT.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ Application will use a pre-built docker image hosted in GitHub registry: `ghcr.i
5353

5454
[![Deploy to Azure](https://aka.ms/deploytoazurebutton)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Fgithub-copilot-resources%2Fcopilot-metrics-viewer%2Fmain%2Fazure-deploy%2Fwith-app-registration%2Fazuredeploy.json/uiFormDefinitionUri/https%3A%2F%2Fraw.githubusercontent.com%2Fgithub-copilot-resources%2Fcopilot-metrics-viewer%2Fmain%2Fazure-deploy%2Fwith-app-registration%2Fportal.json)
5555

56-
>[!INFO]
57-
>**Important**: After deploying Option 2, the redirect URI needs to be updated with the URL of the deployed container app.
58-
>
59-
>Go to: `https://github.com/organizations/<your-org>/settings/apps/<your-app>` or in the UI to the settings of the registered application and add the following redirect URL: `https://<your-container-app-name-and-region>.azurecontainerapps.io/auth/github`
56+
>[!IMPORTANT]
57+
>**Important**: After deploying Option 2, the redirect URI needs to be updated with the URL of the deployed container app.
58+
>
59+
>Go to: `https://github.com/organizations/<your-org>/settings/apps/<your-app>` or in the UI to the settings of the registered application and add the following redirect URL: `https://<your-container-app-name-and-region>.azurecontainerapps.io/auth/github`
6060
6161
### Deployment with private networking
6262

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ Public variables:
9999
can be overriden by route parameters, e.g.
100100
- `http://localhost:3000/enterprises/octo-demo-ent`
101101
- `http://localhost:3000/orgs/octo-demo-org`
102-
- `http://localhost:3000/orgs/octo-demo-org/team/the-a-team`
102+
- `http://localhost:3000/orgs/octo-demo-org/teams/the-a-team`
103103
- `http://localhost:3000/orgs/mocked-org?mock=true`
104104

105105
#### NUXT_PUBLIC_SCOPE

app/components/MainComponent.vue

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111

1212
<!-- Conditionally render the logout button -->
1313
<AuthState>
14-
<template #default="{ loggedIn, user }" >
15-
<div v-show="loggedIn" class="user-info">
16-
Welcome,
17-
<v-avatar class="user-avatar">
18-
<v-img :alt="user?.name" :src="user?.avatarUrl" />
19-
</v-avatar> {{ user?.name }}
20-
</div>
21-
<v-btn v-if="showLogoutButton && loggedIn" class="logout-button" @click="logout">Logout</v-btn>
14+
<template #default="{ loggedIn, user }">
15+
<div v-show="loggedIn" class="user-info">
16+
Welcome,
17+
<v-avatar class="user-avatar">
18+
<v-img :alt="user?.name" :src="user?.avatarUrl" />
19+
</v-avatar> {{ user?.name }}
20+
</div>
21+
<v-btn v-if="showLogoutButton && loggedIn" class="logout-button" @click="logout">Logout</v-btn>
2222
</template>
2323
</AuthState>
2424

@@ -60,11 +60,11 @@
6060
<BreakdownComponent v-if="item === 'editors'" :metrics="metrics" :breakdown-key="'editor'" />
6161
<CopilotChatViewer v-if="item === 'copilot chat'" :metrics="metrics" />
6262
<SeatsAnalysisViewer v-if="item === 'seat analysis'" :seats="seats" />
63-
<ApiResponse v-if="item === 'api response'" :metrics="metrics" :original-metrics="originalMetrics" :seats="seats" />
63+
<ApiResponse v-if="item === 'api response'" :metrics="metrics" :original-metrics="originalMetrics"
64+
:seats="seats" />
6465
</v-card>
6566
</v-window-item>
66-
<v-alert
67-
v-show="metricsReady && metrics.length == 0" density="compact" text="No data available to display"
67+
<v-alert v-show="metricsReady && metrics.length == 0" density="compact" text="No data available to display"
6868
title="No data" type="warning" />
6969
</v-window>
7070

@@ -126,20 +126,20 @@ export default defineNuxtComponent({
126126
const metricsReady = ref(false);
127127
const metrics = ref<Metrics[]>([]);
128128
const originalMetrics = ref<CopilotMetrics[]>([]);
129-
const seatsReady = ref(false);
130-
const seats = ref<Seat[]>([]);
129+
const seatsReady = ref(false);
130+
const seats = ref<Seat[]>([]);
131131
// API Error Message
132132
const apiError = ref<string | undefined>(undefined);
133133
const signInRequired = computed(() => {
134134
return config.public.usingGithubAuth && !loggedIn.value;
135135
});
136-
136+
137137
/**
138138
* Handles API errors by setting appropriate error messages.
139139
* @param {H3Error} error - The error object returned from the API call.
140140
*/
141141
function processError(error: H3Error) {
142-
console.error(error);
142+
console.error(error || 'No data returned from API');
143143
// Check the status code of the error response
144144
if (error.statusCode) {
145145
switch (error.statusCode) {
@@ -148,14 +148,13 @@ export default defineNuxtComponent({
148148
break;
149149
case 404:
150150
apiError.value = `404 Not Found - is the ${config.public.scope || ''} org:'${config.public.githubOrg || ''} ent:'${config.public.githubEnt || ''}' team:'${config.public.githubTeam}' correct? ${error.message}`;
151-
// Update apiError with the error message
151+
// Update apiError with the error message
152152
apiError.value = error.message;
153153
break;
154154
case 500:
155155
apiError.value = `500 Internal Server Error - most likely a bug in the app. Error: ${error.message}`;
156156
break;
157157
}
158-
// TODO: handle errors without status code?
159158
}
160159
}
161160
@@ -172,6 +171,10 @@ export default defineNuxtComponent({
172171
metricsReady.value = true;
173172
}
174173
174+
if (config.public.scope === 'team' && metrics.value.length === 0 && !apiError.value) {
175+
apiError.value = 'No data returned from API - check if the team exists and has any activity and at least 5 active members';
176+
}
177+
175178
const { data: seatsData, error: seatsError } = await seatsFetch;
176179
if (seatsError.value) {
177180
processError(seatsError.value as H3Error);

app/router.options.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default {
1515
},
1616
{
1717
name: 'team',
18-
path: '/orgs/:org/team/:team',
18+
path: '/orgs/:org/teams/:team',
1919
component: () => import('~/pages/index.vue')
2020
},
2121
{

e2e-tests/copilot.team.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ let dashboard: DashboardPage;
77

88
test.beforeAll(async ({ browser }) => {
99
const page = await browser.newPage();
10-
await page.goto('/orgs/octo-demo-org/team/the-a-team');
10+
await page.goto('/orgs/octo-demo-org/teams/the-a-team');
1111

1212
dashboard = new DashboardPage(page);
1313

e2e-tests/metrics.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { DashboardPage } from './pages/DashboardPage';
44
const tag = { tag: ['@ent', '@org', '@team'] };
55

66
[
7-
{ name: 'Teams', url: '/orgs/octodemo-org/team/the-a-team' },
7+
{ name: 'Teams', url: '/orgs/octodemo-org/teams/the-a-team' },
88
{ name: 'Orgs', url: '/orgs/octodemo-org' },
99
{ name: 'Enterprises', url: '/enterprises/octo-enterprise' },
1010
].forEach(({ name, url }) => {

infra/main.bicep

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -48,42 +48,6 @@ var tags = {
4848
var abbrs = loadJsonContent('./abbreviations.json')
4949
var resourceToken = toLower(uniqueString(subscription().id, environmentName, location))
5050

51-
// "settings": [
52-
// {
53-
// "name": "NUXT_OAUTH_GITHUB_CLIENT_ID",
54-
// "value": "${NUXT_OAUTH_GITHUB_CLIENT_ID}",
55-
// "secret": true,
56-
// "_comment_name": "GitHub App Client id - The name of the environment variable when running in Azure."
57-
// },
58-
// {
59-
// "name": "NUXT_OAUTH_GITHUB_CLIENT_SECRET",
60-
// "value": "${NUXT_OAUTH_GITHUB_CLIENT_SECRET}",
61-
// "secret": true,
62-
// "_comment_name": "GitHub App Client Secret - The name of the environment variable when running in Azure."
63-
// },
64-
// {
65-
// "name": "NUXT_SESSION_PASSWORD",
66-
// "value": "$(secretOrRandomPassword)",
67-
// "secret": true,
68-
// "_comment_name": "Session Secret - The name of the environment variable when running in Azure."
69-
// },
70-
// {
71-
// "name": "NUXT_PUBLIC_SCOPE",
72-
// "value": "${NUXT_PUBLIC_SCOPE}",
73-
// "_comment_name": "GitHub App Scope - The name of the environment variable when running in Azure."
74-
// },
75-
// {
76-
// "name": "NUXT_PUBLIC_GITHUB_ORG",
77-
// "value": "${NUXT_PUBLIC_GITHUB_ORG}",
78-
// "_comment_name": "GitHub Organization - The name of the environment variable when running in Azure."
79-
// },
80-
// {
81-
// "name": "NUXT_PUBLIC_GITHUB_ENT",
82-
// "value": "${NUXT_PUBLIC_GITHUB_ENT}",
83-
// "_comment_name": "GitHub Enterprise - The name of the environment variable when running in Azure."
84-
// }
85-
// ]
86-
8751
var settings = concat(
8852
[
8953
{

0 commit comments

Comments
 (0)