Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/deploy-pages-channel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
uses: extractions/setup-just@v3

- name: Install wasm-bindgen-cli
run: cargo install wasm-bindgen-cli --version 0.2.114 --locked
run: cargo install wasm-bindgen-cli --version 0.2.114 --locked --force

- name: Install dioxus-cli
run: cargo install dioxus-cli --version 0.7.9 --locked
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-studio-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
uses: extractions/setup-just@v3

- name: Install wasm-bindgen-cli
run: cargo install wasm-bindgen-cli --version 0.2.114 --locked
run: cargo install wasm-bindgen-cli --version 0.2.114 --locked --force

- name: Install dioxus-cli
run: cargo install dioxus-cli --version 0.7.9 --locked
Expand Down
37 changes: 3 additions & 34 deletions lp-app/lpa-studio-core/src/app/device/device_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ use crate::core::view::steps_view::{UiStepState, UiStepView};
use crate::{
ConnectedDeviceSummary, Controller, ControllerId, DeviceOp, DeviceSnapshot, EndpointChoice,
LinkController, LinkOp, LinkState, ProjectOp, ProjectState, ProviderChoice, ServerController,
ServerFailureKind, ServerState, UiAction, UiLogEntry, UiMetric, UiPaneView, UiStatus,
UiStepsView, UiTerminalLine, UiViewContent,
ServerFailureKind, ServerState, UiAction, UiMetric, UiPaneView, UiStatus, UiStepsView,
UiViewContent,
};

pub struct DeviceController {
pub(crate) link: LinkController,
pub(crate) server: ServerController,
terminal: Vec<UiTerminalLine>,
}

impl DeviceController {
Expand All @@ -23,7 +22,6 @@ impl DeviceController {
Self {
link: LinkController::new(),
server: ServerController::new(),
terminal: Vec::new(),
}
}

Expand All @@ -49,30 +47,8 @@ impl DeviceController {
)
}

pub fn has_meaningful_terminal(&self) -> bool {
!matches!(self.link.state(), LinkState::SelectingProvider { .. })
}

pub fn record_logs(&mut self, logs: &[UiLogEntry]) {
self.terminal.extend(
logs.iter()
.filter(|log| is_device_log_source(&log.source))
.map(|log| UiTerminalLine::new(format!("[{}] {}", log.source, log.message))),
);
if self.terminal.len() > 240 {
let remove_count = self.terminal.len() - 240;
self.terminal.drain(0..remove_count);
}
}

pub fn view(&self, project_state: &ProjectState, project_actions: Vec<UiAction>) -> UiPaneView {
let stack = UiStepsView::new(self.sections(project_state, project_actions)).with_terminal(
if self.has_meaningful_terminal() {
self.terminal.clone()
} else {
Vec::new()
},
);
let stack = UiStepsView::new(self.sections(project_state, project_actions));

UiPaneView::new(
Self::NODE_ID,
Expand Down Expand Up @@ -604,10 +580,3 @@ fn provider_action_priority(kind: lpa_link::LinkProviderKind) -> crate::ActionPr
lpa_link::LinkProviderKind::Fake => crate::ActionPriority::Tertiary,
}
}

