Skip to content

Conversation

@nabilasherif
Copy link

@nabilasherif nabilasherif commented Aug 12, 2024

Description
add test plan
Changes

  • get plans
  • search for a plan
  • delete a plan

Related issues
#25

Comment on lines 29 to 35
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

})
}

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

<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

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

Choose a reason for hiding this comment

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

remove changes made in this file

Choose a reason for hiding this comment

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

same here

Choose a reason for hiding this comment

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

same here

Choose a reason for hiding this comment

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

same here

Copy link
Collaborator

@Mahmoud-Emad Mahmoud-Emad left a comment

Choose a reason for hiding this comment

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

Good job ya Nabila

Comment on lines +4 to +10
baseURL: 'https://server.gent02.dev.grid.tf/api',
timeout: 1000,
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + localStorage.getItem("token"),
Authorization: 'Bearer ' + localStorage.getItem('token'),
},
});
})
Copy link
Collaborator

Choose a reason for hiding this comment

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

As I mentioned earlier, this should be loaded from the window. Also, I've noticed that you and @abdahmed22 are re-implementing the same functionality in several open PRs. What do you think about creating a new PR with only these changes and merging it into your base branch to incorporate the changes you both made?

export { AuthClient, BaseClient };
async function GetPlans (projectId:string) {
try {
localStorage.setItem('token', 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNzIzNzI0Njg5LCJpYXQiOjE3MjM3MTUzODksImp0aSI6IjlmNTU1NmY0MjQzZTRjMmI5OWZmZTcxYjFkNWQxYmJiIiwidXNlcl9pZCI6MSwiZW1haWwiOiJuYWJpbGFAZ21haWwuY29tIn0.OUIvvLV5sgtyVQM_PtLu4HsqJaeOLC5FIx7w39VZ7js')
Copy link
Collaborator

Choose a reason for hiding this comment

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

We agree about the idea of the tokens no? We must not hard-code a user secret and push it into GitHub

}
}

async function SearchPlans (projectId:any, keyWord:any) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's define the types

Comment on lines +55 to +71
notifier.notify({
title: 'Success',
description: 'plan created successfully',
showProgressBar: true,
timeout: 7_000,
type: 'success',
})
} catch (error) {
console.error(error)
notifier.notify({
title: 'Fail',
description: 'Failed to create plan',
showProgressBar: true,
timeout: 7_000,
type: 'error',
})
} finally {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please do the same here

Comment on lines +99 to +102
// const testPlans = ref([{id: '1',title: 'Plan A',created: '2024-08-01',modified: '2024-08-05'},
// {id: '1',title: 'Plan A',created: '2024-08-01',modified: '2024-08-05'},
// {id: '1',title: 'Plan A',created: '2024-08-01',modified: '2024-08-05'}
// ]);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please remove this dummy data

}
};
async function updatePlan(planId){
Copy link
Collaborator

Choose a reason for hiding this comment

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

Define the type of planId

const title=ref("");
function openDeleteDialog(plan) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Define the type of plan

dialogDelete.value = true;
}
function openUpdateDialog(plan){
Copy link
Collaborator

Choose a reason for hiding this comment

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

Define the type of plan


serializer_class = TestSuitesDetailSerializer
permission_classes = (HasProjectAccess,)
# permission_classes = (HasProjectAccess,)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please don't push this, apply this on all backend commented code

DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
AUTH_USER_MODEL = "test_tracker.User"

print("config",config("CLIENT_DOMAIN_NAME"))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove the debug line

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants