From 9ef8a4551a18fbdf6f8418b1957a617aff9aec9f Mon Sep 17 00:00:00 2001 From: ngpmnam Date: Tue, 17 Sep 2024 18:48:01 -0400 Subject: [PATCH 01/48] Added html sub dir to create a subtab in fd2_school with temporary content --- farmdata2/farmdata2_modules/fd2_school/html/html.html | 1 + 1 file changed, 1 insertion(+) create mode 100644 farmdata2/farmdata2_modules/fd2_school/html/html.html diff --git a/farmdata2/farmdata2_modules/fd2_school/html/html.html b/farmdata2/farmdata2_modules/fd2_school/html/html.html new file mode 100644 index 00000000..1b239aac --- /dev/null +++ b/farmdata2/farmdata2_modules/fd2_school/html/html.html @@ -0,0 +1 @@ +NamNguyen From 8e43941ad8026a072e26c37769f9126fb392727b Mon Sep 17 00:00:00 2001 From: ngpmnam Date: Tue, 17 Sep 2024 22:33:23 -0400 Subject: [PATCH 02/48] Created html.html and formatted Harvest Report and My Sample Harvest Report --- .../fd2_school/html/html.html | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/html/html.html b/farmdata2/farmdata2_modules/fd2_school/html/html.html index 1b239aac..d74e0eaf 100644 --- a/farmdata2/farmdata2_modules/fd2_school/html/html.html +++ b/farmdata2/farmdata2_modules/fd2_school/html/html.html @@ -1 +1,17 @@ -NamNguyen + + +

Harvest Report

+

This page is a mockup of a simplified harvest report.

+ +

My Sample Harvest Report

+

Details

+ + From e904f07023e937058fc43b1af3fa2f6dffdc9af7 Mon Sep 17 00:00:00 2001 From: ngpmnam Date: Tue, 17 Sep 2024 23:12:23 -0400 Subject: [PATCH 03/48] Italicize mock and add breaks and line as indicated in html.html --- farmdata2/farmdata2_modules/fd2_school/html/html.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/html/html.html b/farmdata2/farmdata2_modules/fd2_school/html/html.html index d74e0eaf..24904563 100644 --- a/farmdata2/farmdata2_modules/fd2_school/html/html.html +++ b/farmdata2/farmdata2_modules/fd2_school/html/html.html @@ -1,8 +1,8 @@

Harvest Report

-

This page is a mockup of a simplified harvest report.

- +

This page is a mockup of a simplified harvest report.

+

My Sample Harvest Report

Details

    From 8b7f5deaf7793593b650f7d13bbf4e8cbdaffef4 Mon Sep 17 00:00:00 2001 From: ngpmnam Date: Wed, 18 Sep 2024 00:07:27 -0400 Subject: [PATCH 04/48] Created button and text field for Harvest Report --- farmdata2/farmdata2_modules/fd2_school/html/html.html | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/farmdata2/farmdata2_modules/fd2_school/html/html.html b/farmdata2/farmdata2_modules/fd2_school/html/html.html index 24904563..5564e0cc 100644 --- a/farmdata2/farmdata2_modules/fd2_school/html/html.html +++ b/farmdata2/farmdata2_modules/fd2_school/html/html.html @@ -2,6 +2,10 @@

    Harvest Report

    This page is a mockup of a simplified harvest report.

    + + +
    +

    My Sample Harvest Report

    Details

    @@ -14,4 +18,6 @@

    My Sample Harvest Report

  • End:05/15/2018
  • Crop:Kale
+ + From 7401b43cdd2b008c86a1f2e3563f459168267004 Mon Sep 17 00:00:00 2001 From: ngpmnam Date: Wed, 18 Sep 2024 20:24:06 -0400 Subject: [PATCH 05/48] Created Crop and Field Drop down lists --- .../farmdata2_modules/fd2_school/html/html.html | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/farmdata2/farmdata2_modules/fd2_school/html/html.html b/farmdata2/farmdata2_modules/fd2_school/html/html.html index 5564e0cc..31ffc2c5 100644 --- a/farmdata2/farmdata2_modules/fd2_school/html/html.html +++ b/farmdata2/farmdata2_modules/fd2_school/html/html.html @@ -5,6 +5,19 @@

Harvest Report


+ + + + +

My Sample Harvest Report

From c089c983b6c1b0d77a0eade6f3d41850b8b20d90 Mon Sep 17 00:00:00 2001 From: ngpmnam Date: Wed, 18 Sep 2024 20:42:02 -0400 Subject: [PATCH 06/48] Created Start and End Date --- farmdata2/farmdata2_modules/fd2_school/html/html.html | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/html/html.html b/farmdata2/farmdata2_modules/fd2_school/html/html.html index 31ffc2c5..eb9a4900 100644 --- a/farmdata2/farmdata2_modules/fd2_school/html/html.html +++ b/farmdata2/farmdata2_modules/fd2_school/html/html.html @@ -3,7 +3,12 @@

Harvest Report

This page is a mockup of a simplified harvest report.

- + +
+ + + +
-
+
+
+ + + + +
+ + + + +
+ +
+

My Sample Harvest Report

+

Details

+
    +
  • Farm:Sample Farm
  • +
  • User:manager1
  • +
  • Language:English
  • +
    +
  • Start:05/01/2018
  • +
  • End:05/15/2018
  • +
  • Crop:Kale
  • +
+ + + + + + + + + + + + + + + + + + + + + + +
DateAreaCropYieldUnits
09/05/2024Chuau-1Kale10Bunches
09/05/2024SQ7Kale7Bunches
+ + From 8edefec4ad469b430948ef2f00ce57c28ffae07a Mon Sep 17 00:00:00 2001 From: ngpmnam Date: Wed, 25 Sep 2024 21:56:53 -0400 Subject: [PATCH 10/48] Autmoated Header --- .../fd2_school/vue1/vue1.html | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/vue1/vue1.html b/farmdata2/farmdata2_modules/fd2_school/vue1/vue1.html index 7c846724..9fee9874 100644 --- a/farmdata2/farmdata2_modules/fd2_school/vue1/vue1.html +++ b/farmdata2/farmdata2_modules/fd2_school/vue1/vue1.html @@ -3,7 +3,14 @@

Harvest Report

This page is a mockup of a simplified harvest report.

- +
+
+ + +
+ + +
@@ -25,7 +32,21 @@

Harvest Report



-

My Sample Harvest Report

+ +
+

{{ header }}

+
+
+ + +

