Merge conflicts

pull/979/head
Rick Carlino 2018-09-06 13:34:06 -05:00
commit 072baef2db
23 changed files with 593 additions and 739 deletions

View File

@ -7,25 +7,25 @@ GIT
GEM
remote: https://rubygems.org/
specs:
actioncable (5.2.0)
actionpack (= 5.2.0)
actioncable (5.2.1)
actionpack (= 5.2.1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailer (5.2.0)
actionpack (= 5.2.0)
actionview (= 5.2.0)
activejob (= 5.2.0)
actionmailer (5.2.1)
actionpack (= 5.2.1)
actionview (= 5.2.1)
activejob (= 5.2.1)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.2.0)
actionview (= 5.2.0)
activesupport (= 5.2.0)
actionpack (5.2.1)
actionview (= 5.2.1)
activesupport (= 5.2.1)
rack (~> 2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.2.0)
activesupport (= 5.2.0)
actionview (5.2.1)
activesupport (= 5.2.1)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
@ -35,20 +35,20 @@ GEM
activemodel (>= 4.1, < 6)
case_transform (>= 0.2)
jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
activejob (5.2.0)
activesupport (= 5.2.0)
activejob (5.2.1)
activesupport (= 5.2.1)
globalid (>= 0.3.6)
activemodel (5.2.0)
activesupport (= 5.2.0)
activerecord (5.2.0)
activemodel (= 5.2.0)
activesupport (= 5.2.0)
activemodel (5.2.1)
activesupport (= 5.2.1)
activerecord (5.2.1)
activemodel (= 5.2.1)
activesupport (= 5.2.1)
arel (>= 9.0)
activestorage (5.2.0)
actionpack (= 5.2.0)
activerecord (= 5.2.0)
activestorage (5.2.1)
actionpack (= 5.2.1)
activerecord (= 5.2.1)
marcel (~> 0.3.1)
activesupport (5.2.0)
activesupport (5.2.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
@ -58,14 +58,14 @@ GEM
amq-protocol (2.3.0)
arel (9.0.0)
ast (2.4.0)
backports (3.11.3)
backports (3.11.4)
bcrypt (3.1.12)
binding_of_caller (0.8.0)
debug_inspector (>= 0.0.1)
builder (3.2.3)
bunny (2.11.0)
amq-protocol (~> 2.3.0)
capybara (3.4.2)
capybara (3.7.1)
addressable
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
@ -90,24 +90,25 @@ GEM
debug_inspector (0.0.3)
declarative (0.0.10)
declarative-option (0.1.0)
deep-cover (0.6.2)
backports (>= 3.11.0)
binding_of_caller
deep-cover (0.6.4)
bundler
deep-cover-core (= 0.6.4)
highline
parser (~> 2.5.0)
pry
sass
slop (~> 4.0)
term-ansicolor
terminal-table
with_progress
deep-cover-core (0.6.4)
backports (>= 3.11.0)
binding_of_caller
parser (~> 2.5.0)
pry
terminal-table
delayed_job (4.1.5)
activesupport (>= 3.0, < 5.3)
delayed_job_active_record (4.1.3)
activerecord (>= 3.0, < 5.3)
delayed_job (>= 3.0, < 5)
devise (4.4.3)
devise (4.5.0)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0, < 6.0)
@ -121,10 +122,10 @@ GEM
erubi (1.7.1)
eventmachine (1.2.7)
excon (0.62.0)
factory_bot (4.10.0)
factory_bot (4.11.0)
activesupport (>= 3.0.0)
factory_bot_rails (4.10.0)
factory_bot (~> 4.10.0)
factory_bot_rails (4.11.0)
factory_bot (~> 4.11.0)
railties (>= 3.0.0)
faker (1.9.1)
i18n (>= 0.7)
@ -135,12 +136,12 @@ GEM
ffi (1.9.25)
figaro (1.1.1)
thor (~> 0.14)
fog-core (2.1.0)
fog-core (2.1.2)
builder
excon (~> 0.58)
formatador (~> 0.2)
mime-types
fog-google (1.6.0)
fog-google (1.7.1)
fog-core
fog-json
fog-xml
@ -158,26 +159,26 @@ GEM
formatador (0.2.5)
globalid (0.4.1)
activesupport (>= 4.2.0)
google-api-client (0.23.4)
google-api-client (0.23.8)
addressable (~> 2.5, >= 2.5.1)
googleauth (>= 0.5, < 0.7.0)
httpclient (>= 2.8.1, < 3.0)
mime-types (~> 3.0)
representable (~> 3.0)
retriable (>= 2.0, < 4.0)
googleauth (0.6.2)
signet (~> 0.9)
googleauth (0.6.6)
faraday (~> 0.12)
jwt (>= 1.4, < 3.0)
logging (~> 2.0)
memoist (~> 0.12)
multi_json (~> 1.11)
os (~> 0.9)
os (>= 0.9, < 2.0)
signet (~> 0.7)
hashdiff (0.3.7)
hashie (3.5.7)
highline (2.0.0)
httpclient (2.8.3)
i18n (1.0.1)
i18n (1.1.0)
concurrent-ruby (~> 1.0)
json (2.1.0)
jsonapi-renderer (0.2.0)
@ -186,10 +187,6 @@ GEM
addressable (~> 2.3)
letter_opener (1.6.0)
launchy (~> 2.2)
little-plugger (1.1.4)
logging (2.2.2)
little-plugger (~> 1.1)
multi_json (~> 1.10)
lol_dba (2.1.5)
actionpack (>= 3.0)
activerecord (>= 3.0)
@ -203,23 +200,23 @@ GEM
mimemagic (~> 0.3.2)
memoist (0.16.0)
method_source (0.9.0)
mime-types (3.1)
mime-types (3.2.2)
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
mime-types-data (3.2018.0812)
mimemagic (0.3.2)
mini_mime (1.0.0)
mini_mime (1.0.1)
mini_portile2 (2.3.0)
minitest (5.11.3)
multi_json (1.13.1)
multipart-post (2.0.0)
mutations (0.8.2)
mutations (0.8.3)
activesupport
nio4r (2.3.1)
nokogiri (1.8.4)
mini_portile2 (~> 2.3.0)
orm_adapter (0.5.0)
os (0.9.6)
paperclip (6.0.0)
os (1.0.0)
paperclip (6.1.0)
activemodel (>= 4.2.0)
activesupport (>= 4.2.0)
mime-types
@ -227,10 +224,10 @@ GEM
terrapin (~> 0.6.0)
parser (2.5.1.2)
ast (~> 2.4.0)
passenger (5.3.3)
passenger (5.3.4)
rack
rake (>= 0.8.1)
pg (1.0.0)
pg (1.1.2)
polymorphic_constraints (1.0.0)
rails
pry (0.11.3)
@ -238,7 +235,7 @@ GEM
method_source (~> 0.9.0)
pry-rails (0.3.6)
pry (>= 0.10.4)
public_suffix (3.0.2)
public_suffix (3.0.3)
rabbitmq_http_api_client (1.9.1)
effin_utf8 (~> 1.0.0)
faraday (~> 0.13.0)
@ -251,18 +248,18 @@ GEM
rack-cors (1.0.2)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (5.2.0)
actioncable (= 5.2.0)
actionmailer (= 5.2.0)
actionpack (= 5.2.0)
actionview (= 5.2.0)
activejob (= 5.2.0)
activemodel (= 5.2.0)
activerecord (= 5.2.0)
activestorage (= 5.2.0)
activesupport (= 5.2.0)
rails (5.2.1)
actioncable (= 5.2.1)
actionmailer (= 5.2.1)
actionpack (= 5.2.1)
actionview (= 5.2.1)
activejob (= 5.2.1)
activemodel (= 5.2.1)
activerecord (= 5.2.1)
activestorage (= 5.2.1)
activesupport (= 5.2.1)
bundler (>= 1.3.0)
railties (= 5.2.0)
railties (= 5.2.1)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
@ -279,16 +276,13 @@ GEM
rails_stdout_logging
rails_serve_static_assets (0.0.5)
rails_stdout_logging (0.0.5)
railties (5.2.0)
actionpack (= 5.2.0)
activesupport (= 5.2.0)
railties (5.2.1)
actionpack (= 5.2.1)
activesupport (= 5.2.1)
method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
thor (>= 0.19.0, < 2.0)
rake (12.3.1)
rb-fsevent (0.10.3)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
representable (3.0.4)
declarative (< 0.1.0)
declarative-option (< 0.2.0)
@ -299,45 +293,40 @@ GEM
actionpack (>= 4.2.0, < 5.3)
railties (>= 4.2.0, < 5.3)
retriable (3.1.2)
rollbar (2.16.3)
rollbar (2.17.0)
multi_json
rspec (3.7.0)
rspec-core (~> 3.7.0)
rspec-expectations (~> 3.7.0)
rspec-mocks (~> 3.7.0)
rspec-core (3.7.1)
rspec-support (~> 3.7.0)
rspec-expectations (3.7.0)
rspec (3.8.0)
rspec-core (~> 3.8.0)
rspec-expectations (~> 3.8.0)
rspec-mocks (~> 3.8.0)
rspec-core (3.8.0)
rspec-support (~> 3.8.0)
rspec-expectations (3.8.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.7.0)
rspec-mocks (3.7.0)
rspec-support (~> 3.8.0)
rspec-mocks (3.8.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.7.0)
rspec-rails (3.7.2)
rspec-support (~> 3.8.0)
rspec-rails (3.8.0)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 3.7.0)
rspec-expectations (~> 3.7.0)
rspec-mocks (~> 3.7.0)
rspec-support (~> 3.7.0)
rspec-support (3.7.1)
rspec-core (~> 3.8.0)
rspec-expectations (~> 3.8.0)
rspec-mocks (~> 3.8.0)
rspec-support (~> 3.8.0)
rspec-support (3.8.0)
ruby-graphviz (1.2.3)
ruby-progressbar (1.10.0)
rubyzip (1.2.1)
sass (3.5.7)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
rubyzip (1.2.2)
scenic (1.4.1)
activerecord (>= 4.0.0)
railties (>= 4.0.0)
secure_headers (6.0.0)
selenium-webdriver (3.13.1)
selenium-webdriver (3.14.0)
childprocess (~> 0.5)
rubyzip (~> 1.2)
signet (0.8.1)
signet (0.9.1)
addressable (~> 2.3)
faraday (~> 0.9)
jwt (>= 1.5, < 3.0)
@ -347,9 +336,9 @@ GEM
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
skylight (2.0.2)
skylight-core (= 2.0.2)
skylight-core (2.0.2)
skylight (3.0.0)
skylight-core (= 3.0.0)
skylight-core (3.0.0)
activesupport (>= 4.2.0)
slop (4.6.2)
sprockets (3.7.2)

