mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
lint and var renames from merge.
This commit is contained in:
@@ -8,12 +8,12 @@
|
||||
|
||||
let {
|
||||
columns,
|
||||
isCustomCollection = false,
|
||||
isCustomTable = false,
|
||||
allowNoColumns = false,
|
||||
children
|
||||
}: {
|
||||
columns: Writable<Column[]>;
|
||||
isCustomCollection?: boolean;
|
||||
isCustomTable?: boolean;
|
||||
allowNoColumns?: boolean;
|
||||
children: Snippet<[toggle: () => void, selectedColumnsNumber: number]>;
|
||||
} = $props();
|
||||
@@ -34,16 +34,16 @@
|
||||
const saveColumnPreferences = () => {
|
||||
const shownColumns = $columns.filter((n) => n.hide !== true).map((n) => n.id);
|
||||
|
||||
if (isCustomCollection) {
|
||||
preferences.setCustomCollectionColumns(page.params.collection, shownColumns);
|
||||
if (isCustomTable) {
|
||||
preferences.setCustomTableColumns(page.params.table, shownColumns);
|
||||
} else {
|
||||
preferences.setColumns(shownColumns);
|
||||
}
|
||||
};
|
||||
|
||||
onMount(() => {
|
||||
if (isCustomCollection) {
|
||||
const shownColumns = preferences.getCustomCollectionColumns(page.params.collection);
|
||||
if (isCustomTable) {
|
||||
const shownColumns = preferences.getCustomTableColumns(page.params.table);
|
||||
|
||||
columns.update((columns) => {
|
||||
return columns.map((column) => {
|
||||
|
||||
@@ -9,14 +9,14 @@
|
||||
|
||||
export let columns: Writable<Column[]>;
|
||||
export let view: View;
|
||||
export let isCustomCollection = false;
|
||||
export let isCustomTable = false;
|
||||
export let hideView = false;
|
||||
export let hideColumns = false;
|
||||
export let allowNoColumns = false;
|
||||
</script>
|
||||
|
||||
{#if !hideColumns && view === View.Table}
|
||||
<ColumnSelector {columns} {isCustomCollection} {allowNoColumns}>
|
||||
<ColumnSelector {columns} {isCustomTable} {allowNoColumns}>
|
||||
{#snippet children(toggle, selectedColumnsNumber)}
|
||||
<Button.Button
|
||||
size="s"
|
||||
|
||||
@@ -13,14 +13,14 @@
|
||||
view = $bindable(),
|
||||
columns,
|
||||
hideColumns = false,
|
||||
isCustomCollection = false
|
||||
isCustomTable = false
|
||||
}: {
|
||||
show?: boolean;
|
||||
hideView?: boolean;
|
||||
view?: View;
|
||||
columns?: Writable<Column[]>;
|
||||
hideColumns?: boolean;
|
||||
isCustomCollection?: boolean;
|
||||
isCustomTable?: boolean;
|
||||
} = $props();
|
||||
</script>
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
{#if !hideColumns && $columns?.length}
|
||||
<Layout.Stack gap="xs">
|
||||
<Typography.Text>Columns</Typography.Text>
|
||||
<ColumnSelector {columns} {isCustomCollection}>
|
||||
<ColumnSelector {columns} {isCustomTable}>
|
||||
{#snippet children(toggle, selectedColumnsNumber)}
|
||||
<Button.Button
|
||||
size="s"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
export let title: string;
|
||||
export let columns: Writable<Column[]>;
|
||||
export let view: View;
|
||||
export let isCustomCollection = false;
|
||||
export let isCustomTable = false;
|
||||
export let hideView = false;
|
||||
export let hideColumns = false;
|
||||
export let allowNoColumns = false;
|
||||
@@ -20,7 +20,7 @@
|
||||
<ViewSelector
|
||||
{view}
|
||||
{columns}
|
||||
{isCustomCollection}
|
||||
{isCustomTable}
|
||||
{hideView}
|
||||
{hideColumns}
|
||||
{allowNoColumns} />
|
||||
|
||||
@@ -148,7 +148,7 @@ function createPreferences() {
|
||||
|
||||
return n;
|
||||
}),
|
||||
setCustomCollectionColumns: (tableId: string, columns: Preferences['columns']) =>
|
||||
setCustomTableColumns: (tableId: string, columns: Preferences['columns']) =>
|
||||
updateAndSync((n) => {
|
||||
if (!n?.tables?.[tableId]) {
|
||||
n ??= {};
|
||||
|
||||
+1
-1
@@ -103,7 +103,7 @@
|
||||
view={data.view}
|
||||
columns={tableColumns}
|
||||
hideView
|
||||
isCustomCollection />
|
||||
isCustomTable />
|
||||
{#if flags.showCsvImport(data)}
|
||||
<Button
|
||||
secondary
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@
|
||||
.filter((column) => column != selectedColumn.key);
|
||||
|
||||
// todo: change method name to table
|
||||
await preferences.setCustomCollectionColumns($table.$id, selectedColumns);
|
||||
await preferences.setCustomTableColumns($table.$id, selectedColumns);
|
||||
await invalidate(Dependencies.TABLE);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -32,8 +32,8 @@
|
||||
async function updateTableColumns() {
|
||||
const selectedColumns = preferences.getCustomTableColumns(tableId);
|
||||
selectedColumns.push(key ?? data?.key);
|
||||
await preferences.setCustomCollectionColumns(tableId, selectedColumns);
|
||||
await invalidate(Dependencies.COLLECTION);
|
||||
await preferences.setCustomTableColumns(tableId, selectedColumns);
|
||||
await invalidate(Dependencies.TABLE);
|
||||
}
|
||||
|
||||
async function submit() {
|
||||
|
||||
Reference in New Issue
Block a user