Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions addon/components/cell/telematic-provider.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<div ...attributes>
<button
type="button"
disabled={{and @column.permission (cannot @column.permission)}}
{{on "click" this.onClick}}
class="flex min-w-0 max-w-md items-start py-1 gap-2"
>
<div class="pt-0.5">
<Image src={{this.icon}} class="mr-3 h-8 w-8 flex-shrink-0 rounded-md" />
</div>
<div>
<div class="truncate text-sm font-semibold text-gray-900 hover:text-blue-600 dark:text-gray-100 dark:hover:text-blue-300">{{n-a this.name}}</div>
<div class="mt-0.5 line-clamp-2 whitespace-normal text-xs leading-4 text-gray-500 dark:text-gray-400">{{n-a this.description}}</div>
</div>
</button>
</div>
36 changes: 36 additions & 0 deletions addon/components/cell/telematic-provider.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import Component from '@glimmer/component';
import { action } from '@ember/object';

export default class CellTelematicProviderComponent extends Component {
get descriptor() {
return this.args.row?.provider_descriptor ?? {};
}

get name() {
return this.args.row?.name ?? this.descriptor.label ?? this.args.row?.provider;
}

get description() {
return this.descriptor.description ?? this.args.row?.provider;
}

get icon() {
return this.descriptor.icon;
}

@action onClick(event) {
const { row, column, onClick } = this.args;

if (typeof onClick === 'function') {
onClick(row, event);
}

if (typeof column?.action === 'function') {
column.action(row, event);
}

if (typeof column?.onClick === 'function') {
column.onClick(row, event);
}
}
}
75 changes: 75 additions & 0 deletions addon/components/modals/telematic-connection-diagnostics.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<Modal::Default @modalIsOpened={{@modalIsOpened}} @options={{@options}} @confirm={{@onConfirm}} @decline={{@onDecline}}>
<div class="modal-body-container space-y-4">
<div
class="rounded-md border p-4
{{if (eq this.connectionState 'success') 'border-green-200 bg-green-50 dark:border-green-800 dark:bg-green-900/10'}}
{{if (eq this.connectionState 'failed') 'border-red-200 bg-red-50 dark:border-red-800 dark:bg-red-900/10'}}
{{if (eq this.connectionState 'testing') 'border-blue-200 bg-blue-50 dark:border-blue-800 dark:bg-blue-900/10'}}
{{if (eq this.connectionState 'idle') 'border-gray-200 bg-white dark:border-gray-700 dark:bg-gray-800'}}"
>
<div class="flex flex-col gap-3 md:flex-row md:items-start md:justify-between">
<div class="flex min-w-0 gap-3">
<div
class="flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-md
{{if (eq this.connectionState 'success') 'bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-300'}}
{{if (eq this.connectionState 'failed') 'bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300'}}
{{if (eq this.connectionState 'testing') 'bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300'}}
{{if (eq this.connectionState 'idle') 'bg-gray-100 text-gray-500 dark:bg-gray-700 dark:text-gray-300'}}"
>
{{#if (eq this.connectionState "testing")}}
<Spinner class="h-4 w-4" />
{{else if (eq this.connectionState "success")}}
<FaIcon @icon="circle-check" />
{{else if (eq this.connectionState "failed")}}
<FaIcon @icon="circle-exclamation" />
{{else}}
<FaIcon @icon="plug" />
{{/if}}
</div>
<div class="min-w-0">
<h3 class="text-sm font-bold text-gray-900 dark:text-gray-100">{{this.connectionStateTitle}}</h3>
{{#if this.connectionStateMessage}}
<p class="mt-1 text-xs leading-5 text-gray-600 dark:text-gray-300">{{this.connectionStateMessage}}</p>
{{/if}}

{{#if this.hasConnectionMetadata}}
<div class="mt-3 flex flex-wrap gap-2">
{{#each this.connectionMetadataEntries as |item|}}
<span class="inline-flex items-center rounded-md border border-gray-200 bg-white px-2 py-1 text-[11px] text-gray-600 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-300">
<span class="mr-1 font-semibold text-gray-900 dark:text-gray-100">{{item.label}}</span>
{{item.value}}
</span>
{{/each}}
</div>
{{/if}}
</div>
</div>
</div>
</div>

<div class="rounded-md border border-gray-200 dark:border-gray-700">
<div class="flex items-center justify-between border-b border-gray-200 px-3 py-2 dark:border-gray-700">
<div class="flex items-center gap-2 text-xs font-semibold uppercase text-gray-500 dark:text-gray-400">
<FaIcon @icon="terminal" />
<span>Diagnostics</span>
</div>
<Button @icon="copy" @text="Copy diagnostics" @size="xs" @disabled={{this.runTest.isRunning}} @onClick={{this.copyConnectionDiagnostics}} />
</div>
<div class="max-h-64 overflow-y-auto rounded-b-md border border-gray-900 bg-gray-900 p-3 font-mono text-[11px] leading-5 shadow-inner dark:border-gray-700 dark:bg-gray-900">
{{#each this.connectionDiagnosticEntries as |entry|}}
<div
class="flex gap-3
{{if (eq entry.tone 'success') 'text-green-300'}}
{{if (eq entry.tone 'danger') 'text-red-300'}}
{{if (eq entry.tone 'info') 'text-blue-300'}}
{{if (eq entry.tone 'warning') 'text-yellow-300'}}
{{if (eq entry.tone 'muted') 'text-gray-300'}}"
>
<span class="flex-shrink-0 text-gray-500">[{{entry.time}}]</span>
<span class="min-w-0 break-words">{{entry.text}}</span>
</div>
{{/each}}
</div>
</div>
</div>
</Modal::Default>
Loading
Loading