Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(web): bring back zFCP support (new HTTP / JSON API, queries, and TypeScript) #1570

Merged
merged 121 commits into from
Sep 18, 2024
Merged
Changes from 1 commit
Commits
Show all changes
121 commits
Select commit Hold shift + click to select a range
9e8cc77
start with new web API for DASD
jreidinger Aug 21, 2024
daf6124
[WIP] Try to add a supported check to DASD API
teclator Aug 22, 2024
e05a7cc
try to have working dasd#supported
jreidinger Aug 22, 2024
5e246d1
Replaced DASD is supported check
teclator Aug 22, 2024
c772472
[WIP] Start adapting DASDPage
teclator Aug 22, 2024
7e4b34d
Temporal fix for showing dasds
teclator Aug 22, 2024
d866bd8
adapt ids
jreidinger Aug 22, 2024
8788502
Merge branch 'http-dasd' into web-dasd
teclator Aug 22, 2024
08edd00
Start moving DASD pages to Typescript
teclator Aug 22, 2024
e796206
add dasd probe
jreidinger Aug 22, 2024
2b40f73
add more api and queries for dasd
jreidinger Aug 22, 2024
455fa66
add format api call
jreidinger Aug 23, 2024
fa7ac90
fix sort types
jreidinger Aug 23, 2024
b2d7f6c
add backspace icon
jreidinger Aug 23, 2024
6251f72
Move DASD actions to queries
teclator Aug 23, 2024
6e8e581
add jobs api
jreidinger Aug 23, 2024
d4be0c8
Merge remote-tracking branch 'origin/http-dasd' into web-dasd
jreidinger Aug 23, 2024
fc3497f
Moved DASD filters to queries
teclator Aug 23, 2024
41251bf
Move DASD selection to queries
teclator Aug 23, 2024
b7ab21c
Merge remote-tracking branch 'origin/http-dasd' into web-dasd
jreidinger Aug 23, 2024
897bbf4
first attempt to implement proper format with storage jobs
jreidinger Aug 23, 2024
fc8f79c
optimize dasd devices query to not use invalidate
jreidinger Aug 27, 2024
f7530fd
Merge branch 'http-dasd' into web-dasd
teclator Aug 27, 2024
87e4e13
Fix jobs url
teclator Aug 27, 2024
fa3eae7
Getting rid of the DASD initial state
teclator Aug 27, 2024
e2da06a
Use the DASD id for notifing format job changes
teclator Aug 27, 2024
8991d01
Small fixes for the DASD Format progress dialog
teclator Aug 27, 2024
d67205d
Fix jobs summary test
teclator Aug 27, 2024
d7033e5
Merge remote-tracking branch 'origin/master' into web-dasd
jreidinger Aug 28, 2024
94f92fa
add non-working test for component with mutating queries
jreidinger Aug 28, 2024
23405eb
add test for dasd format progress together with fix it reveals
jreidinger Aug 28, 2024
5dba41c
transform DASDFormatProgress component to typescript
jreidinger Aug 29, 2024
40baceb
Update web/src/api/dasd.ts
jreidinger Aug 29, 2024
4e8e129
Removing dasd client
teclator Aug 29, 2024
eeba75f
Removing leftovers
teclator Aug 29, 2024
ad92d01
use connsistent name in API
jreidinger Aug 29, 2024
6b97d1d
Remove not needed code from DASD Page
teclator Aug 29, 2024
c13bfbf
Merge branch 'master' into web-dasd
teclator Aug 29, 2024
debcfb7
Merge remote-tracking branch 'origin/web-dasd' into dasd_failing_test
jreidinger Aug 29, 2024
1a3d485
fix dasd table test
jreidinger Aug 29, 2024
a6cb882
Improve DASDFormat progress dialog
teclator Aug 29, 2024
df7ca94
Notify id in Jobs events
teclator Aug 29, 2024
7ddbba5
Handle JobAdded event
teclator Aug 29, 2024
f585806
Remove running jobs when finish
teclator Aug 29, 2024
b028a3b
Fix DASDFormatProgress unit test
teclator Sep 2, 2024
9fd4544
Removed leftover Deviceinfo
teclator Sep 2, 2024
dbdf722
Changes based on CR
teclator Sep 2, 2024
8bbf57b
Changes based on code review
teclator Sep 3, 2024
d0650ac
Implement http backend for zfcp
jreidinger Aug 29, 2024
c4f6472
format rust
jreidinger Sep 3, 2024
918a5e3
Use mutations instead of API direct calls
teclator Sep 3, 2024
a7a027d
fix autoapi
jreidinger Sep 4, 2024
4405715
More changes based on code review
teclator Sep 4, 2024
6d140be
Replace dasd filter queries by component state
teclator Sep 4, 2024
8fc01b9
Replace dasd selection queries by component state
teclator Sep 4, 2024
50e76ad
Do not set any info about formatting.
teclator Sep 4, 2024
a75354f
Added DASD route only if supported
teclator Sep 4, 2024
669f102
Removed selected DASD leftover queries
teclator Sep 4, 2024
f296c55
add method to get disks and add id to zfcp controller to be able to c…
jreidinger Sep 4, 2024
8ebc3a7
add zFCP types and api for web
jreidinger Sep 4, 2024
76d295b
Use only one mutation for modifying DASD state
teclator Sep 4, 2024
a705ac6
Do not modify existent cache but return new object
teclator Sep 4, 2024
d0bf495
Another inmutability fix
teclator Sep 4, 2024
211df16
add initial zfcp queries
jreidinger Sep 4, 2024
3c9c319
Merge branch 'master' into web-dasd
teclator Sep 4, 2024
1c9dfdd
Added changelog
teclator Sep 4, 2024
9b96a93
Apply suggestions from CR
teclator Sep 5, 2024
5188009
Merge remote-tracking branch 'origin/web-dasd' into zfcp_adapt
jreidinger Sep 5, 2024
77d744e
add route to zfcp page
jreidinger Sep 5, 2024
a9cc9d5
show properly zfcp link
jreidinger Sep 5, 2024
8b908b0
Bring back ZFCP to the devices tech menu and adapted tests
teclator Sep 5, 2024
f87cd51
Merge branch 'master' into zfcp_adapt
teclator Sep 5, 2024
e2141f6
initial WIP for zfcp web UI
jreidinger Sep 5, 2024
b62e58c
split ZFCP controllers table
jreidinger Sep 5, 2024
a28c9bc
add config call to zfcp
jreidinger Sep 6, 2024
4392c08
change backend to provide more info about controllers to avoid doing …
jreidinger Sep 6, 2024
2e63383
fix typo
jreidinger Sep 9, 2024
88ac2be
Fix indentation
teclator Sep 9, 2024
e888d0b
Fix ZFCP controller path
teclator Sep 9, 2024
2a2fa15
Fixed indentation and run prettier
teclator Sep 9, 2024
82303ee
Moving to typescript
teclator Sep 9, 2024
b9adfca
move getting id from path to own method with test
jreidinger Sep 9, 2024
bc543b3
do not use client and manager in disk popup in zfcp page
jreidinger Sep 9, 2024
6c41ec7
change naming for acronyms in ZFCP and switch to hooks
jreidinger Sep 10, 2024
f2d0f15
fix cases to display properly zfcp
jreidinger Sep 10, 2024
fac2422
fix type for luns map
jreidinger Sep 10, 2024
31abfce
Added close action and removed leftovers
teclator Sep 10, 2024
6badb0b
add initial test for zfcp disk table
jreidinger Sep 10, 2024
6c4123f
add initial test for controllers
jreidinger Sep 10, 2024
1f8cfa5
Return json answer in activation calls
teclator Sep 11, 2024
c6ffc79
Fixed activation result
teclator Sep 11, 2024
d9fec02
Navigate to target-device when close
teclator Sep 11, 2024
e5ddfb8
fix zfcp page test
jreidinger Sep 11, 2024
2435305
Close disk activation popup when success
teclator Sep 11, 2024
08a1b89
Moved ZFCP Disk activation form to a page
teclator Sep 12, 2024
cf25379
Fix ZFCPDiskForm unit tests
teclator Sep 12, 2024
0e865bd
Modify ZFCP activation page header and run prettier
teclator Sep 13, 2024
b373be2
Not return queries when subscribing to changes
teclator Sep 13, 2024
1649ef2
Merge branch 'master' into zfcp_adapt
dgdavid Sep 13, 2024
c0be7e0
fix(web): adapt zFCP pages
dgdavid Sep 13, 2024
1f95321
refactor(web): migrate core/ServerError to TypeScript
dgdavid Sep 13, 2024
9ddc9ed
fix(web): improve the ZFCPage internals
dgdavid Sep 13, 2024
8b3b28e
fix(web): better naming
dgdavid Sep 13, 2024
352444a
Change Back button and rename zFCP and DASD functions
teclator Sep 13, 2024
bfacdb0
Choose a better action for navigating to selection device
teclator Sep 17, 2024
9efa66e
Change zfcp queries as suggested
teclator Sep 17, 2024
f0bd5f9
zFCP queries and api changes based on CR
teclator Sep 17, 2024
89efc50
Move zfcp components under its own folder
teclator Sep 17, 2024
cbb7f9a
Move dasd components under its own folder
teclator Sep 17, 2024
1ae7849
Merge branch 'master' into zfcp_adapt
teclator Sep 17, 2024
268d0b9
prettier fixes
teclator Sep 17, 2024
5caebea
Do not export not needed components
teclator Sep 17, 2024
faa5e8b
Added changelog
teclator Sep 17, 2024
65a0903
Ensure changes are applied even if activating.
teclator Sep 17, 2024
cd11f27
Update rust/agama-lib/src/storage/client/zfcp.rs
teclator Sep 18, 2024
92b51ab
Use already defined method for obtaining the id from path
teclator Sep 18, 2024
d5720ec
Move queries and api for dasd and zfcp under storage dir
teclator Sep 18, 2024
7af24f8
Try to simplify zfcp and dasd changes queries
teclator Sep 18, 2024
8268a2f
Fix test
teclator Sep 18, 2024
8b1af6b
Move ZFCPOptions to the web server
teclator Sep 18, 2024
19a242c
Merge branch 'master' into zfcp_adapt
teclator Sep 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 19 additions & 27 deletions web/src/queries/zfcp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,67 +26,56 @@ import { useInstallerClient } from "~/context/installer";
import React from "react";
import { ZFCPConfig, ZFCPController, ZFCPDisk } from "~/types/zfcp";

