Skip to content

Commit

Permalink
Fix device description detail
Browse files Browse the repository at this point in the history
  • Loading branch information
beque committed Oct 30, 2024
1 parent 0753a38 commit b64b2e8
Show file tree
Hide file tree
Showing 24 changed files with 1,557 additions and 1,241 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ GEM
rails (>= 3.0)
rake (>= 0.8.7)
yard (0.9.36)
zeitwerk (2.7.0)
zeitwerk (2.6.18)

PLATFORMS
x86_64-linux
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.react-datepicker-wrapper {
width: 100%;
.react-datepicker__input-container input {
width: 100%;
border-radius: 4px;
box-shadow: inset 0 2px 2px $gray-100;
border: 1px solid $gray-200;
padding: 6px 10px 5px;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@
}

&__value-container {
@extend .flex-nowrap;
@extend .text-nowrap;
@extend .gap-1;
}

&__value-container.chemotion-select__value-container--is-multi {
Expand All @@ -96,11 +96,6 @@
@extend .m-0;
}

&__value-container {
@extend .gap-1;
@extend .d-flex;
}

&__single-value .badge {
@extend .d-block
}
Expand Down Expand Up @@ -159,3 +154,65 @@
@include fa-based-remove-icon;
}
}

.select-in-inputgroup-text {
&__control {
@extend .d-flex;
@extend .justify-content-between;
@extend .align-items-center;
@extend .gap-1;
min-height: auto !important;

&:hover {
border-color: $form-select-border-color;
}

&--menu-is-open {
border-color: color("primary");
}

&:focus, &--is-focused {
border-color: $input-focus-border-color;
outline: 0;
@if $enable-shadows {
@include box-shadow($form-select-box-shadow, $form-select-focus-box-shadow);
} @else {
// Avoid using mixin so we can pass custom focus shadow properly
box-shadow: $form-select-focus-box-shadow;
}
}
}

&__menu {
padding: $form-select-padding-y 0;
box-shadow: none;
z-index: 10;
}

&__option {
padding: $form-select-padding-y $form-select-padding-x;

&--is-selected, &--is-selected.chemotion-select__option--is-focused {
background-color: color("primary");
}

&--is-focused {
background-color: $input-focus-border-color;
}
}
}

.select-in-inputgroup-text__control {
min-height: 30px !important;
}

.select-in-inputgroup-text__menu-list {
@extend .bg-white;
}

.select-in-inputgroup-text__option, .select-in-inputgroup-text__menu-list {
width: 160px;
white-space: normal;
text-align: left;
overflow-x: hidden;
}
1 change: 1 addition & 0 deletions app/assets/stylesheets/global-styles/utilities.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
@import "utilities/detail-card";
@import "utilities/tabs-container-with-borders";
@import "utilities/modal";
@import "utilities/form";
@import "utilities/draggable-modal";
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
> .card-header {
@extend .text-bg-primary;
}
&.detail-card--unsaved .card-header {
&.detail-card--unsaved > .card-header {
@extend .text-bg-info;
}
}
Expand Down
9 changes: 9 additions & 0 deletions app/assets/stylesheets/global-styles/utilities/dnd.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@
@extend .text-center;
}

.dnd-zone-list-item {
@extend .w-100;
@extend .border;
@extend .border-dashed;
@extend .border-3;
@extend .p-3;
@extend .text-start;
}

.dnd-zone-over {
@extend .border-primary;
}
Expand Down
20 changes: 20 additions & 0 deletions app/assets/stylesheets/global-styles/utilities/form.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.multiple-row-fields {
@extend .d-flex;
@extend .justify-content-between;
@extend .align-items-end;
@extend .flex-nowrap;
@extend .gap-2;
@extend .mb-4;
}

.multiple-row-fields.components:last-child {
@extend .mb-3;
}

.multiple-row-fields > div {
flex: 1;
}

.multiple-row-fields .dnd-zone + button {
@extend .my-auto;
}
1 change: 1 addition & 0 deletions app/assets/stylesheets/global-styles/vendor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@
@import "package-mods/calendar";
@import "package-mods/react-svg-file-zoom-pan";
@import "package-mods/react-select";
@import "package-mods/react-datepicker";
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState, useEffect, useContext } from 'react';
import {
Panel, ButtonToolbar, Button, Tabs, Tab, Tooltip, OverlayTrigger
ButtonToolbar, Button, Tabs, Tab, Tooltip, OverlayTrigger, Card
} from 'react-bootstrap';

import PropertiesForm from './propertiesTab/PropertiesForm';
Expand Down Expand Up @@ -135,95 +135,112 @@ const DeviceDescriptionDetails = ({ toggleFullScreen }) => {
if (deviceDescription.isNew || hasNoAnalysis) { return null; }

return (
<Button bsStyle="info" disabled={!deviceDescriptionIsValid()} onClick={() => handleExportAnalyses()}>
<Button
variant="info"
disabled={!deviceDescriptionIsValid()}
onClick={() => handleExportAnalyses()}
>
Download Analysis
{' '}
{deviceDescriptionsStore.analysis_start_export ? (
<span>
<i className="fa fa-spin fa-spinner" />
</span>
) : null}
{deviceDescriptionsStore.analysis_start_export && <i className="fa fa-spin fa-spinner ms-1" />}
</Button>
);
}