fn is_device_log_source(source: &str) -> bool {
matches!(
source,
"lpa-link" | "browser-serial" | "fw-esp32" | "fw-browser" | "lp-server"
)
}
15 changes: 0 additions & 15 deletions lp-app/lpa-studio-core/src/app/studio/studio_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ impl StudioController {
connected: ConnectedLink,
updates: UxUpdateSink,
) -> UiResult {
self.device.record_logs(&connected.logs);
self.logs.extend(connected.logs);
self.connect_server_connection(&connected.connection, updates)
.await
Expand Down Expand Up @@ -263,7 +262,6 @@ impl StudioController {
Ok(auto_connect) => auto_connect,
Err(error) => {
let pending_logs = self.device.server.take_pending_logs();
self.device.record_logs(&pending_logs);
self.logs.extend(pending_logs);
self.project.reset();
if matches!(error, UiError::NoFirmwareDetected(_)) {
Expand Down Expand Up @@ -326,7 +324,6 @@ impl StudioController {
};
match result {
Ok(ProjectConnectResult::Connected { logs }) => {
self.device.record_logs(&logs);
self.logs.extend(logs);
let sync = self.sync_project_after_attach(updates).await?;
Ok(UiNotices::new().with_notice(project_sync_notice(
Expand All @@ -336,12 +333,10 @@ impl StudioController {
)))
}
Ok(ProjectConnectResult::SelectionRequired { logs }) => {
self.device.record_logs(&logs);
self.logs.extend(logs);
Ok(UiNotices::new().with_notice(UiNotice::info("Choose running project")))
}
Ok(ProjectConnectResult::NotFound { logs }) => {
self.device.record_logs(&logs);
self.logs.extend(logs);
Ok(UiNotices::new().with_notice(UiNotice::info("No running project found")))
}
Expand Down Expand Up @@ -376,20 +371,17 @@ impl StudioController {
};
match result? {
ProjectConnectResult::Connected { logs } => {
self.device.record_logs(&logs);
self.logs.extend(logs);
let sync = self.sync_project_after_attach(updates).await?;
Ok(AutoProjectConnect::Connected {
synced: sync.synced,
})
}
ProjectConnectResult::SelectionRequired { logs } => {
self.device.record_logs(&logs);
self.logs.extend(logs);
Ok(AutoProjectConnect::SelectionRequired)
}
ProjectConnectResult::NotFound { logs } => {
self.device.record_logs(&logs);
self.logs.extend(logs);
Ok(AutoProjectConnect::NotFound)
}
Expand All @@ -410,7 +402,6 @@ impl StudioController {
};
match result {
Ok(logs) => {
self.device.record_logs(&logs);
self.logs.extend(logs);
let sync = self.sync_project_after_attach(updates).await?;
Ok(UiNotices::new().with_notice(project_sync_notice(
Expand Down Expand Up @@ -445,7 +436,6 @@ impl StudioController {
};
match result {
Ok(logs) => {
self.device.record_logs(&logs);
self.logs.extend(logs);
let sync = self.sync_project_after_attach(updates).await?;
Ok(UiNotices::new().with_notice(project_sync_notice(
Expand Down Expand Up @@ -515,7 +505,6 @@ impl StudioController {
}

fn record_project_sync_run(&mut self, sync: &ProjectSyncRun) {
self.device.record_logs(&sync.logs);
self.logs.extend(sync.logs.clone());
}

Expand Down Expand Up @@ -560,7 +549,6 @@ impl StudioController {
}
};
self.record_logs(core::mem::take(&mut *captured_logs.borrow_mut()));
self.device.record_logs(&management.logs);
self.logs.extend(management.logs);

let mut outcome = UiNotices::new().with_notice(UiNotice::info("Device reset"));
Expand Down Expand Up @@ -630,7 +618,6 @@ impl StudioController {
return Err(error);
}
};
self.device.record_logs(&management.logs);
self.logs.extend(management.logs);
let mut outcome = UiNotices::new().with_notice(provision_notice(&management.result));
emit_activity(
Expand Down Expand Up @@ -699,7 +686,6 @@ impl StudioController {
return Err(error);
}
};
self.device.record_logs(&management.logs);
self.logs.extend(management.logs);
let mut outcome = UiNotices::new().with_notice(reset_notice(&management.result));
emit_activity(
Expand Down Expand Up @@ -749,7 +735,6 @@ impl StudioController {
if logs.is_empty() {
return;
}
self.device.record_logs(&logs);
self.logs.extend(logs);
}
}
Expand Down
27 changes: 22 additions & 5 deletions lp-app/lpa-studio-web/assets/tailwind.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
--tw-text-xl: 1.25rem;
--tw-text-xl--line-height: calc(1.75 / 1.25);
--tw-font-weight-medium: 500;
--tw-font-weight-semibold: 600;
--tw-font-weight-bold: 700;
--tw-font-weight-extrabold: 800;
--tw-leading-tight: 1.25;
Expand Down Expand Up @@ -174,9 +175,15 @@
.tw\:h-2 {
height: calc(var(--tw-spacing) * 2);
}
.tw\:h-4 {
height: calc(var(--tw-spacing) * 4);
}
.tw\:h-6 {
height: calc(var(--tw-spacing) * 6);
}
.tw\:h-8 {
height: calc(var(--tw-spacing) * 8);
}
.tw\:h-14 {
height: calc(var(--tw-spacing) * 14);
}
Expand Down Expand Up @@ -240,9 +247,15 @@
.tw\:w-2 {
width: calc(var(--tw-spacing) * 2);
}
.tw\:w-4 {
width: calc(var(--tw-spacing) * 4);
}
.tw\:w-6 {
width: calc(var(--tw-spacing) * 6);
}
.tw\:w-8 {
width: calc(var(--tw-spacing) * 8);
}
.tw\:w-14 {
width: calc(var(--tw-spacing) * 14);
}
Expand Down Expand Up @@ -329,6 +342,9 @@
.tw\:grid-cols-3 {
grid-template-columns: repeat(3, minmax(0, 1fr));
}
.tw\:grid-cols-\[18px_minmax\(0\,1fr\)_auto\] {
grid-template-columns: 18px minmax(0,1fr) auto;
}
.tw\:grid-cols-\[28px_minmax\(0\,1fr\)\] {
grid-template-columns: 28px minmax(0,1fr);
}
Expand All @@ -353,17 +369,14 @@
.tw\:grid-cols-\[260px_minmax\(0\,1fr\)\] {
grid-template-columns: 260px minmax(0,1fr);
}
.tw\:grid-cols-\[minmax\(0\,1fr\)_auto_auto\] {
grid-template-columns: minmax(0,1fr) auto auto;
}
.tw\:grid-cols-\[minmax\(0\,1fr\)_minmax\(300px\,380px\)\] {
grid-template-columns: minmax(0,1fr) minmax(300px,380px);
}
.tw\:grid-cols-\[minmax\(80px\,0\.35fr\)_minmax\(0\,1fr\)\] {
grid-template-columns: minmax(80px,0.35fr) minmax(0,1fr);
}
.tw\:grid-cols-\[minmax\(120px\,0\.4fr\)_minmax\(0\,1fr\)_24px\] {
grid-template-columns: minmax(120px,0.4fr) minmax(0,1fr) 24px;
.tw\:grid-cols-\[minmax\(120px\,0\.4fr\)_minmax\(0\,1fr\)_32px\] {
grid-template-columns: minmax(120px,0.4fr) minmax(0,1fr) 32px;
}
.tw\:grid-cols-\[minmax\(120px\,0\.35fr\)_minmax\(0\,1fr\)\] {
grid-template-columns: minmax(120px,0.35fr) minmax(0,1fr);
Expand Down Expand Up @@ -913,6 +926,10 @@
--tw-font-weight: var(--tw-font-weight-medium);
font-weight: var(--tw-font-weight-medium);
}
.tw\:font-semibold {
--tw-font-weight: var(--tw-font-weight-semibold);
font-weight: var(--tw-font-weight-semibold);
}
.tw\:break-words {
overflow-wrap: break-word;
}
Expand Down
9 changes: 3 additions & 6 deletions lp-app/lpa-studio-web/src/app/node/config_slot_row.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,7 @@ pub fn ConfigSlotRow(
span { class: "tw:h-6 tw:w-6 tw:flex-none" }
}
div { class: "tw:min-w-0",
strong { class: "tw:block tw:min-w-0 tw:text-sm tw:leading-tight tw:text-strong-foreground tw:break-words", "{slot.label}" }
if let Some(detail) = slot.detail.as_ref() {
small { class: "tw:block tw:text-xs tw:text-subtle-foreground tw:break-words", "{detail}" }
}
strong { class: "tw:block tw:min-w-0 tw:text-sm tw:font-semibold tw:leading-tight tw:text-strong-foreground tw:break-words", "{slot.label}" }
}
}
div { class: "tw:flex tw:min-w-0 tw:items-center tw:justify-end tw:gap-2 tw:text-sm tw:leading-tight tw:text-muted-foreground",
Expand Down Expand Up @@ -168,9 +165,9 @@ fn AssetSlotEditor(asset: lpa_studio_core::UiSlotAsset) -> Element {

fn record_summary_class(expanded: bool) -> &'static str {
if expanded {
"tw:text-xs tw:font-bold tw:uppercase tw:text-subtle-foreground"
"tw:text-xs tw:font-semibold tw:uppercase tw:text-subtle-foreground"
} else {
"tw:text-xs tw:font-bold tw:uppercase tw:text-muted-foreground"
"tw:text-xs tw:font-semibold tw:uppercase tw:text-muted-foreground"
}
}

Expand Down
22 changes: 11 additions & 11 deletions lp-app/lpa-studio-web/src/app/node/node_header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fn NodeStatusMenu(header: UiNodeHeader) -> Element {
class: node_status_button_class(header.status.kind).to_string(),
open_class: node_status_button_open_class(header.status.kind).to_string(),
icon,
icon_size: 13,
icon_size: 16,
label,
title: format!("{} status details", header.title),
popup_class: node_status_popup_class(header.status.kind).to_string(),
Expand Down Expand Up @@ -91,39 +91,39 @@ fn status_icon(kind: UiStatusKind) -> StudioIconName {
fn node_status_button_class(kind: UiStatusKind) -> &'static str {
match kind {
UiStatusKind::Neutral => {
"tw:inline-flex tw:h-6 tw:w-6 tw:items-center tw:justify-center tw:rounded-full tw:border tw:border-status-neutral-border tw:bg-status-neutral-bg tw:p-0 tw:text-status-neutral-foreground"
"tw:inline-flex tw:h-8 tw:w-8 tw:items-center tw:justify-center tw:rounded-full tw:border tw:border-status-neutral-border tw:bg-status-neutral-bg tw:p-0 tw:text-status-neutral-foreground"
}
UiStatusKind::Working => {
"tw:inline-flex tw:h-6 tw:w-6 tw:items-center tw:justify-center tw:rounded-full tw:border tw:border-status-working-border tw:bg-status-working-bg tw:p-0 tw:text-status-working-foreground"
"tw:inline-flex tw:h-8 tw:w-8 tw:items-center tw:justify-center tw:rounded-full tw:border tw:border-status-working-border tw:bg-status-working-bg tw:p-0 tw:text-status-working-foreground"
}
UiStatusKind::Good => {
"tw:inline-flex tw:h-6 tw:w-6 tw:items-center tw:justify-center tw:rounded-full tw:border tw:border-status-good-border tw:bg-status-good-bg tw:p-0 tw:text-status-good-foreground"
"tw:inline-flex tw:h-8 tw:w-8 tw:items-center tw:justify-center tw:rounded-full tw:border tw:border-status-good-border tw:bg-status-good-bg tw:p-0 tw:text-status-good-foreground"
}
UiStatusKind::Warning => {
"tw:inline-flex tw:h-6 tw:w-6 tw:items-center tw:justify-center tw:rounded-full tw:border tw:border-status-warning-border tw:bg-status-warning-bg tw:p-0 tw:text-status-warning-foreground"
"tw:inline-flex tw:h-8 tw:w-8 tw:items-center tw:justify-center tw:rounded-full tw:border tw:border-status-warning-border tw:bg-status-warning-bg tw:p-0 tw:text-status-warning-foreground"
}
UiStatusKind::Error => {
"tw:inline-flex tw:h-6 tw:w-6 tw:items-center tw:justify-center tw:rounded-full tw:border tw:border-status-error-border tw:bg-status-error-bg tw:p-0 tw:text-status-error-foreground"
"tw:inline-flex tw:h-8 tw:w-8 tw:items-center tw:justify-center tw:rounded-full tw:border tw:border-status-error-border tw:bg-status-error-bg tw:p-0 tw:text-status-error-foreground"
}
}
}

fn node_status_button_open_class(kind: UiStatusKind) -> &'static str {
match kind {
UiStatusKind::Neutral => {
"tw:inline-flex tw:h-6 tw:w-6 tw:items-center tw:justify-center tw:rounded-full tw:border tw:border-status-neutral-border tw:bg-card-raised tw:p-0 tw:text-status-neutral-foreground"
"tw:inline-flex tw:h-8 tw:w-8 tw:items-center tw:justify-center tw:rounded-full tw:border tw:border-status-neutral-border tw:bg-card-raised tw:p-0 tw:text-status-neutral-foreground"
}
UiStatusKind::Working => {
"tw:inline-flex tw:h-6 tw:w-6 tw:items-center tw:justify-center tw:rounded-full tw:border tw:border-status-working-border tw:bg-card-raised tw:p-0 tw:text-status-working-foreground"
"tw:inline-flex tw:h-8 tw:w-8 tw:items-center tw:justify-center tw:rounded-full tw:border tw:border-status-working-border tw:bg-card-raised tw:p-0 tw:text-status-working-foreground"
}
UiStatusKind::Good => {
"tw:inline-flex tw:h-6 tw:w-6 tw:items-center tw:justify-center tw:rounded-full tw:border tw:border-status-good-border tw:bg-card-raised tw:p-0 tw:text-status-good-foreground"
"tw:inline-flex tw:h-8 tw:w-8 tw:items-center tw:justify-center tw:rounded-full tw:border tw:border-status-good-border tw:bg-card-raised tw:p-0 tw:text-status-good-foreground"
}
UiStatusKind::Warning => {
"tw:inline-flex tw:h-6 tw:w-6 tw:items-center tw:justify-center tw:rounded-full tw:border tw:border-status-warning-border tw:bg-card-raised tw:p-0 tw:text-status-warning-foreground"
"tw:inline-flex tw:h-8 tw:w-8 tw:items-center tw:justify-center tw:rounded-full tw:border tw:border-status-warning-border tw:bg-card-raised tw:p-0 tw:text-status-warning-foreground"
}
UiStatusKind::Error => {
"tw:inline-flex tw:h-6 tw:w-6 tw:items-center tw:justify-center tw:rounded-full tw:border tw:border-status-error-border tw:bg-card-raised tw:p-0 tw:text-status-error-foreground"
"tw:inline-flex tw:h-8 tw:w-8 tw:items-center tw:justify-center tw:rounded-full tw:border tw:border-status-error-border tw:bg-card-raised tw:p-0 tw:text-status-error-foreground"
}
}
}
Expand Down
11 changes: 3 additions & 8 deletions lp-app/lpa-studio-web/src/app/node/produced_product_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,15 +341,10 @@ fn product_label(kind: UiProductKind) -> &'static str {

fn preview_detail(preview: &UiProductPreview, tracking: UiProductTrackingState) -> Option<String> {
match preview {
UiProductPreview::VisualSrgb8 {
width,
height,
revision,
..
} => Some(format!("{width} x {height} rev {revision}")),
UiProductPreview::VisualSrgb8 { width, height, .. } => Some(format!("{width} x {height}")),
UiProductPreview::ControlNative(preview) => Some(format!(
"{} x {} samples rev {}",
preview.extent.rows, preview.extent.samples_per_row, preview.revision
"{} x {} samples",
preview.extent.rows, preview.extent.samples_per_row
)),
UiProductPreview::Pending if tracking == UiProductTrackingState::Tracking => {
Some("preview pending".to_string())
Expand Down
2 changes: 1 addition & 1 deletion lp-app/lpa-studio-web/src/app/node/produced_value_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub fn ProducedValueView(
}
}
}
dt { class: "tw:flex tw:min-w-0 tw:items-center tw:justify-between tw:gap-1.5 tw:text-xs tw:font-bold tw:leading-tight tw:text-subtle-foreground",
dt { class: "tw:flex tw:min-w-0 tw:items-center tw:justify-between tw:gap-1.5 tw:text-xs tw:font-semibold tw:leading-tight tw:text-subtle-foreground",
span { class: "tw:min-w-0 tw:break-words", "{value.label}" }
SlotDetailButton {
label: value.label.clone(),
Expand Down
Loading
Loading