mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
fix: disabled forms for analysts
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
import { readable } from 'svelte/store';
|
||||
import type { FormContext } from './form.svelte';
|
||||
import { multiAction, type MultiActionArray } from '$lib/actions/multi-actions';
|
||||
import { isAnalyst } from '$lib/stores/roles';
|
||||
|
||||
export let submit = false;
|
||||
export let secondary = false;
|
||||
@@ -26,11 +27,12 @@
|
||||
export let actions: MultiActionArray = [];
|
||||
export let submissionLoader = false;
|
||||
|
||||
const inForm = hasContext('form') && submit;
|
||||
const isSubmitting = hasContext('form')
|
||||
? getContext<FormContext>('form').isSubmitting
|
||||
: readable(false);
|
||||
|
||||
$: internalDisabled = (submit && $isSubmitting) || disabled;
|
||||
$: internalDisabled = (submit && $isSubmitting) || disabled || (inForm && $isAnalyst);
|
||||
|
||||
function track() {
|
||||
if (!event) {
|
||||
|
||||
@@ -7,6 +7,7 @@ export const scopes = derived(page, ($page) => $page.data?.scopes ?? []);
|
||||
export const isDeveloper = derived(roles, ($roles) => $roles.includes('developer'));
|
||||
export const isBilling = derived(roles, ($roles) => $roles.includes('billing'));
|
||||
export const isOwner = derived(roles, ($roles) => $roles.includes('owner'));
|
||||
export const isAnalyst = derived(roles, ($roles) => $roles.includes('analyst'));
|
||||
|
||||
export const canWriteDatabases = derived(scopes, ($scopes) => $scopes.includes('databases.write'));
|
||||
export const canWriteProjects = derived(scopes, ($scopes) => $scopes.includes('projects.write'));
|
||||
|
||||
Reference in New Issue
Block a user