refactor: port collection move/reorder

This commit is contained in:
jamesgeorge007
2024-02-20 11:45:07 +05:30
parent 6ed9c09f06
commit 076006c4a6
5 changed files with 760 additions and 36 deletions

View File

@@ -656,7 +656,12 @@ export class PersonalWorkspaceProviderService
type: "collection",
value: {
collectionID: `${collectionID}/${id}`,
isLastItem:
item.folders?.length > 1
? id === item.folders.length - 1
: false,
name: childColl.name,
parentCollectionID: collectionID,
},
}
})
@@ -665,6 +670,11 @@ export class PersonalWorkspaceProviderService
return <RESTCollectionViewItem>{
type: "request",
value: {
isLastItem:
item.requests?.length > 1
? id === item.requests.length - 1
: false,
parentCollectionID: collectionID,
requestID: `${collectionID}/${id}`,
request: req,
},
@@ -711,7 +721,10 @@ export class PersonalWorkspaceProviderService
return this.restCollectionState.value.state.map((coll, id) => {
return {
collectionID: id.toString(),
isLastItem:
id === this.restCollectionState.value.state.length - 1,
name: coll.name,
parentIndex: null,
}
})
}),

View File

@@ -10,7 +10,9 @@ export type RESTCollectionLevelAuthHeadersView = {
export type RESTCollectionViewCollection = {
collectionID: string
isLastItem: boolean
name: string
parentCollectionID: string | null
}
export type RESTCollectionViewRequest = {
@@ -18,6 +20,8 @@ export type RESTCollectionViewRequest = {
requestID: string
request: HoppRESTRequest
isLastItem: boolean
parentCollectionID: string | null
}
export type RESTCollectionViewItem =