From 40c61eebcafcaf9c50f40073ca2c1b9271332b1d Mon Sep 17 00:00:00 2001 From: EgleH Date: Mon, 30 Jan 2023 16:36:54 +0100 Subject: [PATCH] Combine account user lists for carriers and speech (#186) * combine account user lists for carriers and speech * edit application capitalization --------- Co-authored-by: EgleHelms --- .../internal/views/applications/edit.tsx | 2 +- .../internal/views/carriers/index.tsx | 34 ++++++++++++------ .../internal/views/speech-services/form.tsx | 3 +- .../internal/views/speech-services/index.tsx | 35 +++++++++++++------ 4 files changed, 49 insertions(+), 25 deletions(-) diff --git a/src/containers/internal/views/applications/edit.tsx b/src/containers/internal/views/applications/edit.tsx index f43f704..9dde3f8 100644 --- a/src/containers/internal/views/applications/edit.tsx +++ b/src/containers/internal/views/applications/edit.tsx @@ -34,7 +34,7 @@ export const EditApplication = () => { return ( <> -

Edit Application

+

Edit application

); diff --git a/src/containers/internal/views/carriers/index.tsx b/src/containers/internal/views/carriers/index.tsx index 775aa92..da97580 100644 --- a/src/containers/internal/views/carriers/index.tsx +++ b/src/containers/internal/views/carriers/index.tsx @@ -47,6 +47,10 @@ export const Carriers = () => { const [filter, setFilter] = useState(""); const carriersFiltered = useMemo(() => { + if (user?.scope === USER_ACCOUNT) { + return carriers; + } + return carriers ? carriers.filter((carrier) => accountSid @@ -137,12 +141,14 @@ export const Carriers = () => { placeholder="Filter carriers" filter={[filter, setFilter]} /> - + + +
@@ -156,19 +162,21 @@ export const Carriers = () => { {carrier.name} - {!accountSid && user?.scope === USER_ACCOUNT && ( + {!carrier.account_sid && user?.scope === USER_ACCOUNT && ( {carrier.name} )}
@@ -192,12 +200,16 @@ export const Carriers = () => {
diff --git a/src/containers/internal/views/speech-services/form.tsx b/src/containers/internal/views/speech-services/form.tsx index 8ade322..adbf9ab 100644 --- a/src/containers/internal/views/speech-services/form.tsx +++ b/src/containers/internal/views/speech-services/form.tsx @@ -115,8 +115,7 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => { const payload: Partial = { vendor, account_sid: accountSid || null, - service_provider_sid: - currentServiceProvider.service_provider_sid || null, + service_provider_sid: currentServiceProvider.service_provider_sid, use_for_tts: ttsCheck ? 1 : 0, use_for_stt: sttCheck ? 1 : 0, ...(vendor === VENDOR_AWS && { diff --git a/src/containers/internal/views/speech-services/index.tsx b/src/containers/internal/views/speech-services/index.tsx index 6a9c5d6..6fe3531 100644 --- a/src/containers/internal/views/speech-services/index.tsx +++ b/src/containers/internal/views/speech-services/index.tsx @@ -37,6 +37,10 @@ export const SpeechServices = () => { const [filter] = useState(""); const credentialsFiltered = useMemo(() => { + if (user?.scope === USER_ACCOUNT) { + return credentials; + } + return credentials ? credentials.filter((credential) => accountSid @@ -99,12 +103,14 @@ export const SpeechServices = () => {
- + + +
@@ -119,7 +125,9 @@ export const SpeechServices = () => { { - {!accountSid && user?.scope === USER_ACCOUNT && ( - Vendor: {credential.vendor} - )} + {!credential.account_sid && + user?.scope === USER_ACCOUNT && ( + Vendor: {credential.vendor} + )}
@@ -177,7 +186,11 @@ export const SpeechServices = () => {