Skip to content

Commit 2b4e9c1

Browse files
authored
Merge pull request #55 from seriohub/dev
New Features and enhanced UI usability
2 parents 1894be1 + d0995c7 commit 2b4e9c1

File tree

238 files changed

+6928
-4517
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

238 files changed

+6928
-4517
lines changed

CHANGELOG.md

+10
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.
44

55
***
66

7+
## [v0.1.20] - 2025-01-23
8+
9+
New Features
10+
- Backup Storage Location Management: Added functionality to configure and manage backup storage locations.
11+
- Volume Snapshot Location Management: Introduced the ability to configure and manage volume snapshot locations.
12+
- Velero Resource Consultation: Added a feature to consult Velero resources.
13+
14+
Improvements
15+
- Enhanced UI usability
16+
717
## [v0.1.19] - 2025-01-11
818

919
- Improved code maintainability

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"clsx": "^2.1.0",
3333
"cron-validate": "^1.4.5",
3434
"dayjs": "^1.11.10",
35+
"js-yaml": "^4.1.0",
3536
"mantine-contextmenu": "^7.6.1",
3637
"mantine-datatable": "^7.6.0",
3738
"moment": "^2.30.1",
@@ -61,6 +62,7 @@
6162
"@testing-library/react": "^14.2.1",
6263
"@testing-library/user-event": "^14.5.2",
6364
"@types/jest": "^29.5.12",
65+
"@types/js-yaml": "^4",
6466
"@types/node": "^20.11.24",
6567
"@types/react": "^18.2.63",
6668
"@typescript-eslint/eslint-plugin": "^6.21.0",

