From eaa8e80efadc55d42462af0a5381f2552acc3c88 Mon Sep 17 00:00:00 2001
From: Vijay Aravamudhan <vraravam@users.noreply.github.com>
Date: Sat, 27 May 2023 18:48:38 +0530
Subject: Expose "Clear service cache" in the service settings screen and the
 sidebar context menu for individual services (#1053)

---
 src/components/settings/services/EditServiceForm.tsx | 12 ++++++++++++
 1 file changed, 12 insertions(+)

(limited to 'src/components/settings/services/EditServiceForm.tsx')

diff --git a/src/components/settings/services/EditServiceForm.tsx b/src/components/settings/services/EditServiceForm.tsx
index c04a53b50..520cb3c46 100644
--- a/src/components/settings/services/EditServiceForm.tsx
+++ b/src/components/settings/services/EditServiceForm.tsx
@@ -156,6 +156,7 @@ interface IProps extends WrappedComponentProps {
   form: Form;
   onSubmit: (...args: any[]) => void;
   onDelete: () => void;
+  onClearCache: () => void;
   openRecipeFile: (recipeFile: string) => void;
   isSaving: boolean;
   isDeleting: boolean;
@@ -223,6 +224,7 @@ class EditServiceForm extends Component<IProps, IState> {
       isSaving,
       isDeleting,
       onDelete,
+      onClearCache,
       openRecipeFile,
       isProxyFeatureEnabled,
       intl,
@@ -246,6 +248,15 @@ class EditServiceForm extends Component<IProps, IState> {
       />
     );
 
+    const clearCacheButton = (
+      <Button
+        buttonType="secondary"
+        label={intl.formatMessage(globalMessages.clearCache)}
+        className="settings__open-settings-cache-button"
+        onClick={onClearCache}
+      />
+    );
+
     let activeTabIndex = 0;
     if (recipe.hasHostedOption && service?.team) {
       activeTabIndex = 1;
@@ -502,6 +513,7 @@ class EditServiceForm extends Component<IProps, IState> {
         <div className="settings__controls">
           {/* Delete Button */}
           <div>{action === 'edit' && deleteButton}</div>
+          <div>{action === 'edit' && clearCacheButton}</div>
 
           {/* Save Button */}
           {isSaving || isValidatingCustomUrl ? (
-- 
cgit v1.2.3-70-g09d2

