mirror of
https://github.com/sysadminsmedia/homebox.git
synced 2025-12-24 14:31:55 +01:00
feat: locations tree viewer (#248)
* location tree API * test fixes * initial tree location elements * locations tree page * update meta-data * code-gen * store item display preferences * introduce basic table/card view elements * codegen * set parent location during location creation * add item support for tree query * refactor tree view * wip: location selector improvements * type gen * rename items -> search * remove various log statements * fix markdown rendering for description * update location selectors * fix tests * fix currency tests * formatting
This commit is contained in:
@@ -1,16 +1,24 @@
|
||||
import { BaseAPI, route } from "../base";
|
||||
import { LocationOutCount, LocationCreate, LocationOut, LocationUpdate } from "../types/data-contracts";
|
||||
import { LocationOutCount, LocationCreate, LocationOut, LocationUpdate, TreeItem } from "../types/data-contracts";
|
||||
import { Results } from "../types/non-generated";
|
||||
|
||||
export type LocationsQuery = {
|
||||
filterChildren: boolean;
|
||||
};
|
||||
|
||||
export type TreeQuery = {
|
||||
withItems: boolean;
|
||||
};
|
||||
|
||||
export class LocationsApi extends BaseAPI {
|
||||
getAll(q: LocationsQuery = { filterChildren: false }) {
|
||||
return this.http.get<Results<LocationOutCount>>({ url: route("/locations", q) });
|
||||
}
|
||||
|
||||
getTree(tq = { withItems: false }) {
|
||||
return this.http.get<Results<TreeItem>>({ url: route("/locations/tree", tq) });
|
||||
}
|
||||
|
||||
create(body: LocationCreate) {
|
||||
return this.http.post<LocationCreate, LocationOut>({ url: route("/locations"), body });
|
||||
}
|
||||
|
||||
@@ -188,6 +188,7 @@ export interface LabelSummary {
|
||||
export interface LocationCreate {
|
||||
description: string;
|
||||
name: string;
|
||||
parentId: string | null;
|
||||
}
|
||||
|
||||
export interface LocationOut {
|
||||
@@ -270,6 +271,13 @@ export interface TotalsByOrganizer {
|
||||
total: number;
|
||||
}
|
||||
|
||||
export interface TreeItem {
|
||||
children: TreeItem[];
|
||||
id: string;
|
||||
name: string;
|
||||
type: string;
|
||||
}
|
||||
|
||||
export interface UserOut {
|
||||
email: string;
|
||||
groupId: string;
|
||||
@@ -347,13 +355,13 @@ export interface EnsureAssetIDResult {
|
||||
}
|
||||
|
||||
export interface GroupInvitation {
|
||||
expiresAt: string;
|
||||
expiresAt: Date;
|
||||
token: string;
|
||||
uses: number;
|
||||
}
|
||||
|
||||
export interface GroupInvitationCreate {
|
||||
expiresAt: string;
|
||||
expiresAt: Date;
|
||||
uses: number;
|
||||
}
|
||||
|
||||
@@ -363,6 +371,6 @@ export interface ItemAttachmentToken {
|
||||
|
||||
export interface TokenResponse {
|
||||
attachmentToken: string;
|
||||
expiresAt: string;
|
||||
expiresAt: Date;
|
||||
token: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user