mirror of
https://github.com/jambonz/jambonz-webapp.git
synced 2026-07-04 19:21:58 +00:00
Combine account user lists for carriers and speech (#186)
* combine account user lists for carriers and speech * edit application capitalization --------- Co-authored-by: EgleHelms <e.helms@cognigy.com>
This commit is contained in:
@@ -34,7 +34,7 @@ export const EditApplication = () => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<H1 className="h2">Edit Application</H1>
|
||||
<H1 className="h2">Edit application</H1>
|
||||
<ApplicationForm application={{ data, refetch, error }} />
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -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]}
|
||||
/>
|
||||
<AccountFilter
|
||||
account={[accountSid, setAccountSid]}
|
||||
accounts={accounts}
|
||||
label="Used by"
|
||||
defaultOption
|
||||
/>
|
||||
<ScopedAccess user={user} scope={Scope.service_provider}>
|
||||
<AccountFilter
|
||||
account={[accountSid, setAccountSid]}
|
||||
accounts={accounts}
|
||||
label="Used by"
|
||||
defaultOption
|
||||
/>
|
||||
</ScopedAccess>
|
||||
</section>
|
||||
<Section {...(hasLength(filteredCarriers) && { slim: true })}>
|
||||
<div className="list">
|
||||
@@ -156,19 +162,21 @@ export const Carriers = () => {
|
||||
<ScopedAccess
|
||||
user={user}
|
||||
scope={
|
||||
!accountSid ? Scope.service_provider : Scope.account
|
||||
!carrier.account_sid
|
||||
? Scope.service_provider
|
||||
: Scope.account
|
||||
}
|
||||
>
|
||||
<Link
|
||||
to={`${ROUTE_INTERNAL_CARRIERS}/${carrier.voip_carrier_sid}/edit`}
|
||||
title="Edit Carrier"
|
||||
title="Edit carrier"
|
||||
className="i"
|
||||
>
|
||||
<strong>{carrier.name}</strong>
|
||||
<Icons.ArrowRight />
|
||||
</Link>
|
||||
</ScopedAccess>
|
||||
{!accountSid && user?.scope === USER_ACCOUNT && (
|
||||
{!carrier.account_sid && user?.scope === USER_ACCOUNT && (
|
||||
<strong>{carrier.name}</strong>
|
||||
)}
|
||||
</div>
|
||||
@@ -192,12 +200,16 @@ export const Carriers = () => {
|
||||
</div>
|
||||
<ScopedAccess
|
||||
user={user}
|
||||
scope={!accountSid ? Scope.service_provider : Scope.account}
|
||||
scope={
|
||||
!carrier.account_sid
|
||||
? Scope.service_provider
|
||||
: Scope.account
|
||||
}
|
||||
>
|
||||
<div className="item__actions">
|
||||
<Link
|
||||
to={`${ROUTE_INTERNAL_CARRIERS}/${carrier.voip_carrier_sid}/edit`}
|
||||
title="Edit Carrier"
|
||||
title="Edit carrier"
|
||||
>
|
||||
<Icons.Edit3 />
|
||||
</Link>
|
||||
|
||||
@@ -115,8 +115,7 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => {
|
||||
const payload: Partial<SpeechCredential> = {
|
||||
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 && {
|
||||
|
||||
@@ -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 = () => {
|
||||
</Link>
|
||||
</section>
|
||||
<section className="filters filters--ender">
|
||||
<AccountFilter
|
||||
account={[accountSid, setAccountSid]}
|
||||
accounts={accounts}
|
||||
label="Used by"
|
||||
defaultOption
|
||||
/>
|
||||
<ScopedAccess user={user} scope={Scope.service_provider}>
|
||||
<AccountFilter
|
||||
account={[accountSid, setAccountSid]}
|
||||
accounts={accounts}
|
||||
label="Used by"
|
||||
defaultOption
|
||||
/>
|
||||
</ScopedAccess>
|
||||
</section>
|
||||
<Section {...(hasLength(filteredCredentials) && { slim: true })}>
|
||||
<div className="list">
|
||||
@@ -119,7 +125,9 @@ export const SpeechServices = () => {
|
||||
<ScopedAccess
|
||||
user={user}
|
||||
scope={
|
||||
!accountSid ? Scope.service_provider : Scope.account
|
||||
!credential.account_sid
|
||||
? Scope.service_provider
|
||||
: Scope.account
|
||||
}
|
||||
>
|
||||
<Link
|
||||
@@ -131,9 +139,10 @@ export const SpeechServices = () => {
|
||||
<Icons.ArrowRight />
|
||||
</Link>
|
||||
</ScopedAccess>
|
||||
{!accountSid && user?.scope === USER_ACCOUNT && (
|
||||
<strong>Vendor: {credential.vendor}</strong>
|
||||
)}
|
||||
{!credential.account_sid &&
|
||||
user?.scope === USER_ACCOUNT && (
|
||||
<strong>Vendor: {credential.vendor}</strong>
|
||||
)}
|
||||
</div>
|
||||
<div className="item__meta">
|
||||
<div>
|
||||
@@ -177,7 +186,11 @@ export const SpeechServices = () => {
|
||||
</div>
|
||||
<ScopedAccess
|
||||
user={user}
|
||||
scope={!accountSid ? Scope.service_provider : Scope.account}
|
||||
scope={
|
||||
!credential.account_sid
|
||||
? Scope.service_provider
|
||||
: Scope.account
|
||||
}
|
||||
>
|
||||
<div className="item__actions">
|
||||
<Link
|
||||
|
||||
Reference in New Issue
Block a user