src/api/Agent/useAgentConfiguration.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ export const useAgentConfiguration = () => {
77
const getAgentConfiguration = async () => {
88
try {
99
// Execute the API call with the generic method
10-
await getData({ url: '/v1/setup/get-config' });
10+
await getData({ url: '/v1/settings/environment' });
1111

1212
// This code will be executed only in case of success
1313
// console.log('Request successful, execute final action...');
14-
} catch (error) {
14+
} catch (e) {
1515
// Error handling
1616
// console.error('Error during call:', error);
1717
} finally {

src/api/Agent/useAgentInfo.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ export const useAgentInfo = () => {
88
try {
99
// Execute the API call with the generic method
1010
await getData({
11-
url: '/info/get',
11+
url: '/info/app',
1212
target: 'agent',
1313
});
1414

1515
// This code will be executed only in case of success
1616
// console.log('Request successful, execute final action...');
17-
} catch (error) {
17+
} catch (e) {
1818
// Error handling
1919
// console.error('Error during call:', error);
2020
} finally {

src/api/Agent/useAgentStats.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ export const useAgentStats = () => {
77
const getAgentStats = async () => {
88
try {
99
// Execute the API call with the generic method
10-
await getData({ url: '/v1/agent/stats/get', target: 'core' });
10+
await getData({ url: '/v1/agents/health', target: 'core' });
1111

1212
// This code will be executed only in case of success
1313
// console.log('Request successful, execute final action...');
14-
} catch (error) {
14+
} catch (e) {
1515
// Error handling
1616
// console.error('Error during call:', error);
1717
} finally {

src/api/App/useAppInfo.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ export const useAppInfo = () => {
1010
try {
1111
// Execute the API call with the generic method
1212
await getData({
13-
url: '/info/get',
14-
target: target,
13+
url: '/info/app',
14+
target,
1515
});
1616

1717
// This code will be executed only in case of success
1818
// console.log('Request successful, execute final action...');
19-
} catch (error) {
19+
} catch (e) {
2020
// Error handling
2121
// console.error('Error during call:', error);
2222
} finally {

src/api/App/useAppVersion.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ export const useAppVersion = () => {
77
const getAppVersion = async () => {
88
try {
99
// Execute the API call with the generic method
10-
await getData({ url: '/v1/setup/version' });
10+
await getData({ url: '/v1/settings/velero' });
1111

1212
// This code will be executed only in case of success
1313
// console.log('Request successful, execute final action...');
14-
} catch (error) {
14+
} catch (e) {
1515
// Error handling
1616
// console.error('Error during call:', error);
1717
} finally {

src/api/App/useGithubRepoVersion.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@ type TargetType = 'core' | 'agent' | 'static';
66
export const useGithubRepoVersion = () => {
77
const { data, getData, fetching, error } = useApiGet();
88

9-
const getRepoVersion = async (target: TargetType, force: boolean=false) => {
9+
const getRepoVersion = async (target: TargetType, force: boolean = false) => {
1010
try {
1111
// Execute the API call with the generic method
1212
await getData({
13-
url: '/info/get-repo-tags',
13+
url: '/info/vui-repo-tags',
1414
params: `force_scrapy=${force}`,
15-
target: target,
15+
target,
1616
});
1717

1818
// This code will be executed only in case of success
1919
// console.log('Request successful, execute final action...');
20-
} catch (error) {
20+
} catch (e) {
2121
// Error handling
2222
// console.error('Error during call:', error);
2323
} finally {

src/api/App/useVeleroTanzuVersion.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ export const useVeleroTanzuVersion = () => {
77
const getVeleroTanzuVersion = async () => {
88
try {
99
// Execute the API call with the generic method
10-
await getData({ url: '/info/get-repo-velero-tag' });
10+
await getData({ url: '/info/velero-repo-tag' });
1111

1212
// This code will be executed only in case of success
1313
// console.log('Request successful, execute final action...');
14-
} catch (error) {
14+
} catch (e) {
1515
// Error handling
1616
// console.error('Error during call:', error);
1717
} finally {

src/api/Backup/useBackupExpiration.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ export const useBackupExpiration = () => {
77
const getBackupExpiration = async (resourceName: String) => {
88
try {
99
// Execute the API call with the generic method
10-
await getData({ url: '/v1/backup/get-expiration', params: `backup_name=${resourceName}` });
10+
await getData({ url: '/v1/backup/expiration', params: `backup_name=${resourceName}` });
1111

1212
// This code will be executed only in case of success
1313
// console.log('Request successful, execute final action...');
14-
} catch (error) {
14+
} catch (e) {
1515
// Error handling
1616
// console.error('Error during call:', error);
1717
} finally {

src/api/Backup/useBackupSettings.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ export const useCreationBackupSettings = () => {
77
const getCreationBackupSettings = async () => {
88
try {
99
// Execute the API call with the generic method
10-
await getData({ url: '/v1/backup/create/settings' });
10+
await getData({ url: '/v1/backup/environment' });
1111

1212
// This code will be executed only in case of success
1313
// console.log('Request successful, execute final action...');
14-
} catch (error) {
14+
} catch (e) {
1515
// Error handling
1616
// console.error('Error during call:', error);
1717
} finally {

src/api/Backup/useBackupUpdateExpiration.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ export const useBackupUpdateExpiration = () => {
77
const backupUpdateExpiration = async (backupName: string, expiration: string) => {
88
try {
99
// Execute the API call with the generic method
10-
await patchData('/v1/backup/update-expiration', { backup_name: backupName, expiration: expiration });
10+
await patchData('/v1/backup/expiration', { backupName, expiration });
1111

1212
// This code will be executed only in case of success
1313
// console.log('Request successful, execute final action...');
14-
} catch (error) {
14+
} catch (e) {
1515
// Error handling
1616
// console.error('Error during call:', error);
1717
} finally {

src/api/Backup/useBackups.ts

+48-21
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,55 @@
11
import { useApiGet } from '@/hooks/utils/useApiGet';
22

3-
// Hook to handle category task fetching logic
3+
interface GetBackupsProps {
4+
scheduleName?: string;
5+
onlyLast4Schedule: boolean;
6+
forced: boolean;
7+
}
8+
9+
function jsonToQueryParams(json: any) {
10+
return Object.entries(json)
11+
.map(([key, value]) => {
12+
if (value === null || value === undefined) {
13+
return null;
14+
}
15+
// @ts-ignore
16+
return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
17+
})
18+
.filter(Boolean)
19+
.join('&');
20+
}
21+
422
export const useBackups = () => {
5-
const { data, getData, fetching, error } = useApiGet();
23+
const { data, getData, fetching, error } = useApiGet();
624

7-
const getBackups = async (onlyLast4Schedule:boolean=true, forced:boolean=false) => {
8-
try {
9-
// Execute the API call with the generic method
10-
await getData({
11-
url: '/v1/backup/get',
12-
params: `only_last_for_schedule=${onlyLast4Schedule}&forced=${forced}`,
13-
});
25+
const getBackups = async ({
26+
scheduleName,
27+
onlyLast4Schedule,
28+
forced,
29+
}: GetBackupsProps): Promise<void> => {
30+
try {
31+
const params = {
32+
...(scheduleName && { schedule_name: scheduleName }),
33+
only_last_for_schedule: onlyLast4Schedule,
34+
forced,
35+
};
1436

15-
// This code will be executed only in case of success
16-
// console.log('Request successful, execute final action...');
17-
} catch (error) {
18-
// Error handling
19-
// console.error('Error during call:', error);
20-
} finally {
21-
// This code will always be executed
22-
// console.log('Final action after request')
23-
}
24-
};
37+
await getData({
38+
url: '/v1/backups',
39+
params: jsonToQueryParams(params),
40+
});
41+
} catch (e) {
42+
console.error('Error:', e);
43+
} finally {
44+
// This code will always be executed
45+
// console.log('Final action after request')
46+
}
47+
};
2548

26-
// Return the function for the call and the necessary data
27-
return { getBackups, data, fetching, error };
49+
return {
50+
getBackups,
51+
data,
52+
fetching,
53+
error,
54+
};
2855
};

src/api/Backup/useCreateBackup.ts

+21-20
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,27 @@ import { useApiPost } from '@/hooks/utils/useApiPost';
22

33
// Hook per gestire la logica di fetching dei task di categoria
44
export const useCreateBackup = () => {
5-
const { data, postData, fetching, error } = useApiPost()
5+
const { data, postData, fetching, error } = useApiPost();
66

7-
const handleCreateBackup = async (values: any) => {
8-
try {
9-
// Esegui la chiamata API con il metodo generico
10-
await postData(
11-
'/v1/backup/create',
12-
values)
7+
const handleCreateBackup = async (values: any) => {
8+
try {
9+
// Execute the API call with the generic method
10+
await postData('/v1/backup', values);
11+
// This code will be executed only in case of success
12+
// console.log('Richiesta riuscita, eseguo azioni finali...');
13+
} catch (e) {
14+
// Error handling
15+
// console.error('Errore durante la chiamata:', error);
16+
} finally {
17+
// This code will always be executed
18+
// console.log('Azione finale dopo la richiesta');
19+
}
20+
};
1321

14-
// Questo codice verrà eseguito solo in caso di successo
15-
// console.log('Richiesta riuscita, eseguo azioni finali...');
16-
} catch (error) {
17-
// Gestione dell'errore
18-
// console.error('Errore durante la chiamata:', error);
19-
} finally {
20-
// Questo codice verrà eseguito sempre
21-
// console.log('Azione finale dopo la richiesta');
22-
}
23-
};
24-
25-
// Restituisci la funzione per la chiamata e i dati necessari
26-
return { handleCreateBackup, responseStatus: data, fetching, error };
22+
return {
23+
handleCreateBackup,
24+
responseStatus: data,
25+
fetching,
26+
error,
27+
};
2728
};

src/api/Backup/useCreateBackupFromScheule.ts

+21-19
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,28 @@ import { useApiPost } from '@/hooks/utils/useApiPost';
22

33
// Hook per gestire la logica di fetching dei task di categoria
44
export const useCreateBackupFromScheule = () => {
5-
const { data, postData, fetching, error } = useApiPost()
5+
const { data, postData, fetching, error } = useApiPost();
66

7-
const handleCreateBackupFromSchedule = async (scheduleName: string) => {
8-
try {
9-
// Esegui la chiamata API con il metodo generico
10-
await postData(
11-
'/v1/backup/create-from-schedule',
12-
{ scheduleName: `${scheduleName}`})
7+
const handleCreateBackupFromSchedule = async (scheduleName: string) => {
8+
try {
9+
// Execute the API call with the generic method
10+
await postData('/v1/backup/create-from-schedule', { scheduleName: `${scheduleName}` });
1311

14-
// Questo codice verrà eseguito solo in caso di successo
15-
// console.log('Richiesta riuscita, eseguo azioni finali...');
16-
} catch (error) {
17-
// Gestione dell'errore
18-
// console.error('Errore durante la chiamata:', error);
19-
} finally {
20-
// Questo codice verrà eseguito sempre
21-
// console.log('Azione finale dopo la richiesta');
22-
}
23-
};
12+
// This code will be executed only in case of success
13+
// console.log('Richiesta riuscita, eseguo azioni finali...');
14+
} catch (e) {
15+
// Error handling
16+
// console.error('Errore durante la chiamata:', error);
17+
} finally {
18+
// This code will always be executed
19+
// console.log('Azione finale dopo la richiesta');
20+
}
21+
};
2422

25-
// Restituisci la funzione per la chiamata e i dati necessari
26-
return { handleCreateBackupFromSchedule, responseStatus: data, fetching, error };
23+
return {
24+
handleCreateBackupFromSchedule,
25+
responseStatus: data,
26+
fetching,
27+
error,
28+
};
2729
};

0 commit comments

Comments
 (0)