Details

  • Farm:Sample Farm
  • From 1b0a23962a9b8861dcc13f1ee89906e6469aa1f0 Mon Sep 17 00:00:00 2001 From: ngpmnam Date: Wed, 25 Sep 2024 23:33:51 -0400 Subject: [PATCH 11/48] Automated date and crop --- .../fd2_school/vue1/vue1.html | 54 +++++++++++-------- 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/vue1/vue1.html b/farmdata2/farmdata2_modules/fd2_school/vue1/vue1.html index 9fee9874..5dfc80af 100644 --- a/farmdata2/farmdata2_modules/fd2_school/vue1/vue1.html +++ b/farmdata2/farmdata2_modules/fd2_school/vue1/vue1.html @@ -3,26 +3,28 @@

    Harvest Report

    This page is a mockup of a simplified harvest report.

    +
    - - -
    - - - - -
    - - + + +
    + + +
    + - - - + - - + - + + + +

    @@ -85,7 +83,20 @@

    {{ header == '' ? "Mock Harvest Report" : header }}

    header: "My Sample Harvest Report", start: "2020-05-05", end: "2021-02-02", - crop:"Kale" + crop:'Kale', + crops:[ + "Kale", + "Broccoli", + "Peas" + ], + field : "", + areas : [ + "All", + "Chuau-1", + "SQ7", + ] + + }, }); From 5bbf673e12b8d529caa10730b9c1daf886703d1e Mon Sep 17 00:00:00 2001 From: ngpmnam Date: Thu, 26 Sep 2024 16:01:28 -0400 Subject: [PATCH 14/48] Added v-for to report table --- .../fd2_school/vue1/vue1.html | 35 +++++++++---------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/vue1/vue1.html b/farmdata2/farmdata2_modules/fd2_school/vue1/vue1.html index ad0cfc95..29d75943 100644 --- a/farmdata2/farmdata2_modules/fd2_school/vue1/vue1.html +++ b/farmdata2/farmdata2_modules/fd2_school/vue1/vue1.html @@ -17,14 +17,17 @@

    Harvest Report


    + + + @@ -34,7 +37,7 @@

    Harvest Report


    -

    {{ header == '' ? "Mock Harvest Report" : header }}

    +

    {{ header ? header : "Mock Harvest Report" }}

    @@ -50,7 +53,7 @@

    {{ header == '' ? "Mock Harvest Report" : header }}

  • End:{{end}}
  • Crop:{{crop}}
- + @@ -59,23 +62,13 @@

{{ header == '' ? "Mock Harvest Report" : header }}

- - - - - - - - - - - - - + + +
Date Yield Units
09/05/2024Chuau-1Kale10Bunches
09/05/2024SQ7Kale7Bunches
{{value}}
- + From 7b9ca7c26c07ea8a40997d08122a1c795cd9d34d Mon Sep 17 00:00:00 2001 From: ngpmnam Date: Thu, 26 Sep 2024 17:32:11 -0400 Subject: [PATCH 16/48] Vue.config.devtool = true --- farmdata2/farmdata2_modules/fd2_school/vue1/vue1.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/farmdata2/farmdata2_modules/fd2_school/vue1/vue1.html b/farmdata2/farmdata2_modules/fd2_school/vue1/vue1.html index d03e5cd8..5daf59c7 100644 --- a/farmdata2/farmdata2_modules/fd2_school/vue1/vue1.html +++ b/farmdata2/farmdata2_modules/fd2_school/vue1/vue1.html @@ -100,5 +100,7 @@

{{ header ? header : "Mock Harvest Report" }}

], }, }); + + Vue.config.devtools = true; From 4c04313f719d9999ec2df4fd051ccf3f3cf2a91d Mon Sep 17 00:00:00 2001 From: ngpmnam Date: Sun, 6 Oct 2024 23:54:48 -0400 Subject: [PATCH 17/48] Created vue2 subtab and vue2.html --- .../fd2_school/vue2/vue2.html | 106 ++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 farmdata2/farmdata2_modules/fd2_school/vue2/vue2.html diff --git a/farmdata2/farmdata2_modules/fd2_school/vue2/vue2.html b/farmdata2/farmdata2_modules/fd2_school/vue2/vue2.html new file mode 100644 index 00000000..5daf59c7 --- /dev/null +++ b/farmdata2/farmdata2_modules/fd2_school/vue2/vue2.html @@ -0,0 +1,106 @@ + + +

Harvest Report

+

This page is a mockup of a simplified harvest report.

+ + +
+
+ + +
+
+ +
+ + + + +
+ + + + + + + + +
+ + +
+ +
+ +
+

{{ header ? header : "Mock Harvest Report" }}

+
+ + + + +

Details

+
    +
  • Farm:Sample Farm
  • +
  • User:manager1
  • +
  • Language:English
  • +
    +
  • Start:{{start}}
  • +
  • End:{{end}}
  • +
  • Crop:{{crop}}
  • +
+ + + + + + + + + + + + + + + + + +
DateAreaCropYieldUnits
{{log.date}}{{log.area}}{{log.cr}}{{log.yield}}{{log.units}}
+ +
+ + + + From 08be886fd7b8988c56c2b4e0ca5e7246e615a654 Mon Sep 17 00:00:00 2001 From: ngpmnam Date: Mon, 7 Oct 2024 00:06:25 -0400 Subject: [PATCH 18/48] Created Generate Report button that generates a specific template of report --- farmdata2/farmdata2_modules/fd2_school/vue2/vue2.html | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/vue2/vue2.html b/farmdata2/farmdata2_modules/fd2_school/vue2/vue2.html index 5daf59c7..dfee5e0a 100644 --- a/farmdata2/farmdata2_modules/fd2_school/vue2/vue2.html +++ b/farmdata2/farmdata2_modules/fd2_school/vue2/vue2.html @@ -33,7 +33,11 @@

Harvest Report


- +
+ +
+
@@ -94,10 +98,7 @@

{{ header ? header : "Mock Harvest Report" }}

"Chuau-1", "SQ7", ], - logs:[ - {date: "2020-09-01", area: "Chuau-1", cr: "Kale", yield: 4, units: "Bunches"}, - {date: "2021-02-02", area: "All", cr: "Broccoli", yield: 14, units: "Bunches"}, - ], + logs:[], }, }); From d338db8400b9c2ca4409cd8a066bed6c8119ac2f Mon Sep 17 00:00:00 2001 From: ngpmnam Date: Mon, 7 Oct 2024 00:26:19 -0400 Subject: [PATCH 19/48] Created methods in Vue instance and created a function to handle the click --- farmdata2/farmdata2_modules/fd2_school/vue2/vue2.html | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/vue2/vue2.html b/farmdata2/farmdata2_modules/fd2_school/vue2/vue2.html index dfee5e0a..5b813ea6 100644 --- a/farmdata2/farmdata2_modules/fd2_school/vue2/vue2.html +++ b/farmdata2/farmdata2_modules/fd2_school/vue2/vue2.html @@ -34,8 +34,7 @@

Harvest Report


- +

@@ -100,6 +99,12 @@

{{ header ? header : "Mock Harvest Report" }}

], logs:[], }, + methods:{ + generate: function(){ + this.logs.push({date: '2018-05-01', area: 'Orion-3', + cr: 'Kale', yield: '12', units: 'Bunches'}); + } + } }); Vue.config.devtools = true; From 869ec28b6dd7520453b717ec75a90f2c7c2bf1df Mon Sep 17 00:00:00 2001 From: ngpmnam Date: Mon, 7 Oct 2024 00:38:33 -0400 Subject: [PATCH 20/48] Add a "Row" column to the report so that each row is numbered --- farmdata2/farmdata2_modules/fd2_school/vue2/vue2.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/vue2/vue2.html b/farmdata2/farmdata2_modules/fd2_school/vue2/vue2.html index 5b813ea6..aa8a2b0f 100644 --- a/farmdata2/farmdata2_modules/fd2_school/vue2/vue2.html +++ b/farmdata2/farmdata2_modules/fd2_school/vue2/vue2.html @@ -59,6 +59,7 @@

{{ header ? header : "Mock Harvest Report" }}

+ @@ -66,7 +67,8 @@

{{ header ? header : "Mock Harvest Report" }}

- + + From b58da7b755cd100c973717f6a830eb8e3df1e059 Mon Sep 17 00:00:00 2001 From: ngpmnam Date: Mon, 7 Oct 2024 16:04:33 -0400 Subject: [PATCH 21/48] Hide the table headings if no report is displayed --- .../fd2_school/vue2/vue2.html | 49 ++++++++++--------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/vue2/vue2.html b/farmdata2/farmdata2_modules/fd2_school/vue2/vue2.html index aa8a2b0f..3faf6257 100644 --- a/farmdata2/farmdata2_modules/fd2_school/vue2/vue2.html +++ b/farmdata2/farmdata2_modules/fd2_school/vue2/vue2.html @@ -34,7 +34,7 @@