const deviceDescriptionHeader = () => {
const saveBtnDisplay = deviceDescription.isEdited ? '' : 'none';
const titleTooltip = formatTimeStampsOfElement(deviceDescription || {});
const defCol = currentCollection && currentCollection.is_shared === false
&& currentCollection.is_locked === false && currentCollection.label !== 'All' ? currentCollection.id : null;

const copyButton = (deviceDescription.can_copy && !deviceDescription.isNew) ? (
<CopyElementModal
element={deviceDescription}
defCol={defCol}
/>
) : null;

return (
<div>
<OverlayTrigger placement="bottom" overlay={<Tooltip id="deviceDescriptionDates">{titleTooltip}</Tooltip>}>
<span>
<i className="icon-device_description" />
&nbsp; <span>{deviceDescription.name}</span> &nbsp;
</span>
</OverlayTrigger>
<ElementCollectionLabels element={deviceDescription} placement="right" />
<HeaderCommentSection element={deviceDescription} />
<ConfirmClose el={deviceDescription} />
<OverlayTrigger
placement="bottom"
overlay={<Tooltip id="saveDeviceDescription">Save device description</Tooltip>}
>
<Button
bsStyle="warning"
bsSize="xsmall"
className="button-right"
onClick={() => handleSubmit()}
style={{ display: saveBtnDisplay }}
<div className="d-flex align-items-center justify-content-between">
<div className="d-flex align-items-center gap-2">
<OverlayTrigger placement="bottom" overlay={<Tooltip id="deviceDescriptionDates">{titleTooltip}</Tooltip>}>
<span>
<i className="icon-device_description me-1" />
{deviceDescription.name}
</span>
</OverlayTrigger>
<ElementCollectionLabels element={deviceDescription} placement="right" />
<HeaderCommentSection element={deviceDescription} />
</div>
<div className="d-flex align-items-center gap-1">
<PrintCodeButton element={deviceDescription} />
{!deviceDescription.isNew &&
<OpenCalendarButton isPanelHeader eventableId={deviceDescription.id} eventableType="DeviceDescription" />}
<OverlayTrigger
placement="bottom"
overlay={<Tooltip id="fullDeviceDescription">FullScreen</Tooltip>}
>
<i className="fa fa-floppy-o " />
</Button>
</OverlayTrigger>
{copyButton}
<OverlayTrigger placement="bottom" overlay={<Tooltip id="fullSample">FullScreen</Tooltip>}>
<Button bsStyle="info" bsSize="xsmall" className="button-right" onClick={() => toggleFullScreen()}>
<i className="fa fa-expand" />
</Button>
</OverlayTrigger>
<PrintCodeButton element={deviceDescription} />
{deviceDescription.isNew
? null
: <OpenCalendarButton isPanelHeader eventableId={deviceDescription.id} eventableType="DeviceDescription" />}
<Button
variant="info"
size="xxsm"
onClick={() => toggleFullScreen()}
>
<i className="fa fa-expand" />
</Button>
</OverlayTrigger>
{deviceDescription.can_copy && !deviceDescription.isNew && (
<CopyElementModal
element={deviceDescription}
defCol={defCol}
/>
)}
{deviceDescription.isEdited && (
<OverlayTrigger
placement="bottom"
overlay={<Tooltip id="saveDeviceDescription">Save device description</Tooltip>}
>
<Button
variant="warning"
size="xxsm"
onClick={() => handleSubmit()}
>
<i className="fa fa-floppy-o " />
</Button>
</OverlayTrigger>
)}
<ConfirmClose el={deviceDescription} />
</div>
</div>
);
}

return (
<Panel bsStyle={deviceDescription.isPendingToSave ? 'info' : 'primary'} className="eln-panel-detail">
<Panel.Heading>{deviceDescriptionHeader()}</Panel.Heading>
<Panel.Body>
<Card className={"detail-card" + (deviceDescription.isPendingToSave ? " detail-card--unsaved" : "")}>
<Card.Header>
{deviceDescriptionHeader()}
</Card.Header>
<Card.Body>
<ElementDetailSortTab
type="device_description"
availableTabs={Object.keys(tabContentComponents)}
tabTitles={tabTitles}
onTabPositionChanged={onTabPositionChanged}
/>
<Tabs activeKey={activeTab} onSelect={key => handleTabChange(key)} id="deviceDescriptionDetailsTab">
{tabContents}
</Tabs>
<ButtonToolbar>
<Button bsStyle="primary" onClick={() => DetailActions.close(deviceDescription)}>
<div className="tabs-container--with-borders">
<Tabs
activeKey={activeTab}
onSelect={key => handleTabChange(key)}
id="deviceDescriptionDetailsTab"
unmountOnExit
>
{tabContents}
</Tabs>
</div>
<CommentModal element={deviceDescription} />
</Card.Body>
<Card.Footer>
<ButtonToolbar className="gap-2">
<Button variant="primary" onClick={() => DetailActions.close(deviceDescription)}>
Close
</Button>
<Button bsStyle="warning" disabled={!deviceDescriptionIsValid()} onClick={() => handleSubmit()}>
<Button variant="warning" disabled={!deviceDescriptionIsValid()} onClick={() => handleSubmit()}>
{submitLabel}
</Button>
{downloadAnalysisButton()}
</ButtonToolbar>
<CommentModal element={deviceDescription} />
</Panel.Body>
</Panel>
</Card.Footer>
</Card>
);
}

Expand Down
Loading

0 comments on commit b64b2e8

Please sign in to comment.