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

feat(web): adapt to HTTP API of DASD operations #1549

Merged
merged 62 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from 60 commits
Commits
Show all changes
62 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
918a5e3
Use mutations instead of API direct calls
teclator Sep 3, 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
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
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
e896085
Redirect to storage page in case DASD is not supported
teclator Sep 5, 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
1 change: 1 addition & 0 deletions rust/agama-server/src/web/common/jobs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ impl JobsStream {
values: &HashMap<String, OwnedValue>,
) -> Result<&'a Job, ServiceError> {
let job = cache.find_or_create(path);
job.id = path.to_string();
property_from_dbus!(job, running, "Running", values, bool);
property_from_dbus!(job, exit_code, "ExitCode", values, u32);
Ok(job)
Expand Down
2 changes: 1 addition & 1 deletion service/lib/agama/dbus/storage/dasds_format_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def initialize(initial, dasds_tree, path, logger: nil)
# Current status, in the format described by the D-Bus API
def summary
result = {}
@infos.each_value { |i| result[i.path] = i.to_dbus if i.path }
@infos.each_value { |i| result[i.id] = i.to_dbus if i.id }
result
end

Expand Down
2 changes: 1 addition & 1 deletion service/test/agama/dbus/storage/jobs_tree_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
expect(job.path).to match(/#{described_class::ROOT_PATH}\/[0-9]+/)

expect(job.summary).to eq(
{ "/path/dasd1" => [1000, 0, false], "/path/dasd2" => [2000, 0, false] }
{ "0.0.001" => [1000, 0, false], "0.0.002" => [2000, 0, false] }
)
end

Expand Down
5 changes: 5 additions & 0 deletions web/package/agama-web-ui.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Sep 4 21:00:34 UTC 2024 - Knut Anderssen <[email protected]>

- Bring back DASD management support (gh#openSUSE/1549).

teclator marked this conversation as resolved.
Show resolved Hide resolved
-------------------------------------------------------------------
Tue Aug 13 14:57:21 UTC 2024 - David Diaz <[email protected]>

Expand Down
89 changes: 89 additions & 0 deletions web/src/api/dasd.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/*
* Copyright (c) [2024] SUSE LLC
*
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as published
* by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, contact SUSE LLC.
*
* To contact SUSE LLC about this file by physical or electronic mail, you may
* find current contact information at www.suse.com.
*/

import { post, get, put } from "~/api/http";
import { DASDDevice } from "~/types/dasd";

/**
* Returns the list of DASD devices
*/
const fetchDASDDevices = (): Promise<DASDDevice[]> => get("/api/storage/dasd/devices");

/**
* Returns if DASD is supported at all
*/
const DASDSupported = (): Promise<boolean> => get("/api/storage/dasd/supported");

/**
* probes DASD devices
*/
const probeDASD = () => post("/api/storage/dasd/probe");

/**
* Start format job for given list of DASD devices
* @param devicesIDs - array of DASD device ids
* @return id of format job
*/
const formatDASD = (devicesIDs: string[]): Promise<string> =>
post("/api/storage/dasd/format", { devices: devicesIDs }).then(({ data }) => data);

/**
* Enable given list of DASD devices
*
* @param devicesIDs - array of DASD device ids
*/
const enableDASD = (devicesIDs: string[]) =>
post("/api/storage/dasd/enable", { devices: devicesIDs });

/**
* Disable given list of DASD devices
*
* @param devicesIDs - array of DASD device ids
*/
const disableDASD = (devicesIDs: string[]) =>
post("/api/storage/dasd/disable", { devices: devicesIDs });

/**
* Enables diag on given list of DASD devices
*
* @param devicesIDs - array of DASD device ids
*/
const enableDiag = (devicesIDs: string[]) =>
put("/api/storage/dasd/diag", { devices: devicesIDs, diag: true });

/**
* Disables diag on given list of DASD devices
*
* @param devicesIDs - array of DASD device ids
*/
const disableDiag = (devicesIDs: string[]) =>
put("/api/storage/dasd/diag", { devices: devicesIDs, diag: false });

export {
fetchDASDDevices,
DASDSupported,
formatDASD,
probeDASD,
enableDASD,
disableDASD,
enableDiag,
disableDiag,
};
2 changes: 1 addition & 1 deletion web/src/api/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const addConnection = (connection: APIConnection) => post("/api/network/connecti
/**
* Updates given connection
*
* @param connection - connection to be added
* @param connection - connection to be updated
*/
const updateConnection = (connection: APIConnection) =>
put(`/api/network/connections/${connection.id}`, connection);
Expand Down
36 changes: 36 additions & 0 deletions web/src/api/storage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright (c) [2024] SUSE LLC
*
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as published
* by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, contact SUSE LLC.
*
* To contact SUSE LLC about this file by physical or electronic mail, you may
* find current contact information at www.suse.com.
*/

import { get } from "~/api/http";
import { Job } from "~/types/job";

/**
* Returns the list of jobs
*/
const fetchStorageJobs = (): Promise<Job[]> => get("/api/storage/jobs");

/**
* Returns the job with given id or undefined
*/
const findStorageJob = (id: string): Promise<Job | undefined> =>
fetchStorageJobs().then((jobs: Job[]) => jobs.find((value) => value.id === id));

export { fetchStorageJobs, findStorageJob };
Loading
Loading