Skip to content

Commit 3f07346

Browse files
committed
frontend/devices: enhance table ui
1 parent cb1e04e commit 3f07346

File tree

1 file changed

+35
-40
lines changed

1 file changed

+35
-40
lines changed

frontend/src/pages/devices.tsx

Lines changed: 35 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ export class DeviceList extends Component<{}, DeviceListState> {
412412
const trimmed_note = charger.note.trim();
413413
const split = trimmed_note.split("\n");
414414
const entry = <tr>
415-
<td class="align-middle">
415+
<td class="align-middle text-center">
416416
<Col className="d-flex justify-content-center align-items-center">
417417
{charger.status === "Disconnected" ? <Circle color="danger"/> : <Circle color="success"/>}
418418
</Col>
@@ -423,24 +423,24 @@ export class DeviceList extends Component<{}, DeviceListState> {
423423
<td class="align-middle">
424424
{Base58.int_to_base58(charger.uid)}
425425
</td>
426-
<td style={{width: "1%"}} class="align-middle">
427-
<Button disabled={!this.connection_possible(charger)} id={`connect-${charger.name}`} onClick={async () => {
428-
await this.connect_to_charger(charger, route);
429-
}} variant="primary">
430-
{t("connect")}
431-
</Button>
426+
<td class="align-middle text-center">
427+
<div className="d-flex flex-row flex-md-wrap flex-lg-nowrap justify-content-center gap-2">
428+
<Button disabled={!this.connection_possible(charger)} id={`connect-${charger.name}`} onClick={async () => {
429+
await this.connect_to_charger(charger, route);
430+
}} variant="primary">
431+
{t("connect")}
432+
</Button>
433+
<Button onClick={async () => {
434+
this.removalDevice = charger;
435+
this.setState({showDeleteModal: true})
436+
}} variant="danger">
437+
{t("remove")}
438+
</Button>
439+
</div>
432440
<p style="color:red;" hidden={charger.valid}>
433441
{t("no_keys")}
434442
</p>
435443
</td>
436-
<td style={{width:"1%"}} class="align-middle">
437-
<Button onClick={async () => {
438-
this.removalDevice = charger;
439-
this.setState({showDeleteModal: true})
440-
}} variant="danger">
441-
{t("remove")}
442-
</Button>
443-
</td>
444444
<td class="align-middle text-center">
445445
{this.formatLastStateChange(t, charger.last_state_change)}
446446
</td>
@@ -557,18 +557,18 @@ export class DeviceList extends Component<{}, DeviceListState> {
557557
{/*Edit Note Modal end*/}
558558

559559
<Col className="d-none d-md-block">
560-
<Table striped hover>
560+
<Table striped hover responsive>
561561
<thead>
562562
<tr class="charger-head">
563563
<th onClick={() => this.setSort("status")}>
564-
<Row>
564+
<Row className="m-0">
565565
<Col className="align-content-end text-end">
566566
{this.get_icon("status")}
567567
</Col>
568568
</Row>
569569
</th>
570570
<th onClick={() => this.setSort("name")}>
571-
<Row>
571+
<Row className="flex-nowrap m-0">
572572
<Col>
573573
{t("charger_name")}
574574
</Col>
@@ -578,7 +578,7 @@ export class DeviceList extends Component<{}, DeviceListState> {
578578
</Row>
579579
</th>
580580
<th onClick={() => this.setSort("uid")}>
581-
<Row>
581+
<Row className="flex-nowrap m-0">
582582
<Col>
583583
{t("charger_id")}
584584
</Col>
@@ -588,30 +588,25 @@ export class DeviceList extends Component<{}, DeviceListState> {
588588
</Row>
589589
</th>
590590
<th/>
591-
<th/>
592591
<th onClick={() => this.setSort("last_state_change")}>
593-
<Container fluid>
594-
<Row>
595-
<Col>
596-
{t("last_state_change")}
597-
</Col>
598-
<Col xs="auto">
599-
{this.get_icon("last_state_change")}
600-
</Col>
601-
</Row>
602-
</Container>
592+
<Row className="flex-nowrap m-0">
593+
<Col>
594+
{t("last_state_change")}
595+
</Col>
596+
<Col xs="auto">
597+
{this.get_icon("last_state_change")}
598+
</Col>
599+
</Row>
603600
</th>
604601
<th onClick={() => this.setSort("note")}>
605-
<Container fluid>
606-
<Row>
607-
<Col>
608-
{t("note")}
609-
</Col>
610-
<Col xs="auto">
611-
{this.get_icon("note")}
612-
</Col>
613-
</Row>
614-
</Container>
602+
<Row className="flex-nowrap m-0">
603+
<Col>
604+
{t("note")}
605+
</Col>
606+
<Col xs="auto">
607+
{this.get_icon("note")}
608+
</Col>
609+
</Row>
615610
</th>
616611
</tr>
617612
</thead>

0 commit comments

Comments
 (0)