Skip to content

Commit 2105cf3

Browse files
authored
Merge pull request #9 from beclab/refactor/controlhub
refactor(controlhub): add controlhub demo mode
2 parents 916b7b3 + e1f2df5 commit 2105cf3

File tree

22 files changed

+191
-120
lines changed

22 files changed

+191
-120
lines changed

.github/workflows/common-config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969
- run: yarn install --no-frozen-lockfile
7070

7171
- name: Build
72-
run: yarn ${{ inputs.PACKAGE_BUILD_SCRIPT }}
72+
run: ${{ inputs.PACKAGE_BUILD_SCRIPT }}
7373

7474
- name: Check if version has been updated
7575
id: check
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Update AdminConsole Frontend
2+
3+
on:
4+
workflow_dispatch:
5+
6+
pull_request:
7+
types:
8+
- opened
9+
branches:
10+
- 'main'
11+
- 'bug/fix-0729_beta'
12+
paths:
13+
- 'apps/adminConsole/package.json'
14+
push:
15+
branches:
16+
- 'main'
17+
- 'chore/apps'
18+
paths:
19+
- 'apps/adminConsole/**'
20+
- 'apps/common/**'
21+
- .github/workflows/update-admin-console.yml
22+
- .github/workflows/common-config.yml
23+
- nginx.conf
24+
25+
jobs:
26+
call-nodes-ci:
27+
uses: ./.github/workflows/common-config.yml
28+
with:
29+
NODE_VERSION: '16.14'
30+
PACKAGE_NAME: controlhub-demo
31+
PACKAGE_PATH: apps/adminConsole/package.json
32+
DIR_PATH: apps/adminConsole
33+
DOCKERFILE_PATH: Dockerfile-admin-console-client
34+
PACKAGE_BUILD_SCRIPT: DEMO=true yarn build:console
35+
DEFAULT_VERSION: latest
36+
secrets: inherit

.github/workflows/update-admin-console.yml

+1-9
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,6 @@ name: Update AdminConsole Frontend
33
on:
44
workflow_dispatch:
55

6-
pull_request:
7-
types:
8-
- opened
9-
branches:
10-
- 'main'
11-
- 'bug/fix-0729_beta'
12-
paths:
13-
- 'apps/adminConsole/package.json'
146
push:
157
branches:
168
- 'main'
@@ -31,6 +23,6 @@ jobs:
3123
PACKAGE_PATH: apps/adminConsole/package.json
3224
DIR_PATH: apps/adminConsole
3325
DOCKERFILE_PATH: Dockerfile-admin-console-client
34-
PACKAGE_BUILD_SCRIPT: build:console
26+
PACKAGE_BUILD_SCRIPT: yarn build:console
3527
DEFAULT_VERSION: latest
3628
secrets: inherit

.github/workflows/update-monitoring.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ jobs:
2525
PACKAGE_PATH: apps/monitoring/package.json
2626
DIR_PATH: apps/monitoring
2727
DOCKERFILE_PATH: Dockerfile-monitoring-client
28-
PACKAGE_BUILD_SCRIPT: build:monitoring
28+
PACKAGE_BUILD_SCRIPT: yarn build:monitoring
2929
DEFAULT_VERSION: latest
3030
secrets: inherit

.github/workflows/update-server.yml

-7
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,6 @@ name: Update Server
33
on:
44
workflow_dispatch:
55

6-
pull_request:
7-
types:
8-
- opened
9-
branches:
10-
- 'main'
11-
paths:
12-
- 'apps/server/package.json'
136
push:
147
branches:
158
- 'main'