View File

@ -25,21 +25,21 @@
"author": "farmbot.io",
"license": "MIT",
"optionalDependencies": {
"webpack-dev-server": "3.1.5"
"webpack-dev-server": "3.1.7"
},
"dependencies": {
"@blueprintjs/core": "2.3.1",
"@blueprintjs/datetime": "2.0.3",
"@blueprintjs/select": "^2.0.1",
"@types/enzyme": "3.1.12",
"@types/enzyme": "3.1.13",
"@types/fastclick": "^1.0.28",
"@types/history": "^4.6.1",
"@types/i18next": "^8.4.2",
"@types/history": "4.7.0",
"@types/i18next": "8.4.5",
"@types/jest": "23.3.1",
"@types/lodash": "4.14.114",
"@types/markdown-it": "^0.0.4",
"@types/lodash": "4.14.116",
"@types/markdown-it": "0.0.5",
"@types/moxios": "^0.4.5",
"@types/node": "10.5.3",
"@types/node": "10.9.4",
"@types/react": "16.3.14",
"@types/react-color": "2.13.5",
"@types/react-dom": "16.0.5",
@ -50,51 +50,51 @@
"browser-speech": "1.1.1",
"coveralls": "3.0.2",
"css-loader": "1.0.0",
"enzyme": "^3.1.0",
"enzyme-adapter-react-16": "^1.1.0",
"enzyme-adapter-react-16": "1.5.0",
"enzyme": "3.6.0",
"farmbot": "https://github.com/RickCarlino/farmbot-js.git#e019f316",
"farmbot-toastr": "^1.0.3",
"fastclick": "^1.0.6",
"file-loader": "1.1.11",
"i18next": "11.5.0",
"file-loader": "2.0.0",
"i18next": "11.7.0",
"imports-loader": "0.8.0",
"jest": "23.4.1",
"jest": "23.5.0",
"json-loader": "0.5.7",
"lodash": "4.17.10",
"markdown-it": "^8.4.0",
"markdown-it-emoji": "^1.4.0",
"moment": "2.22.2",
"moxios": "^0.4.0",
"node-sass": "4.9.2",
"optimize-css-assets-webpack-plugin": "5.0.0",
"node-sass": "4.9.3",
"optimize-css-assets-webpack-plugin": "5.0.1",
"raf": "^3.4.0",
"react": "16.4.1",
"react": "16.4.2",
"react-addons-css-transition-group": "^15.6.2",
"react-addons-test-utils": "^15.6.2",
"react-color": "2.14.1",
"react-dom": "16.4.1",
"react-dom": "16.4.2",
"react-redux": "^5.0.6",
"react-router": "^3",
"react-test-renderer": "16.4.1",
"react-test-renderer": "16.4.2",
"react-transition-group": "^2.3.1",
"redux": "4.0.0",
"redux-immutable-state-invariant": "^2.1.0",
"redux-thunk": "2.3.0",
"rollbar-sourcemap-webpack-plugin": "^2.3.0",
"sass-loader": "7.1.0",
"stats-webpack-plugin": "0.6.2",
"style-loader": "0.21.0",
"ts-jest": "23.0.1",
"stats-webpack-plugin": "0.7.0",
"style-loader": "0.23.0",
"ts-jest": "23.1.4",
"ts-lint": "^4.5.1",
"ts-loader": "4.4.2",
"ts-loader": "5.0.0",
"tslint": "5.11.0",
"typescript": "3.0.1",
"url-loader": "1.0.1",
"webpack": "4.16.4",
"typescript": "3.0.3",
"url-loader": "1.1.1",
"webpack": "4.17.2",
"webpack-uglify-js-plugin": "1.1.9",
"weinre": "^2.0.0-pre-I0Z7U9OV",
"which": "1.3.1",
"yarn": "^1.9.2"
"yarn": "1.9.4"
},
"devDependencies": {
"jscpd": "0.6.22",
@ -124,7 +124,7 @@
"./webpack/__test_support__/additional_mocks.ts"
],
"transform": {
".(ts|tsx)": "<rootDir>/node_modules/ts-jest/preprocessor.js"
".(ts|tsx)": "ts-jest"
},
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$",
"moduleFileExtensions": [

View File

@ -1,12 +1,12 @@
FactoryBot.define do
factory :diagnostic_dump do
device
fbos_version "123_fbos_version"
fbos_commit "123_fbos_commit"
firmware_commit "123_firmware_commit"
network_interface "123_network_interface"
fbos_dmesg_dump "123_fbos_dmesg_dump"
firmware_state "123_firmware_state"
fbos_version { "123_fbos_version" }
fbos_commit { "123_fbos_commit" }
firmware_commit { "123_firmware_commit" }
network_interface { "123_network_interface" }
fbos_dmesg_dump { "123_fbos_dmesg_dump" }
firmware_state { "123_firmware_state" }
ticket_identifier { rand(36**5).to_s(36) }
end
end

View File

@ -1,11 +1,11 @@
FactoryBot.define do
factory :generic_pointer do
radius 1.5
radius { 1.5 }
x { rand(1...550) }
y { rand(1...550) }
z { rand(1...550) }
meta ({})
meta {({})}
device
pointer_type GenericPointer.name
pointer_type { GenericPointer.name }
end
end

View File

@ -1,6 +1,6 @@
FactoryBot.define do
factory :global_config do
key "MyString"
value "MyText"
key { "MyString" }
value { "MyText" }
end
end

View File

@ -2,7 +2,7 @@
FactoryBot.define do
factory :image do
attachment { StringIO.new(File.open("./spec/fixture.jpg").read) }
meta ({x: 1, y: 2, z: 3})
meta {({x: 1, y: 2, z: 3})}
device
end
end

View File

@ -2,6 +2,6 @@ FactoryBot.define do
factory :log_dispatch do
device
log
sent_at "2017-05-25 06:16:55"
sent_at { "2017-05-25 06:16:55" }
end
end

View File

@ -4,6 +4,6 @@ FactoryBot.define do
sequence(:created_at) { |n| n.minutes.ago.utc }
message { Faker::Company.bs }
type { Log::TYPES.sample }
channels ["toast"]
channels { ["toast"] }
end
end

View File

@ -3,6 +3,6 @@ FactoryBot.define do
factory :peripheral do
device
pin { count = (count + 1) % 50 }
label "MyString"
label { "MyString" }
end
end

View File

@ -1,7 +1,7 @@
FactoryBot.define do
factory :plant_template do
openfarm_slug "lettuce"
radius 1.5
openfarm_slug { "lettuce" }
radius { 1.5 }
x { rand(1...550) }
y { rand(1...550) }
z { rand(1...550) }

View File

@ -1,12 +1,12 @@
FactoryBot.define do
factory :plant do
radius 1.5
radius { 1.5 }
x { rand(1...550) }
y { rand(1...550) }
z { rand(1...550) }
meta ({})
meta {({})}
device
openfarm_slug "lettuce"
pointer_type "Plant"
openfarm_slug { "lettuce" }
pointer_type { "Plant" }
end
end

View File

@ -3,7 +3,7 @@ FactoryBot.define do
factory :sensor do
device
pin { count = (count + 1) % 50 }
label "MyString"
mode 1
label { "MyString" }
mode { 1 }
end
end

View File

@ -3,9 +3,9 @@ FactoryBot.define do
x { rand(1...550) }
y { rand(1...550) }
z { rand(1...550) }
meta ({})
meta {({})}
device
tool
pointer_type("ToolSlot")
pointer_type { "ToolSlot" }
end
end

View File

@ -3,9 +3,9 @@
FactoryBot.define do
factory :user do
device
name { Faker::Name.name }
email { Faker::Internet.email }
password { Faker::Internet.password(8) }
name { Faker::Name.name }
email { Faker::Internet.email }
password { Faker::Internet.password(8) }
confirmed_at { Time.now }
after(:create) do |user|
user.device ||= Devices::Create.run!(user: resp[:user])

View File

@ -1,6 +1,6 @@
FactoryBot.define do
factory :webcam_feed do
device
url "http://placehold.it/320x240"
url { "http://placehold.it/320x240" }
end
end

View File

@ -39,7 +39,7 @@ describe("<FarmbotOsSettings/>", () => {
it("renders settings", () => {
const osSettings = mount(<FarmbotOsSettings {...fakeProps()} />);
expect(osSettings.find("input").length).toBe(1);
expect(osSettings.find("button").length).toBe(6);
expect(osSettings.find("button").length).toBe(7);
["NAME", "TIME ZONE", "LAST SEEN", "FARMBOT OS", "CAMERA", "FIRMWARE"]
.map(string => expect(osSettings.text()).toContain(string));
});

View File

@ -66,11 +66,11 @@ describe("<HardwareSettings />", () => {
p.firmwareConfig = fakeFirmwareConfig().body;
p.firmwareConfig.api_migrated = true;
const wrapper = shallow(<HardwareSettings {...p} />);
expect(wrapper.find("Popover").length).toEqual(1);
expect(wrapper.html()).toContain("fa-download");
});
it("doesn't show param export menu", () => {
const wrapper = shallow(<HardwareSettings {...fakeProps()} />);
expect(wrapper.find("Popover").length).toEqual(0);
expect(wrapper.html()).not.toContain("fa-download");
});
});

View File

@ -27,8 +27,7 @@ describe("<VirtualFarmBot/>", () => {
expect(homeLines.at(0).props()).toEqual({ "x1": 2, "x2": 2, "y1": 2, "y2": 1500 });
expect(homeLines.at(1).props()).toEqual({ "x1": 2, "x2": 3000, "y1": 2, "y2": 2 });
const maxLines = wrapper.find("#max-lines").find("line");
expect(maxLines.at(0).html()).toBeFalsy();
expect(maxLines.at(1).html()).toBeFalsy();
expect(maxLines.length).toEqual(0);
});
it("renders home and max lines", () => {
@ -56,10 +55,10 @@ describe("<VirtualFarmBot/>", () => {
const wrapper = shallow(<BotExtents {...p} />);
const homeLines = wrapper.find("#home-lines").find("line");
expect(homeLines.at(0).props()).toEqual({ "x1": 2, "x2": 3000, "y1": 2, "y2": 2 });
expect(homeLines.at(1).html()).toBeFalsy();
expect(homeLines.length).toEqual(1);
const maxLines = wrapper.find("#max-lines").find("line");
expect(maxLines.at(0).props()).toEqual({ "x1": 2, "x2": 3000, "y1": 100, "y2": 100 });
expect(maxLines.at(1).html()).toBeFalsy();
expect(maxLines.length).toEqual(1);
});
it("renders max lines", () => {
@ -72,8 +71,7 @@ describe("<VirtualFarmBot/>", () => {
};
const wrapper = shallow(<BotExtents {...p} />);
const homeLines = wrapper.find("#home-lines").find("line");
expect(homeLines.at(0).html()).toBeFalsy();
expect(homeLines.at(1).html()).toBeFalsy();
expect(homeLines.length).toEqual(0);
const maxLines = wrapper.find("#max-lines").find("line");
expect(maxLines.at(0).props()).toEqual({ "x1": 100, "x2": 100, "y1": 2, "y2": 100 });
expect(maxLines.at(1).props()).toEqual({ "x1": 2, "x2": 100, "y1": 100, "y2": 100 });
@ -128,11 +126,9 @@ describe("<VirtualFarmBot/>", () => {
p.stopAtHome.y = false;
const wrapper = shallow(<BotExtents {...p} />);
const homeLines = wrapper.find("#home-lines").find("line");
expect(homeLines.at(0).html()).toBeFalsy();
expect(homeLines.at(1).html()).toBeFalsy();
expect(homeLines.length).toEqual(0);
const maxLines = wrapper.find("#max-lines").find("line");
expect(maxLines.at(0).html()).toBeFalsy();
expect(maxLines.at(1).html()).toBeFalsy();
expect(maxLines.length).toEqual(0);
});
});

View File

@ -40,13 +40,15 @@ describe("<GardenMapLegend />", () => {
const wrapper = mount(<GardenMapLegend {...fakeProps()} />);
["plants", "origin", "move"].map(string =>
expect(wrapper.text().toLowerCase()).toContain(string));
expect(wrapper.find("Popover").length).toEqual(1);
expect(wrapper.html()).toContain("filter");
expect(wrapper.html()).not.toContain("extras");
});
it("shows submenu", () => {
localStorage.setItem("FUTURE_FEATURES", "true");
const wrapper = mount(<GardenMapLegend {...fakeProps()} />);
expect(wrapper.find("Popover").length).toEqual(2);
expect(wrapper.html()).toContain("filter");
expect(wrapper.html()).toContain("extras");
});
});

View File

@ -49,7 +49,7 @@ export const ZoomControls = ({ zoom, getConfigValue }: {
};
export const PointsSubMenu = () =>
<div>
<div className="map-points-submenu">
<button className={"fb-button green"}
onClick={() => history.push("/app/designer/plants/create_point")}>
{t("Point Creator")}
@ -67,6 +67,7 @@ const LayerToggles = (props: GardenMapLegendProps) => {
value={props.showPoints}
label={t("Points?")}
onClick={toggle("show_points")}
submenuTitle={t("extras")}
popover={!!localStorage.getItem("FUTURE_FEATURES")
? <PointsSubMenu />
: undefined} />
@ -82,6 +83,7 @@ const LayerToggles = (props: GardenMapLegendProps) => {
value={props.showImages}
label={t("Photos?")}
onClick={toggle("show_images")}
submenuTitle={t("filter")}
popover={<ImageFilterMenu
tzOffset={props.tzOffset}
dispatch={props.dispatch}

View File

@ -7,10 +7,13 @@ export interface LayerToggleProps {
value: boolean | undefined;
onClick(): void;
popover?: JSX.Element | undefined;
submenuTitle?: string;
}
/** A flipper type switch for showing/hiding the layers of the garden map. */
export function LayerToggle({ label, value, onClick, popover }: LayerToggleProps) {
export function LayerToggle(props: LayerToggleProps) {
const { label, value, onClick, popover, submenuTitle } = props;
const title = submenuTitle ? submenuTitle : t("more");
const klassName = "fb-button fb-toggle-button " + (value ? "green" : "red");
return <fieldset>
<label>
@ -21,7 +24,7 @@ export function LayerToggle({ label, value, onClick, popover }: LayerToggleProps
targetClassName={"caret-menu-button"}
position={Position.BOTTOM_RIGHT}
className={"caret-menu-button"}>
<i className="fa fa-caret-down" title={t("filter")} />
<i className="fa fa-caret-down" title={t(title)} />
{popover}
</Popover>}
</span>

View File

@ -86,9 +86,9 @@ describe("deletePoints()", () => {
mockData = [{ id: 1 }, { id: 2 }, { id: 3 }];
const dispatch = jest.fn();
await deletePoints("weeds", "plant-detection")(dispatch, jest.fn());
expect(axios.post).toHaveBeenCalledWith(":///api/points/search",
expect(axios.post).toHaveBeenCalledWith("http://localhost/api/points/search",
{ meta: { created_by: "plant-detection" } });
await expect(axios.delete).toHaveBeenCalledWith(":///api/points/1,2,3");
await expect(axios.delete).toHaveBeenCalledWith("http://localhost/api/points/1,2,3");
expect(dispatch).toHaveBeenCalledWith({
payload: [1, 2, 3],
type: Actions.DELETE_POINT_OK
@ -104,9 +104,9 @@ describe("deletePoints()", () => {
mockData = [{ id: 1 }, { id: 2 }, { id: 3 }];
const dispatch = jest.fn();
await deletePoints("weeds", "plant-detection")(dispatch, jest.fn());
expect(axios.post).toHaveBeenCalledWith(":///api/points/search",
expect(axios.post).toHaveBeenCalledWith("http://localhost/api/points/search",
{ meta: { created_by: "plant-detection" } });
await expect(axios.delete).toHaveBeenCalledWith(":///api/points/1,2,3");
await expect(axios.delete).toHaveBeenCalledWith("http://localhost/api/points/1,2,3");
await expect(dispatch).not.toHaveBeenCalled();
expect(mockInc).toHaveBeenCalledTimes(1);
expect(mockFinish).toHaveBeenCalledTimes(1);
@ -120,10 +120,10 @@ describe("deletePoints()", () => {
mockData = times(200, () => ({ id: 1 }));
const dispatch = jest.fn();
await deletePoints("weeds", "plant-detection")(dispatch, jest.fn());
expect(axios.post).toHaveBeenCalledWith(":///api/points/search",
expect(axios.post).toHaveBeenCalledWith("http://localhost/api/points/search",
{ meta: { created_by: "plant-detection" } });
await expect(axios.delete).toHaveBeenCalledWith(
expect.stringContaining(":///api/points/1,"));
expect.stringContaining("http://localhost/api/points/1,"));
expect(dispatch).toHaveBeenCalledWith({
payload: expect.arrayContaining([1]),
type: Actions.DELETE_POINT_OK

980
yarn.lock

File diff suppressed because it is too large Load Diff