Harvest Report


- +

@@ -56,26 +56,27 @@

{{ header ? header : "Mock Harvest Report" }}

  • End:{{end}}
  • Crop:{{crop}}
  • - -
    Row Date Area Crop Units
    {{index + 1}} {{log.date}} {{log.area}} {{log.cr}}
    - - - - - - - - - - - - - - - - - -
    RowDateAreaCropYieldUnits
    {{index + 1}}{{log.date}}{{log.area}}{{log.cr}}{{log.yield}}{{log.units}}
    + + + + + + + + + + + + + + + + + + + +
    RowDateAreaCropYieldUnits
    {{index + 1}}{{log.date}}{{log.area}}{{log.cr}}{{log.yield}}{{log.units}}
    +

    No report to display

    @@ -103,9 +104,9 @@

    {{ header ? header : "Mock Harvest Report" }}

    }, methods:{ generate: function(){ - this.logs.push({date: '2018-05-01', area: 'Orion-3', - cr: 'Kale', yield: '12', units: 'Bunches'}); - } + this.logs.push({date: "2018-05-01", area: "Orion-3", + cr: "Kale", yield: "12", units: "Bunches"}); + }, } }); From 5f9e07cf74de119512a691c4120e9853cdbc6922 Mon Sep 17 00:00:00 2001 From: ngpmnam Date: Mon, 7 Oct 2024 16:21:37 -0400 Subject: [PATCH 22/48] Binded min and max to date selection in previous activities already. --- farmdata2/farmdata2_modules/fd2_school/vue2/vue2.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/vue2/vue2.html b/farmdata2/farmdata2_modules/fd2_school/vue2/vue2.html index 3faf6257..7e655f8d 100644 --- a/farmdata2/farmdata2_modules/fd2_school/vue2/vue2.html +++ b/farmdata2/farmdata2_modules/fd2_school/vue2/vue2.html @@ -16,7 +16,7 @@

    Harvest Report

    -
    +
    From 1864236277527a4bb8cd5a7d9d169b9a867a7412 Mon Sep 17 00:00:00 2001 From: ngpmnam Date: Tue, 8 Oct 2024 20:42:59 -0400 Subject: [PATCH 23/48] Created new branch NamNguyen-05-API --- .../farmdata2_modules/fd2_school/api/api.html | 115 ++++++++++++++++++ .../fd2_school/fd2_school.module | 9 ++ 2 files changed, 124 insertions(+) create mode 100644 farmdata2/farmdata2_modules/fd2_school/api/api.html diff --git a/farmdata2/farmdata2_modules/fd2_school/api/api.html b/farmdata2/farmdata2_modules/fd2_school/api/api.html new file mode 100644 index 00000000..7e655f8d --- /dev/null +++ b/farmdata2/farmdata2_modules/fd2_school/api/api.html @@ -0,0 +1,115 @@ + + +

    Harvest Report

    +

    This page is a mockup of a simplified harvest report.

    + + +
    +
    + + +
    +
    + +
    + + + + +
    + + + + + + + + +
    + + +
    +
    + +
    + +
    + +
    +

    {{ header ? header : "Mock Harvest Report" }}

    +
    + + + + +

    Details

    +
      +
    • Farm:Sample Farm
    • +
    • User:manager1
    • +
    • Language:English
    • +
      +
    • Start:{{start}}
    • +
    • End:{{end}}
    • +
    • Crop:{{crop}}
    • +
    + + + + + + + + + + + + + + + + + + + +
    RowDateAreaCropYieldUnits
    {{index + 1}}{{log.date}}{{log.area}}{{log.cr}}{{log.yield}}{{log.units}}
    +

    No report to display

    + +
    + + + + diff --git a/farmdata2/farmdata2_modules/fd2_school/fd2_school.module b/farmdata2/farmdata2_modules/fd2_school/fd2_school.module index a9f426b0..5ae9788f 100644 --- a/farmdata2/farmdata2_modules/fd2_school/fd2_school.module +++ b/farmdata2/farmdata2_modules/fd2_school/fd2_school.module @@ -78,6 +78,15 @@ $items['farm/fd2-school/vue1'] = array( 'access arguments' => array('view fd2 school'), 'weight' => 310, ); + +$items['farm/fd2-school/vue2'] = array( + 'title' => 'VUE2', + 'type' => MENU_LOCAL_TASK, + 'page callback' => 'fd2_school_view', + 'page arguments' => array('vue2'), + 'access arguments' => array('view fd2 school'), + 'weight' => 410, + ); return $items; }; From 17e237f2f36f679d3ad925a3f65bf8fe05c5e035 Mon Sep 17 00:00:00 2001 From: ngpmnam Date: Tue, 8 Oct 2024 20:59:17 -0400 Subject: [PATCH 24/48] Bind Farm, User, and Language to Vue instance --- farmdata2/farmdata2_modules/fd2_school/api/api.html | 9 ++++++--- .../farmdata2_modules/fd2_school/fd2_school.module | 10 +++++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/api/api.html b/farmdata2/farmdata2_modules/fd2_school/api/api.html index 7e655f8d..a16b5cb3 100644 --- a/farmdata2/farmdata2_modules/fd2_school/api/api.html +++ b/farmdata2/farmdata2_modules/fd2_school/api/api.html @@ -48,9 +48,9 @@

    {{ header ? header : "Mock Harvest Report" }}

    Details

      -
    • Farm:Sample Farm
    • -
    • User:manager1
    • -
    • Language:English
    • +
    • Farm:{{farm}}
    • +
    • User:{{user}}
    • +
    • Language:{{language}}

    • Start:{{start}}
    • End:{{end}}
    • @@ -94,6 +94,9 @@

      {{ header ? header : "Mock Harvest Report" }}

      "Broccoli", "Peas" ], + farm: '', + user: '', + language: '', field : "All", areas : [ "All", diff --git a/farmdata2/farmdata2_modules/fd2_school/fd2_school.module b/farmdata2/farmdata2_modules/fd2_school/fd2_school.module index 5ae9788f..9e196109 100644 --- a/farmdata2/farmdata2_modules/fd2_school/fd2_school.module +++ b/farmdata2/farmdata2_modules/fd2_school/fd2_school.module @@ -87,7 +87,15 @@ $items['farm/fd2-school/vue2'] = array( 'access arguments' => array('view fd2 school'), 'weight' => 410, ); - + +$items['farm/fd2-school/api'] = array( + 'title' => 'API', + 'type' => MENU_LOCAL_TASK, + 'page callback' => 'fd2_school_view', + 'page arguments' => array('api'), + 'access arguments' => array('view fd2 school'), + 'weight' => 510, + ); return $items; }; From b9be31c9a9e8e35b2073d843eb0fd804a2bb6958 Mon Sep 17 00:00:00 2001 From: ngpmnam Date: Tue, 8 Oct 2024 21:05:27 -0400 Subject: [PATCH 25/48] Generate Button now loads Farm, User, and Language values on to the page --- farmdata2/farmdata2_modules/fd2_school/api/api.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/farmdata2/farmdata2_modules/fd2_school/api/api.html b/farmdata2/farmdata2_modules/fd2_school/api/api.html index a16b5cb3..fa9f4c4c 100644 --- a/farmdata2/farmdata2_modules/fd2_school/api/api.html +++ b/farmdata2/farmdata2_modules/fd2_school/api/api.html @@ -109,6 +109,9 @@

      {{ header ? header : "Mock Harvest Report" }}

      generate: function(){ this.logs.push({date: "2018-05-01", area: "Orion-3", cr: "Kale", yield: "12", units: "Bunches"}); + this.farm = "Sample Farm"; + this.user = "manager1"; + this.language = "English"; }, } }); From 153a423f8615fcaa1b5480af14c7177ae06ab759 Mon Sep 17 00:00:00 2001 From: ngpmnam Date: Tue, 8 Oct 2024 21:40:55 -0400 Subject: [PATCH 26/48] Generate Report now pulls information from API to generate Farm, User, Language --- .../farmdata2_modules/fd2_school/api/api.html | 34 ++++++++++++++++--- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/api/api.html b/farmdata2/farmdata2_modules/fd2_school/api/api.html index fa9f4c4c..bbb81beb 100644 --- a/farmdata2/farmdata2_modules/fd2_school/api/api.html +++ b/farmdata2/farmdata2_modules/fd2_school/api/api.html @@ -107,11 +107,35 @@

      {{ header ? header : "Mock Harvest Report" }}

      }, methods:{ generate: function(){ - this.logs.push({date: "2018-05-01", area: "Orion-3", - cr: "Kale", yield: "12", units: "Bunches"}); - this.farm = "Sample Farm"; - this.user = "manager1"; - this.language = "English"; + + + axios.get('/farm.json') // this line sends the request. + .then((response) => { + // Block A: + // Code here executes when the response is received. + // response is an Object created from the “Response Body” JSON. + console.log("Got Response") + console.log(response) + this.farm = response.data.name; + this.user = response.data.user.name; + this.language = response.data.user.language; + + }) + .catch((error) => { + // Block B: + // Code here executes if an error occurs processing the request. + // error is an Object describing the error that occurred. + console.log("Error Occurred") + console.log(error) + + }) + // Block C: + // Code here runs immediately after the request is sent, + // which will be before the code in then() or catch(), + // and before the response is received. + this.logs.push({date: "2018-05-01", area: "Orion-3", + cr: "Kale", yield: "12", units: "Bunches"}); + }, } }); From 7fbbf4dbc2230e7229c98a598516e503ed385976 Mon Sep 17 00:00:00 2001 From: ngpmnam Date: Wed, 9 Oct 2024 19:56:54 -0400 Subject: [PATCH 27/48] Retrieved crop names from farm API --- .../farmdata2_modules/fd2_school/api/api.html | 42 ++++++++++++------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/api/api.html b/farmdata2/farmdata2_modules/fd2_school/api/api.html index bbb81beb..6b9e8122 100644 --- a/farmdata2/farmdata2_modules/fd2_school/api/api.html +++ b/farmdata2/farmdata2_modules/fd2_school/api/api.html @@ -21,13 +21,13 @@

      Harvest Report

      @@ -84,31 +84,45 @@

      {{ header ? header : "Mock Harvest Report" }}

      + From 193caf462bbf25001ae4aafb07cf7b86a6b21ac1 Mon Sep 17 00:00:00 2001 From: ngpmnam Date: Tue, 15 Oct 2024 23:56:11 -0400 Subject: [PATCH 29/48] Added a variable that holds pages requested from endpoint --- .../fd2_school/api2/api2.html | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/api2/api2.html b/farmdata2/farmdata2_modules/fd2_school/api2/api2.html index be418619..914fbfbe 100644 --- a/farmdata2/farmdata2_modules/fd2_school/api2/api2.html +++ b/farmdata2/farmdata2_modules/fd2_school/api2/api2.html @@ -113,6 +113,7 @@

      {{ header ? header : "Mock Harvest Report" }}

      areas : ["Chuau-1", "All", "SQ7"], logs:[], idToCropMap: new Map(), + allPagesArr: [], }, computed:{ cropNames() { @@ -148,9 +149,28 @@

      {{ header ? header : "Mock Harvest Report" }}

      // and before the response is received. this.logs.push({date: "2018-05-01", area: "Orion-3", cr: "Kale", yield: "12", units: "Bunches"}); - + let startTimestamp = dayjs(this.start).unix(); + let endTimestamp = dayjs(this.end).unix(); + console.log(startTimestamp, endTimestamp); + let request = "/log.json?type=farm_harvest×tamp[ge]="+ startTimestamp + "×tamp[le]=" + endTimestamp; + console.log(request); + getAllPages(request) + .then((result) => { + // All of the requested records have now been added to result. + // Additional processing can happen here if necessary, + // or then may be omitted. + this.allPagesArr = result; + console.log("successful") + }) + .catch((err) => { + // An error occurred during the requests, process it here. + console.log("Fail") + }) + // Execution continues here immediately after the request is made. + // Result will not yet contain records but will be filled as responses are received. + // The result will contain all records when then() is invoked. + } }, - } }); Vue.config.devtools = true; From 882fbcb9aacbf9012345d4497af2623a5a0ab982 Mon Sep 17 00:00:00 2001 From: ngpmnam Date: Tue, 15 Oct 2024 23:59:37 -0400 Subject: [PATCH 30/48] Changed the GetAllPages function to fit what is asked --- farmdata2/farmdata2_modules/fd2_school/api2/api2.html | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/api2/api2.html b/farmdata2/farmdata2_modules/fd2_school/api2/api2.html index 914fbfbe..bd8a4a7a 100644 --- a/farmdata2/farmdata2_modules/fd2_school/api2/api2.html +++ b/farmdata2/farmdata2_modules/fd2_school/api2/api2.html @@ -154,12 +154,11 @@

      {{ header ? header : "Mock Harvest Report" }}

      console.log(startTimestamp, endTimestamp); let request = "/log.json?type=farm_harvest×tamp[ge]="+ startTimestamp + "×tamp[le]=" + endTimestamp; console.log(request); - getAllPages(request) - .then((result) => { + getAllPages(request, this.allPagesArr) + .then(() => { // All of the requested records have now been added to result. // Additional processing can happen here if necessary, // or then may be omitted. - this.allPagesArr = result; console.log("successful") }) .catch((err) => { From 4b405d8e1913a9553749243086de0d972358e23d Mon Sep 17 00:00:00 2001 From: ngpmnam Date: Wed, 16 Oct 2024 00:45:43 -0400 Subject: [PATCH 31/48] Automated the table by grabbing accurate values from API endpoints --- .../fd2_school/api2/api2.html | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/api2/api2.html b/farmdata2/farmdata2_modules/fd2_school/api2/api2.html index bd8a4a7a..b346bf87 100644 --- a/farmdata2/farmdata2_modules/fd2_school/api2/api2.html +++ b/farmdata2/farmdata2_modules/fd2_school/api2/api2.html @@ -58,7 +58,7 @@

      {{ header ? header : "Mock Harvest Report" }}

    - + @@ -67,7 +67,7 @@

    {{ header ? header : "Mock Harvest Report" }}

    - + @@ -120,6 +120,22 @@

    {{ header ? header : "Mock Harvest Report" }}

    cropVals = this.idToCropMap.values(); return cropVals; }, + + harvestReportRows() { + let tableRows = [] + for(let log of this.allPagesArr) { + let tableRow = { + date: log.timestamp, + area: log.area[0].name, + yield: log.quantity[0].value, + units: log.quantity[0].unit.name, + cr: this.idToCropMap.get(log.data.crop_tid), + } + tableRows.push(tableRow) + } + return tableRows + }, + }, methods:{ generate: function(){ From d724fe23a773d64a5e9396249100883e726673b5 Mon Sep 17 00:00:00 2001 From: ngpmnam Date: Wed, 16 Oct 2024 10:57:40 -0400 Subject: [PATCH 32/48] Finished table report and deleted codes that are no longer useful (fake harvest logs and console.log statements --- .../farmdata2_modules/fd2_school/api2/api2.html | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/api2/api2.html b/farmdata2/farmdata2_modules/fd2_school/api2/api2.html index b346bf87..99b8ef82 100644 --- a/farmdata2/farmdata2_modules/fd2_school/api2/api2.html +++ b/farmdata2/farmdata2_modules/fd2_school/api2/api2.html @@ -125,7 +125,7 @@

    {{ header ? header : "Mock Harvest Report" }}

    let tableRows = [] for(let log of this.allPagesArr) { let tableRow = { - date: log.timestamp, + date: dayjs.unix(log.timestamp).format('MM/DD/YYYY'), area: log.area[0].name, yield: log.quantity[0].value, units: log.quantity[0].unit.name, @@ -144,8 +144,6 @@

    {{ header ? header : "Mock Harvest Report" }}

    // Block A: // Code here executes when the response is received. // response is an Object created from the “Response Body” JSON. - console.log("Got Response") - console.log(response) this.farm = response.data.name; this.user = response.data.user.name; this.language = response.data.user.language; @@ -155,22 +153,15 @@

    {{ header ? header : "Mock Harvest Report" }}

    // Block B: // Code here executes if an error occurs processing the request. // error is an Object describing the error that occurred. - console.log("Error Occurred") - console.log(error) }) // Block C: // Code here runs immediately after the request is sent, // which will be before the code in then() or catch(), // and before the response is received. - this.logs.push({date: "2018-05-01", area: "Orion-3", - cr: "Kale", yield: "12", units: "Bunches"}); let startTimestamp = dayjs(this.start).unix(); let endTimestamp = dayjs(this.end).unix(); - console.log(startTimestamp, endTimestamp); - let request = "/log.json?type=farm_harvest×tamp[ge]="+ startTimestamp + "×tamp[le]=" + endTimestamp; - console.log(request); - getAllPages(request, this.allPagesArr) + let request = "/log.json?type=farm_harvest×tamp[ge]="+ startTimestamp + "×tamp[le]=" + endTimestamp; getAllPages(request, this.allPagesArr) .then(() => { // All of the requested records have now been added to result. // Additional processing can happen here if necessary, From 1d2e85525bc07ff052f5cb35f5ce4d6a12dc13c6 Mon Sep 17 00:00:00 2001 From: ngpmnam Date: Wed, 16 Oct 2024 11:19:35 -0400 Subject: [PATCH 33/48] Report now generates only logs for chosen crop --- farmdata2/farmdata2_modules/fd2_school/api2/api2.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/api2/api2.html b/farmdata2/farmdata2_modules/fd2_school/api2/api2.html index 99b8ef82..87fdc525 100644 --- a/farmdata2/farmdata2_modules/fd2_school/api2/api2.html +++ b/farmdata2/farmdata2_modules/fd2_school/api2/api2.html @@ -67,7 +67,7 @@

    {{ header ? header : "Mock Harvest Report" }}

    - + @@ -131,7 +131,9 @@

    {{ header ? header : "Mock Harvest Report" }}

    units: log.quantity[0].unit.name, cr: this.idToCropMap.get(log.data.crop_tid), } - tableRows.push(tableRow) + if(tableRow.cr == this.crop) { + tableRows.push(tableRow) + } } return tableRows }, From f77724bcd68d98ceca82062b5b9657baaa62e066 Mon Sep 17 00:00:00 2001 From: ngpmnam Date: Tue, 22 Oct 2024 22:41:40 -0400 Subject: [PATCH 34/48] cypress testing first.spec.js following tutorial --- .../farmdata2_modules/fd2_school/api/api.html | 4 ++-- .../fd2_school/fd2_school.module | 9 +++++++++ .../farmdata2_modules/fd2_school/first.spec.js | 17 +++++++++++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 farmdata2/farmdata2_modules/fd2_school/first.spec.js diff --git a/farmdata2/farmdata2_modules/fd2_school/api/api.html b/farmdata2/farmdata2_modules/fd2_school/api/api.html index 6b9e8122..c654bb35 100644 --- a/farmdata2/farmdata2_modules/fd2_school/api/api.html +++ b/farmdata2/farmdata2_modules/fd2_school/api/api.html @@ -27,7 +27,7 @@

    Harvest Report

    @@ -110,7 +110,7 @@

    {{ header ? header : "Mock Harvest Report" }}

    user: '', language: '', field : "All", - areas : [], + areas : ["Chuau-1", "All", "SQ7"], logs:[], idToCropMap: new Map(), idToAreaMap: new Map(), diff --git a/farmdata2/farmdata2_modules/fd2_school/fd2_school.module b/farmdata2/farmdata2_modules/fd2_school/fd2_school.module index 9e196109..90b7b007 100644 --- a/farmdata2/farmdata2_modules/fd2_school/fd2_school.module +++ b/farmdata2/farmdata2_modules/fd2_school/fd2_school.module @@ -96,6 +96,15 @@ $items['farm/fd2-school/api'] = array( 'access arguments' => array('view fd2 school'), 'weight' => 510, ); + +$items['farm/fd2-school/api2'] = array( + 'title' => 'API2', + 'type' => MENU_LOCAL_TASK, + 'page callback' => 'fd2_school_view', + 'page arguments' => array('api2'), + 'access arguments' => array('view fd2 school'), + 'weight' => 610, + ); return $items; }; diff --git a/farmdata2/farmdata2_modules/fd2_school/first.spec.js b/farmdata2/farmdata2_modules/fd2_school/first.spec.js new file mode 100644 index 00000000..349e3f8f --- /dev/null +++ b/farmdata2/farmdata2_modules/fd2_school/first.spec.js @@ -0,0 +1,17 @@ +describe('My First Test', () => { + it('Gets, types and asserts', () => { + cy.visit('https://example.cypress.io') + + cy.contains('type').click() + + // Should be on a new URL which + // includes '/commands/actions' + cy.url().should('include', '/commands/actions') + + // Get an input, type into it + cy.get('.action-email').type('fake@email.com') + + // Verify that the value has been updated + cy.get('.action-email').should('have.value', 'fake@email.com') + }) +}) From 34dcc4369f6c25fd2d776b892b65a4d7add7026c Mon Sep 17 00:00:00 2001 From: ngpmnam Date: Tue, 22 Oct 2024 22:46:39 -0400 Subject: [PATCH 35/48] Added e2e sub-tab --- .../farmdata2_modules/fd2_school/e2e/e2e.html | 186 ++++++++++++++++++ 1 file changed, 186 insertions(+) create mode 100644 farmdata2/farmdata2_modules/fd2_school/e2e/e2e.html diff --git a/farmdata2/farmdata2_modules/fd2_school/e2e/e2e.html b/farmdata2/farmdata2_modules/fd2_school/e2e/e2e.html new file mode 100644 index 00000000..87fdc525 --- /dev/null +++ b/farmdata2/farmdata2_modules/fd2_school/e2e/e2e.html @@ -0,0 +1,186 @@ + + +

    Harvest Report

    +

    This page is a mockup of a simplified harvest report.

    + + +
    +
    + + +
    +
    + +
    + + + + +
    + + + + + + + + +
    + + +
    +
    + +
    + +
    + +
    +

    {{ header ? header : "Mock Harvest Report" }}

    +
    + + + + +

    Details

    +
      +
    • Farm:{{farm}}
    • +
    • User:{{user}}
    • +
    • Language:{{language}}
    • +
      +
    • Start:{{start}}
    • +
    • End:{{end}}
    • +
    • Crop:{{crop}}
    • +
    + +
    Row Date Area Units
    {{index + 1}} {{log.date}} {{log.area}}Units
    {{index + 1}} {{log.date}} {{log.area}}
    + + + + + + + + + + + + + + + + + +
    RowDateAreaCropYieldUnits
    {{index + 1}}{{log.date}}{{log.area}}{{log.cr}}{{log.yield}}{{log.units}}
    +

    No report to display

    + + + + + + From c92f31f1b52652531eec8d074dcc7c68da9fbdb8 Mon Sep 17 00:00:00 2001 From: ngpmnam Date: Tue, 22 Oct 2024 23:13:40 -0400 Subject: [PATCH 36/48] Cypress test default start and end dates --- .../fd2_school/e2e/e2e.defaults.spec.js | 17 +++++++++++++++++ .../farmdata2_modules/fd2_school/e2e/e2e.html | 8 ++++---- .../fd2_school/fd2_school.module | 9 +++++++++ 3 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 farmdata2/farmdata2_modules/fd2_school/e2e/e2e.defaults.spec.js diff --git a/farmdata2/farmdata2_modules/fd2_school/e2e/e2e.defaults.spec.js b/farmdata2/farmdata2_modules/fd2_school/e2e/e2e.defaults.spec.js new file mode 100644 index 00000000..d57a0bfa --- /dev/null +++ b/farmdata2/farmdata2_modules/fd2_school/e2e/e2e.defaults.spec.js @@ -0,0 +1,17 @@ +describe("Test the harvest report default values", () => { + beforeEach(() => { + cy.login("manager1", "farmdata2") + cy.visit("/farm/fd2-school/e2e") + }) + + it("Check the page header", () => { + cy.get("[data-cy=page-header]").should("have.text","Harvest Report") + }) + + it("Check the default start and end dates", () => { + cy.get('[data-cy = start-date]').should('have.value', '2020-05-05') + cy.get('[data-cy = end-date]').should('have.value', '2020-05-15') + }) + + +}) diff --git a/farmdata2/farmdata2_modules/fd2_school/e2e/e2e.html b/farmdata2/farmdata2_modules/fd2_school/e2e/e2e.html index 87fdc525..e90ddd17 100644 --- a/farmdata2/farmdata2_modules/fd2_school/e2e/e2e.html +++ b/farmdata2/farmdata2_modules/fd2_school/e2e/e2e.html @@ -1,6 +1,6 @@ -

    Harvest Report

    +

    Harvest Report

    This page is a mockup of a simplified harvest report.

    @@ -13,9 +13,9 @@

    Harvest Report

    - + - +
    @@ -103,7 +103,7 @@

    {{ header ? header : "Mock Harvest Report" }}

    data: { header: "My Sample Harvest Report", start: "2020-05-05", - end: "2021-02-02", + end: "2020-05-15", crop:'Kale', crops:[], farm: '', diff --git a/farmdata2/farmdata2_modules/fd2_school/fd2_school.module b/farmdata2/farmdata2_modules/fd2_school/fd2_school.module index 90b7b007..e0ec6dae 100644 --- a/farmdata2/farmdata2_modules/fd2_school/fd2_school.module +++ b/farmdata2/farmdata2_modules/fd2_school/fd2_school.module @@ -105,6 +105,15 @@ $items['farm/fd2-school/api2'] = array( 'access arguments' => array('view fd2 school'), 'weight' => 610, ); + +$items['farm/fd2-school/e2e'] = array( + 'title' => 'E2E', + 'type' => MENU_LOCAL_TASK, + 'page callback' => 'fd2_school_view', + 'page arguments' => array('e2e'), + 'access arguments' => array('view fd2 school'), + 'weight' => 620, + ); return $items; }; From e7f92c6eb29accfe2f3cab038919ef1c66cd41a7 Mon Sep 17 00:00:00 2001 From: ngpmnam Date: Tue, 22 Oct 2024 23:43:22 -0400 Subject: [PATCH 37/48] cypress tests for the crop drop down --- .../farmdata2_modules/fd2_school/e2e/e2e.defaults.spec.js | 8 +++++++- farmdata2/farmdata2_modules/fd2_school/e2e/e2e.html | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/e2e/e2e.defaults.spec.js b/farmdata2/farmdata2_modules/fd2_school/e2e/e2e.defaults.spec.js index d57a0bfa..a9d58d9b 100644 --- a/farmdata2/farmdata2_modules/fd2_school/e2e/e2e.defaults.spec.js +++ b/farmdata2/farmdata2_modules/fd2_school/e2e/e2e.defaults.spec.js @@ -13,5 +13,11 @@ describe("Test the harvest report default values", () => { cy.get('[data-cy = end-date]').should('have.value', '2020-05-15') }) - + it("Check the crop dropdown", () => { + cy.get('[data-cy = crop-drop-down]').children().eq(0).should('have.text', "ARUGULA") + cy.get('[data-cy = crop-drop-down]').children().eq(4).should('have.text', "BEAN-FAVA") + cy.get('[data-cy = crop-drop-down]').children().eq(110).should('have.text', "ZUCCHINI") + cy.get('[data-cy = crop-drop-down]').children().should('have.length', 111) + + }) }) diff --git a/farmdata2/farmdata2_modules/fd2_school/e2e/e2e.html b/farmdata2/farmdata2_modules/fd2_school/e2e/e2e.html index e90ddd17..31bc7dde 100644 --- a/farmdata2/farmdata2_modules/fd2_school/e2e/e2e.html +++ b/farmdata2/farmdata2_modules/fd2_school/e2e/e2e.html @@ -20,7 +20,7 @@

    Harvest Report

    - From 9f86e8c0bb0eb0ecfa53e91df25a0d2c8268725e Mon Sep 17 00:00:00 2001 From: ngpmnam Date: Wed, 23 Oct 2024 18:57:03 -0400 Subject: [PATCH 38/48] Added tests for actions with generate button --- .../cypress/e2e/1-getting-started/todo.cy.js | 143 +++++++++ .../e2e/2-advanced-examples/actions.cy.js | 299 ++++++++++++++++++ .../e2e/2-advanced-examples/aliasing.cy.js | 39 +++ .../e2e/2-advanced-examples/assertions.cy.js | 176 +++++++++++ .../e2e/2-advanced-examples/connectors.cy.js | 97 ++++++ .../e2e/2-advanced-examples/cookies.cy.js | 77 +++++ .../e2e/2-advanced-examples/cypress_api.cy.js | 182 +++++++++++ .../e2e/2-advanced-examples/files.cy.js | 87 +++++ .../e2e/2-advanced-examples/location.cy.js | 32 ++ .../e2e/2-advanced-examples/misc.cy.js | 104 ++++++ .../e2e/2-advanced-examples/navigation.cy.js | 56 ++++ .../network_requests.cy.js | 163 ++++++++++ .../e2e/2-advanced-examples/querying.cy.js | 114 +++++++ .../spies_stubs_clocks.cy.js | 203 ++++++++++++ .../e2e/2-advanced-examples/storage.cy.js | 110 +++++++ .../e2e/2-advanced-examples/traversal.cy.js | 121 +++++++ .../e2e/2-advanced-examples/utilities.cy.js | 108 +++++++ .../e2e/2-advanced-examples/viewport.cy.js | 59 ++++ .../e2e/2-advanced-examples/waiting.cy.js | 31 ++ .../e2e/2-advanced-examples/window.cy.js | 22 ++ .../fd2_school/e2e/e2e.actions.spec.js | 11 + .../farmdata2_modules/fd2_school/e2e/e2e.html | 6 +- 22 files changed, 2237 insertions(+), 3 deletions(-) create mode 100644 farmdata2/cypress/e2e/1-getting-started/todo.cy.js create mode 100644 farmdata2/cypress/e2e/2-advanced-examples/actions.cy.js create mode 100644 farmdata2/cypress/e2e/2-advanced-examples/aliasing.cy.js create mode 100644 farmdata2/cypress/e2e/2-advanced-examples/assertions.cy.js create mode 100644 farmdata2/cypress/e2e/2-advanced-examples/connectors.cy.js create mode 100644 farmdata2/cypress/e2e/2-advanced-examples/cookies.cy.js create mode 100644 farmdata2/cypress/e2e/2-advanced-examples/cypress_api.cy.js create mode 100644 farmdata2/cypress/e2e/2-advanced-examples/files.cy.js create mode 100644 farmdata2/cypress/e2e/2-advanced-examples/location.cy.js create mode 100644 farmdata2/cypress/e2e/2-advanced-examples/misc.cy.js create mode 100644 farmdata2/cypress/e2e/2-advanced-examples/navigation.cy.js create mode 100644 farmdata2/cypress/e2e/2-advanced-examples/network_requests.cy.js create mode 100644 farmdata2/cypress/e2e/2-advanced-examples/querying.cy.js create mode 100644 farmdata2/cypress/e2e/2-advanced-examples/spies_stubs_clocks.cy.js create mode 100644 farmdata2/cypress/e2e/2-advanced-examples/storage.cy.js create mode 100644 farmdata2/cypress/e2e/2-advanced-examples/traversal.cy.js create mode 100644 farmdata2/cypress/e2e/2-advanced-examples/utilities.cy.js create mode 100644 farmdata2/cypress/e2e/2-advanced-examples/viewport.cy.js create mode 100644 farmdata2/cypress/e2e/2-advanced-examples/waiting.cy.js create mode 100644 farmdata2/cypress/e2e/2-advanced-examples/window.cy.js create mode 100644 farmdata2/farmdata2_modules/fd2_school/e2e/e2e.actions.spec.js diff --git a/farmdata2/cypress/e2e/1-getting-started/todo.cy.js b/farmdata2/cypress/e2e/1-getting-started/todo.cy.js new file mode 100644 index 00000000..4768ff92 --- /dev/null +++ b/farmdata2/cypress/e2e/1-getting-started/todo.cy.js @@ -0,0 +1,143 @@ +/// + +// Welcome to Cypress! +// +// This spec file contains a variety of sample tests +// for a todo list app that are designed to demonstrate +// the power of writing tests in Cypress. +// +// To learn more about how Cypress works and +// what makes it such an awesome testing tool, +// please read our getting started guide: +// https://on.cypress.io/introduction-to-cypress + +describe('example to-do app', () => { + beforeEach(() => { + // Cypress starts out with a blank slate for each test + // so we must tell it to visit our website with the `cy.visit()` command. + // Since we want to visit the same URL at the start of all our tests, + // we include it in our beforeEach function so that it runs before each test + cy.visit('https://example.cypress.io/todo') + }) + + it('displays two todo items by default', () => { + // We use the `cy.get()` command to get all elements that match the selector. + // Then, we use `should` to assert that there are two matched items, + // which are the two default items. + cy.get('.todo-list li').should('have.length', 2) + + // We can go even further and check that the default todos each contain + // the correct text. We use the `first` and `last` functions + // to get just the first and last matched elements individually, + // and then perform an assertion with `should`. + cy.get('.todo-list li').first().should('have.text', 'Pay electric bill') + cy.get('.todo-list li').last().should('have.text', 'Walk the dog') + }) + + it('can add new todo items', () => { + // We'll store our item text in a variable so we can reuse it + const newItem = 'Feed the cat' + + // Let's get the input element and use the `type` command to + // input our new list item. After typing the content of our item, + // we need to type the enter key as well in order to submit the input. + // This input has a data-test attribute so we'll use that to select the + // element in accordance with best practices: + // https://on.cypress.io/selecting-elements + cy.get('[data-test=new-todo]').type(`${newItem}{enter}`) + + // Now that we've typed our new item, let's check that it actually was added to the list. + // Since it's the newest item, it should exist as the last element in the list. + // In addition, with the two default items, we should have a total of 3 elements in the list. + // Since assertions yield the element that was asserted on, + // we can chain both of these assertions together into a single statement. + cy.get('.todo-list li') + .should('have.length', 3) + .last() + .should('have.text', newItem) + }) + + it('can check off an item as completed', () => { + // In addition to using the `get` command to get an element by selector, + // we can also use the `contains` command to get an element by its contents. + // However, this will yield the
    +
    + +
    + + + + +
    + + + + + + + + +
    + + +
    +
    + +
    + +
    + +
    +

    {{ header ? header : "My Sample Harvest Report"}}

    +
    + + + + +

    Details

    +
      +
    • Farm:{{farm}}
    • +
    • User:{{user}}
    • +
    • Language:{{language}}
    • +
      +
    • Start:{{start}}
    • +
    • End:{{end}}
    • +
    • Crop:{{crop}}
    • +
    + + + + + + + + + + + + + + + + + + + +
    RowDateAreaCropYieldUnits
    {{index + 1}}{{log.date}}{{log.area}}{{log.cr}}{{log.yield}}{{log.units}}
    +

    No report to display

    + + + + + + From 48403fd00b0dbb645df1c3cd3f45c66d66856a71 Mon Sep 17 00:00:00 2001 From: ngpmnam Date: Wed, 30 Oct 2024 22:59:39 -0400 Subject: [PATCH 41/48] Changed crop drop down using DropDownWithAll Component --- .../farmdata2_modules/fd2_school/fd2/fd2.html | 332 ++++++++---------- 1 file changed, 154 insertions(+), 178 deletions(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/fd2/fd2.html b/farmdata2/farmdata2_modules/fd2_school/fd2/fd2.html index 649e5019..483bb19d 100644 --- a/farmdata2/farmdata2_modules/fd2_school/fd2/fd2.html +++ b/farmdata2/farmdata2_modules/fd2_school/fd2/fd2.html @@ -1,186 +1,162 @@ + + + -

    Harvest Report

    -

    This page is a mockup of a simplified harvest report.

    + + Harvest Report + + +

    Harvest Report

    +

    This page is a mockup of a simplified harvest report.

    -
    - - -
    -
    - -
    - - - - -
    - - - - - - - - -
    - - -
    -
    - +
    + +
    +
    + +
    + + + + +
    + + + + + + + +
    + +
    +
    + +
    + +
    + +
    +

    {{ header ? header : "My Sample Harvest Report" }}

    +
    + +

    Details

    +
      +
    • Farm: {{ farm }}
    • +
    • User: {{ user }}
    • +
    • Language: {{ language }}
    • +
      +
    • Start: {{ start }}
    • +
    • End: {{ end }}
    • +
    • Crop: {{ crop }}
    • +
    + + + + + + + + + + + + + + + + + + +
    RowDateAreaCropYieldUnits
    {{ index + 1 }}{{ log.date }}{{ log.area }}{{ log.cr }}{{ log.yield }}{{ log.units }}
    +

    No report to display

    -
    - -
    -

    {{ header ? header : "My Sample Harvest Report"}}

    -
    - - - - -

    Details

    -
      -
    • Farm:{{farm}}
    • -
    • User:{{user}}
    • -
    • Language:{{language}}
    • -
      -
    • Start:{{start}}
    • -
    • End:{{end}}
    • -
    • Crop:{{crop}}
    • -
    - - - - - - - - - - - - - - - - - - - -
    RowDateAreaCropYieldUnits
    {{index + 1}}{{log.date}}{{log.area}}{{log.cr}}{{log.yield}}{{log.units}}
    -

    No report to display

    - -
    - - - + + From 13b56d1b6d91cff09f1cab47f6d690f44fe327bb Mon Sep 17 00:00:00 2001 From: ngpmnam Date: Wed, 30 Oct 2024 23:07:01 -0400 Subject: [PATCH 42/48] Crop drop down now shows all rows for all the crops --- .../farmdata2_modules/fd2_school/fd2/fd2.html | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/farmdata2/farmdata2_modules/fd2_school/fd2/fd2.html b/farmdata2/farmdata2_modules/fd2_school/fd2/fd2.html index 483bb19d..6ce2cac5 100644 --- a/farmdata2/farmdata2_modules/fd2_school/fd2/fd2.html +++ b/farmdata2/farmdata2_modules/fd2_school/fd2/fd2.html @@ -126,6 +126,24 @@

    {{ header ? header : "My Sample Harvest Report" }} row.cr === this.crop); }, + harvestReportRows() { + let tableRows = [] + for(let log of this.allPagesArr) { + let tableRow = { + date: dayjs.unix(log.timestamp).format('MM/DD/YYYY'), + area: log.area[0].name, + yield: log.quantity[0].value, + units: log.quantity[0].unit.name, + cr: this.idToCropMap.get(log.data.crop_tid), + } + if(tableRow.cr == this.crop || this.crop == 'All') { + tableRows.push(tableRow) + } + + } + return tableRows + }, + }, methods: { onCropChange(newCrop) { From 2dbe928b9070337865be572ecce2dc568465bac0 Mon Sep 17 00:00:00 2001 From: ngpmnam Date: Wed, 30 Oct 2024 23:21:27 -0400 Subject: [PATCH 43/48] Changed link for cypress tests fd2 --- farmdata2/farmdata2_modules/fd2_school/fd2/fd2.actions.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/fd2/fd2.actions.spec.js b/farmdata2/farmdata2_modules/fd2_school/fd2/fd2.actions.spec.js index ae2a12a5..b046eec5 100644 --- a/farmdata2/farmdata2_modules/fd2_school/fd2/fd2.actions.spec.js +++ b/farmdata2/farmdata2_modules/fd2_school/fd2/fd2.actions.spec.js @@ -1,7 +1,7 @@ describe('Test actions can be performed', () => { beforeEach(() => { cy.login("manager1", "farmdata2") - cy.visit("/farm/fd2-school/e2e") + cy.visit("/farm/fd2-school/fd2") }) it('Check the Generate Report button', () => { //cy.get("[data-cy = report-header]").should("not.exist") From 75d2558d633cd74f1565c8ab52a12014927a3148 Mon Sep 17 00:00:00 2001 From: ngpmnam Date: Wed, 30 Oct 2024 23:49:31 -0400 Subject: [PATCH 44/48] Changed Cypress Test fd2.defaults.spec.js to fit fd2 sub-tab --- farmdata2/farmdata2_modules/fd2_school/e2e/e2e.html | 4 ++-- .../fd2_school/fd2/fd2.defaults.spec.js | 13 ++++++++----- .../farmdata2_modules/fd2_school/fd2_school.module | 9 +++++++++ 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/e2e/e2e.html b/farmdata2/farmdata2_modules/fd2_school/e2e/e2e.html index 571e79d2..649e5019 100644 --- a/farmdata2/farmdata2_modules/fd2_school/e2e/e2e.html +++ b/farmdata2/farmdata2_modules/fd2_school/e2e/e2e.html @@ -76,7 +76,7 @@

    {{ header ? header : "My Sample Harvest Report"}}{{log.units}} -

    No report to display

    +

    No report to display

    @@ -104,7 +104,7 @@

    {{ header ? header : "My Sample Harvest Report"}} { beforeEach(() => { cy.login("manager1", "farmdata2") - cy.visit("/farm/fd2-school/e2e") + cy.visit("/farm/fd2-school/fd2") }) it("Check the page header", () => { @@ -14,10 +14,13 @@ describe("Test the harvest report default values", () => { }) it("Check the crop dropdown", () => { - cy.get('[data-cy = crop-drop-down]').children().eq(0).should('have.text', "ARUGULA") - cy.get('[data-cy = crop-drop-down]').children().eq(4).should('have.text', "BEAN-FAVA") - cy.get('[data-cy = crop-drop-down]').children().eq(110).should('have.text', "ZUCCHINI") - cy.get('[data-cy = crop-drop-down]').children().should('have.length', 111) + cy.get("[data-cy=crop-drop-down] > [data-cy=dropdown-input] > [data-cy=option0]").should('have.text', "All") + + cy.get("[data-cy=crop-drop-down] > [data-cy=dropdown-input] > [data-cy=option1]").should('have.text', "ARUGULA") + + cy.get("[data-cy=crop-drop-down] > [data-cy=dropdown-input] > [data-cy=option5]").should('have.text', "BEAN-FAVA") + cy.get("[data-cy=crop-drop-down] > [data-cy=dropdown-input] > [data-cy=option111]").should('have.text', "ZUCCHINI") + cy.get("[data-cy=crop-drop-down] > [data-cy=dropdown-input]").children().should('have.length', 112) }) }) diff --git a/farmdata2/farmdata2_modules/fd2_school/fd2_school.module b/farmdata2/farmdata2_modules/fd2_school/fd2_school.module index e0ec6dae..56dd89c8 100644 --- a/farmdata2/farmdata2_modules/fd2_school/fd2_school.module +++ b/farmdata2/farmdata2_modules/fd2_school/fd2_school.module @@ -114,6 +114,15 @@ $items['farm/fd2-school/e2e'] = array( 'access arguments' => array('view fd2 school'), 'weight' => 620, ); + +$items['farm/fd2-school/fd2'] = array( + 'title' => 'FD2', + 'type' => MENU_LOCAL_TASK, + 'page callback' => 'fd2_school_view', + 'page arguments' => array('fd2'), + 'access arguments' => array('view fd2 school'), + 'weight' => 720, + ); return $items; }; From e104550196d46fed41a68850718278acf9339c53 Mon Sep 17 00:00:00 2001 From: ngpmnam Date: Thu, 31 Oct 2024 21:02:16 -0400 Subject: [PATCH 45/48] Added CustomTableComponent to replace HTML harvest table --- .../farmdata2_modules/fd2_school/fd2/fd2.html | 69 +++++++++++++------ 1 file changed, 49 insertions(+), 20 deletions(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/fd2/fd2.html b/farmdata2/farmdata2_modules/fd2_school/fd2/fd2.html index 6ce2cac5..e3675cf6 100644 --- a/farmdata2/farmdata2_modules/fd2_school/fd2/fd2.html +++ b/farmdata2/farmdata2_modules/fd2_school/fd2/fd2.html @@ -60,26 +60,20 @@

    {{ header ? header : "My Sample Harvest Report" }}End: {{ end }}
  • Crop: {{ crop }}
  • + - - - - - - - - - - - - - - - - - -
    RowDateAreaCropYieldUnits
    {{ index + 1 }}{{ log.date }}{{ log.area }}{{ log.cr }}{{ log.yield }}{{ log.units }}
    -

    No report to display

    +
    +

    No report to display

    + + +
    + +