Skip to content
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

Added /v2 api endpoint for scheduling delete project #117

Merged
merged 1 commit into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions web-app/packages/admin-app/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ export default defineConfig(({ mode }) => ({
'/v1': {
target: `http://127.0.0.1:${serverPort}`
},
'/v2': {
target: `http://127.0.0.1:${serverPort}`
},
'/app': {
target: `http://127.0.0.1:${serverPort}`
},
Expand Down
3 changes: 3 additions & 0 deletions web-app/packages/app/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ export default defineConfig(({ mode }) => ({
'/v1': {
target: `http://127.0.0.1:${serverPort}`
},
'/v2': {
target: `http://127.0.0.1:${serverPort}`
},
'/app': {
target: `http://127.0.0.1:${serverPort}`
},
Expand Down
13 changes: 4 additions & 9 deletions web-app/packages/lib/src/modules/project/projectApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
UpdateProjectAccessParams
} from '@/modules/project/types'


export const ProjectApi = {
async fetchProject(
namespace: string,
Expand Down Expand Up @@ -59,16 +58,12 @@
},

async deleteProject(
namespace: string,
projectName: string,
id: string,
withRetry?: boolean
): Promise<AxiosResponse<void>> {
return ProjectModule.httpService.delete(
`/v1/project/${namespace ? `${namespace}/${projectName}` : projectName}`,
{
...(withRetry ? getDefaultRetryOptions() : {})
}
)
return ProjectModule.httpService.post(`/v2/projects/${id}/scheduleDelete`, {
...(withRetry ? getDefaultRetryOptions() : {})
})
},

async unsubscribeProject(id: string): Promise<AxiosResponse<void>> {
Expand Down Expand Up @@ -193,7 +188,7 @@
transaction: string,
chunk: string,
token: CancelToken,
data: any,

Check warning on line 191 in web-app/packages/lib/src/modules/project/projectApi.ts

View workflow job for this annotation

GitHub Actions / JavaScript code convention check

Unexpected any. Specify a different type
withRetry?: boolean
): Promise<AxiosResponse<void>> {
return ProjectModule.httpService.post(
Expand Down
11 changes: 4 additions & 7 deletions web-app/packages/lib/src/modules/project/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ import {
ProjectAccessRequest,
GetUserAccessRequestsPayload,
GetProjectAccessRequestsPayload,
DownloadPayload
DownloadPayload,
DeleteProjectPayload
} from '@/modules/project/types'
import { useUserStore } from '@/modules/user/store'

Expand Down Expand Up @@ -266,17 +267,13 @@ export const useProjectStore = defineStore('projectModule', {
}
},

async deleteProject(payload) {
async deleteProject(payload: DeleteProjectPayload) {
const notificationStore = useNotificationStore()
const userStore = useUserStore()

try {
waitCursor(true)
await ProjectApi.deleteProject(
payload.namespace,
payload.projectName,
true
)
await ProjectApi.deleteProject(payload.projectId, true)
this.setProject({ project: null })
await userStore.fetchUserProfile()
waitCursor(false)
Expand Down
4 changes: 4 additions & 0 deletions web-app/packages/lib/src/modules/project/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,3 +307,7 @@ export interface TableDataHeader {
sortable?: boolean
width?: number
}

export interface DeleteProjectPayload {
projectId: string
}
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,7 @@ export default defineComponent({
},
onDeleteProject() {
this.deleteProject({
namespace: this.namespace,
projectName: this.projectName
projectId: this.project.id
})
}
}
Expand Down
Loading