@plutonhq/core-frontend 0.1.28 → 0.1.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist-lib/components/Plan/PlanForm/PlanForm.d.ts.map +1 -1
  2. package/dist-lib/components/Plan/PlanForm/PlanForm.js +20 -11
  3. package/dist-lib/components/Plan/PlanForm/PlanForm.js.map +1 -1
  4. package/dist-lib/components/Plan/PlanSettings/PlanAdvancedSettings.d.ts +2 -1
  5. package/dist-lib/components/Plan/PlanSettings/PlanAdvancedSettings.d.ts.map +1 -1
  6. package/dist-lib/components/Plan/PlanSettings/PlanAdvancedSettings.js +28 -21
  7. package/dist-lib/components/Plan/PlanSettings/PlanAdvancedSettings.js.map +1 -1
  8. package/dist-lib/components/Plan/PlanSettings/PlanGeneralSettings.d.ts +2 -1
  9. package/dist-lib/components/Plan/PlanSettings/PlanGeneralSettings.d.ts.map +1 -1
  10. package/dist-lib/components/Plan/PlanSettings/PlanGeneralSettings.js +21 -20
  11. package/dist-lib/components/Plan/PlanSettings/PlanGeneralSettings.js.map +1 -1
  12. package/dist-lib/components/common/form/Toggle/Toggle.d.ts +2 -1
  13. package/dist-lib/components/common/form/Toggle/Toggle.d.ts.map +1 -1
  14. package/dist-lib/components/common/form/Toggle/Toggle.js +21 -11
  15. package/dist-lib/components/common/form/Toggle/Toggle.js.map +1 -1
  16. package/dist-lib/components/common/form/Toggle/Toggle.module.scss.js +6 -4
  17. package/dist-lib/components/common/form/Toggle/Toggle.module.scss.js.map +1 -1
  18. package/dist-lib/hooks/usePlanSingleActions.d.ts.map +1 -1
  19. package/dist-lib/hooks/usePlanSingleActions.js +34 -33
  20. package/dist-lib/hooks/usePlanSingleActions.js.map +1 -1
  21. package/dist-lib/services/settings.d.ts +3 -0
  22. package/dist-lib/services/settings.d.ts.map +1 -1
  23. package/dist-lib/services/settings.js.map +1 -1
  24. package/dist-lib/styles/core-frontend.css +1 -1
  25. package/package.json +1 -1
  26. package/src/components/Plan/PlanForm/PlanForm.tsx +7 -1
  27. package/src/components/Plan/PlanSettings/PlanAdvancedSettings.tsx +7 -2
  28. package/src/components/Plan/PlanSettings/PlanGeneralSettings.tsx +3 -1
  29. package/src/components/common/form/Toggle/Toggle.module.scss +7 -0
  30. package/src/components/common/form/Toggle/Toggle.tsx +14 -3
  31. package/src/hooks/usePlanSingleActions.tsx +4 -2
  32. package/src/services/settings.ts +3 -0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@plutonhq/core-frontend",
3
3
  "description": "Pluton Core Frontend Library",
4
- "version": "0.1.28",
4
+ "version": "0.1.30",
5
5
  "author": "Plutonhq",
6
6
  "license": "Apache-2.0",
