Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfixes for tag 5.19.0 #452

Merged
merged 6 commits into from
Apr 26, 2023
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
10 changes: 6 additions & 4 deletions love/src/components/AuxTel/Camera/Camera.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ export default class Camera extends Component {

render() {
const imageIds = Object.keys(this.props.imageSequence?.images ?? {});
const orederedImages = imageIds.sort((a, b) => {
return this.props.imageSequence.images[b].timestamp - this.props.imageSequence.images[a].timestamp;

// Sort images by timestamp
imageIds.sort((a, b) => {
return this.props.imageSequence.images[b].timeStamp - this.props.imageSequence.images[a].timeStamp;
});

return (
Expand Down Expand Up @@ -111,8 +113,8 @@ export default class Camera extends Component {
</tr>
</thead>
<tbody>
{orederedImages &&
orederedImages.map((imageName) => {
{imageIds &&
imageIds.map((imageName) => {
const image = this.props.imageSequence.images[imageName];
const imageKey = `${this.props.imageSequence.name}-${imageName}`;
const isIntegrating = image.state === 'INTEGRATING';
Expand Down
2 changes: 1 addition & 1 deletion love/src/components/Facility/Map/Device.module.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.device {
filter: drop-shadow(0px 0px 1px rgb(0 0 0 / 0.25));
/* filter: drop-shadow(0px 0px 1px rgb(0 0 0 / 0.25)); */
}

.container {
Expand Down
1 change: 0 additions & 1 deletion love/src/components/Facility/Map/Levels/Level2.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export default class Level2 extends Component {
d3.select(mapId).attr('transform', transformData);
d3.select(deviceId).attr('transform', transformData);
this.props.savePos(transformData);
console.log(transformData);
};

getDevices() {
Expand Down
1 change: 0 additions & 1 deletion love/src/components/Facility/Map/Levels/Level3.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export default class Level3 extends Component {
d3.select(mapId).attr('transform', transformData);
d3.select(deviceId).attr('transform', transformData);
this.props.savePos(transformData);
console.log(transformData);
};

getDevices() {
Expand Down
1 change: 0 additions & 1 deletion love/src/components/Facility/Map/Levels/Level4.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export default class Level4 extends Component {
d3.select(mapId).attr('transform', transformData);
d3.select(deviceId).attr('transform', transformData);
this.props.savePos(transformData);
console.log(transformData);
};

getDevices() {
Expand Down
3 changes: 1 addition & 2 deletions love/src/components/Facility/Map/Levels/Level5.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export default class Level5 extends Component {
d3.select(mapId).attr('transform', transformData);
d3.select(deviceId).attr('transform', transformData);
this.props.savePos(transformData);
console.log(transformData);
};

getDevices() {
Expand All @@ -58,7 +57,7 @@ export default class Level5 extends Component {
manejadoraLower02P05,
manejadoraLower03P05,
manejadoraLower04P05,
vea01P01,
vea01P05,
vea08P05,
vea09P05,
vea10P05,
Expand Down
1 change: 0 additions & 1 deletion love/src/components/Facility/Map/Levels/Level6.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export default class Level6 extends Component {
d3.select(mapId).attr('transform', transformData);
d3.select(deviceId).attr('transform', transformData);
this.props.savePos(transformData);
console.log(transformData);
};

getDevices() {
Expand Down
1 change: 0 additions & 1 deletion love/src/components/Facility/Map/Levels/Level7.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export default class Level7 extends Component {
d3.select(mapId).attr('transform', transformData);
d3.select(deviceId).attr('transform', transformData);
this.props.savePos(transformData);
console.log(transformData);
};

getDevices() {
Expand Down
1 change: 0 additions & 1 deletion love/src/components/Facility/Map/Levels/Level8.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export default class Level8 extends Component {
d3.select(mapId).attr('transform', transformData);
d3.select(deviceId).attr('transform', transformData);
this.props.savePos(transformData);
console.log(transformData);
};

getDevices() {
Expand Down
5 changes: 2 additions & 3 deletions love/src/components/OLE/Exposure/Exposure.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@
margin-right: 0.5em;
}

.checkboxText > input:first-of-type{
.checkboxText > input:first-of-type {
width: auto;
}

Expand Down Expand Up @@ -428,9 +428,8 @@ th.tableHead {
.spinnerIcon {
height: var(--font-size-small);
width: var(--font-size-small);
margin-left: var(--small-padding);
}

.refreshDataBtn {
height: 2.4em;
}
}
17 changes: 11 additions & 6 deletions love/src/components/OLE/Exposure/ExposureAdd.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export default class ExposureAdd extends Component {
selectedTags: [],
updatingExposures: false,
selectedDayExposure: Moment(),
savingLog: false,
};
this.handleSubmit = this.handleSubmit.bind(this);
}
Expand Down Expand Up @@ -108,7 +109,6 @@ export default class ExposureAdd extends Component {
}

componentDidUpdate(prevProps, prevState) {
// TODO: only when the filter is shown
if (
prevState.selectedInstrument !== this.state.selectedInstrument ||
prevState.selectedDayExposure !== this.state.selectedDayExposure
Expand Down Expand Up @@ -146,22 +146,27 @@ export default class ExposureAdd extends Component {

saveMessage() {
const { isLogCreate, isMenu } = this.props;

const payload = { ...this.state.newMessage };
payload['request_type'] = 'exposure';
payload['instrument'] = this.state.selectedInstrument;

if (payload['tags']) {
payload['tags'] = payload['tags'].map((tag) => tag.id);
}

this.setState({ savingLog: true });
ManagerInterface.createMessageExposureLogs(payload).then((result) => {
this.setState({ confirmationModalShown: false });
if (isLogCreate || isMenu || !this.state.logEdit.obs_id) {
this.props.back();
} else {
this.props.view();
}
this.cleanForm();

this.setState({
confirmationModalShown: false,
savingLog: false,
});
});
}

Expand Down Expand Up @@ -191,6 +196,7 @@ export default class ExposureAdd extends Component {
}

renderModalFooter() {
const { savingLog } = this.state;
return (
<div className={styles.modalFooter}>
<Button
Expand All @@ -200,8 +206,8 @@ export default class ExposureAdd extends Component {
>
Go back
</Button>
<Button onClick={() => this.saveMessage()} status="default">
Yes
<Button disabled={savingLog} onClick={() => this.saveMessage()} status="default">
{savingLog ? <SpinnerIcon className={styles.spinnerIcon} /> : 'Yes'}
</Button>
</div>
);
Expand Down Expand Up @@ -391,7 +397,6 @@ export default class ExposureAdd extends Component {
className={styles.iconBtn}
title="Delete"
onClick={() => {
console.log('click delete');
this.deleteMessage();
}}
status="transparent"
Expand Down
19 changes: 13 additions & 6 deletions love/src/components/OLE/NonExposure/NonExposureEdit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import lodash from 'lodash';
import Moment from 'moment';
import DownloadIcon from 'components/icons/DownloadIcon/DownloadIcon';
import CloseIcon from 'components/icons/CloseIcon/CloseIcon';
import SpinnerIcon from 'components/icons/SpinnerIcon/SpinnerIcon';
import TextArea from 'components/GeneralPurpose/TextArea/TextArea';
import Input from 'components/GeneralPurpose/Input/Input';
import Button from 'components/GeneralPurpose/Button/Button';
Expand Down Expand Up @@ -75,6 +76,7 @@ export default class NonExposureEdit extends Component {
logEdit,
confirmationModalShown: false,
confirmationModalText: '',
savingLog: false,
};

this.handleSubmit = this.handleSubmit.bind(this);
Expand Down Expand Up @@ -116,6 +118,7 @@ export default class NonExposureEdit extends Component {
}

renderModalFooter = () => {
const { savingLog } = this.state;
return (
<div className={styles.modalFooter}>
<Button
Expand All @@ -125,22 +128,21 @@ export default class NonExposureEdit extends Component {
>
Go back
</Button>
<Button onClick={() => this.updateOrCreateMessageNarrativeLogs()} status="default">
Yes
<Button disabled={savingLog} onClick={() => this.updateOrCreateMessageNarrativeLogs()} status="default">
{savingLog ? <SpinnerIcon className={styles.spinnerIcon} /> : 'Yes'}
</Button>
</div>
);
};

updateOrCreateMessageNarrativeLogs() {
const payload = { ...this.state.logEdit };
payload['request_type'] = 'narrative';

payload['request_type'] = 'narrative';
const beginDateISO = this.state.logEdit.date_begin?.toISOString();
const endDateISO = this.state.logEdit.date_end?.toISOString();
payload['date_begin'] = beginDateISO.substring(0, beginDateISO.length - 1); // remove Zone due to backend standard
payload['date_end'] = endDateISO.substring(0, endDateISO.length - 1); // remove Zone due to backend standard

payload['tags'] = [...(payload['systems'] ?? []), ...(payload['subsystems'] ?? []), ...(payload['cscs'] ?? [])];

// Clean null and empty values to avoid API errors
Expand All @@ -150,15 +152,20 @@ export default class NonExposureEdit extends Component {
}
});

this.setState({ savingLog: true });
if (this.state.logEdit.id) {
ManagerInterface.updateMessageNarrativeLogs(this.state.logEdit.id, payload).then((response) => {
this.setState({ confirmationModalShown: false });
this.setState({
confirmationModalShown: false,
savingLog: false,
});
this.props.save(response);
});
} else {
ManagerInterface.createMessageNarrativeLogs(payload).then((response) => {
this.setState({
confirmationModalShown: false,
savingLog: false,
});
this.props.save(response);
this.cleanForm();
Expand Down Expand Up @@ -526,7 +533,7 @@ export default class NonExposureEdit extends Component {
parentSelector={() => document.querySelector(`#${this.id}`)}
size={50}
>
<p style={{textAlign: 'center'}}>{confirmationModalText}</p>
<p style={{ textAlign: 'center' }}>{confirmationModalText}</p>
{this.renderModalFooter()}
</Modal>
</div>
Expand Down
2 changes: 1 addition & 1 deletion love/src/components/icons/MountainIcon/MountainIcon.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default function MountainIcon(props) {
d="m1.15,17.54l1.61-4.14c.23-.59.94-.75,1.38-.32h0s2.11-6.49,2.11-6.49c.18-.55.51-1.04.95-1.4h0c1.38-1.12,3.37-.68,4.21.93l.76,1.47h0c.53-.19,1.1.09,1.32.64l3.59,9.3c.17.44-.13.92-.58.92H1.73c-.45,0-.75-.48-.58-.92Z"
/>{' '}
<path
className={style}
className={status}
d="m4.02,2.95l-1.2.35c-.15.06-.15.26,0,.32l1.2.35s.08.05.1.1l.35,1.2c.06.15.26.15.32,0l.35-1.2s.05-.08.1-.1l1.2-.35c.15-.06.15-.26,0-.32l-1.2-.35s-.08-.05-.1-.1l-.35-1.2c-.06-.15-.26-.15-.32,0l-.35,1.2s-.05.08-.1.1Z"
/>
<path
Expand Down