Skip to content

Commit

Permalink
Merge pull request #2114 from undb-io/release/v1.0.0-110
Browse files Browse the repository at this point in the history
Release version v1.0.0-110
  • Loading branch information
nichenqin authored Oct 24, 2024
2 parents 0943287 + 233004d commit c58ea22
Show file tree
Hide file tree
Showing 85 changed files with 634 additions and 146 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Changelog

## v1.0.0-110

## v1.0.0-109


Expand Down
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
FROM node:22 as builder

Check warning on line 1 in Dockerfile

View workflow job for this annotation

GitHub Actions / docker

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

ARG CDN_URL
ENV PUBLIC_CDN_URL=$CDN_URL

WORKDIR /usr/src/app

RUN npm i -g bun
Expand Down
40 changes: 25 additions & 15 deletions apps/backend/src/modules/web/web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,38 @@ import Elysia from "elysia"
@singleton()
export class Web {
route() {
const index = Bun.file("dist/index.html")
const cdnUrl = process.env.PUBLIC_CDN_URL
const getAsset = async (path: string) => {
if (cdnUrl) {
const response = await fetch(`${cdnUrl}${path}`)
return response.text()
}
return Bun.file(`dist${path}`).text()
}

const getIndex = () => getAsset("/index.html")

return new Elysia()
.use(staticPlugin({ prefix: "/", assets: "dist" }))
.use(staticPlugin({ prefix: "/assets", assets: "assets" }))
.get("/", () => index)
.get("/t/*", () => index)
.get("/dashboards/*", () => index)
.get("/s/*", () => index)
.get("/bases/*", () => index)
.get("/account/*", () => index)
.get("/settings", () => index)
.get("/login", () => index)
.get("/signup", (ctx) => {
.get("/", () => getIndex())
.get("/t/*", () => getIndex())
.get("/dashboards/*", () => getIndex())
.get("/s/*", () => getIndex())
.get("/bases/*", () => getIndex())
.get("/account/*", () => getIndex())
.get("/settings", () => getIndex())
.get("/login", () => getIndex())
.get("/signup", async (ctx) => {
if (env.UNDB_DISABLE_REGISTRATION) {
ctx.redirect("/login", 302)
return
}
return index
return getIndex()
})
.get("/verify-email", () => index)
.get("/reset-password/*", () => index)
.get("/create-from-share/*", () => index)
.get("/templates/*", () => index)
.get("/verify-email", () => getIndex())
.get("/reset-password/*", () => getIndex())
.get("/create-from-share/*", () => getIndex())
.get("/templates/*", () => getIndex())
}
}
1 change: 1 addition & 0 deletions apps/frontend/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ enum FieldType {
date
duration
email
formula
id
json
longText
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
mutationFn: trpc.table.view.widget.update.mutate,
async onSuccess(data, variables, context) {
if (table) {
await invalidate(`table:${table.id.value}`)
await invalidate(`undb:table:${table.id.value}`)
await tick()
await client.invalidateQueries({ queryKey: ["aggregate", table.id.value, widget.id] })
}
Expand Down
22 changes: 13 additions & 9 deletions apps/frontend/src/lib/components/blocks/base/base-detail.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -39,35 +39,39 @@
{#if $hasPermission("table:create")}
<button
type="button"
class="flex h-32 w-80 flex-col justify-between rounded-lg border bg-gray-100 px-4 py-7 text-left transition-all hover:bg-gray-200/50 hover:shadow-lg"
class="flex h-32 w-80 flex-col justify-between rounded-lg border bg-neutral-50 px-4 py-7 text-left transition-all hover:bg-neutral-100/70 hover:shadow-md"
on:click={() => {
baseId.set(base.id)
openModal(CREATE_TABLE_MODAL)
}}
>
<PlusCircleIcon class="text-muted-foreground" />
<PlusCircleIcon class="text-blue-600" />

Create New Table
</button>
<button
type="button"
class="flex h-32 w-80 flex-col justify-between rounded-lg border bg-gray-100 px-4 py-7 text-left transition-all hover:bg-gray-200/50 hover:shadow-lg"
class="flex h-32 w-80 flex-col justify-between rounded-lg border bg-neutral-50 px-4 py-7 text-left transition-all hover:bg-neutral-100/70 hover:shadow-md"
on:click={() => {
baseId.set(base.id)
openModal(IMPORT_TABLE_MODAL)
}}
>
<ImportIcon class="text-muted-foreground" />
<ImportIcon class="text-orange-600" />

Import Table
</button>
{/if}
{#if $hasPermission("dashboard:create")}
<button
type="button"
class="flex h-32 w-80 flex-col justify-between rounded-lg border bg-gray-100 px-4 py-7 text-left transition-all hover:bg-gray-200/50 hover:shadow-lg"
class="flex h-32 w-80 flex-col justify-between rounded-lg border bg-neutral-50 px-4 py-7 text-left transition-all hover:bg-neutral-100/70 hover:shadow-md"
on:click={() => {
baseId.set(base.id)
openModal(CREATE_DASHBOARD_MODAL)
}}
>
<LayoutDashboardIcon class="text-muted-foreground" />
<LayoutDashboardIcon class="text-green-600" />

Create New Dashboard
</button>
Expand All @@ -76,14 +80,14 @@

<section class="flex flex-1 flex-col overflow-hidden pt-3">
{#if base.dashboards.length > 0}
<h3 class="mt-2 text-2xl font-semibold tracking-tight">Dashboards</h3>
<h3 class="mt-2 text-xl font-semibold tracking-tight">Dashboards</h3>

<div class="mt-4 flex flex-wrap gap-2 overflow-y-auto">
{#each base.dashboards as dashboard}
{#if dashboard}
<a
href={`/dashboards/${dashboard.id}`}
class="text-card-foreground h-[100px] w-[300px] overflow-hidden rounded-md border px-4 py-2"
class="text-card-foreground h-[100px] w-[300px] overflow-hidden rounded-md border px-4 py-2 transition-all hover:shadow-md"
>
<span class="inline-flex items-center font-semibold">
<GaugeIcon class="mr-2 h-4 w-4" />
Expand All @@ -98,7 +102,7 @@
</div>
{/if}

<h3 class="mt-2 text-2xl font-semibold tracking-tight">Tables</h3>
<h3 class="mt-2 text-xl font-semibold tracking-tight">Tables</h3>

<Table.Root class="flex w-full flex-1 flex-col overflow-y-auto">
<Table.Header class="flex w-full">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
async onSuccess() {
toast.success("Create field success")
reset()
await invalidate(`table:${$table.id.value}`)
await invalidate(`undb:table:${$table.id.value}`)
await client.invalidateQueries({ queryKey: ["records", $table.id.value] })
onSuccess()
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import CheckboxControl from "./checkbox-control.svelte"
import UrlControl from "./url-control.svelte"
import RollupField from "../field-value/rollup-field.svelte"
import FormulaField from "../field-value/formula-field.svelte"
import LongTextControl from "./long-text-control.svelte"
import CurrencyControl from "./currency-control.svelte"
import ButtonControl from "./button-control.svelte"
Expand Down Expand Up @@ -55,6 +56,7 @@
date: DateControl,
json: JsonControl,
checkbox: CheckboxControl,
formula: FormulaField,
user: UserControl,
duration: DurationControl,
percentage: PercentageControl,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
let selected = writable<string[]>(value)
onMount(() => {
selected.set(value)
selected?.set(value)
})
$: $selected, (value = $selected)
Expand All @@ -39,7 +39,7 @@
>
{#if hasValueReactive}
<Button size="xs" variant="link" class="px-0" builders={[builder]}>
{$selected.length} Linked Records
{$selected?.length} Linked Records
</Button>
{:else}
<Button size="xs" variant="link" type="button" class="text-muted-foreground px-0" builders={[builder]}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
MousePointerClickIcon,
TimerIcon,
PercentIcon,
SquareFunctionIcon,
} from "lucide-svelte"
export let type: FieldType
Expand Down Expand Up @@ -58,6 +59,7 @@
button: MousePointerClickIcon,
duration: TimerIcon,
percentage: PercentIcon,
formula: SquareFunctionIcon,
}
</script>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import DurationField from "./duration-field.svelte"
import PercentageField from "./percentage-field.svelte"
import ButtonControl from "../field-control/button-control.svelte"
import FormulaField from "./formula-field.svelte"
export let type: FieldType
export let value: any
Expand Down Expand Up @@ -55,6 +56,7 @@
user: UserField,
duration: DurationField,
percentage: PercentageField,
formula: FormulaField,
button: ButtonControl,
}
</script>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<script lang="ts">
import { cn } from "$lib/utils"
export let value: string | undefined = undefined
export let placeholder: string | undefined = undefined
$: v = value || placeholder || ""
</script>

{#if v}
<div class={cn("truncate text-left text-sm", $$restProps.class)}>
{v}
</div>
{/if}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
mutationFn: trpc.table.field.delete.mutate,
async onSuccess() {
toast.success("Delete field success")
await invalidate(`table:${$table.id.value}`)
await invalidate(`undb:table:${$table.id.value}`)
await client.invalidateQueries({ queryKey: ["records", $table.id.value] })
open = false
deleteAlertOpen = false
Expand All @@ -70,7 +70,7 @@
mutationFn: trpc.table.field.duplicate.mutate,
async onSuccess() {
toast.success("Duplicate field success")
await invalidate(`table:${$table.id.value}`)
await invalidate(`undb:table:${$table.id.value}`)
await client.invalidateQueries({ queryKey: ["records", $table.id.value] })
open = false
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
mutationKey: ["table", $table.id.value, "createForm"],
async onSuccess(data) {
toast.success("create form successfully")
await invalidate(`table:${$table.id.value}`)
await invalidate(`undb:table:${$table.id.value}`)
formId.set(data.formId)
onSuccess?.()
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
mutationKey: ["table", $table.id.value, "setForm"],
mutationFn: trpc.table.form.set.mutate,
async onSuccess() {
await invalidate(`table:${$table.id.value}`)
await invalidate(`undb:table:${$table.id.value}`)
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
mutationKey: ["table", $table.id.value, "setForm"],
mutationFn: trpc.table.form.set.mutate,
async onSuccess() {
await invalidate(`table:${$table.id.value}`)
await invalidate(`undb:table:${$table.id.value}`)
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
mutationKey: ["table", $table.id.value, "setForm"],
mutationFn: trpc.table.form.set.mutate,
async onSuccess() {
await invalidate(`table:${$table.id.value}`)
await invalidate(`undb:table:${$table.id.value}`)
},
})
Expand All @@ -55,7 +55,7 @@
mutationKey: ["table", $table.id.value, "deleteForm"],
mutationFn: trpc.table.form.delete.mutate,
async onSuccess() {
await invalidate(`table:${$table.id.value}`)
await invalidate(`undb:table:${$table.id.value}`)
await goto(`/t/${$table.id.value}`)
},
})
Expand All @@ -76,7 +76,7 @@
async onSuccess(data) {
toast.success("Duplicate form successfully")
duplicateFormDialog = false
await invalidate(`table:${$table.id.value}`)
await invalidate(`undb:table:${$table.id.value}`)
formId.set(data.formId)
},
})
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<script lang="ts">
import { Button } from "$lib/components/ui/button"
import { KanbanSquareDashedIcon } from "lucide-svelte"
import * as Dropdown from "$lib/components/ui/dropdown-menu"
import GalleryViewFieldForm from "./gallery-view-field-form.svelte"
import type { GalleryView } from "@undb/table"
export let view: GalleryView
export let readonly = false
</script>

<Dropdown.Root>
<Dropdown.Trigger asChild let:builder>
<Button variant="ghost" size="sm" builders={[builder]}>
<KanbanSquareDashedIcon class="text-muted-foreground mr-2 h-4 w-4 font-semibold" />
Gallery
</Button>
</Dropdown.Trigger>
<Dropdown.Content class="w-[400px] p-2">
<Dropdown.Label>
{#if !readonly}
Update kanban view
{:else}
Kanban view
{/if}
</Dropdown.Label>
<GalleryViewFieldForm {view} {readonly} />
</Dropdown.Content>
</Dropdown.Root>
Loading

0 comments on commit c58ea22

Please sign in to comment.