Skip to content

Commit f32de54

Browse files
test-env
1 parent 48ef244 commit f32de54

File tree

5 files changed

+71
-38
lines changed

5 files changed

+71
-38
lines changed

.github/workflows/ci.yml

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -31,40 +31,40 @@ jobs:
3131
submodules-app-installation-id: ${{ secrets.INFRA_BOT_APP_INSTALLATION_ID }}
3232
submodules-app-private-key: ${{ secrets.INFRA_BOT_APP_PRIVATE_KEY }}
3333

34-
lint-and-test:
35-
timeout-minutes: 60
36-
runs-on: wlc-lint-and-test-runner
37-
steps:
38-
- uses: actions/checkout@v3
39-
- uses: actions/setup-node@v3
40-
with:
41-
node-version: 20
42-
- name: Install Yarn
43-
run: npm install -g yarn
44-
- name: Install dependencies
45-
run: yarn install --frozen-lockfile
34+
# lint-and-test:
35+
# timeout-minutes: 60
36+
# runs-on: wlc-lint-and-test-runner
37+
# steps:
38+
# - uses: actions/checkout@v3
39+
# - uses: actions/setup-node@v3
40+
# with:
41+
# node-version: 20
42+
# - name: Install Yarn
43+
# run: npm install -g yarn
44+
# - name: Install dependencies
45+
# run: yarn install --frozen-lockfile
4646

47-
- name: Run linter and formatter
48-
run: |
49-
yarn lint
50-
yarn format:check
47+
# - name: Run linter and formatter
48+
# run: |
49+
# yarn lint
50+
# yarn format:check
5151

52-
- name: Run unit tests
53-
run: yarn test:unit
52+
# - name: Run unit tests
53+
# run: yarn test:unit
5454

55-
- name: Install Playwright Browsers
56-
run: yarn playwright install --with-deps
57-
- name: Run Playwright tests
58-
run: yarn playwright test
59-
- uses: actions/upload-artifact@v4
60-
if: always()
61-
with:
62-
name: playwright-report
63-
path: playwright-report/
64-
retention-days: 30
55+
# - name: Install Playwright Browsers
56+
# run: yarn playwright install --with-deps
57+
# - name: Run Playwright tests
58+
# run: yarn playwright test
59+
# - uses: actions/upload-artifact@v4
60+
# if: always()
61+
# with:
62+
# name: playwright-report
63+
# path: playwright-report/
64+
# retention-days: 30
6565

6666
tag-deploy:
6767
needs:
68-
- lint-and-test
68+
# - lint-and-test
6969
- build-docker
7070
uses: CyberCRI/github-workflows/.github/workflows/tag-deploy.yaml@main

k8s/welearn-client/values.dev.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
injectedEnv:
22
nonSensitive:
33
VITE_API_BASE: https://api.welearn.k8s.lp-i.dev
4-
VITE_ENVIRONMENT: dev
4+
VITE_ENVIRONMENT: prod
55

66
ingress:
77
hosts:
8-
- welearn.k8s.lp-i.dev
8+
- welearn.k8s.lp-i.dev

src/components/NavComponent.vue

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@ import { ref } from 'vue';
77
import { useUserStore } from '@/stores/user';
88
import i18n from '@/localisation/i18n';
99
import BookIcon from './icons/BookIcon.vue';
10+
import { useFeatureFlipStore } from '@/stores/featureFlip';
11+
12+
const featureFlip = useFeatureFlipStore();
13+
const isFeatureEnabled = featureFlip.isFeatureEnabled('tutor');
1014
1115
const user = useUserStore();
1216
1317
const isNavOpened = ref<boolean>(false);
1418
15-
const isProd = import.meta.env.VITE_ENVIRONMENT === 'prod';
16-
console.log('isProd', isProd);
17-
1819
const handle_nav_bookmarks = () => {
1920
isNavOpened.value = false;
2021
user.updateSearchState('CHECK_BOOKMARK');
@@ -78,7 +79,7 @@ const handle_nav_bookmarks = () => {
7879
}}</span>
7980
</router-link>
8081
</div>
81-
<!-- <div class="link-wrapper" v-if="!isProd">
82+
<div class="link-wrapper" v-if="isFeatureEnabled">
8283
<router-link
8384
class="router-link"
8485
to="/tutor"
@@ -90,7 +91,7 @@ const handle_nav_bookmarks = () => {
9091
</div>
9192
<span class="item-name" :class="isNavOpened && 'visible-name'">{{ $t('tutor') }}</span>
9293
</router-link>
93-
</div> -->
94+
</div>
9495
<div class="nav-langs" :class="isNavOpened && 'open'">
9596
<a
9697
class="nav-lang"

src/router/index.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,24 @@
11
import { createRouter, createWebHistory, type RouteLocationNormalized } from 'vue-router';
22
import SearchSDG from '@/views/SearchSDG.vue';
3+
import { computed } from 'vue';
34
import QandA from '@/views/QandA.vue';
45
import Bookmarks from '@/views/BookmarkdSources.vue';
56
import Tutor from '@/views/TutorPage.vue';
67
import LandingPage from '@/views/LandingPage.vue';
78
import NotFound from '@/views/NotFound.vue';
89

9-
const env = import.meta.env.VITE_ENVIRONMENT;
10+
const mapEnv = {
11+
dev: 'dev',
12+
prod: 'prod'
13+
};
14+
15+
const computedEnv = computed(() => {
16+
const { VITE_ENVIRONMENT } = import.meta.env as 'dev' | 'prod';
17+
console.log(`VITE_ENVIRONMENT: ${VITE_ENVIRONMENT}`);
18+
console.log(mapEnv[VITE_ENVIRONMENT]);
19+
console.log(mapEnv[VITE_ENVIRONMENT] === 'prod');
20+
return mapEnv[VITE_ENVIRONMENT] !== 'prod';
21+
});
1022

1123
const router = createRouter({
1224
history: createWebHistory(import.meta.env.BASE_URL),
@@ -33,7 +45,7 @@ const router = createRouter({
3345
component: Bookmarks
3446
},
3547
{
36-
...(env !== 'prod' && {
48+
...(computedEnv && {
3749
path: '/tutor',
3850
name: 'tutor',
3951
component: Tutor

src/stores/featureFlip.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { defineStore } from 'pinia';
2+
type FeatureFlip = {
3+
[key: string]: boolean;
4+
};
5+
export const useFeatureFlipStore = defineStore('featureFlip', () => {
6+
const { VITE_ENVIRONMENT } = import.meta.env;
7+
const env = VITE_ENVIRONMENT as 'dev' | 'prod';
8+
const featureFlip: FeatureFlip = {
9+
tutor: env !== 'prod'
10+
};
11+
12+
const isFeatureEnabled = (feature: string) => {
13+
return featureFlip[feature] || false;
14+
};
15+
16+
return {
17+
featureFlip,
18+
isFeatureEnabled
19+
};
20+
});

0 commit comments

Comments
 (0)