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:
Hayden 2023-01-28 11:53:00 -09:00 committed by GitHub
parent 4d220cdd9c
commit 3d295b5132
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
33 changed files with 1119 additions and 79 deletions

View file

@ -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 });
}

View file

@ -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;
}