Merge branch 'remove_bot_alerts_from_fe' into fri
commit
4397195e79
|
@ -38,7 +38,6 @@ module Api
|
|||
Device
|
||||
.delay
|
||||
.connection_warning(username) if !is_guest
|
||||
Rollbar.error(WARNING % username)
|
||||
raise RateLimit, username
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,7 +6,8 @@ class FbosConfig < ApplicationRecord
|
|||
after_save :maybe_sync_nerves, on: [:create, :update]
|
||||
|
||||
FIRMWARE_HARDWARE = [
|
||||
NONE = nil,
|
||||
NOT_SET = nil,
|
||||
NONE = "none",
|
||||
ARDUINO = "arduino",
|
||||
FARMDUINO = "farmduino",
|
||||
FARMDUINO_K14 = "farmduino_k14",
|
||||
|
|
|
@ -51,8 +51,7 @@ export let bot: Everything["bot"] = {
|
|||
"user_env": {},
|
||||
"process_info": {
|
||||
"farmwares": {}
|
||||
},
|
||||
"alerts": {},
|
||||
}
|
||||
},
|
||||
"dirty": false,
|
||||
"currentOSVersion": "3.1.6",
|
||||
|
|
|
@ -272,7 +272,7 @@ export function fakeWebAppConfig(): TaggedWebAppConfig {
|
|||
updated_at: "2018-01-22T15:32:41.970Z",
|
||||
confirm_plant_deletion: true,
|
||||
confirm_step_deletion: false,
|
||||
// confirm_sequence_deletion: true,
|
||||
confirm_sequence_deletion: true,
|
||||
disable_animations: false,
|
||||
disable_i18n: false,
|
||||
display_trail: false,
|
||||
|
|
|
@ -111,7 +111,9 @@ describe("<BoardType/>", () => {
|
|||
|
||||
it("displays standard boards", () => {
|
||||
const wrapper = shallow(<BoardType {...fakeProps()} />);
|
||||
expect(wrapper.find("FBSelect").props().list).toEqual([
|
||||
const { list } = wrapper.find("FBSelect").props();
|
||||
expect(list).toEqual([
|
||||
{ label: "None", value: "none" },
|
||||
{ label: "Arduino/RAMPS (Genesis v1.2)", value: "arduino" },
|
||||
{ label: "Farmduino (Genesis v1.3)", value: "farmduino" },
|
||||
{ label: "Farmduino (Genesis v1.4)", value: "farmduino_k14" }]);
|
||||
|
@ -121,7 +123,9 @@ describe("<BoardType/>", () => {
|
|||
const p = fakeProps();
|
||||
p.shouldDisplay = () => true;
|
||||
const wrapper = shallow(<BoardType {...p} />);
|
||||
expect(wrapper.find("FBSelect").props().list).toEqual([
|
||||
const { list } = wrapper.find("FBSelect").props();
|
||||
expect(list).toEqual([
|
||||
{ label: "None", value: "none" },
|
||||
{ label: "Arduino/RAMPS (Genesis v1.2)", value: "arduino" },
|
||||
{ label: "Farmduino (Genesis v1.3)", value: "farmduino" },
|
||||
{ label: "Farmduino (Genesis v1.4)", value: "farmduino_k14" },
|
||||
|
|
|
@ -17,17 +17,19 @@ const FARMDUINO_K14 = {
|
|||
const EXPRESS_K10 = {
|
||||
label: "Farmduino (Express v1.0)", value: "express_k10"
|
||||
};
|
||||
const NONE = { label: "None", value: "none" };
|
||||
|
||||
export const FIRMWARE_CHOICES_DDI = {
|
||||
[ARDUINO.value]: ARDUINO,
|
||||
[FARMDUINO.value]: FARMDUINO,
|
||||
[FARMDUINO_K14.value]: FARMDUINO_K14,
|
||||
[EXPRESS_K10.value]: EXPRESS_K10,
|
||||
[NONE.value]: NONE
|
||||
};
|
||||
|
||||
export const isFwHardwareValue = (x?: unknown): x is FirmwareHardware => {
|
||||
const values: FirmwareHardware[] = [
|
||||
"arduino", "farmduino", "farmduino_k14", "express_k10"];
|
||||
const values: FirmwareHardware[] =
|
||||
["arduino", "farmduino", "farmduino_k14", "express_k10", "none"];
|
||||
return !!values.includes(x as FirmwareHardware);
|
||||
};
|
||||
|
||||
|
@ -77,8 +79,14 @@ export class BoardType extends React.Component<BoardTypeProps, BoardTypeState> {
|
|||
|
||||
get firmwareChoices() {
|
||||
const { shouldDisplay } = this.props;
|
||||
return [ARDUINO, FARMDUINO, FARMDUINO_K14,
|
||||
...(shouldDisplay(Feature.express_k10) ? [EXPRESS_K10] : [])];
|
||||
const others = shouldDisplay(Feature.express_k10) ? [EXPRESS_K10] : [];
|
||||
return [
|
||||
NONE,
|
||||
ARDUINO,
|
||||
FARMDUINO,
|
||||
FARMDUINO_K14,
|
||||
...others
|
||||
];
|
||||
}
|
||||
|
||||
get firmwareVersion() {
|
||||
|
@ -97,6 +105,8 @@ export class BoardType extends React.Component<BoardTypeProps, BoardTypeState> {
|
|||
return FIRMWARE_CHOICES_DDI["farmduino_k14"];
|
||||
case "express_k10":
|
||||
return FIRMWARE_CHOICES_DDI["express_k10"];
|
||||
case "none":
|
||||
return FIRMWARE_CHOICES_DDI["none"];
|
||||
case "unknown":
|
||||
// If unknown/disconnected, display API FirmwareHardware value if valid
|
||||
return (this.sending && this.apiValue)
|
||||
|
|
|
@ -66,8 +66,7 @@ export let initialState = (): BotState => ({
|
|||
user_env: {},
|
||||
process_info: {
|
||||
farmwares: {},
|
||||
},
|
||||
alerts: {},
|
||||
}
|
||||
},
|
||||
dirty: false,
|
||||
currentOSVersion: undefined,
|
||||
|
|
|
@ -31,7 +31,7 @@ export const BooleanSetting: Record<BooleanConfigKey, BooleanConfigKey> = {
|
|||
|
||||
/** Sequence settings */
|
||||
confirm_step_deletion: "confirm_step_deletion",
|
||||
// confirm_sequence_deletion: "confirm_sequence_deletion",
|
||||
confirm_sequence_deletion: "confirm_sequence_deletion",
|
||||
show_pins: "show_pins",
|
||||
expand_step_options: "expand_step_options",
|
||||
discard_unsaved_sequences: "discard_unsaved_sequences",
|
||||
|
|
|
@ -51,13 +51,16 @@ namespace :api do
|
|||
end
|
||||
|
||||
def parcel(cmd, opts = " ")
|
||||
intro = ["node_modules/parcel-bundler/bin/cli.js",
|
||||
cmd,
|
||||
DashboardController::PARCEL_ASSET_LIST,
|
||||
"--out-dir",
|
||||
DashboardController::PUBLIC_OUTPUT_DIR,
|
||||
"--public-url",
|
||||
DashboardController::OUTPUT_URL].join(" ")
|
||||
intro = [
|
||||
"NODE_ENV=#{Rails.env}",
|
||||
"node_modules/parcel-bundler/bin/cli.js",
|
||||
cmd,
|
||||
DashboardController::PARCEL_ASSET_LIST,
|
||||
"--out-dir",
|
||||
DashboardController::PUBLIC_OUTPUT_DIR,
|
||||
"--public-url",
|
||||
DashboardController::OUTPUT_URL,
|
||||
].join(" ")
|
||||
sh [intro, opts].join(" ")
|
||||
end
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
COVERAGE_FILE_PATH = "./coverage_fe/index.html"
|
||||
THRESHOLD = 0.001
|
||||
REPO_URL = "https://api.github.com/repos/Farmbot/Farmbot-Web-App"
|
||||
THRESHOLD = 0.001
|
||||
REPO_URL = "https://api.github.com/repos/Farmbot/Farmbot-Web-App"
|
||||
LATEST_COV_URL = "https://coveralls.io/github/FarmBot/Farmbot-Web-App.json"
|
||||
PULL_REQUEST = ENV.fetch("CIRCLE_PULL_REQUEST", "/0")
|
||||
PULL_REQUEST = ENV.fetch("CIRCLE_PULL_REQUEST", "/0")
|
||||
CURRENT_BRANCH = ENV.fetch("CIRCLE_BRANCH", "staging") # "staging" or "pull/11"
|
||||
CURRENT_COMMIT = ENV.fetch("CIRCLE_SHA1", "")
|
||||
CSS_SELECTOR = ".fraction"
|
||||
CSS_SELECTOR = ".fraction"
|
||||
FRACTION_DELIM = "/"
|
||||
|
||||
# Fetch JSON over HTTP. Rails probably already has a helper for this :shrug:
|
||||
|
@ -44,8 +44,8 @@ end
|
|||
# Gather relevant coverage data.
|
||||
def relevant_data(build)
|
||||
{ branch: build["branch"],
|
||||
commit: build["commit_sha"],
|
||||
percent: build["covered_percent"]}
|
||||
commit: build["commit_sha"],
|
||||
percent: build["covered_percent"] }
|
||||
end
|
||||
|
||||
# Fetch relevant coverage build data from commit.
|
||||
|
@ -86,10 +86,10 @@ def fetch_build_data()
|
|||
build_data = fetch_builds_for_page(1)
|
||||
build_data.push(*fetch_builds_for_page(2))
|
||||
clean_build_data = build_data
|
||||
.reject{ |build| build["covered_percent"].nil? }
|
||||
.reject{ |build| build["branch"].include? "/" }
|
||||
.reject { |build| build["covered_percent"].nil? }
|
||||
.reject { |build| build["branch"].include? "/" }
|
||||
puts "Using data from #{clean_build_data.length} recent coverage builds."
|
||||
clean_build_data.map{ |build| relevant_data(build)}
|
||||
clean_build_data.map { |build| relevant_data(build) }
|
||||
end
|
||||
|
||||
# Print history and return the most recent match for the provided branch.
|
||||
|
@ -97,15 +97,16 @@ def latest_build_data(build_history, branch)
|
|||
if branch == "*"
|
||||
branch_builds = build_history
|
||||
else
|
||||
branch_builds = build_history.select{ |build| build[:branch] == branch }
|
||||
branch_builds = build_history.select { |build| build[:branch] == branch }
|
||||
end
|
||||
if branch_builds.length > 0
|
||||
puts "\nCoverage history (newest to oldest):"
|
||||
branch_builds.map{ |build|
|
||||
puts "#{build[:branch]}: #{build[:percent].round(3)}%"}
|
||||
branch_builds[0]
|
||||
branch_builds.map { |build|
|
||||
puts "#{build[:branch]}: #{build[:percent].round(3)}%"
|
||||
}
|
||||
branch_builds[0]
|
||||
else
|
||||
{branch: branch, commit: nil, percent: nil}
|
||||
{ branch: branch, commit: nil, percent: nil }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -121,9 +122,9 @@ def print_summary_text(build_percent, remote, pull_data)
|
|||
diff = (build_percent - remote[:percent]).round(3)
|
||||
direction = diff > 0 ? "increased" : "decreased"
|
||||
description = diff == 0 ? "remained the same at" : "#{direction} (#{diff}%) to"
|
||||
puts "Coverage #{description} #{build_percent.round(3)}%"\
|
||||
" when pulling #{branch_info_string?("head", pull_data)}"\
|
||||
" into #{branch_info_string?("base", pull_data) || remote[:branch]}."
|
||||
puts "Coverage #{description} #{build_percent.round(3)}%" \
|
||||
" when pulling #{branch_info_string?("head", pull_data)}" \
|
||||
" into #{branch_info_string?("base", pull_data) || remote[:branch]}."
|
||||
end
|
||||
|
||||
def to_percent(pair)
|
||||
|
@ -131,13 +132,13 @@ def to_percent(pair)
|
|||
end
|
||||
|
||||
namespace :coverage do
|
||||
desc "Verify code test coverage changes remain within acceptable thresholds."\
|
||||
"Compares current test coverage percentage from Jest output to previous"\
|
||||
"values from the base branch of a PR (or the build branch if not a PR)."\
|
||||
"This task is used during ci to fail PR builds if test coverage"\
|
||||
"decreases significantly and can also be run locally after running"\
|
||||
"`jest --coverage` or `npm test-slow`."\
|
||||
"The Coveralls stats reporter used to perform this check, but didn't"\
|
||||
desc "Verify code test coverage changes remain within acceptable thresholds." \
|
||||
"Compares current test coverage percentage from Jest output to previous" \
|
||||
"values from the base branch of a PR (or the build branch if not a PR)." \
|
||||
"This task is used during ci to fail PR builds if test coverage" \
|
||||
"decreases significantly and can also be run locally after running" \
|
||||
"`jest --coverage` or `npm test-slow`." \
|
||||
"The Coveralls stats reporter used to perform this check, but didn't" \
|
||||
"compare against a PR's base branch and would always return 0% change."
|
||||
task run: :environment do
|
||||
# Fetch current build coverage data from the HTML summary.
|
||||
|
@ -155,8 +156,8 @@ namespace :coverage do
|
|||
puts "Lines: #{to_percent(lines)}%"
|
||||
|
||||
# Calculate an aggregate coverage percentage for the current build.
|
||||
covered = lines.head + branches.head
|
||||
total = lines.tail + branches.tail
|
||||
covered = lines.head + branches.head
|
||||
total = lines.tail + branches.tail
|
||||
build_percent = (covered / total) * 100
|
||||
puts "Aggregate: #{build_percent.round(4)}%"
|
||||
puts
|
||||
|
@ -196,14 +197,15 @@ namespace :coverage do
|
|||
if remote[:percent].nil?
|
||||
puts "Error getting coveralls data."
|
||||
puts "Using 100 instead of nil for remote coverage value."
|
||||
remote = {branch: "N/A", commit: "", percent: 100}
|
||||
remote = { branch: "N/A", commit: "", percent: 100 }
|
||||
end
|
||||
|
||||
# Adjust remote build data values for printing.
|
||||
r = {
|
||||
branch: (remote[:branch] + ' ' * 8)[0,8],
|
||||
branch: (remote[:branch] + " " * 8)[0, 8],
|
||||
percent: remote[:percent].round(8),
|
||||
commit: remote[:commit][0,8]}
|
||||
commit: remote[:commit][0, 8],
|
||||
}
|
||||
|
||||
# Calculate coverage difference between the current and previous build.
|
||||
diff = (build_percent - remote[:percent])
|
||||
|
@ -212,7 +214,7 @@ namespace :coverage do
|
|||
puts
|
||||
puts "=" * 37
|
||||
puts "COVERAGE RESULTS"
|
||||
puts "This build: #{build_percent.round(8)}% #{CURRENT_COMMIT[0,8]}"
|
||||
puts "This build: #{build_percent.round(8)}% #{CURRENT_COMMIT[0, 8]}"
|
||||
puts "#{r[:branch]} build: #{r[:percent]}% #{r[:commit]}"
|
||||
puts "=" * 37
|
||||
puts "Difference: #{diff.round(8)}%"
|
||||
|
@ -222,6 +224,5 @@ namespace :coverage do
|
|||
print_summary_text(build_percent, remote, pull_request_data)
|
||||
|
||||
exit (pass || exit_0?) ? 0 : 1
|
||||
|
||||
end
|
||||
end
|
||||
|
|
14
package.json
14
package.json
|
@ -41,15 +41,13 @@
|
|||
"axios": "0.19.0",
|
||||
"boxed_value": "1.0.0",
|
||||
"browser-speech": "1.1.1",
|
||||
"coveralls": "3.0.4",
|
||||
"coveralls": "3.0.5",
|
||||
"enzyme": "3.10.0",
|
||||
"enzyme-adapter-react-16": "1.14.0",
|
||||
"farmbot": "8.0.1-rc8",
|
||||
"farmbot": "8.0.2",
|
||||
"i18next": "17.0.6",
|
||||
"jest": "24.8.0",
|
||||
"jest-cli": "24.8.0",
|
||||
"lodash": "4.17.14",
|
||||
"markdown-it": "9.0.0",
|
||||
"markdown-it": "9.0.1",
|
||||
"markdown-it-emoji": "1.4.0",
|
||||
"moment": "2.24.0",
|
||||
"moxios": "0.4.0",
|
||||
|
@ -61,14 +59,14 @@
|
|||
"react-addons-test-utils": "15.6.2",
|
||||
"react-color": "2.17.3",
|
||||
"react-dom": "16.8.6",
|
||||
"react-joyride": "2.0.5",
|
||||
"react-joyride": "2.1.0",
|
||||
"react-redux": "7.1.0",
|
||||
"react-test-renderer": "16.8.6",
|
||||
"react-transition-group": "4.2.1",
|
||||
"redux": "4.0.4",
|
||||
"redux-immutable-state-invariant": "2.1.0",
|
||||
"redux-thunk": "2.3.0",
|
||||
"sass": "1.22.3",
|
||||
"sass": "1.22.4",
|
||||
"sass-lint": "1.13.1",
|
||||
"takeme": "0.11.1",
|
||||
"ts-jest": "24.0.2",
|
||||
|
@ -78,6 +76,8 @@
|
|||
"which": "1.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"jest": "24.8.0",
|
||||
"jest-cli": "24.8.0",
|
||||
"jest-skipped-reporter": "0.0.4",
|
||||
"jshint": "2.10.2",
|
||||
"madge": "3.4.4"
|
||||
|
|
Loading…
Reference in New Issue