Skip to content

Commit

Permalink
Merge pull request #6430 from DonOmalVindula/fix/sms-provider-loading
Browse files Browse the repository at this point in the history
  • Loading branch information
DonOmalVindula authored Jun 11, 2024
2 parents 4b2b96b + 69799c3 commit c1363ad
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/perfect-tips-work.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@wso2is/admin.sms-providers.v1": patch
---

Add loading state to sms provider form
3 changes: 3 additions & 0 deletions features/admin.sms-providers.v1/pages/custom-sms-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { Divider, Grid } from "semantic-ui-react";
import { SMSProviderConstants } from "../constants";

interface CustomSMSProviderPageInterface extends IdentifiableComponentInterface {
isLoading?: boolean;
isReadOnly: boolean;
"data-componentid": string;
onSubmit: (values: any) => void;
Expand All @@ -40,6 +41,7 @@ const CustomSMSProvider: FunctionComponent<CustomSMSProviderPageInterface> = (

const {
["data-componentid"]: componentId,
isLoading,
isReadOnly,
onSubmit
} = props;
Expand Down Expand Up @@ -228,6 +230,7 @@ const CustomSMSProvider: FunctionComponent<CustomSMSProviderPageInterface> = (
onClick={ onSubmit }
ariaLabel="SMS provider form update button"
data-componentid={ `${componentId}-update-button` }
loading={ isLoading }
>
{ "Submit" }
</PrimaryButton>
Expand Down
3 changes: 3 additions & 0 deletions features/admin.sms-providers.v1/pages/sms-providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,7 @@ const SMSProviders: FunctionComponent<SMSProviderPageInterface> = (
SMSProviderConstants.CUSTOM_SMS_PROVIDER && (
<>
<CustomSMSProvider
isLoading={ isSubmitting }
isReadOnly={ isReadOnly }
onSubmit={ handleSubmit }
data-componentid={ "custom-sms-provider" }
Expand All @@ -618,6 +619,7 @@ const SMSProviders: FunctionComponent<SMSProviderPageInterface> = (
{ smsProviderSettings?.selectedProvider ===
SMSProviderConstants.TWILIO_SMS_PROVIDER && (
<TwilioSMSProvider
isLoading={ isSubmitting }
isReadOnly={ isReadOnly }
onSubmit={ handleSubmit }
data-componentid={ "twilio-sms-provider" }
Expand All @@ -626,6 +628,7 @@ const SMSProviders: FunctionComponent<SMSProviderPageInterface> = (
{ smsProviderSettings?.selectedProvider ===
SMSProviderConstants.VONAGE_SMS_PROVIDER && (
<VonageSMSProvider
isLoading={ isSubmitting }
isReadOnly={ isReadOnly }
onSubmit={ handleSubmit }
data-componentid={ "vonage-sms-provider" }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com).
* Copyright (c) 2023-2024, WSO2 LLC. (https://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
Expand Down Expand Up @@ -32,6 +32,7 @@ import { SMSProviderConstants } from "../constants";
interface TwilioSMSProviderPageInterface extends IdentifiableComponentInterface {
"data-componentid": string;
isReadOnly: boolean;
isLoading?: boolean;
onSubmit: (values: any) => void;
}

Expand All @@ -41,6 +42,7 @@ const TwilioSMSProvider: FunctionComponent<TwilioSMSProviderPageInterface> = (
const {
["data-componentid"]: componentId,
onSubmit,
isLoading,
isReadOnly
} = props;
const { t } = useTranslation();
Expand Down Expand Up @@ -171,6 +173,7 @@ const TwilioSMSProvider: FunctionComponent<TwilioSMSProviderPageInterface> = (
onClick={ onSubmit }
ariaLabel="SMS provider form update button"
data-componentid={ `${componentId}-update-button` }
loading={ isLoading }
>
{ "Submit" }
</PrimaryButton>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com).
* Copyright (c) 2023-2024, WSO2 LLC. (https://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
Expand Down Expand Up @@ -31,6 +31,7 @@ import { SMSProviderConstants } from "../constants";

interface VonageSMSProviderPageInterface extends IdentifiableComponentInterface {
"data-componentid": string;
isLoading?: boolean;
isReadOnly: boolean;
onSubmit: (values: any) => void;
}
Expand All @@ -40,6 +41,7 @@ const VonageSMSProvider: FunctionComponent<VonageSMSProviderPageInterface> = (
): ReactElement => {
const {
["data-componentid"]: componentId,
isLoading,
isReadOnly,
onSubmit
} = props;
Expand Down Expand Up @@ -171,6 +173,7 @@ const VonageSMSProvider: FunctionComponent<VonageSMSProviderPageInterface> = (
onClick={ onSubmit }
ariaLabel="SMS provider form update button"
data-componentid={ `${componentId}-update-button` }
loading={ isLoading }
>
{ "Submit" }
</PrimaryButton>
Expand Down

0 comments on commit c1363ad

Please sign in to comment.