Skip to content
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
},
"dependencies": {
"@mdi/font": "7.4.47",
"axios": "^1.7.3",
"core-js": "^3.37.1",
"roboto-fontface": "*",
"vue": "^3.4.31",
Expand Down
73 changes: 73 additions & 0 deletions client/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 40 additions & 1 deletion client/src/api/axios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,43 @@ const BaseClient: AxiosInstance = axios.create({
timeout: 1000,
});

export { AuthClient, BaseClient };

async function GetPlans(projectId:any){
await AuthClient.get(`/test_plan/${projectId}/`)
.then(response=>{
return response.data
})
.catch(error=>{
return error
})
}

async function SearchPlans(project_id:any,key_word:any){
await AuthClient.post(`/test_plan/${project_id}/search/${key_word}/`)
.then(response=>{
return response.data
})
.catch(error=>{
return error
})

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
await AuthClient.post(`/test_plan/${project_id}/search/${key_word}/`)
.then(response=>{
return response.data
})
.catch(error=>{
return error
})
return await AuthClient.post(`/test_plan/${project_id}/search/${key_word}/`)

handle it with try and catch when you call it

}

async function DeletePlan(project_id:any,test_plan_id:any) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

await AuthClient.delete(`/test_plan/${project_id}/actions/${test_plan_id}/`)
.then(response=>{
})
.catch(error=>{
return error
})
}

async function UpdatePlanTitle(project_id:any,test_plan_id:any,title:any) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

await AuthClient.put(`/test_plan/${project_id}/${test_plan_id}/update/`,title)
.then(response=>{
})
.catch(error=>{
return error
})
}

export default{ AuthClient, BaseClient,GetPlans,SearchPlans,DeletePlan,UpdatePlanTitle };
3 changes: 1 addition & 2 deletions client/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ export {}
/* prettier-ignore */
declare module 'vue' {
export interface GlobalComponents {
AppFooter: typeof import('./components/AppFooter.vue')['default']
HelloWorld: typeof import('./components/HelloWorld.vue')['default']
NewPlan: typeof import('./components/NewPlan.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
Test: typeof import('./components/test.vue')['default']
Expand Down
60 changes: 60 additions & 0 deletions client/src/components/NewPlan.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<template>
<div class="text-center pa-4">
<!-- this is just to be replaced later on with the + button on click , it opens the dialog.. -->
<v-btn @click="dialog = true">
Open Dialog
</v-btn>

<v-dialog v-model="dialog" max-width="600px">
<v-card >
<v-card-title>New Test Plan</v-card-title>
<v-divider></v-divider>
<br>
<v-card-subtitle>
<div>
<strong>Title</strong>
<v-text-field v-model="details.title" placeholder="Enter title "></v-text-field>
</div>
<div>
<v-radio-group v-model="details.type">
<v-radio label="Create With Default Templates" value="template"></v-radio>
<v-radio label="Create With Custom Templates" value="blank" ></v-radio>
</v-radio-group>
</div>
</v-card-subtitle>
<v-divider></v-divider>
<v-card-actions>
<v-btn color="primary" @click="dialog = false">Close</v-btn>
<v-btn color="success" @click="createTestPlan">Create</v-btn>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add loading and disabled props

</v-card-actions>
</v-card>
</v-dialog>
</div>
</template>

<script>
import axios from '@/api/axios';
export default{
setup(){
let dialog=ref(false);
const details = ref({
title: '',
type: null,
});

const createTestPlan=async()=>{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

implement notifier

try{
await axios.CreateNewTestPlan(details.value,projectId);
} catch(error){
console.error(error);
}
}
return{
dialog,
createTestPlan,
details
}

}
}
</script>
Loading