fix: actually disable backup buttons if the user is not entitled (#955)
This commit is contained in:
@@ -122,6 +122,9 @@ export const EmailBackups = observer(({ application }: Props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const toggleMuteFailedBackupEmails = async () => {
|
const toggleMuteFailedBackupEmails = async () => {
|
||||||
|
if (!isEntitledToEmailBackups) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const previousValue = isFailedBackupEmailMuted;
|
const previousValue = isFailedBackupEmailMuted;
|
||||||
setIsFailedBackupEmailMuted(!isFailedBackupEmailMuted);
|
setIsFailedBackupEmailMuted(!isFailedBackupEmailMuted);
|
||||||
|
|
||||||
@@ -134,6 +137,13 @@ export const EmailBackups = observer(({ application }: Props) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleEmailFrequencyChange = (item: string) => {
|
||||||
|
if (!isEntitledToEmailBackups) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
updateEmailFrequency(item as EmailBackupFrequency);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PreferencesGroup>
|
<PreferencesGroup>
|
||||||
<PreferencesSegment>
|
<PreferencesSegment>
|
||||||
@@ -176,9 +186,8 @@ export const EmailBackups = observer(({ application }: Props) => {
|
|||||||
label="Select email frequency"
|
label="Select email frequency"
|
||||||
items={emailFrequencyOptions}
|
items={emailFrequencyOptions}
|
||||||
value={emailFrequency}
|
value={emailFrequency}
|
||||||
onChange={(item) => {
|
onChange={handleEmailFrequencyChange}
|
||||||
updateEmailFrequency(item as EmailBackupFrequency);
|
disabled={!isEntitledToEmailBackups}
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@@ -196,6 +205,7 @@ export const EmailBackups = observer(({ application }: Props) => {
|
|||||||
<Switch
|
<Switch
|
||||||
onChange={toggleMuteFailedBackupEmails}
|
onChange={toggleMuteFailedBackupEmails}
|
||||||
checked={!isFailedBackupEmailMuted}
|
checked={!isFailedBackupEmailMuted}
|
||||||
|
disabled={!isEntitledToEmailBackups}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -54,6 +54,9 @@ export const CloudBackupProvider: FunctionComponent<Props> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const installIntegration = (event: Event) => {
|
const installIntegration = (event: Event) => {
|
||||||
|
if (!isEntitledToCloudBackups) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
||||||
const authUrl = application.getCloudProviderIntegrationUrl(
|
const authUrl = application.getCloudProviderIntegrationUrl(
|
||||||
@@ -223,6 +226,7 @@ export const CloudBackupProvider: FunctionComponent<Props> = ({
|
|||||||
label="Enable"
|
label="Enable"
|
||||||
className={`px-1 text-xs min-w-40 ${additionalClass}`}
|
className={`px-1 text-xs min-w-40 ${additionalClass}`}
|
||||||
onClick={installIntegration}
|
onClick={installIntegration}
|
||||||
|
disabled={!isEntitledToCloudBackups}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -98,6 +98,9 @@ export const CloudLink: FunctionComponent<Props> = ({ application }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const toggleMuteFailedCloudBackupEmails = async () => {
|
const toggleMuteFailedCloudBackupEmails = async () => {
|
||||||
|
if (!isEntitledToCloudBackups) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const previousValue = isFailedCloudBackupEmailMuted;
|
const previousValue = isFailedCloudBackupEmailMuted;
|
||||||
setIsFailedCloudBackupEmailMuted(!isFailedCloudBackupEmailMuted);
|
setIsFailedCloudBackupEmailMuted(!isFailedCloudBackupEmailMuted);
|
||||||
|
|
||||||
@@ -165,6 +168,7 @@ export const CloudLink: FunctionComponent<Props> = ({ application }) => {
|
|||||||
<Switch
|
<Switch
|
||||||
onChange={toggleMuteFailedCloudBackupEmails}
|
onChange={toggleMuteFailedCloudBackupEmails}
|
||||||
checked={!isFailedCloudBackupEmailMuted}
|
checked={!isFailedCloudBackupEmailMuted}
|
||||||
|
disabled={!isEntitledToCloudBackups}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user