Skip to content

Commit

Permalink
feature: types & design updates
Browse files Browse the repository at this point in the history
  • Loading branch information
abdahmed22 committed Aug 26, 2024
1 parent 76b97ae commit 1f316b0
Show file tree
Hide file tree
Showing 20 changed files with 116 additions and 85 deletions.
4 changes: 2 additions & 2 deletions client/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<p>To be implemented</p>
<ProjectsView />
</template>

<script lang="ts" setup>
//
import ProjectsView from './pages/projects/ProjectsView.vue'
</script>
2 changes: 1 addition & 1 deletion client/src/api/clients.ts → client/src/api/axios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const AuthClient: AxiosInstance = axios.create({
timeout: 1000,
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer ' + 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNzIzOTk0NzQ5LCJpYXQiOjE3MjM5ODU0NDksImp0aSI6ImRjMWRjMDU1ZTgzZjQ0NGQ4NDU1NTAwMGMyNDUwMTJhIiwidXNlcl9pZCI6NCwiZW1haWwiOiJib3VkaWVAYm91ZGllLmNvbSJ9.OgeODfFg5GxP1QxAAyu2FFlOMx2suAdWvjBtkK5eT0U',
Authorization: localStorage.getItem('token'),
},
})

Expand Down
4 changes: 2 additions & 2 deletions client/src/api/projectService.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AuthClient } from './clients'
import { AuthClient } from './axios'
import { Project } from '@/types/types'

