-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add members #40
base: development_2.0.0
Are you sure you want to change the base?
Add members #40
Conversation
3f60e34
to
f0b1832
Compare
client/src/api/axios.ts
Outdated
async function Search(searchInput:any) { | ||
await AuthClient.get(`/members/search/${searchInput}`) | ||
.then(response=>{ | ||
console.log('Search results:', response.data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove console logs
client/src/api/axios.ts
Outdated
await AuthClient.get(`/members/search/${searchInput}`) | ||
.then(response=>{ | ||
return response.data; | ||
}) | ||
.catch(error=>{ | ||
console.error(error); | ||
}) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await AuthClient.get(`/members/search/${searchInput}`) | |
.then(response=>{ | |
return response.data; | |
}) | |
.catch(error=>{ | |
console.error(error); | |
}) | |
} | |
return await AuthClient.get(`/members/search/${searchInput}`) | |
} | |
and handle it with try and catch when you call it
client/src/pages/AddMembers.vue
Outdated
<v-row > | ||
<p class="mt-2 text-h4 text-blue-darken-4" variant="h5">ALL MEMBERS</p> | ||
<v-spacer></v-spacer> | ||
<v-btn color="primary" @click="addMemberDialog=true"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add loading prop
client/src/pages/AddMembers.vue
Outdated
<v-card-actions> | ||
<v-spacer></v-spacer> | ||
<v-btn color="info" @click="addMemberDialog = false">Close</v-btn> | ||
<v-btn color="success" @click="addMember">ADD+</v-btn> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add loading and disabled prop
client/src/pages/AddMembers.vue
Outdated
// take userinfo | ||
}; | ||
|
||
const SearchMember = async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
implement notifier here
There was a problem hiding this 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, some comments
client/src/pages/AddMembers.vue
Outdated
required: true, | ||
}, | ||
project_id: { | ||
type: string, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use String
instead
client/src/api/axios.ts
Outdated
baseURL: import.meta.env.VITE_APP_ENDPOINT, | ||
baseURL: import.meta.env.VITE_APP_ENDPOINT, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Load it from the window instead
client/src/api/axios.ts
Outdated
return await AuthClient.get(`/members/search/${searchInput}`) | ||
} | ||
async function getProjectMembers (projectId:any) { | ||
return await AuthClient.get(`/members/project/${projectId}/members/`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use members without projects, should be /api/members/all/
use this endpoint /members/project/${projectId}/members/
only inside an active project
<div style="margin-left: 7cm; margin-right: 7cm;"> | ||
<v-container> | ||
<v-row> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to load the navbar here
client/src/pages/AddMembers.vue
Outdated
color="primary" | ||
@click="addMemberDialog=true" | ||
> | ||
INVITE MEMBERS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
INVITE MEMBERS | |
Invite member |
client/src/pages/AddMembers.vue
Outdated
<div style="margin-left: 7cm; margin-right: 7cm;"> | ||
<v-container> | ||
<v-row> | ||
<p class="mt-2 text-h4 text-blue-darken-4" variant="h5">ALL MEMBERS</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<p class="mt-2 text-h4 text-blue-darken-4" variant="h5">ALL MEMBERS</p> | |
<p class="mt-2 text-h4 text-blue-darken-4" variant="h5">All members</p> |
client/src/pages/AddMembers.vue
Outdated
v-model="inviteNewMember.first_name" | ||
density="compact" | ||
placeholder="First Name" | ||
prepend-inner-icon="mdi-account-outline" | ||
variant="outlined" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add the validation rules, and apply it to all inputs
client/src/pages/AddMembers.vue
Outdated
<p>Permission</p> | ||
<v-select | ||
:items="['Full access', 'Admin access']" | ||
label="Select" | ||
/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<p>Permission</p> | |
<v-select | |
:items="['Full access', 'Admin access']" | |
label="Select" | |
/> | |
<v-select | |
:items="['Full access', 'Admin access']" | |
label="Permission" | |
/> |
also, use an enum to normalizre the value, the backend require an exact pattern see the enum there
class PERMISSION_CHOICES(models.TextChoices):
FULL_ACCESS = "full_access", "Full access"
ADMIN_ACCESS = "admin_access", "Admin access"
so you need to send the full_access
or admin_access
as the value
<p>Permission</p> | |
<v-select | |
:items="['Full access', 'Admin access']" | |
label="Select" | |
/> | |
<v-select | |
:items="[{name: "Full access" value: 'full_access'}, {name: 'Admin access', value: 'admin_access'}]" | |
label="Permission" | |
/> |
client/src/pages/AddMembers.vue
Outdated
const inviteNewMember = ref({ | ||
first_name: '', | ||
last_name: '', | ||
email: '', | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to define an interface for the data
client/src/pages/AddMembers.vue
Outdated
notifier.notify({ | ||
title: 'success', | ||
description: 'member added successfully', | ||
showProgressBar: true, | ||
timeout: 7_000, | ||
type: 'success', | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The message will be returned from the backend
client/src/api/axios.ts
Outdated
baseURL: window.location.origin, | ||
timeout: 1000, | ||
headers: { | ||
'Content-Type': 'application/json', | ||
'Authorization': 'Bearer ' + localStorage.getItem("token"), | ||
Authorization: 'Bearer ' + localStorage.getItem('token'), | ||
}, | ||
}); | ||
}) | ||
|
||
const BaseClient: AxiosInstance = axios.create({ | ||
baseURL: import.meta.env.VITE_APP_ENDPOINT, | ||
baseURL: window.location.origin, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use window.env.SERVER_DOMAIN_NAME_API
instead
client/src/api/axios.ts
Outdated
|
||
export { AuthClient, BaseClient }; | ||
async function search (searchInput:any) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we agreed we need to define the types of the parameters
server/test_tracker/views/member.py
Outdated
@@ -39,7 +39,7 @@ class GetMemberApiView(GenericAPIView): | |||
""" | |||
|
|||
serializer_class = MemberSerializers | |||
permission_classes = (IsHost,) | |||
# permission_classes = (IsHost,) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't commit the commented code
Description
Add members page
Changes
Related issues
#19