From ebca2574d7dcb439c95827b66541a3dac3e6cbba Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Thu, 29 Jun 2023 13:44:26 +0200 Subject: [PATCH] lighten types in arg inputs --- frontend/src/lib/components/ArgInput.svelte | 2 +- frontend/src/lib/components/EditorBar.svelte | 287 ------------------ .../src/lib/components/FieldHeader.svelte | 12 +- .../lib/components/LightweightArgInput.svelte | 2 +- frontend/src/lib/components/Required.svelte | 2 +- 5 files changed, 9 insertions(+), 296 deletions(-) diff --git a/frontend/src/lib/components/ArgInput.svelte b/frontend/src/lib/components/ArgInput.svelte index 4bba2e1e74..d73e8f6afd 100644 --- a/frontend/src/lib/components/ArgInput.svelte +++ b/frontend/src/lib/components/ArgInput.svelte @@ -139,7 +139,7 @@ function validateInput(pattern: string | undefined, v: any): void { if (required && (v == undefined || v == null || v === '')) { - error = 'This field is required' + error = 'Required' valid = false } else { if (pattern && !testRegex(pattern, v)) { diff --git a/frontend/src/lib/components/EditorBar.svelte b/frontend/src/lib/components/EditorBar.svelte index 267ed501ea..1dd3f76657 100644 --- a/frontend/src/lib/components/EditorBar.svelte +++ b/frontend/src/lib/components/EditorBar.svelte @@ -134,293 +134,6 @@ return rec(schema.properties, true) } - $: console.log( - compile({ - type: 'object', - required: [], - properties: { - id: { - type: 'integer' - }, - meta: { - type: 'object', - properties: { - team: { - type: 'null' - }, - sender: { - type: 'object', - properties: { - id: { - type: 'integer' - }, - name: { - type: 'string' - }, - type: { - type: 'string' - }, - email: { - type: 'null' - }, - thumbnail: { - type: 'string' - }, - identifier: { - type: 'null' - }, - phone_number: { - type: 'null' - }, - custom_attributes: { - type: 'object' - }, - additional_attributes: { - type: 'object' - } - }, - additionalProperties: false - }, - assignee: { - type: 'null' - }, - hmac_verified: { - type: 'boolean' - } - }, - additionalProperties: false - }, - event: { - type: 'string' - }, - labels: { - type: 'array' - }, - status: { - type: 'string' - }, - channel: { - type: 'string' - }, - inbox_id: { - type: 'integer' - }, - messages: { - type: 'array', - items: { - type: 'object', - properties: { - id: { - type: 'integer' - }, - sender: { - type: 'object', - properties: { - id: { - type: 'integer' - }, - name: { - type: 'string' - }, - type: { - type: 'string' - }, - email: { - type: ['null'] - }, - thumbnail: { - type: 'string' - }, - identifier: { - type: ['null'] - }, - phone_number: { - type: ['null'] - }, - custom_attributes: { - type: 'object' - }, - additional_attributes: { - type: 'object' - } - }, - additionalProperties: false - }, - status: { - type: 'string' - }, - content: { - type: 'string' - }, - private: { - type: 'boolean' - }, - inbox_id: { - type: 'integer' - }, - sender_id: { - type: 'integer' - }, - source_id: { - type: ['null'] - }, - account_id: { - type: 'integer' - }, - created_at: { - type: 'integer' - }, - label_list: { - type: ['null'] - }, - updated_at: { - type: 'string', - format: 'date-time' - }, - sender_type: { - type: 'string' - }, - content_type: { - type: 'string' - }, - conversation: { - type: 'object', - properties: { - assignee_id: { - type: ['null'] - }, - unread_count: { - type: 'integer' - } - }, - additionalProperties: false - }, - message_type: { - type: 'integer' - }, - conversation_id: { - type: 'integer' - }, - content_attributes: { - type: 'object' - }, - external_source_ids: { - type: 'object' - }, - additional_attributes: { - type: 'object' - } - }, - additionalProperties: false - } - }, - can_reply: { - type: 'boolean' - }, - timestamp: { - type: 'integer' - }, - created_at: { - type: 'integer' - }, - unread_count: { - type: 'integer' - }, - contact_inbox: { - type: 'object', - properties: { - id: { - type: 'integer' - }, - inbox_id: { - type: 'integer' - }, - source_id: { - type: 'string', - format: 'uuid' - }, - contact_id: { - type: 'integer' - }, - created_at: { - type: 'string', - format: 'date-time' - }, - updated_at: { - type: 'string', - format: 'date-time' - }, - pubsub_token: { - type: 'string' - }, - hmac_verified: { - type: 'boolean' - } - }, - additionalProperties: false - }, - snoozed_until: { - type: 'null' - }, - custom_attributes: { - type: 'object' - }, - agent_last_seen_at: { - type: 'integer' - }, - contact_last_seen_at: { - type: 'integer' - }, - additional_attributes: { - type: 'object', - properties: { - browser: { - type: 'object', - properties: { - device_name: { - type: 'string' - }, - browser_name: { - type: 'string' - }, - platform_name: { - type: 'string' - }, - browser_version: { - type: 'string' - }, - platform_version: { - type: 'string' - } - }, - additionalProperties: false - }, - referer: { - type: 'string', - format: 'url' - }, - initiated_at: { - type: 'object', - properties: { - timestamp: { - type: 'string' - } - }, - additionalProperties: false - }, - browser_language: { - type: 'string' - } - }, - additionalProperties: false - }, - first_reply_created_at: { - type: 'null' - } - }, - additionalProperties: false - }) - ) let historyBrowserDrawerOpen = false diff --git a/frontend/src/lib/components/FieldHeader.svelte b/frontend/src/lib/components/FieldHeader.svelte index 0fce5472b5..5ff5a96b26 100644 --- a/frontend/src/lib/components/FieldHeader.svelte +++ b/frontend/src/lib/components/FieldHeader.svelte @@ -24,15 +24,15 @@ {#if displayType} - {#if format && format != ''} - - ({format}) + {#if format && !format.startsWith('resource')} + + {format} {:else} - - ({type ?? 'any'}{contentEncoding && contentEncoding != '' + + {type ?? 'any'}{contentEncoding && contentEncoding != '' ? `, encoding: ${contentEncoding}` - : ''}) + : ''} {/if} {/if} diff --git a/frontend/src/lib/components/LightweightArgInput.svelte b/frontend/src/lib/components/LightweightArgInput.svelte index 6bc8df8de7..e6ca392307 100644 --- a/frontend/src/lib/components/LightweightArgInput.svelte +++ b/frontend/src/lib/components/LightweightArgInput.svelte @@ -105,7 +105,7 @@ function validateInput(pattern: string | undefined, v: any): void { if (required && (v == undefined || v == null || v === '')) { - error = 'This field is required' + error = 'Required' valid = false } else { if (pattern && !testRegex(pattern, v)) { diff --git a/frontend/src/lib/components/Required.svelte b/frontend/src/lib/components/Required.svelte index 80e8138ce4..ef7c980ff1 100644 --- a/frontend/src/lib/components/Required.svelte +++ b/frontend/src/lib/components/Required.svelte @@ -4,7 +4,7 @@ {#if required} - * + * {:else if detail || detail != ''} ({detail != '' ? `${detail}` : ''})