Skip to content

Commit 2523adc

Browse files
committed
refactor(ui): move menu to component
1 parent 1659b44 commit 2523adc

File tree

5 files changed

+58
-23
lines changed

5 files changed

+58
-23
lines changed

web/src/components/DashboardMenu.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
</v-tab>
2828

2929
<v-tab
30-
v-if="canUpdateProject && projectType === ''"
30+
v-if="isPro && canUpdateProject && projectType === ''"
3131
key="runners"
3232
:to="`/project/${projectId}/runners`"
3333
data-testid="dashboard-runners"
@@ -49,6 +49,12 @@ export default {
4949
canUpdateProject: Boolean,
5050
},
5151
52+
computed: {
53+
isPro() {
54+
return (process.env.VUE_APP_BUILD_TYPE || '').startsWith('pro_');
55+
},
56+
},
57+
5258
data() {
5359
return {
5460
id: null,
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<template>
2+
<div>
3+
<v-tabs class="pl-4">
4+
<v-tab
5+
key="keys"
6+
:to="`/project/${projectId}/keys`"
7+
data-testid="keystore-keys"
8+
>
9+
Keys
10+
</v-tab>
11+
12+
<v-tab
13+
key="storages"
14+
:to="`/project/${projectId}/secret_storages`"
15+
data-testid="keystore-storages"
16+
>
17+
Storages
18+
</v-tab>
19+
</v-tabs>
20+
<v-divider style="margin-top: -1px;" />
21+
</div>
22+
</template>
23+
24+
<script>
25+
export default {
26+
27+
props: {
28+
projectId: Number,
29+
},
30+
31+
};
32+
</script>

web/src/components/TeamMenu.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
</v-tabs>
2828
</template>
2929

30-
3130
<script>
3231
export default {
3332

web/src/views/project/Keys.vue

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -45,25 +45,8 @@
4545
>{{ $t('newKey') }}</v-btn>
4646
</v-toolbar>
4747

48-
<v-tabs class="pl-4">
49-
<v-tab
50-
key="keys"
51-
:to="`/project/${projectId}/keys`"
52-
data-testid="keystore-keys"
53-
>
54-
Keys
55-
</v-tab>
56-
57-
<v-tab
58-
key="storages"
59-
:to="`/project/${projectId}/secret_storages`"
60-
data-testid="keystore-storages"
61-
>
62-
Storages
63-
</v-tab>
64-
</v-tabs>
65-
66-
<v-divider style="margin-top: -1px;" />
48+
<KeyStoreMenu v-if="isPro" :project-id="projectId" />
49+
<v-divider v-else />
6750

6851
<v-data-table
6952
:headers="headers"
@@ -105,16 +88,23 @@
10588
import ItemListPageBase from '@/components/ItemListPageBase';
10689
import KeyForm from '@/components/KeyForm.vue';
10790
import PageMixin from '@/components/PageMixin';
91+
import KeyStoreMenu from '@/components/KeyStoreMenu.vue';
10892
10993
export default {
110-
components: { KeyForm },
94+
components: { KeyStoreMenu, KeyForm },
11195
11296
mixins: [ItemListPageBase, PageMixin],
11397
11498
props: {
11599
systemInfo: Object,
116100
},
117101
102+
computed: {
103+
isPro() {
104+
return (process.env.VUE_APP_BUILD_TYPE || '').startsWith('pro_');
105+
},
106+
},
107+
118108
methods: {
119109
getHeaders() {
120110
return [{

web/src/views/project/Team.vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@
3737
</v-btn>
3838
</v-toolbar>
3939

40-
<TeamMenu :project-id="projectId" :system-info="systemInfo" />
40+
<TeamMenu
41+
v-if="isPro"
42+
:project-id="projectId"
43+
:system-info="systemInfo"
44+
/>
4145

4246
<v-divider style="margin-top: -1px;"/>
4347

@@ -94,6 +98,10 @@ export default {
9498
userRoles() {
9599
return [...USER_ROLES, ...this.systemInfo.roles];
96100
},
101+
102+
isPro() {
103+
return (process.env.VUE_APP_BUILD_TYPE || '').startsWith('pro_');
104+
},
97105
},
98106
99107
methods: {

0 commit comments

Comments
 (0)