Skip to content

Commit

Permalink
Merge pull request #2470 from FarmBot/staging
Browse files Browse the repository at this point in the history
v15.10.1
  • Loading branch information
gabrielburnworth authored Sep 26, 2024
2 parents 73c91ed + 3ca7d73 commit 8190f94
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 7 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ gem "rollbar"
gem "scenic"
gem "secure_headers"
gem "tzinfo" # For validation of user selected timezone names
gem "tzinfo-data" # For validation of user selected timezone names
gem "valid_url"
gem "thwait"
gem "lograge" # Used to filter repetitive RabbitMQ logs.
Expand Down
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,8 @@ GEM
trailblazer-option (0.1.2)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
tzinfo-data (1.2024.2)
tzinfo (>= 1.0.0)
uber (0.1.0)
uri (0.13.1)
valid_url (0.0.4)
Expand Down Expand Up @@ -424,6 +426,7 @@ DEPENDENCIES
simplecov-cobertura
thwait
tzinfo
tzinfo-data
valid_url
webmock

Expand Down
2 changes: 1 addition & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class Application < Rails::Application
),
form_action: %w('self'),
frame_src: %w(*), # We need "*" to support webcam users.
frame_ancestors: %w('none'),
frame_ancestors: %w('self' https://farm.bot),
img_src: %w(* data:), # We need "*" to support webcam users.
manifest_src: %w('self'),
media_src: %w(),
Expand Down
2 changes: 1 addition & 1 deletion frontend/css/farm_designer/farm_designer_panels.scss
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
height: 24rem;
.location-info-panel {
.panel-content {
max-height: calc(100vh - 47rem);
max-height: 19rem;
}
}
}
Expand Down
13 changes: 13 additions & 0 deletions frontend/messages/__tests__/cards_test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import { buildResourceIndex } from "../../__test_support__/resource_index_builde
import { fakeWizardStepResult } from "../../__test_support__/fake_state/resources";
import { Path } from "../../internal_urls";
import { API } from "../../api";
import moment from "moment";

API.setBaseUrl("");

Expand Down Expand Up @@ -83,6 +84,7 @@ describe("<AlertCard />", () => {
expect(wrapper.text()).toContain("Your device has no firmware");
expect(wrapper.find(".fa-times").length).toEqual(0);
expect(wrapper.text()).toContain("Apr");
expect(wrapper.text()).toContain("2019");
expect(wrapper.text()).toContain("Select one");
});

Expand Down Expand Up @@ -237,6 +239,17 @@ describe("<AlertCard />", () => {
const wrapper = mount(<AlertCard {...p} />);
expect(wrapper.text()).not.toContain("Jan 1, 12:00am");
});

it("doesn't show current year", () => {
const p = fakeProps();
p.alert.problem_tag = "farmbot_os.firmware.missing";
p.alert.created_at = Date.now().valueOf() / 1000;
p.timeSettings.hour24 = false;
p.timeSettings.utcOffset = 0;
const wrapper = mount(<AlertCard {...p} />);
const currentYear = moment().format("YYYY");
expect(wrapper.text()).not.toContain(currentYear);
});
});

describe("changeFirmwareHardware()", () => {
Expand Down
4 changes: 3 additions & 1 deletion frontend/messages/cards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,16 @@ const timeOk = (timestamp: number) => timestamp > 1550000000;

const AlertCardTemplate = (props: AlertCardTemplateProps) => {
const { alert, findApiAlertById, dispatch, timeSettings } = props;
const thisYear = moment.unix(alert.created_at).year() == moment().year();
const timeFormat = thisYear ? "MMM D" : "MMM D, YYYY";
return <div className={
`problem-alert ${props.className} priority-${props.alert.priority}`}>
<div className="problem-alert-title">
<i className={`fa ${props.iconName || "fa-exclamation-triangle"}`} />
<h3>{t(props.title)}</h3>
{timeOk(alert.created_at) &&
<p>
{formatTime(moment.unix(alert.created_at), timeSettings, "MMM D")}
{formatTime(moment.unix(alert.created_at), timeSettings, timeFormat)}
</p>}
</div>
{alert.id && !props.noDismiss && <i className={"fa fa-times fb-icon-button"}
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,17 @@
"@parcel/transformer-sass": "2.12.0",
"@parcel/transformer-typescript-tsc": "2.12.0",
"@react-spring/three": "9.7.4",
"@react-three/drei": "9.111.3",
"@react-three/drei": "9.114.0",
"@react-three/fiber": "8.17.8",
"@rollbar/react": "0.12.0-beta",
"@types/lodash": "4.17.9",
"@types/markdown-it": "14.1.2",
"@types/node": "22.6.1",
"@types/node": "22.7.3",
"@types/promise-timeout": "1.3.3",
"@types/react": "18.3.9",
"@types/react-color": "3.0.12",
"@types/react-dom": "18.3.0",
"@types/three": "0.167.1",
"@types/three": "0.169.0",
"@types/ws": "8.5.12",
"axios": "1.7.7",
"bowser": "2.11.0",
Expand Down Expand Up @@ -79,7 +79,7 @@
"redux-thunk": "3.1.0",
"rollbar": "2.26.4",
"takeme": "0.12.0",
"three": "0.167.1",
"three": "0.169.0",
"typescript": "5.6.2",
"url": "0.11.4",
"@xterm/xterm": "5.5.0"
Expand Down
1 change: 1 addition & 0 deletions tsconfig.dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"noUnusedParameters": true,
"pretty": true,
"removeComments": true,
"skipLibCheck": true,
"sourceMap": true,
"strictNullChecks": true,
"target": "es5",
Expand Down

0 comments on commit 8190f94

Please sign in to comment.