Skip to content

Commit 3be8ac6

Browse files
committed
dev-demo: add system tests tab
1 parent 639dd63 commit 3be8ac6

3 files changed

Lines changed: 69 additions & 44 deletions

File tree

dev-demo/custom/AfComponents.vue

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -376,27 +376,8 @@
376376
]"
377377
:expandDepth="2"
378378
/>
379-
380-
<Button @click="createJob">
381-
Create Job
382-
</Button>
383-
384-
<Button @click="callHelloWorldApi">
385-
Call API
386-
</Button>
387-
388-
<Button @click="callHelloWorldApi">
389-
Refresh badge
390-
</Button>
391-
392-
<Button @click="doTest2faCall">
393-
Test 2FA API Call
394-
</Button>
395379
</div>
396-
397-
398380
</div>
399-
400381
</template>
401382

402383
<script setup lang="ts">
@@ -508,15 +489,6 @@ function doSmth(){
508489
adminforth.alert({message: 'You clicked the button!', variant: 'success' })
509490
}
510491
511-
async function createJob() {
512-
try {
513-
const res = await callApi({path: '/api/create-job/', method: 'POST'});
514-
console.log('Job created successfully:', res);
515-
} catch (error) {
516-
console.error('Error creating job:', error);
517-
}
518-
}
519-
520492
async function loadPageData(data) {
521493
const { offset, limit } = data;
522494
// in real app do await callAdminForthApi or await fetch to get date, use offset and limit value to slice data
@@ -538,20 +510,4 @@ watch(textInput, (newVal) => {
538510
console.log('Text input changed:', newVal, typeof newVal);
539511
});
540512
541-
async function callHelloWorldApi() {
542-
try {
543-
const response = await callApi({ path: '/api/hello/', method: 'GET' });
544-
console.log('API response:', response);
545-
} catch (error) {
546-
console.error('API error:', error);
547-
}
548-
}
549-
550-
async function doTest2faCall() {
551-
try {
552-
const response = await callApi({ path: '/api/test2faCall/', method: 'GET' });
553-
} catch (error) {
554-
console.error('2FA API error:', error);
555-
}
556-
}
557513
</script>

dev-demo/custom/SystemTest.vue

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<template>
2+
<div class="flex flex-col max-w-[200px] m-10 mt-20 gap-10">
3+
<Button @click="createJob">
4+
Create Job
5+
</Button>
6+
7+
<Button @click="callHelloWorldApi">
8+
Call API
9+
</Button>
10+
11+
<Button @click="callHelloWorldApi">
12+
Refresh badge
13+
</Button>
14+
15+
<Button @click="doTest2faCall">
16+
Test 2FA API Call
17+
</Button>
18+
</div>
19+
</template>
20+
21+
<script setup lang="ts">
22+
import { ref, watch } from 'vue';
23+
import { Button } from '@/afcl'
24+
import { useAdminforth } from '@/adminforth';
25+
import { callApi } from '@/utils';
26+
27+
28+
const { alert } = useAdminforth();
29+
import adminforth from '@/adminforth';
30+
31+
32+
const valueStart = ref()
33+
34+
watch(valueStart, (newVal) => {
35+
console.log('New start value:', newVal);
36+
});
37+
38+
async function createJob() {
39+
try {
40+
const res = await callApi({path: '/api/create-job/', method: 'POST'});
41+
console.log('Job created successfully:', res);
42+
} catch (error) {
43+
console.error('Error creating job:', error);
44+
}
45+
}
46+
47+
async function callHelloWorldApi() {
48+
try {
49+
const response = await callApi({ path: '/api/hello/', method: 'GET' });
50+
console.log('API response:', response);
51+
} catch (error) {
52+
console.error('API error:', error);
53+
}
54+
}
55+
56+
async function doTest2faCall() {
57+
try {
58+
const response = await callApi({ path: '/api/test2faCall/', method: 'GET' });
59+
} catch (error) {
60+
console.error('2FA API error:', error);
61+
}
62+
}
63+
</script>

dev-demo/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,12 @@ export const admin = new AdminForth({
198198
{
199199
type: 'gap'
200200
},
201+
{
202+
label: 'System tests',
203+
icon: 'flowbite:shield-solid',
204+
component: '@@/SystemTest.vue',
205+
path: '/system-tests',
206+
},
201207
{
202208
label: 'Users',
203209
icon: 'flowbite:user-solid',

0 commit comments

Comments
 (0)