Skip to content

Commit 67a113a

Browse files
committed
refactor: Add conditional rendering for SeatsAnalysisViewer in MainComponent.vue
1 parent 8bd690d commit 67a113a

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/api/ExtractSeats.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,8 @@ export const getSeatsApi = async (): Promise<Seat[]> => {
3434
}
3535
});
3636

37-
38-
3937
seatsData = seatsData.concat(response.data.seats.map((item: any) => new Seat(item)));
4038

41-
42-
4339
// Calculate the total pages
4440
const totalSeats = response.data.total_seats;
4541
const totalPages = Math.ceil(totalSeats / perPage);

src/components/MainComponent.vue

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@
3131
<BreakdownComponent v-if="item === 'languages'" :metrics="metrics" :breakdownKey="'language'"/>
3232
<BreakdownComponent v-if="item === 'editors'" :metrics="metrics" :breakdownKey="'editor'"/>
3333
<CopilotChatViewer v-if="item === 'copilot chat'" :metrics="metrics" />
34-
<SeatsAnalysisViewer v-if="item === 'seat analysis'" :seats="seats" />
34+
<div v-if="isScopeOrganization">
35+
<SeatsAnalysisViewer v-if="item === 'seat analysis'" :seats="seats" />
36+
</div>
3537
<ApiResponse v-if="item === 'api response'" :metrics="metrics" :seats="seats" />
3638
</v-card>
3739
</v-window-item>
@@ -79,18 +81,24 @@ export default defineComponent({
7981
},
8082
capitalizedItemName() {
8183
return this.itemName.charAt(0).toUpperCase() + this.itemName.slice(1);
84+
},
85+
isScopeOrganization() {
86+
return process.env.VUE_APP_SCOPE === 'organization';
8287
}
8388
},
8489
data () {
8590
return {
86-
tabItems: ['languages', 'editors', 'copilot chat','seat analysis', 'api response'],
91+
tabItems: ['languages', 'editors', 'copilot chat', 'api response'],
8792
tab: null
8893
}
8994
},
9095
created() {
9196
if(this.itemName !== 'invalid'){
9297
this.tabItems.unshift(this.itemName);
9398
}
99+
if (process.env.VUE_APP_SCOPE === 'organization') {
100+
this.tabItems.push('seat analysis');
101+
}
94102
},
95103
setup() {
96104
const metricsReady = ref(false);

0 commit comments

Comments
 (0)