export async function postProject (project :Partial<Project>) {
Expand All @@ -8,7 +8,7 @@ export async function postProject (project :Partial<Project>) {
export async function getProjects (page :number) {
return AuthClient.get('/dashboard/projects/', {
params: {
cursor: page,
page,
},
})
}
Expand Down
3 changes: 0 additions & 3 deletions client/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@ export {}
/* prettier-ignore */
declare module 'vue' {
export interface GlobalComponents {
AppFooter: typeof import('./components/AppFooter.vue')['default']
HelloWorld: typeof import('./components/HelloWorld.vue')['default']
ProjectForm: typeof import('./components/projects/ProjectForm.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
Test: typeof import('./components/test.vue')['default']
}
}
9 changes: 6 additions & 3 deletions client/src/components/projects/ProjectForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,21 +90,24 @@
.then((response: any) => {
notifier.notify({
title: 'Success',
description: 'Project created Successfully',
description: response.data.message,
showProgressBar: true,
timeout: 7_000,
type: 'success',
})
})
.catch((err: any) => {
let description = 'Can not create project'
if (err.response) {
description = err.response.data.detail
}
notifier.notify({
title: 'Fail',
description: 'Can not create project',
description,
showProgressBar: true,
timeout: 7_000,
type: 'error',
})
console.error(err)
})
}
Expand Down
Empty file removed client/src/components/test.vue
Empty file.
5 changes: 0 additions & 5 deletions client/src/layouts/README.md

This file was deleted.

13 changes: 0 additions & 13 deletions client/src/layouts/default.vue

This file was deleted.

6 changes: 0 additions & 6 deletions client/src/pages/DashboardView.vue

This file was deleted.

16 changes: 11 additions & 5 deletions client/src/pages/projects/ProjectsView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,20 @@
const getPage = async (page: number) => {
getProjects(page).then((response: any) => {
projects.value = response.data.results
// count.value = response.body.total_count
count.value = response.data.total_count
})
.catch((err: any) => {
let description = 'Can not get projects'
if (err.response) {
description = err.response.data.detail
}
notifier.notify({
title: 'Fail',
description: 'Can not get projects',
description,
showProgressBar: true,
timeout: 7_000,
type: 'error',
})
console.error(err)
})
}
Expand All @@ -132,14 +135,17 @@
.then((response: any) => {
})
.catch((err: any) => {
let description = 'Can not search for projects'
if (err.response) {
description = err.response.data.detail
}
notifier.notify({
title: 'Fail',
description: 'Can not search projects',
description,
showProgressBar: true,
timeout: 7_000,
type: 'error',
})
console.error(err)
})
}
Expand Down
1 change: 0 additions & 1 deletion client/src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { createRouter, createWebHistory } from 'vue-router/auto'
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
routes: [
{ path: '/', component: () => import('@/pages/DashboardView.vue') },
{ path: '/projects/:projectId', name: 'projectDetails', component: () => import('@/pages/projects/ProjectDetailsView.vue'), props: true },
],
})
Expand Down
1 change: 0 additions & 1 deletion client/src/typed-router.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ declare module 'vue-router/auto-routes' {
* Route name map generated by unplugin-vue-router
*/
export interface RouteNamedMap {
'/DashboardView': RouteRecordInfo<'/DashboardView', '/DashboardView', Record<never, never>, Record<never, never>>,
'/projects/ProjectDetailsView': RouteRecordInfo<'/projects/ProjectDetailsView', '/projects/ProjectDetailsView', Record<never, never>, Record<never, never>>,
'/projects/ProjectsView': RouteRecordInfo<'/projects/ProjectsView', '/projects/ProjectsView', Record<never, never>, Record<never, never>>,
}
Expand Down
69 changes: 60 additions & 9 deletions client/src/types/types.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,73 @@
enum Status {
NOT_STARTED='not_started',
IN_PROGRESS='in_progress',
COMPLETED='completed',
}

export type Activity = {
action: string,
date: string,
}

export type TestPlan = {
id: number,
modified: string,
created: string,
title: string,
type: string,
}

export type Requirement = {
id: number,
updated: string,
created: string,
title: string,
requirements: string[],
}

export type TestSuite = {
id: number,
modified: string,
created: string,
title: string,
number_of_test_cases: number,
test_plan: number,
}

export type TestRun = {

}

export type TestCase = {
id: number,
modified: string,
created: string,
title: string,
testcase_title: string,
requirement: string
last_saved: {
id: number,
full_name: string,
}
test_suite: string,
description: string,
test_steps: string,
expected_result: string,
}
export type Project = {
id: number,
user: string,
teams: string[],
modified: string,
created: string,
activity: Activity[],
total_test_plan: any,
total_requirements_docs: any,
total_suites: any, // update the any to type of each attribute
total_test_runs: any,
incomplete_test_runs_assigned_to_you: any,
people_with_the_most_incomplete_test_runs: any,
title:string,
repo_link:string,
short_description:string,
total_test_plan: TestPlan[],
total_requirements_docs: Requirement[],
total_suites: TestSuite[],
total_test_runs: TestRun[],
incomplete_test_runs_assigned_to_you: TestRun[],
people_with_the_most_incomplete_test_runs: TestRun[],
title: string,
repo_link: string,
short_description: string,
}
2 changes: 1 addition & 1 deletion server/test_tracker/views/member.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ class ProjectMembersAPIView(GenericAPIView):
"""This class to return all project members"""

serializer_class = ProjectTeamSerializer
permission_classes = (HasProjectAccess,)


def get(self, request: Request, project_id: str) -> Response:
"""Use this endpoint to get all project members"""
Expand Down
14 changes: 7 additions & 7 deletions server/test_tracker/views/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ProjectsDetailAPIView(GenericAPIView):
"""

serializer_class = ProjectsSerializer
# permission_classes = (HasProjectAccess,)
#

def get(self, request: Request, project_id: str) -> Response:
"""Return a single project based on the given project id"""
Expand Down Expand Up @@ -130,7 +130,7 @@ class AddMemberToProjectAPIView(GenericAPIView):
Add Member to project
"""

# permission_classes = (HasProjectAccess,)
#

def put(self, request: Request, project_id: Project, member_id: Member) -> Response:
"""
Expand Down Expand Up @@ -288,7 +288,7 @@ class AccountMembersNotInProjectAPIView(GenericAPIView):
Class to get all account members where members not in project
"""

permission_classes = (HasProjectAccess,)

serializer_class = ProjectTeamSerializer

def get(self, request: Request, project_id: str):
Expand Down Expand Up @@ -318,7 +318,7 @@ def get(self, request: Request, project_id: str):

class TestSuitesSectionAPIView(GenericAPIView):
serializer_class = TestSuiteSectionSerializer
permission_classes = (HasProjectAccess,)


def post(self, request: Request, project_id: str):
"""Post new section, required fields is [Title,]"""
Expand All @@ -333,7 +333,7 @@ def post(self, request: Request, project_id: str):

class GetTestSuitesSectionsAPIView(GenericAPIView):
serializer_class = GetTestSuiteSectionSerializer
permission_classes = (HasProjectAccess,)


def get(self, request: Request, project_id: str, test_suite: str) -> Response:
"""Get all project test suite sections"""
Expand All @@ -351,7 +351,7 @@ def get(self, request: Request, project_id: str, test_suite: str) -> Response:

class DeleteTestSuiteSectionAPIView(GenericAPIView):
"""Delete a test suite section by its id."""
permission_classes = (HasProjectAccess,)


def delete(self, request: Request, project_id: str, section_id: str) -> Response:
"""Delete a section with given id"""
Expand All @@ -370,7 +370,7 @@ def delete(self, request: Request, project_id: str, section_id: str) -> Response

class AddTestCaseToTestSuiteSectionAPIView(GenericAPIView):
"""Add a test case to test suite section"""
permission_classes = (HasProjectAccess,)

# serializer_class = AddTestCaseToTestSuiteSectionSerializers

def put(self, request: Request, project_id: str):
Expand Down
14 changes: 7 additions & 7 deletions server/test_tracker/views/requirement.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class PostNewRequirementDocsAPIView(GenericAPIView):
"""class project requirement view"""

serializer_class = RequirementDocsSerializer
permission_classes = (HasProjectAccess,)


def post(self, request: Request, project_id: str) -> Response:
"""post a new requirement"""
Expand Down Expand Up @@ -70,7 +70,7 @@ class GetAllRequirementDocsAPIView(GenericAPIView):
"""class project requirement view"""

serializer_class = RequirementDocsSerializer
permission_classes = (HasProjectAccess,)


def get(self, request: Request, project_id: str) -> Response:
"""
Expand All @@ -96,7 +96,7 @@ class project requirement view search on project requirements
"""

serializer_class = RequirementDocsSerializer
permission_classes = (HasProjectAccess,)


def get(self, request: Request, project_id: str, key_word: str) -> Response:
"""get all requirements for a project"""
Expand All @@ -121,7 +121,7 @@ class project requirement view
"""

serializer_class = RequirementDocsSerializer
permission_classes = (HasProjectAccess,)


def get(self, request: Request, project_id: str, requirement_id: str) -> Response:
"""Use this endpoint to get requirement detail and sub requirements"""
Expand Down Expand Up @@ -190,7 +190,7 @@ class RequirementAPIView(GenericAPIView):
"""This class is a sub requirement for project requirements"""

serializer_class = RequirementsSerializer
permission_classes = (HasProjectAccess,)


def post(self, request: Request, project_id: str, requirements_id: str) -> Response:
"""
Expand Down Expand Up @@ -269,7 +269,7 @@ class project requirement view
"""

serializer_class = RequirementsSerializer
permission_classes = (HasProjectAccess,)


def get(
self,
Expand Down Expand Up @@ -371,7 +371,7 @@ class SearchRequirementsInRequirementDocssAPIView(APIView):
Use this endpoint to filter any requirement based on title or description
"""

permission_classes = (HasProjectAccess,)


def get(self, request: Request, project_id: str, key_word: str):
"""
Expand Down
Loading

0 comments on commit 1f316b0

Please sign in to comment.