Skip to content

Commit

Permalink
Merge pull request #175 from knuton/drop-label-printer
Browse files Browse the repository at this point in the history
Remove unused label printer page
  • Loading branch information
guyonvarch authored Sep 6, 2024
2 parents 2befad4 + d92b460 commit 5f6bfb6
Show file tree
Hide file tree
Showing 10 changed files with 7 additions and 178 deletions.
4 changes: 4 additions & 0 deletions controller/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

- controller: Enable spatial navigation using the arrow keys

## Removed

- controller: Remove unused label printing functionality

# [2024.7.0] - 2024-08-02

# [2024.7.0-VALIDATION] - 2024-07-02
Expand Down
5 changes: 0 additions & 5 deletions controller/bindings/label-printer/dune

This file was deleted.

33 changes: 0 additions & 33 deletions controller/bindings/label-printer/label_printer.ml

This file was deleted.

8 changes: 0 additions & 8 deletions controller/bindings/label-printer/label_printer.mli

This file was deleted.

6 changes: 0 additions & 6 deletions controller/gui/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -454,12 +454,6 @@ html {
overflow: auto;
}

.d-HiddenLink {
text-decoration: none;
cursor: text;
color: black;
}

.d-Code {
font-style: normal;
background-color: #F1F1F1;
Expand Down
4 changes: 2 additions & 2 deletions controller/server/dune
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
(name server)
(public_name playos-controller)
(modules server update info gui health
info_page localization_page status_page error_page label_page
info_page localization_page status_page error_page
network_list_page network_details_page changelog_page
page definition icon)
(libraries lwt logs logs.fmt logs.lwt fpath cohttp-lwt-unix logging
opium tyxml rauc zerotier connman locale network timedate systemd
label_printer semver2 fieldslib screen_settings)
semver2 fieldslib screen_settings)
(preprocess (pps lwt_ppx ppx_sexp_conv)))

(library
Expand Down
57 changes: 0 additions & 57 deletions controller/server/gui.ml
Original file line number Diff line number Diff line change
Expand Up @@ -395,62 +395,6 @@ module NetworkGui = struct
end


(** Label printing *)
module LabelGui = struct
open Label_printer

let make_label () =
let%lwt ethernet_interfaces =
Network.Interface.get_all ()
>|= List.filter (fun (i: Network.Interface.t) ->
Re.execp (Re.seq [Re.start; Re.str "enp" ] |> Re.compile) i.name)
in
let%lwt server_info = Info.get () in
return
({ machine_id = server_info.machine_id
; mac_1 = CCOption.(
ethernet_interfaces
|> CCList.get_at_idx 0
>|= (fun i -> i.address)
|> get_or ~default:"-"
)
; mac_2 = CCOption.(
ethernet_interfaces
|> CCList.get_at_idx 1
>|= (fun i -> i.address)
|> get_or ~default:"-"
)
} : Label_printer.label)

let overview _req =
let%lwt label = make_label () in
Lwt.return (page (Label_page.html label))

let print req =
let%lwt form_data = urlencoded_pairs_of_body req in
let url = form_data
|> List.assoc "label_printer_url"
|> List.hd
in
let count = form_data
|> List.assoc "count"
|> List.hd
|> int_of_string
in
let%lwt label = make_label () in
CCList.replicate count ()
|> Lwt_list.iter_s
(fun () -> Label_printer.print ~url label)
>|= (fun () -> "Labels printed.")
>|= success

let build app =
app
|> get "/label" overview
|> post "/label/print" print

end

module StatusGui = struct
let build ~health_s ~update_s ~rauc app =
app
Expand Down Expand Up @@ -537,7 +481,6 @@ let routes ~systemd ~shutdown ~health_s ~update_s ~rauc ~connman app =
|> InfoGui.build
|> NetworkGui.build ~connman
|> LocalizationGui.build
|> LabelGui.build
|> StatusGui.build ~health_s ~update_s ~rauc
|> ChangelogGui.build
|> RemoteMaintenanceGui.build ~systemd
Expand Down
58 changes: 0 additions & 58 deletions controller/server/view/label_page.ml

This file was deleted.

3 changes: 0 additions & 3 deletions controller/server/view/label_page.mli

This file was deleted.

7 changes: 1 addition & 6 deletions controller/server/view/status_page.ml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@ let html { health; update; rauc } =
~current_page:Page.SystemStatus
~header:(Page.header_title
~icon:Icon.screen
[ txt "System Statu"
; a
~a:[ a_class [ "d-HiddenLink" ]
; a_href "/label"
]
[ txt "s" ]
[ txt "System Status"
])
(Definition.list
(definition "Health" health
Expand Down

0 comments on commit 5f6bfb6

Please sign in to comment.