7
7
  "publishConfig": {
@@ -273,7 +273,13 @@ const PlanForm = ({
273
273
  )}
274
274
  {step === 4 && (
275
275
  <div className={PFClasses.planStep}>
276
- <PlanAdvancedSettings plan={planSettings} appSettings={appSettings} onUpdate={onPlanSettingsChange} device={deviceInstance} />
276
+ <PlanAdvancedSettings
277
+ plan={planSettings}
278
+ appSettings={appSettings}
279
+ onUpdate={onPlanSettingsChange}
280
+ device={deviceInstance}
281
+ isEditing={type === 'edit'}
282
+ />
277
283
  </div>
278
284
  )}
279
285
  </div>
@@ -16,9 +16,10 @@ interface PlanAdvancedSettingsProps {
16
16
  appSettings?: Record<string, any>;
17
17
  device: Device;
18
18
  onUpdate: (notificationSettings: NewPlanSettings) => void;
19
+ isEditing: boolean;
19
20
  }
20
21
 
21
- const PlanAdvancedSettings = ({ plan, appSettings, device, onUpdate }: PlanAdvancedSettingsProps) => {
22
+ const PlanAdvancedSettings = ({ plan, appSettings, device, onUpdate, isEditing }: PlanAdvancedSettingsProps) => {
22
23
  const [advancedTab, setAdvancedTab] = useState('General');
23
24
  const settings = plan.settings;
24
25
  const integrationTypes = useMemo(() => {
@@ -75,7 +76,11 @@ const PlanAdvancedSettings = ({ plan, appSettings, device, onUpdate }: PlanAdvan
75
76
  )}
76
77
  <div className={classes.advancedTabContent}>
77
78
  {advancedTab === 'General' && (
78
- <PlanGeneralSettings settings={settings} onUpdate={(newSettings) => onUpdate({ ...plan, settings: newSettings })} />
79
+ <PlanGeneralSettings
80
+ settings={settings}
81
+ onUpdate={(newSettings) => onUpdate({ ...plan, settings: newSettings })}
82
+ isEditing={isEditing}
83
+ />
79
84
  )}
80
85
  {advancedTab === 'Notification' && (
81
86
  <PlanNotificationSettings
@@ -6,9 +6,10 @@ import classes from './PlanSettings.module.scss';
6
6
  interface PlanGeneralSettingsProps {
7
7
  settings: NewPlanSettings['settings'];
8
8
  onUpdate: (settings: NewPlanSettings['settings']) => void;
9
+ isEditing: boolean;
9
10
  }
10
11
 
11
- const PlanGeneralSettings = ({ settings, onUpdate }: PlanGeneralSettingsProps) => {
12
+ const PlanGeneralSettings = ({ settings, onUpdate, isEditing }: PlanGeneralSettingsProps) => {
12
13
  const { encryption, compression, retries, retryDelay } = settings;
13
14
  return (
14
15
  <>
@@ -16,6 +17,7 @@ const PlanGeneralSettings = ({ settings, onUpdate }: PlanGeneralSettingsProps) =
16
17
  <label className={classes.label}>Encryption</label>
17
18
  <Toggle
18
19
  fieldValue={encryption}
20
+ disabled={isEditing}
19
21
  onUpdate={(val: boolean) => onUpdate({ ...settings, encryption: val })}
20
22
  description="Encrypt Source Files before backup"
21
23
  />
@@ -61,6 +61,13 @@
61
61
  label:active:after {
62
62
  width: 30px;
63
63
  }
64
+ &.toggleDisabled {
65
+ opacity: 0.6;
66
+ cursor: not-allowed;
67
+ label {
68
+ cursor: not-allowed;
69
+ }
70
+ }
64
71
  }
65
72
 
66
73
  .description {
@@ -9,11 +9,22 @@ type ToggleProps = {
9
9
  inline?: boolean;
10
10
  hint?: string;
11
11
  error?: string;
12
+ disabled?: boolean;
12
13
  fieldValue: boolean;
13
14
  onUpdate: (f: boolean) => void;
14
15
  };
15
16
 
16
- const Toggle = ({ label, description, customClasses = '', fieldValue = false, inline = false, hint = '', error, onUpdate }: ToggleProps) => {
17
+ const Toggle = ({
18
+ label,
19
+ description,
20
+ customClasses = '',
21
+ fieldValue = false,
22
+ inline = false,
23
+ hint = '',
24
+ error,
25
+ disabled = false,
26
+ onUpdate,
27
+ }: ToggleProps) => {
17
28
  const toggleID = nanoid();
18
29
  const updateField = (event: React.FormEvent<HTMLInputElement>) => {
19
30
  const inputVal = event.currentTarget.value === 'true';
@@ -22,8 +33,8 @@ const Toggle = ({ label, description, customClasses = '', fieldValue = false, in
22
33
 
23
34
  return (
24
35
  <FormField type="toggle" label={label} hint={hint} error={error} inline={inline} classes={`${classes.toggleField} ${customClasses}`}>
25
- <div className={classes.toggleCheckbox}>
26
- <input type="checkbox" id={toggleID} value={fieldValue.toString()} onChange={updateField} checked={fieldValue} />
36
+ <div className={`${classes.toggleCheckbox} ${disabled ? classes.toggleDisabled : ''}`}>
37
+ <input type="checkbox" id={toggleID} value={fieldValue.toString()} onChange={updateField} checked={fieldValue} disabled={disabled} />
27
38
  <label htmlFor={toggleID}>{label}</label>
28
39
  {description && <span className={classes.description}>{description}</span>}
29
40
  </div>
@@ -99,13 +99,15 @@ export const usePlanSingleActions = (): {
99
99
 
100
100
  performBackupMutation.mutate(plan.id, {
101
101
  onSuccess: (data) => {
102
+ const msg = data?.message || `${isSync ? 'Sync' : 'Backup'} initiated successfully! 🚀`;
103
+ const notStarted = !isSync && data?.message && data?.message.includes('reached the concurrency limit');
102
104
  toast.update(toastId, {
103
- render: isSync ? data?.message || 'Sync initiated successfully! 🚀' : 'Backup initiated successfully! 🚀',
105
+ render: isSync ? msg : notStarted ? data?.message : 'Backup initiated successfully!',
104
106
  type: 'success',
105
107
  isLoading: false,
106
108
  autoClose: 3000,
107
109
  });
108
- if (!isSync) {
110
+ if (!isSync && !notStarted) {
109
111
  navigate(`/plan/${plan.id}?pendingbackup=1`);
110
112
  }
111
113
  },
@@ -171,7 +171,10 @@ export function useValidateIntegration() {
171
171
  export interface SetupStatus {
172
172
  setupPending: boolean;
173
173
  isBinary: boolean;
174
+ requiresSetup: boolean;
175
+ /** @deprecated Use requiresSetup instead */
174
176
  requiresKeyringSetup: boolean;
177
+ hasEncEnvFile: boolean;
175
178
  platform: string;
176
179
  }
177
180