@ovh-ux/manager-pci-common 2.2.1 → 2.3.0

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.
@@ -19,6 +19,11 @@ export type TProject = {
19
19
  unleash: boolean;
20
20
  };
21
21
  export declare const getProject: (projectId: string) => Promise<TProject>;
22
+ export type TProjectUpdate = {
23
+ description: string | null;
24
+ manualQuota: boolean;
25
+ };
26
+ export declare const updateProject: (projectId: string, { description, manualQuota }: TProjectUpdate) => Promise<void>;
22
27
  export type TQuota = {
23
28
  instance?: {
24
29
  maxCores: number;
@@ -1,5 +1,5 @@
1
1
  import { QueryOptions } from '@tanstack/react-query';
2
- import { TProject, TQuota } from '../data/project';
2
+ import { TProject, TProjectUpdate, TQuota } from '../data/project';
3
3
  export interface ResponseAPIError {
4
4
  message: string;
5
5
  stack: string;
@@ -15,11 +15,90 @@ export interface ResponseAPIError {
15
15
  };
16
16
  };
17
17
  }
18
+ export declare const getProjectQueryKey: (projectId: string) => string[];
18
19
  export declare const getProjectQuery: (projectId: string) => {
19
20
  queryKey: string[];
20
21
  queryFn: () => Promise<TProject>;
21
22
  };
22
23
  export declare const useProject: (projectId?: string, options?: QueryOptions<TProject, ResponseAPIError>) => import("@tanstack/react-query/build/legacy/types").UseQueryResult<TProject, ResponseAPIError>;
24
+ export interface UpdateProjectProps {
25
+ projectId: string;
26
+ onError: (cause: Error) => void;
27
+ onSuccess: () => void;
28
+ }
29
+ export declare const useUpdateProject: ({ projectId, onError, onSuccess, }: UpdateProjectProps) => {
30
+ data: undefined;
31
+ variables: undefined;
32
+ error: null;
33
+ isError: false;
34
+ isIdle: true;
35
+ isPending: false;
36
+ isSuccess: false;
37
+ status: "idle";
38
+ mutate: import("@tanstack/react-query/build/legacy/types").UseMutateFunction<void, Error, TProjectUpdate, unknown>;
39
+ reset: () => void;
40
+ context: unknown;
41
+ failureCount: number;
42
+ failureReason: Error;
43
+ isPaused: boolean;
44
+ submittedAt: number;
45
+ mutateAsync: import("@tanstack/react-query/build/legacy/types").UseMutateAsyncFunction<void, Error, TProjectUpdate, unknown>;
46
+ update: (changes: TProjectUpdate) => void;
47
+ } | {
48
+ data: undefined;
49
+ variables: TProjectUpdate;
50
+ error: null;
51
+ isError: false;
52
+ isIdle: false;
53
+ isPending: true;
54
+ isSuccess: false;
55
+ status: "pending";
56
+ mutate: import("@tanstack/react-query/build/legacy/types").UseMutateFunction<void, Error, TProjectUpdate, unknown>;
57
+ reset: () => void;
58
+ context: unknown;
59
+ failureCount: number;
60
+ failureReason: Error;
61
+ isPaused: boolean;
62
+ submittedAt: number;
63
+ mutateAsync: import("@tanstack/react-query/build/legacy/types").UseMutateAsyncFunction<void, Error, TProjectUpdate, unknown>;
64
+ update: (changes: TProjectUpdate) => void;
65
+ } | {
66
+ data: undefined;
67
+ error: Error;
68
+ variables: TProjectUpdate;
69
+ isError: true;
70
+ isIdle: false;
71
+ isPending: false;
72
+ isSuccess: false;
73
+ status: "error";
74
+ mutate: import("@tanstack/react-query/build/legacy/types").UseMutateFunction<void, Error, TProjectUpdate, unknown>;
75
+ reset: () => void;
76
+ context: unknown;
77
+ failureCount: number;
78
+ failureReason: Error;
79
+ isPaused: boolean;
80
+ submittedAt: number;
81
+ mutateAsync: import("@tanstack/react-query/build/legacy/types").UseMutateAsyncFunction<void, Error, TProjectUpdate, unknown>;
82
+ update: (changes: TProjectUpdate) => void;
83
+ } | {
84
+ data: void;
85
+ error: null;
86
+ variables: TProjectUpdate;
87
+ isError: false;
88
+ isIdle: false;
89
+ isPending: false;
90
+ isSuccess: true;
91
+ status: "success";
92
+ mutate: import("@tanstack/react-query/build/legacy/types").UseMutateFunction<void, Error, TProjectUpdate, unknown>;
93
+ reset: () => void;
94
+ context: unknown;
95
+ failureCount: number;
96
+ failureReason: Error;
97
+ isPaused: boolean;
98
+ submittedAt: number;
99
+ mutateAsync: import("@tanstack/react-query/build/legacy/types").UseMutateAsyncFunction<void, Error, TProjectUpdate, unknown>;
100
+ update: (changes: TProjectUpdate) => void;
101
+ };
23
102
  export declare const getProjectQuotaQuery: (projectId: string) => {
24
103
  queryKey: string[];
25
104
  queryFn: () => Promise<TQuota[]>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ovh-ux/manager-pci-common",
3
- "version": "2.2.1",
3
+ "version": "2.3.0",
4
4
  "private": false,
5
5
  "description": "Public Cloud Common components",
6
6
  "homepage": "https://github.com/ovh/manager/blob/master/packages/manager/modules/manager-pci-common/README.md",
@@ -42,7 +42,7 @@
42
42
  },
43
43
  "devDependencies": {
44
44
  "@ovh-ux/manager-core-api": "^0.10.0",
45
- "@ovh-ux/manager-react-components": "^2.12.0",
45
+ "@ovh-ux/manager-react-components": "^2.14.0",
46
46
  "@ovh-ux/manager-react-shell-client": "^0.8.5",
47
47
  "@ovh-ux/manager-vite-config": "^0.9.1",
48
48
  "@ovhcloud/ods-components": "^18.4.1",