Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/appwrite/console into 1.4.x
Browse files Browse the repository at this point in the history
  • Loading branch information
christyjacob4 committed Aug 9, 2023
2 parents 2a074e4 + ae9e67f commit 2a7c57e
Show file tree
Hide file tree
Showing 57 changed files with 333 additions and 214 deletions.
9 changes: 9 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This configuration file was automatically generated by Gitpod.
# Please adjust to your needs (see https://www.gitpod.io/docs/introduction/learn-gitpod/gitpod-yaml)
# and commit this file to your remote git repository to share the goodness with others.

# Learn more from ready-to-use templates: https://www.gitpod.io/docs/introduction/getting-started/quickstart

tasks:
- init: npm install && npm run build
command: npm run dev
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"dependencies": {
"@analytics/google-analytics": "^1.0.5",
"@appwrite.io/console": "npm:christy-console@^0.3.0",
"@appwrite.io/pink": "^0.0.6-rc.10",
"@appwrite.io/pink": "^0.0.6-rc.14",
"@analytics/google-tag-manager": "^0.5.3",
"@popperjs/core": "^2.11.6",
"@sentry/svelte": "^7.44.2",
Expand Down
7 changes: 7 additions & 0 deletions src/lib/components/cardGrid.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,10 @@
</div>
{/if}
</Card>

<style lang="scss">
.grid-1-2 > * {
width: 100%;
overflow: hidden;
}
</style>
16 changes: 10 additions & 6 deletions src/lib/components/clickableListItem.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@

<li class="clickable-list-item">
<a {href} class="clickable-list-button" on:click>
<h5 class="clickable-list-title u-trim-1">
<slot />
</h5>
<div class="clickable-list-desc">
<p class="text u-margin-block-start-8"><slot name="desc" /></p>
</div>
{#if $$slots.default}
<h5 class="clickable-list-title u-trim-1">
<slot />
</h5>
{/if}
{#if $$slots.desc}
<div class="clickable-list-desc">
<p class="text u-margin-block-start-8"><slot name="desc" /></p>
</div>
{/if}
</a>
</li>
4 changes: 3 additions & 1 deletion src/lib/components/drop.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
export let fullWidth = false;
export let fixed = false;
const dispatch = createEventDispatcher();
const dispatch = createEventDispatcher<{
blur: undefined;
}>();
let element: HTMLDivElement;
let tooltip: HTMLDivElement;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/permissions/actions.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
}
</script>

<DropList bind:show={showDropdown} placement="bottom-end">
<DropList bind:show={showDropdown} placement="bottom-end" fixed>
<slot />
<svelte:fragment slot="list">
<DropListItem disabled={$groups.has('any')} on:click={() => dispatch('create', ['any'])}>
Expand Down
132 changes: 67 additions & 65 deletions src/lib/components/permissions/permissions.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
<script lang="ts">
import { Button } from '$lib/elements/forms';
import {
Table,
TableBody,
TableCell,
TableCellHead,
Expand All @@ -24,6 +23,7 @@
import { writable, type Unsubscriber } from 'svelte/store';
import Actions from './actions.svelte';
import Row from './row.svelte';
import Table from '$lib/elements/table/table.svelte';
export let withCreate = false;
export let permissions: string[] = [];
Expand Down Expand Up @@ -142,74 +142,76 @@
</script>

{#if [...$groups]?.length}
<Table noMargin noStyles>
<TableHeader>
<TableCellHead width={70}>Role</TableCellHead>
{#if withCreate}
<TableCellHead width={70}>Create</TableCellHead>
{/if}
<TableCellHead width={70}>Read</TableCellHead>
<TableCellHead width={70}>Update</TableCellHead>
<TableCellHead width={70}>Delete</TableCellHead>
<TableCellHead width={40} />
</TableHeader>
<TableBody>
{#each [...$groups].sort(sortRoles) as [role, permission] (role)}
<TableRow>
<TableCell title="Role">
<Row {role} />
</TableCell>

{#if withCreate}
<TableCell title="Create">
<div class="table-wrapper">
<Table noMargin noStyles>
<TableHeader>
<TableCellHead width={140}>Role</TableCellHead>
{#if withCreate}
<TableCellHead width={60}>Create</TableCellHead>
{/if}
<TableCellHead width={50}>Read</TableCellHead>
<TableCellHead width={60}>Update</TableCellHead>
<TableCellHead width={60}>Delete</TableCellHead>
<TableCellHead width={32} />
</TableHeader>
<TableBody>
{#each [...$groups].sort(sortRoles) as [role, permission] (role)}
<TableRow>
<TableCell title="Role">
<Row {role} />
</TableCell>

{#if withCreate}
<TableCell title="Create">
<input
type="checkbox"
class="icon-check"
aria-label="Create"
checked={permission.create}
on:change={() => togglePermission(role, 'create')} />
</TableCell>
{/if}
<TableCell title="Read">
<input
type="checkbox"
class="icon-check"
aria-label="Read"
checked={permission.read}
on:change={() => togglePermission(role, 'read')} />
</TableCell>
<TableCell title="Update">
<input
type="checkbox"
class="icon-check"
aria-label="Create"
checked={permission.create}
on:change={() => togglePermission(role, 'create')} />
aria-label="Update"
checked={permission.update}
on:change={() => togglePermission(role, 'update')} />
</TableCell>
<TableCell title="Delete">
<input
type="checkbox"
class="icon-check"
aria-label="Delete"
checked={permission.delete}
on:change={() => togglePermission(role, 'delete')} />
</TableCell>

<TableCell title="Remove" width={40}>
<div class="u-flex">
<button
class="button is-text is-only-icon"
type="button"
aria-label="delete"
on:click={() => deleteRole(role)}>
<span class="icon-x" aria-hidden="true" />
</button>
</div>
</TableCell>
{/if}
<TableCell title="Read">
<input
type="checkbox"
class="icon-check"
aria-label="Read"
checked={permission.read}
on:change={() => togglePermission(role, 'read')} />
</TableCell>
<TableCell title="Update">
<input
type="checkbox"
class="icon-check"
aria-label="Update"
checked={permission.update}
on:change={() => togglePermission(role, 'update')} />
</TableCell>
<TableCell title="Delete">
<input
type="checkbox"
class="icon-check"
aria-label="Delete"
checked={permission.delete}
on:change={() => togglePermission(role, 'delete')} />
</TableCell>

<TableCell title="Remove" width={40}>
<div class="u-flex">
<button
class="button is-text is-only-icon"
type="button"
aria-label="delete"
on:click={() => deleteRole(role)}>
<span class="icon-x" aria-hidden="true" />
</button>
</div>
</TableCell>
</TableRow>
{/each}
</TableBody>
</Table>
</TableRow>
{/each}
</TableBody>
</Table>
</div>

<Actions
bind:showCustom
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/viewSelector.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
class="icon-view-boards u-opacity-50"
aria-hidden="true"
aria-label="columns" />
<span class="text is-only-desktop">Columns</span>
<span class="text">Columns</span>
<span class="inline-tag">{selectedColumnsNumber}</span>
</Button>
<svelte:fragment slot="list">
Expand Down
6 changes: 5 additions & 1 deletion src/lib/elements/forms/formItem.svelte
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
<li class="form-item">
<script lang="ts">
export let fullWidth = false;
</script>

<li class="form-item" class:u-width-full-line={fullWidth}>
<slot />
</li>
49 changes: 39 additions & 10 deletions src/lib/elements/forms/inputFile.svelte
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<script lang="ts">
import { Trim } from '$lib/components';
import { humanFileSize } from '$lib/helpers/sizeConvertion';
import { onMount } from 'svelte';
import { Helper } from '.';
export let label: string = null;
export let files: FileList;
export let list = new DataTransfer();
export let allowedFileExtensions: string[] = [];
export let maxSize: number = null;
export let required = false;
Expand All @@ -14,16 +15,35 @@
let input: HTMLInputElement;
let hovering = false;
function setFiles(value: FileList) {
if (!value) return;
const hasInvalidExt = Array.from(value).some((file) => {
const fileExtension = file.name.split('.').pop();
return !allowedFileExtensions.includes(fileExtension);
});
if (hasInvalidExt) {
error = 'Invalid file extension';
return;
}
files = value;
input.files = value;
}
function resetFiles() {
setFiles(new DataTransfer().files);
}
function dropHandler(ev: DragEvent) {
ev.dataTransfer.dropEffect = 'move';
hovering = false;
if (ev.dataTransfer.items) {
for (let i = 0; i < ev.dataTransfer.items.length; i++) {
if (ev.dataTransfer.items[i].kind === 'file') {
list.items.clear();
list.items.add(ev.dataTransfer.items[i].getAsFile());
files = list.files;
}
if (!ev.dataTransfer.items) return;
for (let i = 0; i < ev.dataTransfer.items.length; i++) {
if (ev.dataTransfer.items[i].kind === 'file') {
const dataTransfer = new DataTransfer();
dataTransfer.items.add(ev.dataTransfer.items[i].getAsFile());
setFiles(dataTransfer.files);
}
}
}
Expand All @@ -47,10 +67,19 @@
}
$: fileArray = files?.length ? Array.from(files) : [];
onMount(() => {
setFiles(files);
});
const handleChange = (event: Event) => {
const target = event.currentTarget as HTMLInputElement;
setFiles(target.files);
};
</script>

<input
bind:files
on:change={handleChange}
bind:this={input}
accept={allowedFileExtensions.map((n) => `.${n}`).join(',')}
type="file"
Expand Down Expand Up @@ -123,7 +152,7 @@
{fileSize.value + fileSize.unit}
</span>
<button
on:click={() => (files = null)}
on:click|preventDefault={resetFiles}
type="button"
class="button is-text is-only-icon u-margin-inline-start-auto"
aria-label="remove file"
Expand Down
3 changes: 2 additions & 1 deletion src/lib/elements/forms/inputText.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
export let readonly = false;
export let autofocus = false;
export let autocomplete = false;
export let fullWidth = false;
export let maxlength: number = null;
export let tooltip: string = null;
Expand Down Expand Up @@ -58,7 +59,7 @@
$: showNullCheckbox = nullable && !required;
</script>

<FormItem>
<FormItem {fullWidth}>
<Label {required} {tooltip} {optionalText} hide={!showLabel} for={id}>
{label}
</Label>
Expand Down
5 changes: 3 additions & 2 deletions src/lib/elements/table/tableScroll.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import type { Action } from 'svelte/action';
export let isSticky = false;
export let noMargin = false;
let isOverflowing = false;
const hasOverflow: Action<HTMLDivElement> = (node) => {
Expand Down Expand Up @@ -37,8 +38,8 @@
};
</script>

<div class="table-with-scroll u-margin-block-start-32" data-private>
<div class="table-wrapper" use:hasOverflow>
<div class="table-with-scroll" class:u-margin-block-start-32={!noMargin} data-private>
<div class="table-wrapper" use:hasOverflow={(v) => (isOverflowing = v)}>
<table class="table" class:is-sticky-scroll={isSticky && isOverflowing}>
<slot />
</table>
Expand Down
Loading

0 comments on commit 2a7c57e

Please sign in to comment.