Skip to content

Commit

Permalink
Changes based on Code Review
Browse files Browse the repository at this point in the history
  • Loading branch information
teclator committed May 16, 2024
1 parent 106b984 commit ef1d4b1
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 21 deletions.
2 changes: 2 additions & 0 deletions rust/agama-lib/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ use zbus::{self, zvariant};

#[derive(Error, Debug)]
pub enum ServiceError {
#[error("Cannot generate Agama logs: {0}")]
CannotGenerateLogs(String),
#[error("D-Bus service error: {0}")]
DBus(#[from] zbus::Error),
#[error("Could not connect to Agama bus at '{0}': {1}")]
Expand Down
2 changes: 1 addition & 1 deletion rust/agama-server/src/manager/web.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ async fn generate_logs() -> Result<String, Error> {
Command::new("agama")
.args(["logs", "store", "-d", path.as_str()])
.status()
.expect("Cannot generate logs");
.map_err(|e| ServiceError::CannotGenerateLogs(e.to_string()))?;

let full_path = format!("{path}.tar.bz2");
Ok(full_path)
Expand Down
36 changes: 36 additions & 0 deletions rust/data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"network": {
"connections": [
{
"id": "eth0",
"method4": "auto",
"method6": "auto",
"addresses": [
"192.168.0.101/24"
],
"interface": "eth0",
"status": "up"
},
{
"id": "Wired connection 1",
"method4": "auto",
"method6": "auto",
"interface": "enp5s0f4u2c2",
"status": "up"
},
{
"id": "Sarambeque",
"method4": "auto",
"method6": "auto",
"wireless": {
"password": "vikingo.pass",
"security": "wpa-psk",
"ssid": "Sarambeque",
"mode": "infrastructure"
},
"status": "up"
}
]
}
}

9 changes: 0 additions & 9 deletions web/src/client/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,6 @@ class HTTPClient {
return response;
}

/**
* @param {string} url - Endpoint URL (e.g., "/l10n/config").
* @return {Promise<Response>} Server response.
*/
async getRaw(url) {
const response = await fetch(`${this.baseUrl}${url}`);
return response;
}

/**
* @param {string} url - Endpoint URL (e.g., "/l10n/config").
* @param {object} data - Data to submit
Expand Down
3 changes: 2 additions & 1 deletion web/src/client/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ class ManagerBaseClient {
* @return {Promise<Response>}
*/
async fetchLogs() {
return this.client.getRaw("/manager/logs");
const response = await fetch(`${this.client.baseUrl}/manager/logs`);
return response;
}

/**
Expand Down
12 changes: 2 additions & 10 deletions web/src/components/core/Sidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,7 @@ import { Icon } from "~/components/layout";
import { InstallerKeymapSwitcher, InstallerLocaleSwitcher } from "~/components/l10n";
import {
About,
Disclosure,
// FIXME: unify names here by renaming LogsButton -> LogButton or ShowLogButton -> ShowLogsButton
LogsButton,
ShowLogButton,
ShowTerminalButton,
} from "~/components/core";
import { noop } from "~/utils";
import { _ } from "~/i18n";
Expand All @@ -47,7 +43,7 @@ import useNodeSiblings from "~/hooks/useNodeSiblings";
*
* @param {SidebarProps}
*/
export default function Sidebar ({ isOpen, onClose = noop, children }) {
export default function Sidebar({ isOpen, onClose = noop, children }) {
const asideRef = useRef(null);
const closeButtonRef = useRef(null);
const [addAttribute, removeAttribute] = useNodeSiblings(asideRef.current);
Expand Down Expand Up @@ -136,11 +132,7 @@ export default function Sidebar ({ isOpen, onClose = noop, children }) {

<div className="flex-stack justify-between" onClick={onClick}>
<div className="flex-stack">
<Disclosure label={_("Diagnostic tools")} data-keep-sidebar-open>
<ShowLogButton />
<LogsButton data-keep-sidebar-open="true" />
<ShowTerminalButton />
</Disclosure>
<LogsButton data-keep-sidebar-open="true" />
{children}
<About />
</div>
Expand Down

0 comments on commit ef1d4b1

Please sign in to comment.