forked from mirrors/homebox
fix: other minor fixes (#388)
* remove overflow-hidden on when no collapsed * fix recently added on homescreen * fix delete account formatting * add manufacturer to search * move nav button to left
This commit is contained in:
parent
ced5aef6d1
commit
4dd925caf0
8 changed files with 38 additions and 20 deletions
|
@ -58,6 +58,7 @@ func (ctrl *V1Controller) HandleItemsGetAll() errchain.HandlerFunc {
|
||||||
LabelIDs: queryUUIDList(params, "labels"),
|
LabelIDs: queryUUIDList(params, "labels"),
|
||||||
IncludeArchived: queryBool(params.Get("includeArchived")),
|
IncludeArchived: queryBool(params.Get("includeArchived")),
|
||||||
Fields: filterFieldItems(params["fields"]),
|
Fields: filterFieldItems(params["fields"]),
|
||||||
|
OrderBy: params.Get("orderBy"),
|
||||||
}
|
}
|
||||||
|
|
||||||
if strings.HasPrefix(v.Search, "#") {
|
if strings.HasPrefix(v.Search, "#") {
|
||||||
|
|
|
@ -35,7 +35,8 @@ type (
|
||||||
LabelIDs []uuid.UUID `json:"labelIds"`
|
LabelIDs []uuid.UUID `json:"labelIds"`
|
||||||
SortBy string `json:"sortBy"`
|
SortBy string `json:"sortBy"`
|
||||||
IncludeArchived bool `json:"includeArchived"`
|
IncludeArchived bool `json:"includeArchived"`
|
||||||
Fields []FieldQuery
|
Fields []FieldQuery `json:"fields"`
|
||||||
|
OrderBy string `json:"orderBy"`
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemField struct {
|
ItemField struct {
|
||||||
|
@ -326,6 +327,7 @@ func (e *ItemsRepository) QueryByGroup(ctx context.Context, gid uuid.UUID, q Ite
|
||||||
item.NameContainsFold(q.Search),
|
item.NameContainsFold(q.Search),
|
||||||
item.DescriptionContainsFold(q.Search),
|
item.DescriptionContainsFold(q.Search),
|
||||||
item.NotesContainsFold(q.Search),
|
item.NotesContainsFold(q.Search),
|
||||||
|
item.ManufacturerContainsFold(q.Search),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -385,7 +387,17 @@ func (e *ItemsRepository) QueryByGroup(ctx context.Context, gid uuid.UUID, q Ite
|
||||||
return PaginationResult[ItemSummary]{}, err
|
return PaginationResult[ItemSummary]{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
qb = qb.Order(ent.Asc(item.FieldName)).
|
// Order
|
||||||
|
switch q.OrderBy {
|
||||||
|
case "createdAt":
|
||||||
|
qb = qb.Order(ent.Desc(item.FieldCreatedAt))
|
||||||
|
case "updatedAt":
|
||||||
|
qb = qb.Order(ent.Desc(item.FieldUpdatedAt))
|
||||||
|
default: // "name"
|
||||||
|
qb = qb.Order(ent.Asc(item.FieldName))
|
||||||
|
}
|
||||||
|
|
||||||
|
qb = qb.
|
||||||
WithLabel().
|
WithLabel().
|
||||||
WithLocation()
|
WithLocation()
|
||||||
|
|
||||||
|
|
|
@ -23,10 +23,10 @@
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
:class="{
|
:class="{
|
||||||
'max-h-[99999px]': !collapsed,
|
'max-h-[9000px]': collapsable && !collapsed,
|
||||||
'max-h-0': collapsed,
|
'max-h-0 overflow-hidden': collapsed,
|
||||||
}"
|
}"
|
||||||
class="transition-[max-height] duration-200 overflow-hidden"
|
class="transition-[max-height] duration-200"
|
||||||
>
|
>
|
||||||
<slot />
|
<slot />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -79,7 +79,7 @@
|
||||||
};
|
};
|
||||||
const props = defineProps<Props>();
|
const props = defineProps<Props>();
|
||||||
|
|
||||||
const sortByProperty = ref<keyof ItemSummary>("name");
|
const sortByProperty = ref<keyof ItemSummary | "">("");
|
||||||
|
|
||||||
const headers = computed<TableHeader[]>(() => {
|
const headers = computed<TableHeader[]>(() => {
|
||||||
return [
|
return [
|
||||||
|
@ -136,6 +136,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function itemSort(a: ItemSummary, b: ItemSummary) {
|
function itemSort(a: ItemSummary, b: ItemSummary) {
|
||||||
|
if (!sortByProperty.value) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
const aLower = extractSortable(a, sortByProperty.value);
|
const aLower = extractSortable(a, sortByProperty.value);
|
||||||
const bLower = extractSortable(b, sortByProperty.value);
|
const bLower = extractSortable(b, sortByProperty.value);
|
||||||
|
|
||||||
|
|
|
@ -16,16 +16,16 @@
|
||||||
<AppHeaderDecor class="-mt-10 hidden lg:block" />
|
<AppHeaderDecor class="-mt-10 hidden lg:block" />
|
||||||
<!-- Button -->
|
<!-- Button -->
|
||||||
<div class="navbar z-[99] lg:hidden top-0 fixed bg-primary shadow-md drawer-button">
|
<div class="navbar z-[99] lg:hidden top-0 fixed bg-primary shadow-md drawer-button">
|
||||||
|
<label for="my-drawer-2" class="btn btn-square btn-ghost text-base-100 drawer-button lg:hidden">
|
||||||
|
<Icon name="mdi-menu" class="h-6 w-6" />
|
||||||
|
</label>
|
||||||
<NuxtLink to="/home">
|
<NuxtLink to="/home">
|
||||||
<h2 class="mt-1 ml-1 text-3xl font-bold tracking-tight text-base-100 flex">
|
<h2 class="text-3xl font-bold tracking-tight text-base-100 flex">
|
||||||
HomeB
|
HomeB
|
||||||
<AppLogo class="w-8 -mb-3" />
|
<AppLogo class="w-8 -mb-3" />
|
||||||
x
|
x
|
||||||
</h2>
|
</h2>
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
<label for="my-drawer-2" class="btn btn-square btn-ghost ml-auto text-base-100 drawer-button lg:hidden">
|
|
||||||
<Icon name="mdi-menu" class="h-6 w-6" />
|
|
||||||
</label>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
|
|
|
@ -15,6 +15,7 @@ import { AttachmentTypes, PaginationResult } from "../types/non-generated";
|
||||||
import { Requests } from "~~/lib/requests";
|
import { Requests } from "~~/lib/requests";
|
||||||
|
|
||||||
export type ItemsQuery = {
|
export type ItemsQuery = {
|
||||||
|
orderBy?: string;
|
||||||
includeArchived?: boolean;
|
includeArchived?: boolean;
|
||||||
page?: number;
|
page?: number;
|
||||||
pageSize?: number;
|
pageSize?: number;
|
||||||
|
|
|
@ -5,6 +5,7 @@ export function itemsTable(api: UserClient) {
|
||||||
const { data } = await api.items.getAll({
|
const { data } = await api.items.getAll({
|
||||||
page: 1,
|
page: 1,
|
||||||
pageSize: 5,
|
pageSize: 5,
|
||||||
|
orderBy: "createdAt",
|
||||||
});
|
});
|
||||||
return data.items;
|
return data.items;
|
||||||
});
|
});
|
||||||
|
|
|
@ -473,11 +473,10 @@
|
||||||
<span class="text-base-600"> Delete Account</span>
|
<span class="text-base-600"> Delete Account</span>
|
||||||
<template #description> Delete your account and all it's associated data </template>
|
<template #description> Delete your account and all it's associated data </template>
|
||||||
</BaseSectionHeader>
|
</BaseSectionHeader>
|
||||||
|
</template>
|
||||||
<div class="py-4 border-t-2 border-gray-300">
|
<div class="p-4 px-6 border-t-2 border-gray-300">
|
||||||
<BaseButton size="sm" class="btn-error" @click="deleteProfile"> Delete Account </BaseButton>
|
<BaseButton size="sm" class="btn-error" @click="deleteProfile"> Delete Account </BaseButton>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
|
||||||
</BaseCard>
|
</BaseCard>
|
||||||
</BaseContainer>
|
</BaseContainer>
|
||||||
<footer v-if="status" class="text-center w-full bottom-0 pb-4">
|
<footer v-if="status" class="text-center w-full bottom-0 pb-4">
|
||||||
|
|
Loading…
Reference in a new issue