apps/adminConsole/quasar.config.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ module.exports = configure(function (ctx) {
5858
LOGIN_USERNAME: process.env.LOGIN_USERNAME,
5959
LOGIN_PASSWORD: process.env.LOGIN_PASSWORD,
6060
AUTH_TOKEN: process.env.AUTH_TOKEN,
61-
ACCOUNT: process.env.ACCOUNT
61+
ACCOUNT: process.env.ACCOUNT,
62+
DEMO: process.env.DEMO
6263
},
6364

6465
// Add dependencies for transpiling with Babel (Array of string/regex)

apps/adminConsole/src/layouts/MainLayout.vue

+25-18
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import { onMounted, computed } from 'vue';
2525
import { useRouter, useRoute } from 'vue-router';
2626
import { useSplitMenu } from '@packages/ui/src/stores/menu';
2727
import { useI18n } from 'vue-i18n';
28+
import { useAppDetailStore } from 'src/stores/AppDetail';
2829
import {
2930
updateBreadcrumbs,
3031
options,
@@ -34,26 +35,32 @@ import {
3435
options3
3536
} from './breadcrumbs';
3637
const { t } = useI18n();
37-
38+
const appDetailStore = useAppDetailStore();
3839
const splitMenu = useSplitMenu();
3940
40-
const items = computed(() => [
41-
{
42-
key: 'terminus',
43-
label: t('TERMINUS'),
44-
children: options.value
45-
},
46-
{
47-
key: 'resource',
48-
label: t('RESOURCE'),
49-
children: options2.value
50-
},
51-
{
52-
key: 'middleware',
53-
label: t('MIDDLEWARE'),
54-
children: options3.value
55-
}
56-
]);
41+
const items = computed(() => {
42+
const item1 = [
43+
{
44+
key: 'terminus',
45+
label: t('TERMINUS'),
46+
children: options.value
47+
},
48+
{
49+
key: 'resource',
50+
label: t('RESOURCE'),
51+
children: options2.value
52+
}
53+
];
54+
const item2 = [
55+
{
56+
key: 'middleware',
57+
label: t('MIDDLEWARE'),
58+
children: options3.value
59+
}
60+
];
61+
62+
return appDetailStore.isDemo ? item1 : item1.concat(item2);
63+
});
5764
5865
const optionsAll = [...options.value, ...options2.value, ...options3.value];
5966

apps/adminConsole/src/layouts/breadcrumbs.ts

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { ref, computed } from 'vue';
22
import { t } from 'src/boot/i18n';
3+
import { useAppDetailStore } from 'src/stores/AppDetail';
34
export interface Breadcrumb {
45
title: string;
56
icon?: string;
@@ -83,11 +84,13 @@ export const options3 = computed(() => [
8384
}
8485
]);
8586

86-
const optionAll = computed(() => [
87-
...options.value,
88-
...options2.value,
89-
...options3.value
90-
]);
87+
const optionAll = computed(() => {
88+
const appDetailsStore = useAppDetailStore();
89+
90+
return appDetailsStore.isDemo
91+
? [...options.value, ...options2.value]
92+
: [...options.value, ...options2.value, ...options3.value];
93+
});
9194
export const active = ref(optionAll.value[0].key);
9295
export const currentItem = computed(() =>
9396
optionAll.value.find((item) => item.key === active.value)

apps/adminConsole/src/pages/ApplicationSpaces/Configurations/Configmaps.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<MyContentPage>
33
<template #extra>
44
<div class="col-auto">
5-
<QButtonStyle>
5+
<QButtonStyle v-permission>
66
<q-btn dense flat icon="sym_r_edit_square" @click="clickHandler">
77
<q-tooltip>
88
<div style="white-space: nowrap">

apps/adminConsole/src/pages/ApplicationSpaces/Configurations/Secrets.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<MyContentPage>
33
<template #extra>
44
<div class="col-auto">
5-
<QButtonStyle>
5+
<QButtonStyle v-permission>
66
<q-btn dense flat icon="sym_r_edit_square" @click="clickHandler">
77
<q-tooltip>
88
<div style="white-space: nowrap">

apps/adminConsole/src/pages/ApplicationSpaces/Configurations/ServiceAccounts.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<MyContentPage>
33
<template #extra>
44
<div class="col-auto">
5-
<QButtonStyle>
5+
<QButtonStyle v-permission>
66
<q-btn dense flat icon="sym_r_edit_square" @click="clickHandler">
77
<q-tooltip>
88
<div style="white-space: nowrap">

apps/adminConsole/src/pages/ApplicationSpaces/Services/Detail.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<MyContentPage>
44
<template #extra>
55
<div class="col-auto">
6-
<QButtonStyle>
6+
<QButtonStyle v-permission>
77
<q-btn dense flat icon="sym_r_edit_square" @click="clickHandler">
88
<q-tooltip>
99
<div style="white-space: nowrap">
@@ -12,7 +12,7 @@
1212
</q-tooltip>
1313
</q-btn>
1414
</QButtonStyle>
15-
<QButtonStyle>
15+
<QButtonStyle v-permission>
1616
<q-btn dense flat icon="sym_r_edit_square" @click="clickHandler2">
1717
<q-tooltip>
1818
<div style="white-space: nowrap">

apps/adminConsole/src/pages/ApplicationSpaces/Workloads/Detail.vue

+5-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@
1111
</q-tooltip>
1212
</q-btn>
1313
</QButtonStyle>
14-
<MoreSelection :options="options" size="md"></MoreSelection>
14+
<MoreSelection
15+
:options="options"
16+
size="md"
17+
v-permission
18+
></MoreSelection>
1519
</div>
1620
</template>
1721
<EnvironmentVariables ref="envRef"> </EnvironmentVariables>

apps/adminConsole/src/pages/Customresources/Detail.vue

+5-2
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,10 @@ const columns: any = computed(() => {
170170
label: t('CREATED_TIME'),
171171
align: 'left',
172172
field: 'createTime'
173-
},
173+
}
174+
];
175+
176+
const data2 = [
174177
{
175178
name: 'Operations',
176179
label: t('OPERATIONS'),
@@ -181,7 +184,7 @@ const columns: any = computed(() => {
181184
if (module === 'applications') {
182185
data.splice(1, 1);
183186
}
184-
return data;
187+
return appDetailStore.isDemo ? data : data.concat(data2);
185188
});
186189
187190
const currentYamlData = ref<any>({});

apps/adminConsole/src/pages/Jobs/CronJobsDetails.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<MyContentPage>
33
<template #extra>
4-
<div class="col-auto">
4+
<div class="col-auto" v-permission>
55
<QButtonStyle v-for="item in options" :key="item.value">
66
<q-btn dense flat :icon="item.icon" @click="item.onClick">
77
<q-tooltip>

apps/adminConsole/src/pages/Jobs/JobsDetails.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div class="absolute-position">
33
<MyContentPage>
44
<template #extra>
5-
<div class="col-auto">
5+
<div class="col-auto" v-permission>
66
<QButtonStyle v-for="item in options" :key="item.value">
77
<q-btn dense flat :icon="item.icon" @click="item.onClick">
88
<q-tooltip>

apps/adminConsole/src/pages/NetworkPolicies/PoliciesDetail.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<MyContentPage>
33
<template #extra>
44
<div class="col-auto">
5-
<QButtonStyle>
5+
<QButtonStyle v-permission>
66
<q-btn dense flat icon="sym_r_edit_square" @click="clickHandler">
77
<q-tooltip>
88
<div style="white-space: nowrap">

apps/adminConsole/src/pages/Pods/PodList.vue

+25-17
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)