/**
* Returns a query for retrieving the zFCP controllers
*/
const zfcpControllersQuery = () => ({
const zfcpControllersQuery = {
Copy link
Contributor

@dgdavid dgdavid Sep 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, maybe I miss something at some point but the only suggestion I see is about the naming: #1570 (review)

But not about the full structure. I've no strong opinion about writing them as function or object. But I though we were writing them always as function for consistence since they could receive args for building the query. As far as I can see, @imobachgs has wrote some as function and some as object in the storage part too. We can go ahead with such approach if you guys think it is better, but we should be consistent in all places.

PLEASE, do not take this comment as a suggestion for continue sending changes against this PR. Whatever we decide to choose should be addressed in a change unifying all the queries across the code.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change was based on this another suggestion #1570 (comment), in that case objects were used, so, I also does not have an strong opinion and agree on unifying.

Copy link
Contributor

@dgdavid dgdavid Sep 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I see.

As said, let's go ahead and talk about it later, once we finish the queries implementation.

Copy link
Contributor

@imobachgs imobachgs Sep 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change was based on this another suggestion #1570 (comment), in that case objects were used, so, I also does not have an strong opinion and agree on unifying.

Well, the point of my comment was not the queryKey thingie, but the overall approach of the whole function. I added another note about it (see #1570 (comment)).

queryKey: ["zfcp", "controllers"],
queryFn: fetchZFCPControllers,
staleTime: Infinity
});
};

/**
* Returns a query for retrieving the zFCP disks
*/
const ZFCPDisksQuery = () => ({
const zfcpDisksQuery = {
queryKey: ["zfcp", "disks"],
queryFn: fetchZFCPDisks,
staleTime: Infinity
});
};

/**
* Returns a query for checking if zFCP is supported
*/
const zfcpSupportedQuery = () => ({
const zfcpSupportedQuery = {
queryKey: ["zfcp", "supported"],
queryFn: supportedZFCP,
});
/**
* Returns a query for retrieving the zFCP config
*/
const zfcpConfigQuery = () => ({
};

const zfcpConfigQuery = {
queryKey: ["zfcp", "config"],
queryFn: fetchZFCPConfig,
});
};

/**
* Hook that returns zFCP controllers.
*/
const useZFCPControllers = (): ZFCPController[] => {
const { data: controllers } = useSuspenseQuery(zfcpControllersQuery());
const { data: controllers } = useSuspenseQuery(zfcpControllersQuery);
return controllers;
};

/**
* Hook that returns zFCP disks.
*/
const useZFCPDisks = (): ZFCPDisk[] => {
const { data: devices } = useSuspenseQuery(ZFCPDisksQuery());
const { data: devices } = useSuspenseQuery(zfcpDisksQuery);
return devices;
};

/**
* Hook that returns zFCP config.
*/
const useZFCPSupported = (): boolean => {
const { data: supported } = useSuspenseQuery(zfcpSupportedQuery());
const { data: supported } = useSuspenseQuery(zfcpSupportedQuery);
return supported;
};
/**
* Hook that returns zFCP config.
*/
const useZFCPConfig = (): ZFCPConfig => {
const { data: config } = useSuspenseQuery(zfcpConfigQuery());
const { data: config } = useSuspenseQuery(zfcpConfigQuery);
return config;
};

Expand All @@ -104,15 +93,17 @@ const useZFCPControllersChanges = () => {
switch (event.type) {
case "ZFCPControllerAdded": {
const device: ZFCPController = event.device;
queryClient.setQueryData(["zfcp", "controllers"], (prev: ZFCPController[]) => {
queryClient.setQueryData(zfcpControllersQuery.queryKey, (prev: ZFCPController[] | undefined) => {
if (prev === undefined) return;
return [...prev, device];
});
break;
}
case "ZFCPControllerRemoved": {
const device: ZFCPController = event.device;
const { id } = device;
queryClient.setQueryData(["zfcp", "controllers"], (prev: ZFCPController[]) => {
queryClient.setQueryData(zfcpControllersQuery.queryKey, (prev: ZFCPController[] | undefined) => {
if (prev === undefined) return;
const res = prev.filter((dev) => dev.id !== id);
return res;
});
Expand All @@ -121,7 +112,8 @@ const useZFCPControllersChanges = () => {
case "ZFCPControllerChanged": {
const device: ZFCPController = event.device;
const { id } = device;
queryClient.setQueryData(["zfcp", "controllers"], (prev: ZFCPController[]) => {
queryClient.setQueryData(zfcpControllersQuery.queryKey, (prev: ZFCPController[] | undefined) => {
if (prev === undefined) return;
// deep copy of original to have it immutable
const res = [...prev];
const index = res.findIndex((dev) => dev.id === id);
Expand Down