Modular logistics and supply chain operating system (LSOS)
JavaScript driver-appfleet-managementfreight-managementinfrastructureinventory-managementlast-mile-deliverylogisticsondemandopen-sourceorder-managementroute-optimizationsupply-chain-managementtracking-and-monitoringtransport-management-systemtransportationwarehouse-management
fix(oauth): list linked and available providers under separate headings
Ronald A. Richardson3b84a9a927bf
diff --git a/console/app/components/account/connected-accounts.hbs b/console/app/components/account/connected-accounts.hbsindex 1cb7947d..a556c2f1 100644--- a/console/app/components/account/connected-accounts.hbs+++ b/console/app/components/account/connected-accounts.hbs@@ -2,48 +2,52 @@<ContentPanel @title={{t "auth.login.oauth.connected-accounts"}} @open={{true}} @wrapperClass="bordered-classic"><p class="text-sm text-gray-700 dark:text-gray-300 mb-4">{{t "auth.login.oauth.connected-accounts-help"}}</p>- <div class="space-y-2">- {{#each this.identities as |identity|}}- <div class="flex items-center justify-between rounded-md border border-gray-200 dark:border-gray-700 px-3 py-2">- <div class="flex items-center">- {{#if identity.icon}}- <FaIcon @icon={{identity.icon}} @prefix="fab" class="mr-3 text-gray-600 dark:text-gray-300" />- {{/if}}- <div>- <div class="text-sm font-semibold text-gray-900 dark:text-white">{{identity.label}}</div>- {{#if identity.provider_email}}- <div class="text-xs text-gray-500 dark:text-gray-400">{{identity.provider_email}}</div>+ {{#if this.identities.length}}+ <h4 class="text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400 mb-2">{{t "auth.login.oauth.linked-heading"}}</h4>+ <div class="space-y-2" data-test-linked-providers>+ {{#each this.identities as |identity|}}+ <div class="flex items-center justify-between rounded-md border border-gray-200 dark:border-gray-700 px-3 py-2">+ <div class="flex items-center">+ {{#if identity.icon}}+ <FaIcon @icon={{identity.icon}} @prefix="fab" class="mr-3 text-gray-600 dark:text-gray-300" />{{/if}}+ <div>+ <div class="text-sm font-semibold text-gray-900 dark:text-white">{{identity.label}}</div>+ {{#if identity.provider_email}}+ <div class="text-xs text-gray-500 dark:text-gray-400">{{identity.provider_email}}</div>+ {{/if}}+ </div></div>+ <Button+ @size="xs"+ @type="danger"+ @icon="link-slash"+ @text={{t "auth.login.oauth.unlink-button"}}+ @disabled={{this.isLastCredential identity}}+ @helpText={{if (this.isLastCredential identity) (t "auth.login.oauth.errors.last-credential")}}+ @isLoading={{this.unlink.isRunning}}+ @onClick={{fn this.confirmUnlink identity}}+ /></div>- <Button- @size="xs"- @type="danger"- @icon="link-slash"- @text={{t "auth.login.oauth.unlink-button"}}- @disabled={{this.isLastCredential identity}}- @helpText={{if (this.isLastCredential identity) (t "auth.login.oauth.errors.last-credential")}}- @isLoading={{this.unlink.isRunning}}- @onClick={{fn this.confirmUnlink identity}}- />- </div>- {{/each}}+ {{/each}}+ </div>+ {{/if}}- {{#each this.available as |provider|}}- <div class="flex items-center justify-between rounded-md border border-dashed border-gray-300 dark:border-gray-700 px-3 py-2">- <div class="flex items-center">- <FaIcon @icon={{provider.icon}} @prefix="fab" class="mr-3 text-gray-400" />- <div class="text-sm text-gray-700 dark:text-gray-300">{{provider.label}}</div>+ {{#if this.available.length}}+ <h4 class="text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400 mb-2 {{if this.identities.length 'mt-5'}}">+ {{t "auth.login.oauth.available-heading"}}+ </h4>+ <div class="space-y-2" data-test-available-providers>+ {{#each this.available as |provider|}}+ <div class="flex items-center justify-between rounded-md border border-dashed border-gray-300 dark:border-gray-700 px-3 py-2">+ <div class="flex items-center">+ <FaIcon @icon={{provider.icon}} @prefix="fab" class="mr-3 text-gray-400" />+ <div class="text-sm text-gray-700 dark:text-gray-300">{{provider.label}}</div>+ </div>+ <Button @size="xs" @icon="link" @text={{t "auth.login.oauth.link-button"}} @isLoading={{this.link.isRunning}} @onClick={{perform this.link provider}} /></div>- <Button- @size="xs"- @icon="link"- @text={{t "auth.login.oauth.link-button"}}- @isLoading={{this.link.isRunning}}- @onClick={{perform this.link provider}}- />- </div>- {{/each}}- </div>+ {{/each}}+ </div>+ {{/if}}</ContentPanel>-{{/if}}+{{/if}}\ No newline at end of filediff --git a/console/tests/integration/components/account/connected-accounts-test.js b/console/tests/integration/components/account/connected-accounts-test.jsindex 8246c84e..d80e8ed6 100644--- a/console/tests/integration/components/account/connected-accounts-test.js+++ b/console/tests/integration/components/account/connected-accounts-test.js@@ -1,6 +1,6 @@import { module, test } from 'qunit';import { setupRenderingTest } from '@fleetbase/console/tests/helpers';-import { render } from '@ember/test-helpers';+import { render, click, waitUntil } from '@ember/test-helpers';import { hbs } from 'ember-cli-htmlbars';import Service from '@ember/service';import ConnectedAccountsComponent from '@fleetbase/console/components/account/connected-accounts';@@ -107,6 +107,44 @@ module('Integration | Component | account/connected-accounts', function (hooks)assert.deepEqual(captured.instance.identities, []);});+ test('unlinking through the confirmation dialog removes the provider from the linked list', async function (assert) {+ // What the API really answers: nothing linked, and the provider offered to link again.+ this.unlinkResult = () =>+ Promise.resolve({+ identities: [],+ available: [+ { id: 'google', label: 'Google', icon: 'google' },+ { id: 'github', label: 'GitHub', icon: 'github' },+ ],+ has_password: true,+ });+ await render(hbs`<ModalsContainer /><Account::ConnectedAccounts />`);++ const unlinkButton = [...this.element.querySelectorAll('button')].find((button) => button.textContent.trim() === 'Unlink');+ await click(unlinkButton);+ await waitUntil(() => document.querySelector('.flb--confirm-modal'));+ const accept = [...document.querySelectorAll('.flb--confirm-modal button')].find((button) => button.textContent.trim() === 'Unlink');+ await click(accept);++ assert.deepEqual(this.unlinked, ['google']);+ assert.strictEqual([...this.element.querySelectorAll('button')].filter((button) => button.textContent.trim() === 'Unlink').length, 0, 'no provider is shown as linked');+ assert.dom(this.element).doesNotContainText('[email protected]');+ // Google moves to the "available" group, under its own heading, not beside linked ones.+ assert.dom('[data-test-linked-providers]').doesNotExist();+ assert.dom('[data-test-available-providers]').containsText('Google');+ assert.dom(this.element).containsText('Available to link');+ });++ test('linked and available providers are listed under separate headings', async function (assert) {+ await render(hbs`<Account::ConnectedAccounts />`);++ assert.dom('[data-test-linked-providers]').containsText('Google');+ assert.dom('[data-test-linked-providers]').doesNotContainText('GitHub');+ assert.dom('[data-test-available-providers]').containsText('GitHub');+ assert.dom(this.element).containsText('Linked');+ assert.dom(this.element).containsText('Available to link');+ });+test('it explains a refused unlink in plain language', async function (assert) {const captured = captureComponent(this.owner, 'account/connected-accounts', ConnectedAccountsComponent);this.unlinkResult = () => Promise.reject({ code: 'last_credential' });diff --git a/console/translations/ar-ae.yaml b/console/translations/ar-ae.yamlindex 8373e7e2..5c7b3a90 100644--- a/console/translations/ar-ae.yaml+++ b/console/translations/ar-ae.yaml@@ -576,6 +576,8 @@ auth:finish-signup: 'أكمل إعداد حساب Fleetbase للمتابعة.'connected-accounts: 'الحسابات المرتبطة'connected-accounts-help: 'سجّل الدخول عبر مزوّد بدلاً من كلمة المرور. يمكنك ربط أكثر من مزوّد.'+ linked-heading: 'مرتبطة'+ available-heading: 'متاحة للربط'link-button: 'ربط'unlink-button: 'إلغاء الربط'unlink-title: 'إلغاء ربط {provider}؟'diff --git a/console/translations/bg-bg.yaml b/console/translations/bg-bg.yamlindex 3c0732ca..ae03bcd0 100644--- a/console/translations/bg-bg.yaml+++ b/console/translations/bg-bg.yaml@@ -583,6 +583,8 @@ auth:finish-signup: 'Завършете настройката на профила си във Fleetbase, за да продължите.'connected-accounts: 'Свързани акаунти'connected-accounts-help: 'Влизайте чрез доставчик вместо с парола. Можете да свържете повече от един.'+ linked-heading: 'Свързани'+ available-heading: 'Налични за свързване'link-button: 'Свържи'unlink-button: 'Прекъсни'unlink-title: 'Да се прекъсне ли {provider}?'diff --git a/console/translations/de-de.yaml b/console/translations/de-de.yamlindex b5e933fb..e03f9893 100644--- a/console/translations/de-de.yaml+++ b/console/translations/de-de.yaml@@ -612,6 +612,8 @@ auth:finish-signup: 'Schließen Sie die Einrichtung Ihres Fleetbase-Kontos ab, um fortzufahren.'connected-accounts: 'Verknüpfte Konten'connected-accounts-help: 'Melden Sie sich über einen Anbieter statt mit einem Passwort an. Sie können mehrere verknüpfen.'+ linked-heading: 'Verknüpft'+ available-heading: 'Zum Verknüpfen verfügbar'link-button: 'Verknüpfen'unlink-button: 'Trennen'unlink-title: '{provider} trennen?'diff --git a/console/translations/en-us.yaml b/console/translations/en-us.yamlindex e154ead7..a0d175fe 100644--- a/console/translations/en-us.yaml+++ b/console/translations/en-us.yaml@@ -623,6 +623,8 @@ auth:finish-signup: 'Finish setting up your Fleetbase account to continue.'connected-accounts: 'Connected accounts'connected-accounts-help: 'Sign in with a provider instead of a password. You can link more than one.'+ linked-heading: 'Linked'+ available-heading: 'Available to link'link-button: 'Link'unlink-button: 'Unlink'unlink-title: 'Unlink {provider}?'diff --git a/console/translations/es-es.yaml b/console/translations/es-es.yamlindex 7940eb9c..bc316e2d 100644--- a/console/translations/es-es.yaml+++ b/console/translations/es-es.yaml@@ -585,6 +585,8 @@ auth:finish-signup: 'Termine de configurar su cuenta de Fleetbase para continuar.'connected-accounts: 'Cuentas vinculadas'connected-accounts-help: 'Inicie sesión con un proveedor en lugar de una contraseña. Puede vincular más de uno.'+ linked-heading: 'Vinculadas'+ available-heading: 'Disponibles para vincular'link-button: 'Vincular'unlink-button: 'Desvincular'unlink-title: '¿Desvincular {provider}?'diff --git a/console/translations/es-mx.yaml b/console/translations/es-mx.yamlindex b1cf5227..19835162 100644--- a/console/translations/es-mx.yaml+++ b/console/translations/es-mx.yaml@@ -615,6 +615,8 @@ auth:finish-signup: 'Termina de configurar tu cuenta de Fleetbase para continuar.'connected-accounts: 'Cuentas vinculadas'connected-accounts-help: 'Inicia sesión con un proveedor en lugar de una contraseña. Puedes vincular más de uno.'+ linked-heading: 'Vinculadas'+ available-heading: 'Disponibles para vincular'link-button: 'Vincular'unlink-button: 'Desvincular'unlink-title: '¿Desvincular {provider}?'diff --git a/console/translations/fa-ir.yaml b/console/translations/fa-ir.yamlindex 9eef9168..65379aed 100644--- a/console/translations/fa-ir.yaml+++ b/console/translations/fa-ir.yaml@@ -567,6 +567,8 @@ auth:finish-signup: 'برای ادامه، راهاندازی حساب Fleetbase خود را کامل کنید.'connected-accounts: 'حسابهای متصل'connected-accounts-help: 'بهجای رمز عبور با یک ارائهدهنده وارد شوید. میتوانید بیش از یکی متصل کنید.'+ linked-heading: 'متصلشده'+ available-heading: 'قابل اتصال'link-button: 'اتصال'unlink-button: 'قطع اتصال'unlink-title: 'اتصال {provider} قطع شود؟'diff --git a/console/translations/fr-fr.yaml b/console/translations/fr-fr.yamlindex 2defc40b..03b04a84 100644--- a/console/translations/fr-fr.yaml+++ b/console/translations/fr-fr.yaml@@ -586,6 +586,8 @@ auth:finish-signup: 'Terminez la configuration de votre compte Fleetbase pour continuer.'connected-accounts: 'Comptes associés'connected-accounts-help: 'Connectez-vous via un fournisseur plutôt qu''avec un mot de passe. Vous pouvez en associer plusieurs.'+ linked-heading: 'Associés'+ available-heading: 'Disponibles à associer'link-button: 'Associer'unlink-button: 'Dissocier'unlink-title: 'Dissocier {provider} ?'diff --git a/console/translations/it-it.yaml b/console/translations/it-it.yamlindex 1c75726d..43f2f6f2 100644--- a/console/translations/it-it.yaml+++ b/console/translations/it-it.yaml@@ -621,6 +621,8 @@ auth:finish-signup: 'Completa la configurazione del tuo account Fleetbase per continuare.'connected-accounts: 'Account collegati'connected-accounts-help: 'Accedi con un provider invece che con una password. Puoi collegarne più di uno.'+ linked-heading: 'Collegati'+ available-heading: 'Disponibili da collegare'link-button: 'Collega'unlink-button: 'Scollega'unlink-title: 'Scollegare {provider}?'diff --git a/console/translations/mn-mn.yaml b/console/translations/mn-mn.yamlindex 7117cfd6..e6a07c8d 100644--- a/console/translations/mn-mn.yaml+++ b/console/translations/mn-mn.yaml@@ -584,6 +584,8 @@ auth:finish-signup: 'Үргэлжлүүлэхийн тулд Fleetbase бүртгэлээ тохируулж дуусгана уу.'connected-accounts: 'Холбогдсон бүртгэлүүд'connected-accounts-help: 'Нууц үгийн оронд үйлчилгээгээр нэвтэрнэ үү. Нэгээс олныг холбох боломжтой.'+ linked-heading: 'Холбогдсон'+ available-heading: 'Холбох боломжтой'link-button: 'Холбох'unlink-button: 'Салгах'unlink-title: '{provider}-г салгах уу?'diff --git a/console/translations/pt-br.yaml b/console/translations/pt-br.yamlindex a51941f5..cdce8a7a 100644--- a/console/translations/pt-br.yaml+++ b/console/translations/pt-br.yaml@@ -581,6 +581,8 @@ auth:finish-signup: 'Conclua a configuração da sua conta Fleetbase para continuar.'connected-accounts: 'Contas conectadas'connected-accounts-help: 'Entre com um provedor em vez de uma senha. Você pode conectar mais de um.'+ linked-heading: 'Conectadas'+ available-heading: 'Disponíveis para conectar'link-button: 'Conectar'unlink-button: 'Desconectar'unlink-title: 'Desconectar {provider}?'diff --git a/console/translations/ru-ru.yaml b/console/translations/ru-ru.yamlindex 07d80035..af0822d1 100644--- a/console/translations/ru-ru.yaml+++ b/console/translations/ru-ru.yaml@@ -582,6 +582,8 @@ auth:finish-signup: 'Завершите настройку учётной записи Fleetbase, чтобы продолжить.'connected-accounts: 'Связанные аккаунты'connected-accounts-help: 'Входите через поставщика вместо пароля. Можно привязать несколько.'+ linked-heading: 'Привязанные'+ available-heading: 'Доступные для привязки'link-button: 'Привязать'unlink-button: 'Отвязать'unlink-title: 'Отвязать {provider}?'diff --git a/console/translations/uz-uz.yaml b/console/translations/uz-uz.yamlindex cb135327..0e084b95 100644--- a/console/translations/uz-uz.yaml+++ b/console/translations/uz-uz.yaml@@ -596,6 +596,8 @@ auth:finish-signup: 'Davom etish uchun Fleetbase hisobingizni sozlashni yakunlang.'connected-accounts: 'Bog‘langan hisoblar'connected-accounts-help: 'Parol o‘rniga provayder orqali kiring. Bir nechtasini bog‘lash mumkin.'+ linked-heading: 'Bog‘langan'+ available-heading: 'Bog‘lash mumkin'link-button: 'Bog‘lash'unlink-button: 'Uzish'unlink-title: '{provider} uzilsinmi?'diff --git a/console/translations/vi-vn.yaml b/console/translations/vi-vn.yamlindex 649f5fab..407ace6f 100644--- a/console/translations/vi-vn.yaml+++ b/console/translations/vi-vn.yaml@@ -585,6 +585,8 @@ auth:finish-signup: 'Hoàn tất thiết lập tài khoản Fleetbase của bạn để tiếp tục.'connected-accounts: 'Tài khoản đã liên kết'connected-accounts-help: 'Đăng nhập bằng nhà cung cấp thay vì mật khẩu. Bạn có thể liên kết nhiều nhà cung cấp.'+ linked-heading: 'Đã liên kết'+ available-heading: 'Có thể liên kết'link-button: 'Liên kết'unlink-button: 'Hủy liên kết'unlink-title: 'Hủy liên kết {provider}?'diff --git a/console/translations/zh-cn.yaml b/console/translations/zh-cn.yamlindex db21d76c..ee5c1137 100644--- a/console/translations/zh-cn.yaml+++ b/console/translations/zh-cn.yaml@@ -560,6 +560,8 @@ auth:finish-signup: '请完成 Fleetbase 账户设置以继续。'connected-accounts: '已关联账户'connected-accounts-help: '使用登录服务代替密码登录。可以关联多个。'+ linked-heading: '已关联'+ available-heading: '可关联'link-button: '关联'unlink-button: '取消关联'unlink-title: '取消关联 {provider}?'