From cb169c7ffca8654ca0b6f0f8725956ad6cab0bea Mon Sep 17 00:00:00 2001 From: Austin McGee <947888+amcgee@users.noreply.github.com> Date: Thu, 28 Nov 2019 17:08:34 +0100 Subject: [PATCH] refactor: port plugin and app to app-platform (#327) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * WIP: start porting plugin and app to app-platform * chore: remove punycode peerdep * chore: remove loglevel (for now) * feat: WIP pivot table type (#335) * chore: remove references to chart, use visualization instead Now that the visualization can be also a pivot table, we should not use chart when referring to the visualization. * feat: add pivot table as possible visualization type Make it the default one too (at least for now), since the AO does not have the "type" property yet, otherwise the default (previously COLUMN) would be used as type also for reportTable AOs. * feat: allow for loading of reportTable AOs Instead of always pass "chart" in the File Menu, change to "reportTable" when Pivot table is selected as visualization type. This does not always currently work due to FileMenu not refreshing the file list (it needs to be fixed in FileMenu component). The "apiObjectName" passed around is not computed from the visualization type, instead of just being set to "chart". * feat: load a different plugin for PIVOT_TABLE vis type (Currently the pivot plugin is a copy of the chart one). * chore: regenerate pot file * fix: fix failing tests * fix: typo in baseUrl reference * chore: squash merge master into epic branch commit a3dbb9fb20356b3aa303155de98e16795dcffaf6 Author: Jan Henrik Øverland Date: Mon Nov 11 14:46:30 2019 +0100 feat: use layout rules for add-to-layout ui (#362) * feat: generate add to layout button/menu based on rules * feat: refactor logic to use rules * upgrade @dhis2/analytics dep * tmp fix add to button tests * TODO fix tests * remove comment * replace local fn with analytics fn * todo: tmp commented out tests * remove folder commit d6ba4a3ca25004e0ef5c0d3e09e659cfa4dd95a4 Author: Jan Henrik Øverland Date: Mon Nov 11 14:09:50 2019 +0100 refactor: use dimension menu from @dhis2/analytics (#364) * refactor: Use DimensionMenu and rules logic from @dhis2/analytics for all occurrences of such duplicated menus * refactor: upgraded @dhis2/analytics to v2.5.1 commit 204fe7abc0b505ff0ff5a3de1368744cbecaf8f6 Author: Jan Henrik Overland Date: Tue Nov 5 14:02:06 2019 +0100 fix: use axisName instead of axisKey commit dd8b5635649f2f0f2506e1ea147c5ccfed98a745 Author: Martin Date: Tue Nov 5 11:22:22 2019 +0100 updated analytics repo (#363) commit 8c0ed1324275082b7c171104196524f236bf5696 Author: Martin Date: Tue Nov 5 11:20:18 2019 +0100 fix: changed height to min-height for the axes area (#361) commit 74edb3cc15017d60ce22497e213f1d5940ed3d21 Author: Viktor Varland Date: Thu Oct 24 19:39:35 2019 +0200 chore(deps): upgrade d2-i18n(-generate) deps (master) (#359) * chore(deps): upgrade d2-i18n(-generate) deps (master) * chore(deps): update i18n for packages commit 4bcb913a763066f0fe7541c5b2645c04ce471844 Author: @dhis2-bot Date: Thu Oct 24 12:22:35 2019 +0200 chore(translations): sync Russian translations from transifex (master) Automatically merged to resolve the avalance commit 2941ee9f5da3e304b0036bbeae0faefe3a677afe Author: @dhis2-bot Date: Wed Oct 23 15:02:24 2019 +0200 chore(translations): sync Arabic translations from transifex (master) Automatically merged to resolve the avalance commit 6067063d87390d709bd2052a074df80ab9692426 Author: @dhis2-bot Date: Wed Oct 23 15:02:21 2019 +0200 chore(translations): sync Danish translations from transifex (master) Automatically merged to resolve the avalance commit 5f8ec50d3221e39d717896aff921838e50fda7c6 Author: @dhis2-bot Date: Wed Oct 23 15:02:19 2019 +0200 chore(translations): sync Spanish translations from transifex (master) Automatically merged to resolve the avalance commit ee07b7b935a4f10f3e35152bf5d2b003cbb23104 Author: @dhis2-bot Date: Wed Oct 23 15:02:16 2019 +0200 chore(translations): sync PersianAfghanistan translations from transifex (master) Automatically merged to resolve the avalance commit 3e5ab95a55f064af138e2a2a542d488ea8aa3171 Author: @dhis2-bot Date: Wed Oct 23 15:02:14 2019 +0200 chore(translations): sync French translations from transifex (master) Automatically merged to resolve the avalance commit 754984ee04f11a34bd516ea2569e41b7e4e0c6b3 Author: @dhis2-bot Date: Wed Oct 23 15:02:11 2019 +0200 chore(translations): sync Indonesian translations from transifex (master) Automatically merged to resolve the avalance commit b0c23c85cbc884ac7ed78a30fe161c8a4dcefd65 Author: @dhis2-bot Date: Wed Oct 23 15:02:07 2019 +0200 chore(translations): sync Lao translations from transifex (master) Automatically merged to resolve the avalance commit e1531d052056654006f56696b6ca2435df9f3ec8 Author: @dhis2-bot Date: Wed Oct 23 15:02:01 2019 +0200 chore(translations): sync Burmese translations from transifex (master) Automatically merged to resolve the avalance commit 9af084b0d95b41866c6c2f5e3f69de3b748f2ca5 Author: @dhis2-bot Date: Wed Oct 23 15:01:58 2019 +0200 chore(translations): sync Pushto translations from transifex (master) Automatically merged to resolve the avalance commit 21f72cb6b60cb73e43d803ec923d549439d8204b Author: @dhis2-bot Date: Wed Oct 23 15:01:56 2019 +0200 chore(translations): sync Portuguese translations from transifex (master) Automatically merged to resolve the avalance commit e0d1207390e3389e551969f552adfb6c4898dcba Author: @dhis2-bot Date: Wed Oct 23 15:01:53 2019 +0200 chore(translations): sync PortugueseBrazil translations from transifex (master) Automatically merged to resolve the avalance commit a9c2acefafb34359c446b1aff1970031461d4996 Author: @dhis2-bot Date: Wed Oct 23 15:01:51 2019 +0200 chore(translations): sync Swedish translations from transifex (master) Automatically merged to resolve the avalance commit 8e8e4671c48a58c2157b2e5df1b6de4a36966b12 Author: @dhis2-bot Date: Wed Oct 23 15:01:49 2019 +0200 chore(translations): sync TetumTetun translations from transifex (master) Automatically merged to resolve the avalance commit cdce03bb116d242d0cbfb247c4bd0f8c47844902 Author: @dhis2-bot Date: Wed Oct 23 15:01:46 2019 +0200 chore(translations): sync Tajik translations from transifex (master) Automatically merged to resolve the avalance commit a63b9ecf5fc7159be052dc8c899447827f84c35b Author: @dhis2-bot Date: Wed Oct 23 15:01:44 2019 +0200 chore(translations): sync Ukrainian translations from transifex (master) Automatically merged to resolve the avalance commit c37f5a2b2dc7804a5216498d38185353da511409 Author: @dhis2-bot Date: Wed Oct 23 15:01:42 2019 +0200 chore(translations): sync Urdu translations from transifex (master) Automatically merged to resolve the avalance commit bbc8ebfb2d9c5e9d14ee5a7607c3b564a7e002b6 Author: @dhis2-bot Date: Wed Oct 23 15:01:39 2019 +0200 chore(translations): sync Vietnamese translations from transifex (master) Automatically merged to resolve the avalance commit 8c5b0c780ac35efb83ef5abc041a747bb5991460 Author: @dhis2-bot Date: Wed Oct 23 15:01:36 2019 +0200 chore(translations): sync Chinese translations from transifex (master) Automatically merged to resolve the avalance * chore: add icon for PT vis type (#369) * chore: squash merge master into epic branch commit 7fa8693832b2eb8ece02adce885170a5ecbc011e Author: @dhis2-bot Date: Tue Nov 19 09:31:29 2019 +0100 chore(translations): sync Arabic translations from transifex (master) Automatically merged to resolve the avalance commit c3c5753869c06d4de155f2aaab543428f5a87e77 Author: @dhis2-bot Date: Tue Nov 19 09:31:27 2019 +0100 chore(translations): sync Spanish translations from transifex (master) Automatically merged to resolve the avalance commit 84e30cfa98c4867599c5a7e58e76bd2b6eb1de60 Author: @dhis2-bot Date: Tue Nov 19 09:31:25 2019 +0100 chore(translations): sync PersianAfghanistan translations from transifex (master) Automatically merged to resolve the avalance commit 613e8186952d86ff056376014659cf89abb47dfa Author: @dhis2-bot Date: Tue Nov 19 09:31:22 2019 +0100 chore(translations): sync French translations from transifex (master) Automatically merged to resolve the avalance commit f0a73e761fa9516c0c73b0fa55e7762a44af4a2f Author: @dhis2-bot Date: Tue Nov 19 09:31:19 2019 +0100 chore(translations): sync Lao translations from transifex (master) Automatically merged to resolve the avalance commit a251cc024a22be13fdd31dc8e3e3b7fdb1c5b28b Author: @dhis2-bot Date: Tue Nov 19 09:31:16 2019 +0100 chore(translations): sync Burmese translations from transifex (master) Automatically merged to resolve the avalance commit a9d70ddf19104437787396d043d530aa20fe1d50 Author: @dhis2-bot Date: Tue Nov 19 09:31:13 2019 +0100 chore(translations): sync Pushto translations from transifex (master) Automatically merged to resolve the avalance commit bf94c6dc50079c726e6fc1599044e9c59555ebe0 Author: @dhis2-bot Date: Tue Nov 19 09:31:11 2019 +0100 chore(translations): sync Portuguese translations from transifex (master) Automatically merged to resolve the avalance commit 41c2f38954ed28aa1f03dfa60b7f63b027607b20 Author: @dhis2-bot Date: Tue Nov 19 09:31:09 2019 +0100 chore(translations): sync PortugueseBrazil translations from transifex (master) Automatically merged to resolve the avalance commit 782e55aa0368c629547b00ca346d94a95120ba82 Author: @dhis2-bot Date: Tue Nov 19 09:31:06 2019 +0100 chore(translations): sync Russian translations from transifex (master) Automatically merged to resolve the avalance commit c6d5f76d4224f6bdbe883b6e630ee439ed6a9c4f Author: @dhis2-bot Date: Tue Nov 19 09:31:03 2019 +0100 chore(translations): sync Swedish translations from transifex (master) Automatically merged to resolve the avalance commit 3ed9dcb25ca907c8bedcd1d9d50f16bd1bb2d746 Author: @dhis2-bot Date: Tue Nov 19 09:31:00 2019 +0100 chore(translations): sync TetumTetun translations from transifex (master) Automatically merged to resolve the avalance commit 6b76689fcb65ee2a0f1a7122e366a0a04381f3d5 Author: @dhis2-bot Date: Tue Nov 19 09:30:56 2019 +0100 chore(translations): sync Tajik translations from transifex (master) Automatically merged to resolve the avalance commit f95ef04b8f5992696330b41777178d71d36a32f0 Author: @dhis2-bot Date: Tue Nov 19 09:30:54 2019 +0100 chore(translations): sync Ukrainian translations from transifex (master) Automatically merged to resolve the avalance commit ecbf2686681893c53c896dabbebf854463ea61ab Author: @dhis2-bot Date: Tue Nov 19 09:30:51 2019 +0100 chore(translations): sync Vietnamese translations from transifex (master) Automatically merged to resolve the avalance commit e6c7fa6bfacfad2b510ff8d8ba77e90b15020680 Author: @dhis2-bot Date: Tue Nov 19 09:13:48 2019 +0100 chore(translations): sync Chinese translations from transifex (master) Automatically merged to resolve the avalance commit c96ac099af5854a1e8dd4c194a5c1c8be78b87cb Author: Martin Date: Fri Nov 15 14:11:55 2019 +0100 fix: changed incorrect prop types and tests (#372) * fix: changed incorrect prop types and tests * fix: upgraded to Analytics v2.6.2 commit 22c36e27bc963ea13b6cc2af9765806ff14b339f Author: Martin Date: Fri Nov 15 13:06:07 2019 +0100 fix: map is not vis type (#371) * fix: extracted map from vis type to a static item * fix: renamed chart to vis * refactor: removed legacy native type to use only vis type instead * fix: issue with 'selected' prop * fix: added missing comment from Analytics * fix: added prop types * fix: added more prop types * fix: removed unnecessary prop type commit 91847d22ebec27e5863a76f57cd8be1f72a7ded7 Author: Martin Date: Thu Nov 14 15:57:02 2019 +0100 Fix: Implement disallowed dims from Analytics UI rules (#370) * fix: using Analytics to calculate disallowed dimensions * fix: Analytics v2.6.0 commit 26d12c61d35feb148c65cc67b4bb3250d35b3c79 Author: Martin Date: Thu Nov 14 11:30:20 2019 +0100 fix: use shared vis types (#368) * use vis types from analytics * upgrades to and depends on @dhis2/analytics to v2.5.2 * implemented layout rules for the "add to layout" button commit a3dbb9fb20356b3aa303155de98e16795dcffaf6 Author: Jan Henrik Øverland Date: Mon Nov 11 14:46:30 2019 +0100 feat: use layout rules for add-to-layout ui (#362) * feat: generate add to layout button/menu based on rules * feat: refactor logic to use rules * upgrade @dhis2/analytics dep * tmp fix add to button tests * TODO fix tests * remove comment * replace local fn with analytics fn * todo: tmp commented out tests * remove folder commit d6ba4a3ca25004e0ef5c0d3e09e659cfa4dd95a4 Author: Jan Henrik Øverland Date: Mon Nov 11 14:09:50 2019 +0100 refactor: use dimension menu from @dhis2/analytics (#364) * refactor: Use DimensionMenu and rules logic from @dhis2/analytics for all occurrences of such duplicated menus * refactor: upgraded @dhis2/analytics to v2.5.1 commit 204fe7abc0b505ff0ff5a3de1368744cbecaf8f6 Author: Jan Henrik Overland Date: Tue Nov 5 14:02:06 2019 +0100 fix: use axisName instead of axisKey commit dd8b5635649f2f0f2506e1ea147c5ccfed98a745 Author: Martin Date: Tue Nov 5 11:22:22 2019 +0100 updated analytics repo (#363) commit 8c0ed1324275082b7c171104196524f236bf5696 Author: Martin Date: Tue Nov 5 11:20:18 2019 +0100 fix: changed height to min-height for the axes area (#361) commit 74edb3cc15017d60ce22497e213f1d5940ed3d21 Author: Viktor Varland Date: Thu Oct 24 19:39:35 2019 +0200 chore(deps): upgrade d2-i18n(-generate) deps (master) (#359) * chore(deps): upgrade d2-i18n(-generate) deps (master) * chore(deps): update i18n for packages commit 4bcb913a763066f0fe7541c5b2645c04ce471844 Author: @dhis2-bot Date: Thu Oct 24 12:22:35 2019 +0200 chore(translations): sync Russian translations from transifex (master) Automatically merged to resolve the avalance commit 2941ee9f5da3e304b0036bbeae0faefe3a677afe Author: @dhis2-bot Date: Wed Oct 23 15:02:24 2019 +0200 chore(translations): sync Arabic translations from transifex (master) Automatically merged to resolve the avalance commit 6067063d87390d709bd2052a074df80ab9692426 Author: @dhis2-bot Date: Wed Oct 23 15:02:21 2019 +0200 chore(translations): sync Danish translations from transifex (master) Automatically merged to resolve the avalance commit 5f8ec50d3221e39d717896aff921838e50fda7c6 Author: @dhis2-bot Date: Wed Oct 23 15:02:19 2019 +0200 chore(translations): sync Spanish translations from transifex (master) Automatically merged to resolve the avalance commit ee07b7b935a4f10f3e35152bf5d2b003cbb23104 Author: @dhis2-bot Date: Wed Oct 23 15:02:16 2019 +0200 chore(translations): sync PersianAfghanistan translations from transifex (master) Automatically merged to resolve the avalance commit 3e5ab95a55f064af138e2a2a542d488ea8aa3171 Author: @dhis2-bot Date: Wed Oct 23 15:02:14 2019 +0200 chore(translations): sync French translations from transifex (master) Automatically merged to resolve the avalance commit 754984ee04f11a34bd516ea2569e41b7e4e0c6b3 Author: @dhis2-bot Date: Wed Oct 23 15:02:11 2019 +0200 chore(translations): sync Indonesian translations from transifex (master) Automatically merged to resolve the avalance commit b0c23c85cbc884ac7ed78a30fe161c8a4dcefd65 Author: @dhis2-bot Date: Wed Oct 23 15:02:07 2019 +0200 chore(translations): sync Lao translations from transifex (master) Automatically merged to resolve the avalance commit e1531d052056654006f56696b6ca2435df9f3ec8 Author: @dhis2-bot Date: Wed Oct 23 15:02:01 2019 +0200 chore(translations): sync Burmese translations from transifex (master) Automatically merged to resolve the avalance commit 9af084b0d95b41866c6c2f5e3f69de3b748f2ca5 Author: @dhis2-bot Date: Wed Oct 23 15:01:58 2019 +0200 chore(translations): sync Pushto translations from transifex (master) Automatically merged to resolve the avalance commit 21f72cb6b60cb73e43d803ec923d549439d8204b Author: @dhis2-bot Date: Wed Oct 23 15:01:56 2019 +0200 chore(translations): sync Portuguese translations from transifex (master) Automatically merged to resolve the avalance commit e0d1207390e3389e551969f552adfb6c4898dcba Author: @dhis2-bot Date: Wed Oct 23 15:01:53 2019 +0200 chore(translations): sync PortugueseBrazil translations from transifex (master) Automatically merged to resolve the avalance commit a9c2acefafb34359c446b1aff1970031461d4996 Author: @dhis2-bot Date: Wed Oct 23 15:01:51 2019 +0200 chore(translations): sync Swedish translations from transifex (master) Automatically merged to resolve the avalance commit 8e8e4671c48a58c2157b2e5df1b6de4a36966b12 Author: @dhis2-bot Date: Wed Oct 23 15:01:49 2019 +0200 chore(translations): sync TetumTetun translations from transifex (master) Automatically merged to resolve the avalance commit cdce03bb116d242d0cbfb247c4bd0f8c47844902 Author: @dhis2-bot Date: Wed Oct 23 15:01:46 2019 +0200 chore(translations): sync Tajik translations from transifex (master) Automatically merged to resolve the avalance commit a63b9ecf5fc7159be052dc8c899447827f84c35b Author: @dhis2-bot Date: Wed Oct 23 15:01:44 2019 +0200 chore(translations): sync Ukrainian translations from transifex (master) Automatically merged to resolve the avalance commit c37f5a2b2dc7804a5216498d38185353da511409 Author: @dhis2-bot Date: Wed Oct 23 15:01:42 2019 +0200 chore(translations): sync Urdu translations from transifex (master) Automatically merged to resolve the avalance commit bbc8ebfb2d9c5e9d14ee5a7607c3b564a7e002b6 Author: @dhis2-bot Date: Wed Oct 23 15:01:39 2019 +0200 chore(translations): sync Vietnamese translations from transifex (master) Automatically merged to resolve the avalance commit 8c5b0c780ac35efb83ef5abc041a747bb5991460 Author: @dhis2-bot Date: Wed Oct 23 15:01:36 2019 +0200 chore(translations): sync Chinese translations from transifex (master) Automatically merged to resolve the avalance * fix: solve problems after merge * chore: update @dhis2/analytics for PT support * chore: squash merge master into epic branch commit 26a95e8fe73bdc20c45bd22394069214f723c9fa Author: Martin Date: Thu Nov 21 10:25:25 2019 +0100 fix: added icons to tooltip for warning and locked (#447) * added icons for warning and locked to dimension tooltip commit 445f1d840d3d5f8e7764869eb29c27a237ad30c7 Author: Martin Date: Thu Nov 21 10:13:48 2019 +0100 fix: rules dim handling (#446) * fix: passing dimension id instead of whole dimension object * fix: updated imports to follow latest Analytics signature * fix: Updated Analytics dep to v2.6.9 commit b75967a8fb5bd056ad6ebc0983ef422f6eefdcc3 Author: Jan Henrik Øverland Date: Thu Nov 21 08:14:04 2019 +0100 fix: rename axis name constants (#445) * fix: rename axis name to axis id * fix: rename axis display name to axis name * fix: Updated Analytics dep to v2.6.8 commit 883304f7b8e83570c2ba7cfa97129c85d39fe835 Author: Jan Henrik Øverland Date: Wed Nov 20 16:52:43 2019 +0100 fix: use locked dimensions rule from analytics (#444) * fix: use locked dimensions rule from Analytics in chip * fix: show locked in tooltip * fix: use axis constants * fix: Updated Analytics dep to v2.6.6 commit ded0ee9836c98bdb7565c909a57aa0faa1d63c28 Author: Martin Date: Wed Nov 20 10:09:54 2019 +0100 fix: use max items rule (#373) * feat: use max items rule * fix: use layout rules in DialogManager * fix: use rules logic for single value items * fix: Updated Analytics dep to v2.6.5 commit 7fa8693832b2eb8ece02adce885170a5ecbc011e Author: @dhis2-bot Date: Tue Nov 19 09:31:29 2019 +0100 chore(translations): sync Arabic translations from transifex (master) Automatically merged to resolve the avalance commit c3c5753869c06d4de155f2aaab543428f5a87e77 Author: @dhis2-bot Date: Tue Nov 19 09:31:27 2019 +0100 chore(translations): sync Spanish translations from transifex (master) Automatically merged to resolve the avalance commit 84e30cfa98c4867599c5a7e58e76bd2b6eb1de60 Author: @dhis2-bot Date: Tue Nov 19 09:31:25 2019 +0100 chore(translations): sync PersianAfghanistan translations from transifex (master) Automatically merged to resolve the avalance commit 613e8186952d86ff056376014659cf89abb47dfa Author: @dhis2-bot Date: Tue Nov 19 09:31:22 2019 +0100 chore(translations): sync French translations from transifex (master) Automatically merged to resolve the avalance commit f0a73e761fa9516c0c73b0fa55e7762a44af4a2f Author: @dhis2-bot Date: Tue Nov 19 09:31:19 2019 +0100 chore(translations): sync Lao translations from transifex (master) Automatically merged to resolve the avalance commit a251cc024a22be13fdd31dc8e3e3b7fdb1c5b28b Author: @dhis2-bot Date: Tue Nov 19 09:31:16 2019 +0100 chore(translations): sync Burmese translations from transifex (master) Automatically merged to resolve the avalance commit a9d70ddf19104437787396d043d530aa20fe1d50 Author: @dhis2-bot Date: Tue Nov 19 09:31:13 2019 +0100 chore(translations): sync Pushto translations from transifex (master) Automatically merged to resolve the avalance commit bf94c6dc50079c726e6fc1599044e9c59555ebe0 Author: @dhis2-bot Date: Tue Nov 19 09:31:11 2019 +0100 chore(translations): sync Portuguese translations from transifex (master) Automatically merged to resolve the avalance commit 41c2f38954ed28aa1f03dfa60b7f63b027607b20 Author: @dhis2-bot Date: Tue Nov 19 09:31:09 2019 +0100 chore(translations): sync PortugueseBrazil translations from transifex (master) Automatically merged to resolve the avalance commit 782e55aa0368c629547b00ca346d94a95120ba82 Author: @dhis2-bot Date: Tue Nov 19 09:31:06 2019 +0100 chore(translations): sync Russian translations from transifex (master) Automatically merged to resolve the avalance commit c6d5f76d4224f6bdbe883b6e630ee439ed6a9c4f Author: @dhis2-bot Date: Tue Nov 19 09:31:03 2019 +0100 chore(translations): sync Swedish translations from transifex (master) Automatically merged to resolve the avalance commit 3ed9dcb25ca907c8bedcd1d9d50f16bd1bb2d746 Author: @dhis2-bot Date: Tue Nov 19 09:31:00 2019 +0100 chore(translations): sync TetumTetun translations from transifex (master) Automatically merged to resolve the avalance commit 6b76689fcb65ee2a0f1a7122e366a0a04381f3d5 Author: @dhis2-bot Date: Tue Nov 19 09:30:56 2019 +0100 chore(translations): sync Tajik translations from transifex (master) Automatically merged to resolve the avalance commit f95ef04b8f5992696330b41777178d71d36a32f0 Author: @dhis2-bot Date: Tue Nov 19 09:30:54 2019 +0100 chore(translations): sync Ukrainian translations from transifex (master) Automatically merged to resolve the avalance commit ecbf2686681893c53c896dabbebf854463ea61ab Author: @dhis2-bot Date: Tue Nov 19 09:30:51 2019 +0100 chore(translations): sync Vietnamese translations from transifex (master) Automatically merged to resolve the avalance commit e6c7fa6bfacfad2b510ff8d8ba77e90b15020680 Author: @dhis2-bot Date: Tue Nov 19 09:13:48 2019 +0100 chore(translations): sync Chinese translations from transifex (master) Automatically merged to resolve the avalance commit c96ac099af5854a1e8dd4c194a5c1c8be78b87cb Author: Martin Date: Fri Nov 15 14:11:55 2019 +0100 fix: changed incorrect prop types and tests (#372) * fix: changed incorrect prop types and tests * fix: upgraded to Analytics v2.6.2 commit 22c36e27bc963ea13b6cc2af9765806ff14b339f Author: Martin Date: Fri Nov 15 13:06:07 2019 +0100 fix: map is not vis type (#371) * fix: extracted map from vis type to a static item * fix: renamed chart to vis * refactor: removed legacy native type to use only vis type instead * fix: issue with 'selected' prop * fix: added missing comment from Analytics * fix: added prop types * fix: added more prop types * fix: removed unnecessary prop type commit 91847d22ebec27e5863a76f57cd8be1f72a7ded7 Author: Martin Date: Thu Nov 14 15:57:02 2019 +0100 Fix: Implement disallowed dims from Analytics UI rules (#370) * fix: using Analytics to calculate disallowed dimensions * fix: Analytics v2.6.0 commit 26d12c61d35feb148c65cc67b4bb3250d35b3c79 Author: Martin Date: Thu Nov 14 11:30:20 2019 +0100 fix: use shared vis types (#368) * use vis types from analytics * upgrades to and depends on @dhis2/analytics to v2.5.2 * implemented layout rules for the "add to layout" button commit a3dbb9fb20356b3aa303155de98e16795dcffaf6 Author: Jan Henrik Øverland Date: Mon Nov 11 14:46:30 2019 +0100 feat: use layout rules for add-to-layout ui (#362) * feat: generate add to layout button/menu based on rules * feat: refactor logic to use rules * upgrade @dhis2/analytics dep * tmp fix add to button tests * TODO fix tests * remove comment * replace local fn with analytics fn * todo: tmp commented out tests * remove folder commit d6ba4a3ca25004e0ef5c0d3e09e659cfa4dd95a4 Author: Jan Henrik Øverland Date: Mon Nov 11 14:09:50 2019 +0100 refactor: use dimension menu from @dhis2/analytics (#364) * refactor: Use DimensionMenu and rules logic from @dhis2/analytics for all occurrences of such duplicated menus * refactor: upgraded @dhis2/analytics to v2.5.1 commit 204fe7abc0b505ff0ff5a3de1368744cbecaf8f6 Author: Jan Henrik Overland Date: Tue Nov 5 14:02:06 2019 +0100 fix: use axisName instead of axisKey commit dd8b5635649f2f0f2506e1ea147c5ccfed98a745 Author: Martin Date: Tue Nov 5 11:22:22 2019 +0100 updated analytics repo (#363) commit 8c0ed1324275082b7c171104196524f236bf5696 Author: Martin Date: Tue Nov 5 11:20:18 2019 +0100 fix: changed height to min-height for the axes area (#361) commit 74edb3cc15017d60ce22497e213f1d5940ed3d21 Author: Viktor Varland Date: Thu Oct 24 19:39:35 2019 +0200 chore(deps): upgrade d2-i18n(-generate) deps (master) (#359) * chore(deps): upgrade d2-i18n(-generate) deps (master) * chore(deps): update i18n for packages commit 4bcb913a763066f0fe7541c5b2645c04ce471844 Author: @dhis2-bot Date: Thu Oct 24 12:22:35 2019 +0200 chore(translations): sync Russian translations from transifex (master) Automatically merged to resolve the avalance commit 2941ee9f5da3e304b0036bbeae0faefe3a677afe Author: @dhis2-bot Date: Wed Oct 23 15:02:24 2019 +0200 chore(translations): sync Arabic translations from transifex (master) Automatically merged to resolve the avalance commit 6067063d87390d709bd2052a074df80ab9692426 Author: @dhis2-bot Date: Wed Oct 23 15:02:21 2019 +0200 chore(translations): sync Danish translations from transifex (master) Automatically merged to resolve the avalance commit 5f8ec50d3221e39d717896aff921838e50fda7c6 Author: @dhis2-bot Date: Wed Oct 23 15:02:19 2019 +0200 chore(translations): sync Spanish translations from transifex (master) Automatically merged to resolve the avalance commit ee07b7b935a4f10f3e35152bf5d2b003cbb23104 Author: @dhis2-bot Date: Wed Oct 23 15:02:16 2019 +0200 chore(translations): sync PersianAfghanistan translations from transifex (master) Automatically merged to resolve the avalance commit 3e5ab95a55f064af138e2a2a542d488ea8aa3171 Author: @dhis2-bot Date: Wed Oct 23 15:02:14 2019 +0200 chore(translations): sync French translations from transifex (master) Automatically merged to resolve the avalance commit 754984ee04f11a34bd516ea2569e41b7e4e0c6b3 Author: @dhis2-bot Date: Wed Oct 23 15:02:11 2019 +0200 chore(translations): sync Indonesian translations from transifex (master) Automatically merged to resolve the avalance commit b0c23c85cbc884ac7ed78a30fe161c8a4dcefd65 Author: @dhis2-bot Date: Wed Oct 23 15:02:07 2019 +0200 chore(translations): sync Lao translations from transifex (master) Automatically merged to resolve the avalance commit e1531d052056654006f56696b6ca2435df9f3ec8 Author: @dhis2-bot Date: Wed Oct 23 15:02:01 2019 +0200 chore(translations): sync Burmese translations from transifex (master) Automatically merged to resolve the avalance commit 9af084b0d95b41866c6c2f5e3f69de3b748f2ca5 Author: @dhis2-bot Date: Wed Oct 23 15:01:58 2019 +0200 chore(translations): sync Pushto translations from transifex (master) Automatically merged to resolve the avalance commit 21f72cb6b60cb73e43d803ec923d549439d8204b Author: @dhis2-bot Date: Wed Oct 23 15:01:56 2019 +0200 chore(translations): sync Portuguese translations from transifex (master) Automatically merged to resolve the avalance commit e0d1207390e3389e551969f552adfb6c4898dcba Author: @dhis2-bot Date: Wed Oct 23 15:01:53 2019 +0200 chore(translations): sync PortugueseBrazil translations from transifex (master) Automatically merged to resolve the avalance commit a9c2acefafb34359c446b1aff1970031461d4996 Author: @dhis2-bot Date: Wed Oct 23 15:01:51 2019 +0200 chore(translations): sync Swedish translations from transifex (master) Automatically merged to resolve the avalance commit 8e8e4671c48a58c2157b2e5df1b6de4a36966b12 Author: @dhis2-bot Date: Wed Oct 23 15:01:49 2019 +0200 chore(translations): sync TetumTetun translations from transifex (master) Automatically merged to resolve the avalance commit cdce03bb116d242d0cbfb247c4bd0f8c47844902 Author: @dhis2-bot Date: Wed Oct 23 15:01:46 2019 +0200 chore(translations): sync Tajik translations from transifex (master) Automatically merged to resolve the avalance commit a63b9ecf5fc7159be052dc8c899447827f84c35b Author: @dhis2-bot Date: Wed Oct 23 15:01:44 2019 +0200 chore(translations): sync Ukrainian translations from transifex (master) Automatically merged to resolve the avalance commit c37f5a2b2dc7804a5216498d38185353da511409 Author: @dhis2-bot Date: Wed Oct 23 15:01:42 2019 +0200 chore(translations): sync Urdu translations from transifex (master) Automatically merged to resolve the avalance commit bbc8ebfb2d9c5e9d14ee5a7607c3b564a7e002b6 Author: @dhis2-bot Date: Wed Oct 23 15:01:39 2019 +0200 chore(translations): sync Vietnamese translations from transifex (master) Automatically merged to resolve the avalance commit 8c5b0c780ac35efb83ef5abc041a747bb5991460 Author: @dhis2-bot Date: Wed Oct 23 15:01:36 2019 +0200 chore(translations): sync Chinese translations from transifex (master) Automatically merged to resolve the avalance * chore: fix some things * chore: set ENV and use beta app-scripts * chore: fix jest and cypress configs * chore: re-add semicolon * chore: re-add image import * chore: clean up some things * chore: add latest cli-style * chore: update netlify.toml * chore: clean up more files, move enzyme to workspace root * ci: run tests on travis * chore: remove unused jest transform pattern * chore: update deploy-build to work with platform app * chore: use plain yarn workspaces instead of lerna, remove unused root dependencies * docs: update start script instructions * docs: update cypress instructions * chore: upgrade to released app-platform * fix: change bad module reference, load schemas on startup --- .babelrc | 17 - .dependabot/config.yml | 16 + .eslintrc.js | 12 + .eslintrc.json | 7 - .github/semantic.yml | 4 + .gitignore | 4 + .huskyrc.js | 13 + .prettierrc | 5 - .prettierrc.js | 5 + .travis.yml | 31 +- LICENSE | 2 +- README.md | 62 +- __mocks__/styleMock.js | 1 - config/jest/cssTransform.js | 14 - config/jest/fileTransform.js | 12 - config/polyfills.js | 22 - config/shim.js | 9 - jest.config.js | 32 - netlify.toml | 18 +- package.json | 39 +- packages/app/.env | 2 + packages/app/README.md | 38 +- packages/app/config/env.js | 93 - packages/app/config/paths.js | 55 - packages/app/config/webpack.config.dev.js | 306 - packages/app/config/webpack.config.prod.js | 380 - .../app/config/webpackDevServer.config.js | 95 - packages/app/cypress.json | 5 +- .../fixtures/.gitkeep} | 0 .../app/cypress/integration/smoke.spec.js | 2 +- packages/app/cypress/support/commands.js | 7 + packages/app/d2.config.js | 10 + packages/app/i18n/en.pot | 5 +- packages/app/i18n/ru.po | 6 + packages/app/package.json | 129 +- packages/app/public/index.html | 38 - packages/app/scripts/build.js | 136 - packages/app/scripts/start.js | 111 - packages/app/scripts/test.js | 24 - packages/app/src/AppWrapper.js | 30 + packages/app/src/D2Shim.js | 59 + packages/app/src/components/App.js | 77 +- .../Dialogs/__tests__/DialogManager.spec.js | 6 +- packages/app/src/components/Layout/Chip.js | 28 +- packages/app/src/components/Layout/Tooltip.js | 4 +- .../components/Visualization/BlankCanvas.js | 4 +- packages/app/src/index.js | 79 - packages/plugin/d2.config.js | 9 + packages/plugin/i18n/en.pot | 12 + packages/plugin/package.json | 33 +- packages/plugin/src/index.js | 3 +- packages/plugin/src/modules/chartTypes.js | 7 + yarn.lock | 11764 ++++++---------- 53 files changed, 4676 insertions(+), 9206 deletions(-) delete mode 100644 .babelrc create mode 100644 .dependabot/config.yml create mode 100644 .eslintrc.js delete mode 100644 .eslintrc.json create mode 100644 .github/semantic.yml create mode 100644 .huskyrc.js delete mode 100644 .prettierrc create mode 100644 .prettierrc.js delete mode 100644 __mocks__/styleMock.js delete mode 100644 config/jest/cssTransform.js delete mode 100644 config/jest/fileTransform.js delete mode 100644 config/polyfills.js delete mode 100644 config/shim.js delete mode 100644 jest.config.js create mode 100644 packages/app/.env delete mode 100644 packages/app/config/env.js delete mode 100644 packages/app/config/paths.js delete mode 100644 packages/app/config/webpack.config.dev.js delete mode 100644 packages/app/config/webpack.config.prod.js delete mode 100644 packages/app/config/webpackDevServer.config.js rename packages/app/{public/i18n/i18n_module_en.properties => cypress/fixtures/.gitkeep} (100%) create mode 100644 packages/app/d2.config.js delete mode 100644 packages/app/public/index.html delete mode 100644 packages/app/scripts/build.js delete mode 100644 packages/app/scripts/start.js delete mode 100644 packages/app/scripts/test.js create mode 100644 packages/app/src/AppWrapper.js create mode 100644 packages/app/src/D2Shim.js delete mode 100644 packages/app/src/index.js create mode 100644 packages/plugin/d2.config.js create mode 100644 packages/plugin/i18n/en.pot diff --git a/.babelrc b/.babelrc deleted file mode 100644 index abf11411e7..0000000000 --- a/.babelrc +++ /dev/null @@ -1,17 +0,0 @@ -{ - "presets": [ - [ - "env", - { - "modules": false - } - ], - "react", - "stage-0" - ], - "env": { - "test": { - "plugins": ["transform-es2015-modules-commonjs"] - } - } -} diff --git a/.dependabot/config.yml b/.dependabot/config.yml new file mode 100644 index 0000000000..263e8e76ea --- /dev/null +++ b/.dependabot/config.yml @@ -0,0 +1,16 @@ +version: 1 + +update_configs: + - package_manager: 'javascript' + directory: '/' + update_schedule: 'daily' + version_requirement_updates: 'increase_versions' + target_branch: 'master' + automerged_updates: + - match: + dependency_name: '@dhis2/*' + dependency_type: 'all' + update_type: 'semver:minor' + - match: + dependency_type: 'all' + update_type: 'security:patch' diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000000..0b67e86c03 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,12 @@ +const { config } = require('@dhis2/cli-style') + +module.exports = { + extends: [config.eslintReact], + plugins: [ + "react-hooks" + ], + rules: { + "react-hooks/rules-of-hooks": "error", + "react-hooks/exhaustive-deps": "warn" + } +} diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 9bd18a5e3a..0000000000 --- a/.eslintrc.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": ["react-app", "prettier"], - "plugins": ["react", "prettier"], - "rules": { - "prettier/prettier": "error" - } -} diff --git a/.github/semantic.yml b/.github/semantic.yml new file mode 100644 index 0000000000..756b8b5aa7 --- /dev/null +++ b/.github/semantic.yml @@ -0,0 +1,4 @@ +titleOnly: true +commitsOnly: false +titleAndCommits: false +allowMergeCommits: false diff --git a/.gitignore b/.gitignore index 814e4246f1..ce06ee1947 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,7 @@ packages/app/i18n/en.pot #maven /target + +# DHIS2 Platform +packages/*/.d2 +packages/*/coverage \ No newline at end of file diff --git a/.huskyrc.js b/.huskyrc.js new file mode 100644 index 0000000000..91f8f9276d --- /dev/null +++ b/.huskyrc.js @@ -0,0 +1,13 @@ +const { config } = require('@dhis2/cli-style') + +const tasks = arr => arr.join(' && ') + +module.exports = { + hooks: { + ...config.husky.hooks, + 'pre-commit': tasks([ + // 'd2-style js check --staged', + // 'd2-style text check --staged', + ]), + }, +} diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index a6765aff59..0000000000 --- a/.prettierrc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "singleQuote": true, - "tabWidth": 4, - "trailingComma": "es5" -} diff --git a/.prettierrc.js b/.prettierrc.js new file mode 100644 index 0000000000..def7934e3d --- /dev/null +++ b/.prettierrc.js @@ -0,0 +1,5 @@ +const { config } = require('@dhis2/cli-style') + +module.exports = { + ...require(config.prettier), +} diff --git a/.travis.yml b/.travis.yml index 5961a04d40..a2f333fd55 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,23 +1,22 @@ language: node_js node_js: -- '8' + - '8' env: - global: - - CC_TEST_REPORTER_ID=2a6f417bdfe1cdc8e2ec8d3347728fc81e64752286079db5ab17fd65c964b946 - - secure: KQSX6TsA1fyPreY1GIxWW+XqNckxviIPVde5GDHkrrlfhR+pzTJQ2as3/j1QpTQ7LW3fESO3hfijueC4nKDyi0ZdNpd2+DDi19J0EVKDl2g5WfnAw8H82GE670P9ZPRREh0+SZ11sAf3Wlvs0RPItftSoYwyS8rwxGAaLWWiJoXObax6dpqw7IrKhK3yBf/ixdQKa+ZZ0pjt8KXkL9oPeqHf9Mx2Sh78OIEIcRlN+dznvEbF8QeVQ+8cM8e43N7jWkntsvnZ3TfuuiOf/tz/BQRxlKPkXG0eVDy6teISUrbe6e3faezEES64p/9ubHUALEEJi8ZfSJXL3m9nv48tHz1gSKhlp0/mfSHr58TFJLj1jgZ0SvE0hkVLdrCtbyhxq1cwYY7pXB9Qrd8JjtLPo2mT9sBOVDqjz1NUCyzO/Cl7f4wwR7OCYFD0q50+ARmfvTKWC+UzQHs0ahIeMzg5cGGBTm/kAawmcBQR+AZnsyOckM1enQTPKy60lWRZV2I7OrCrBspOJECUvH3edkPeAs1B/yfM1WduVWqykOXPwVN3Ww+dHdKAGfat3KNf5ZBEe7owO41m6J8fAqxkXXoxuiFH5id+/g0Yg+iumh7CAchpUefWdmyFDHamhcfoJfPAdKdgQ18psNFfFx+coF3R13Gx2tHUf8wwv6dIj+NT6vM= + global: + - CC_TEST_REPORTER_ID=2a6f417bdfe1cdc8e2ec8d3347728fc81e64752286079db5ab17fd65c964b946 + - secure: KQSX6TsA1fyPreY1GIxWW+XqNckxviIPVde5GDHkrrlfhR+pzTJQ2as3/j1QpTQ7LW3fESO3hfijueC4nKDyi0ZdNpd2+DDi19J0EVKDl2g5WfnAw8H82GE670P9ZPRREh0+SZ11sAf3Wlvs0RPItftSoYwyS8rwxGAaLWWiJoXObax6dpqw7IrKhK3yBf/ixdQKa+ZZ0pjt8KXkL9oPeqHf9Mx2Sh78OIEIcRlN+dznvEbF8QeVQ+8cM8e43N7jWkntsvnZ3TfuuiOf/tz/BQRxlKPkXG0eVDy6teISUrbe6e3faezEES64p/9ubHUALEEJi8ZfSJXL3m9nv48tHz1gSKhlp0/mfSHr58TFJLj1jgZ0SvE0hkVLdrCtbyhxq1cwYY7pXB9Qrd8JjtLPo2mT9sBOVDqjz1NUCyzO/Cl7f4wwR7OCYFD0q50+ARmfvTKWC+UzQHs0ahIeMzg5cGGBTm/kAawmcBQR+AZnsyOckM1enQTPKy60lWRZV2I7OrCrBspOJECUvH3edkPeAs1B/yfM1WduVWqykOXPwVN3Ww+dHdKAGfat3KNf5ZBEe7owO41m6J8fAqxkXXoxuiFH5id+/g0Yg+iumh7CAchpUefWdmyFDHamhcfoJfPAdKdgQ18psNFfFx+coF3R13Gx2tHUf8wwv6dIj+NT6vM= before_script: -- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 - > ./cc-test-reporter -- chmod +x ./cc-test-reporter -- "./cc-test-reporter before-build" -- npm install --global @dhis2/deploy-build + - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 + > ./cc-test-reporter + - chmod +x ./cc-test-reporter + - './cc-test-reporter before-build' script: -- npm run build + - npm run build && npm run test after_script: -- "./cc-test-reporter after-build -d --exit-code $TRAVIS_TEST_RESULT" + - './cc-test-reporter after-build -d --exit-code $TRAVIS_TEST_RESULT' deploy: -- provider: script - script: deploy-build - skip_cleanup: true - on: - all_branches: true + - provider: script + script: npx --package @dhis2/deploy-build deploy-build d2-ci build/app + skip_cleanup: true + on: + all_branches: true diff --git a/LICENSE b/LICENSE index 9e954ffa4a..34ecf9f739 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ BSD 3-Clause License -Copyright (c) 2004-2017, University of Oslo +Copyright (c) 2004-2019, University of Oslo All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/README.md b/README.md index 86025db4bf..21487103d0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Data visualizer app and plugin -This is a lerna repo that contains the data-visualizer-app. Eventually it will also contain the analytics plugins. +This is a yarn workspaces mono-repo that contains the data-visualizer-app. Eventually it will also contain the analytics plugins. ## Getting started @@ -14,29 +14,10 @@ $ yarn build ### Development -The data-visualizer-app package is the only "app" in the repo. You can start it in 2 different ways: - -From the repo root directory: - -``` -$ yarn start-app -``` - -Or from the package directory (packages/app): - -``` -$ cd packages/app -$ yarn start -``` +To build the plugin and start the app on `localhost:3000`, run `yarn start` from the repo root directory. The following npm scripts can all be run from the repo root directory and will execute on all packages -#### Lint - -``` -$ yarn lint -``` - #### Unit tests ``` @@ -51,10 +32,19 @@ $ yarn coverage #### Browser tests -We use Cypress for our browser tests. Currently the tests can only run against the dhis2 server localhost:8080. -There are plans to make this configurable. In order to run the tests, you need to define two environment variables: +We use Cypress for our browser tests. + +Before running cypress, start the development server in another terminal session. +Ensure that you specify the correct DHIS2_BASE_URL. + +```sh +> DHIS2_BASE_URL=http://localhost:8080 yarn start +``` + +There are plans to make this configurable. In order to run the tests, you need to define three environment variables: ``` +CYPRESS_LOGIN_URL=http://localhost:8080 # This must match DHIS2_BASE_URL CYPRESS_DHIS2_USERNAME=myusername CYPRESS_DHIS2_PASSWORD=mypassword ``` @@ -62,34 +52,35 @@ CYPRESS_DHIS2_PASSWORD=mypassword Run tests interactively: ``` -yarn cy:e2e:open +cd packages/app && yarn cy:e2e:open ``` Run tests in ci mode: ``` -yarn cy:e2e:run +cd packages/app && yarn cy:e2e:run ``` -#### Prettier and write changes +#### Linting and Formatting + +Automatically fix all fixable code-style violations (prettier and eslint) ``` -$ yarn prettier-write +$ yarn format ``` -Run prettier and just report failing files (useful for ci) +Check all files for code-style violations (prettier and eslint) ``` -$ yarn prettier-ci +$ yarn lint ``` -### Build the all packages +### Build all packages ``` $ yarn build ``` - #### Manual testing with Netlify This repo is configured to deploy all branches to netlify. This makes it simple to share a running implementation with others (e.g., tester, product manager, ux, fellow developers) prior @@ -98,19 +89,20 @@ to merging to master. All netlfiy deployments run against play.dhis2.org/dev, so in order to use them, you must configure CORS for your particular branch: 1. Copy the URL of the deployment you want to enable, i.e. `https://dhis2-data-visualizer.netlify.com` -2. Visit the play/dev [system settings -- access](https://play.dhis2.org/dev/dhis-web-settings/index.html#/access) page +2. Visit the [system settings -- access](https://play.dhis2.org/dev/dhis-web-settings/index.html#/access) page on the DHIS2 instance you want to test against (i.e. `https://debug.dhis2.org/dev`) 3. Add the copied URL on a new line the in CORS Whitelist textbox **NOTE**: do NOT include a trailing slash +4. Back on [netlify](`https://dhis2-data-visualizer.netlify.com`), enter the DHIS2 instance URL in the Server input of the login dialog The master branch is always available at: -```https://dhis2-data-visualizer.netlify.com``` +`https://dhis2-data-visualizer.netlify.com` Branches are available at (replace `/` and other special characters in `{branchname}` with `-`): -```https://{branchname}--dhis2-data-visualizer.netlify.com``` +`https://{branchname}--dhis2-data-visualizer.netlify.com` Pull requests (I.E. #209) are available at: -```https://deploy-preview-209--dhis2-data-visualizer.netlify.com``` +`https://deploy-preview-209--dhis2-data-visualizer.netlify.com` Netlify will also add a status check to each PR which links directly to the PR deployment. diff --git a/__mocks__/styleMock.js b/__mocks__/styleMock.js deleted file mode 100644 index f053ebf797..0000000000 --- a/__mocks__/styleMock.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = {}; diff --git a/config/jest/cssTransform.js b/config/jest/cssTransform.js deleted file mode 100644 index e70083e7b1..0000000000 --- a/config/jest/cssTransform.js +++ /dev/null @@ -1,14 +0,0 @@ -'use strict'; - -// This is a custom Jest transformer turning style imports into empty objects. -// http://facebook.github.io/jest/docs/en/webpack.html - -module.exports = { - process() { - return 'module.exports = {};'; - }, - getCacheKey() { - // The output is always the same. - return 'cssTransform'; - }, -}; diff --git a/config/jest/fileTransform.js b/config/jest/fileTransform.js deleted file mode 100644 index 1bfd52ffb0..0000000000 --- a/config/jest/fileTransform.js +++ /dev/null @@ -1,12 +0,0 @@ -'use strict'; - -const path = require('path'); - -// This is a custom Jest transformer turning file imports into filenames. -// http://facebook.github.io/jest/docs/en/webpack.html - -module.exports = { - process(src, filename) { - return `module.exports = ${JSON.stringify(path.basename(filename))};`; - }, -}; diff --git a/config/polyfills.js b/config/polyfills.js deleted file mode 100644 index 0f49830b54..0000000000 --- a/config/polyfills.js +++ /dev/null @@ -1,22 +0,0 @@ -'use strict'; - -if (typeof Promise === 'undefined') { - // Rejection tracking prevents a common issue where React gets into an - // inconsistent state due to an error, but it gets swallowed by a Promise, - // and the user has no idea what causes React's erratic future behavior. - require('promise/lib/rejection-tracking').enable(); - window.Promise = require('promise/lib/es6-extensions.js'); -} - -// fetch() polyfill for making API calls. -require('whatwg-fetch'); - -// Object.assign() is commonly used with React. -// It will use the native implementation if it's present and isn't buggy. -Object.assign = require('object-assign'); - -// In tests, polyfill requestAnimationFrame since jsdom doesn't provide it yet. -// We don't polyfill it in the browser--this is user's responsibility. -if (process.env.NODE_ENV === 'test') { - require('raf').polyfill(global); -} diff --git a/config/shim.js b/config/shim.js deleted file mode 100644 index 3af1176cc1..0000000000 --- a/config/shim.js +++ /dev/null @@ -1,9 +0,0 @@ -import 'babel-polyfill'; - -global.requestAnimationFrame = callback => { - setTimeout(callback, 0); -}; - -// needed for headerbar beta -global.DHIS_CONFIG = { baseUrl: 'http://localhost:8080' }; -global.manifest = {}; diff --git a/jest.config.js b/jest.config.js deleted file mode 100644 index 240bf013fa..0000000000 --- a/jest.config.js +++ /dev/null @@ -1,32 +0,0 @@ -module.exports = { - collectCoverageFrom: ['/packages/*/src/**/*.{js,jsx,mjs}'], - coverageDirectory: '/coverage', - setupFiles: ['/config/polyfills.js', '/config/shim.js'], - testMatch: [ - '/packages/*/src/**/__tests__/**/*.{js,jsx,mjs}', - '/packages/*/src/**/?(*.)(spec|test).{js,jsx,mjs}', - ], - testURL: 'http://localhost', - setupTestFrameworkScriptFile: '/config/testSetup.js', - testPathIgnorePatterns: [ - '/node_modules/', - '/packages/app/cypress/', - '/packages/*/build/', - '/packages/*/scripts/', - ], - verbose: false, - transform: { - '^.+\\.(js|jsx|mjs)$': '/node_modules/babel-jest', - '^.+\\.css$': '/config/jest/cssTransform.js', - '^(?!.*\\.(js|jsx|mjs|css|json)$)': - '/config/jest/fileTransform.js', - }, - transformIgnorePatterns: [ - 'node_modules/(?!(lodash-es|analytics-shared|@dhis2/d2-ui-[a-z-]+)/)', - ], - moduleFileExtensions: ['js', 'jsx'], - moduleDirectories: ['node_modules'], - moduleNameMapper: { - '\\.css$': '/__mocks__/styleMock.js', - }, -}; diff --git a/netlify.toml b/netlify.toml index b0f4c69281..ee5b511f36 100644 --- a/netlify.toml +++ b/netlify.toml @@ -4,21 +4,7 @@ # Directory to change to before starting a build. # This is where we will look for package.json/.nvmrc/etc. base = "" + publish = "packages/app/build/app" - # Directory (relative to root of your repo) that contains the deploy-ready - # HTML files and assets generated by the build. - publish = "packages/app/build" - - # Default build command. - # && yarn manifest --manifest.activities.dhis=\"https://play.dhis2.org/dev\"" - command = "echo BUILDING... && yarn build" - -[[redirects]] - from = "/*" - to = "https://play.dhis2.org/dev/:splat" - status = 200 - - [redirects.headers] - # Use request forwarding and basic authentication as admin:district for now - Authorization = "Basic YWRtaW46ZGlzdHJpY3Q=" + command = "echo BUILDING... && cd packages/plugin && yarn build && cd ../app && yarn build --standalone" diff --git a/package.json b/package.json index 737e05a66f..39a37f9cab 100644 --- a/package.json +++ b/package.json @@ -4,30 +4,25 @@ "private": true, "license": "BSD-3-Clause", "devDependencies": { - "@dhis2/d2-i18n-extract": "^1.0.6", - "@dhis2/d2-i18n-generate": "^1.1.1", - "babel-preset-env": "^1.6.1", - "babel-preset-stage-0": "^6.24.1", - "create-react-class": "^15.6.3", - "enzyme": "^3.5.0", - "enzyme-adapter-react-16": "^1.3.0", - "eslint-config-prettier": "^3.0.1", - "eslint-plugin-prettier": "^2.6.0", - "husky": "^1.1.2", - "jest-enzyme": "^6.0.0", - "lerna": "^3.1.4", - "prettier": "^1.11.1", - "react-stub-context": "^0.8.1" + "@dhis2/cli-style": "^5.0.2", + "enzyme": "^3.10.0", + "enzyme-adapter-react-16": "^1.15.1", + "eslint-plugin-react-hooks": "^2.3.0", + "jest-enzyme": "^7.1.2", + "loglevel": "^1.6.6" }, "scripts": { - "bootstrap": "lerna bootstrap", - "build": "lerna run build", - "lint": "lerna run lint", - "prettier-ci": "lerna run prettier-ci", - "prettier-write": "lerna run prettier-write", - "start-app": "lerna run --scope data-visualizer-app start", - "test": "jest", - "coverage": "lerna run test -- --coverage" + "build-plugin": "cd packages/plugin && yarn build", + "build-app": "cd packages/app && yarn build", + "build": "yarn build-plugin && yarn build-app", + "lint": "d2-style js check || d2-style text check", + "format": "d2-style js apply || d2-style text apply", + "start-app": "cd packages/app && yarn start", + "start": "yarn build-plugin && yarn start-app", + "test-plugin": "cd packages/plugin && yarn test", + "test-app": "cd packages/app && yarn test", + "test": "yarn test-plugin && yarn test-app", + "coverage": "yarn test-plugin --coverage && yarn test-app --coverage" }, "workspaces": [ "packages/*" diff --git a/packages/app/.env b/packages/app/.env new file mode 100644 index 0000000000..2653bc78e5 --- /dev/null +++ b/packages/app/.env @@ -0,0 +1,2 @@ +# TODO: Remove this, the platform should take care of it +SKIP_PREFLIGHT_CHECK=true diff --git a/packages/app/README.md b/packages/app/README.md index 28e0bfdfef..cf860e59eb 100644 --- a/packages/app/README.md +++ b/packages/app/README.md @@ -4,39 +4,21 @@ [![Test Coverage](https://codeclimate.com/github/dhis2/data-visualizer-app/badges/coverage.svg)](https://codeclimate.com/github/dhis2/data-visualizer-app/coverage) [![Code Climate](https://codeclimate.com/github/dhis2/data-visualizer-app/badges/gpa.svg)](https://codeclimate.com/github/dhis2/data-visualizer-app) -This package contains the as-yet unreleased data-visualizer-app - -It was bootstrapped with [Create React App](https://github.com/facebookincubator/create-react-app), and later ejected. +This package contains the data-visualizer-app ## Developer guide -### Prerequisites - -To use the data-visualizer-app in development mode, it is necessary to have a running DHIS2 instance, and be logged in to it. This is because the app requests resources, like react and react-dom, from the DHIS2 core resources. Most developers use their local DHIS2 instance. If you haven't configured your DHIS2_HOME env variable and set up a config.json, then the app will default to using localhost:8080 with the admin user (see -[config/webpack.config.dev.js](config/webpack.config.dev.js#L35)). - -### Starting the app in dev mode +**THIS IS A WORK-IN-PROGRESS PORT TO THE APPLICATION PLATFORM** +See [the platform documentation](https://platform.dhis2.nu) -Prior to starting the app, be sure to follow the startup instructions in the [root README.md](../../README.md#getting-started) file. After you have completed those steps then: - -``` -$ yarn start -``` +## Cypress -The webpack-dev-server will start up on localhost:3000, by default. +There are three required environment variables to run Cypress. Additionally, the application must be running in a separate process on `localhost:3000`: -### Available scripts +```sh +# In one terminal +> DHIS2_BASE_URL=https://debug.dhis2.org/dev yarn start -``` -$ yarn lint // lint files -$ yarn test // run tests in watch mode -$ yarn coverage // run tests and output coverage report -$ yarn prettier-ci // run prettier and list non-compliant files -$ yarn prettier-write // run prettier and fix -``` - -### Create a build of the app - -``` -$ yarn build +# In another terminal +> CYPRESS_LOGIN_URL=https://debug.dhis2.org/dev CYPRESS_DHIS2_USERNAME=admin CYPRESS_DHIS2_PASSWORD=district yarn cy:e2e:open ``` diff --git a/packages/app/config/env.js b/packages/app/config/env.js deleted file mode 100644 index 4e6954051f..0000000000 --- a/packages/app/config/env.js +++ /dev/null @@ -1,93 +0,0 @@ -'use strict'; - -const fs = require('fs'); -const path = require('path'); -const paths = require('./paths'); - -// Make sure that including paths.js after env.js will read .env variables. -delete require.cache[require.resolve('./paths')]; - -const NODE_ENV = process.env.NODE_ENV; -if (!NODE_ENV) { - throw new Error( - 'The NODE_ENV environment variable is required but was not specified.' - ); -} - -// https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use -var dotenvFiles = [ - `${paths.dotenv}.${NODE_ENV}.local`, - `${paths.dotenv}.${NODE_ENV}`, - // Don't include `.env.local` for `test` environment - // since normally you expect tests to produce the same - // results for everyone - NODE_ENV !== 'test' && `${paths.dotenv}.local`, - paths.dotenv, -].filter(Boolean); - -// Load environment variables from .env* files. Suppress warnings using silent -// if this file is missing. dotenv will never modify any environment variables -// that have already been set. Variable expansion is supported in .env files. -// https://github.com/motdotla/dotenv -// https://github.com/motdotla/dotenv-expand -dotenvFiles.forEach(dotenvFile => { - if (fs.existsSync(dotenvFile)) { - require('dotenv-expand')( - require('dotenv').config({ - path: dotenvFile, - }) - ); - } -}); - -// We support resolving modules according to `NODE_PATH`. -// This lets you use absolute paths in imports inside large monorepos: -// https://github.com/facebookincubator/create-react-app/issues/253. -// It works similar to `NODE_PATH` in Node itself: -// https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders -// Note that unlike in Node, only *relative* paths from `NODE_PATH` are honored. -// Otherwise, we risk importing Node.js core modules into an app instead of Webpack shims. -// https://github.com/facebookincubator/create-react-app/issues/1023#issuecomment-265344421 -// We also resolve them to make sure all tools using them work consistently. -const appDirectory = fs.realpathSync(process.cwd()); -process.env.NODE_PATH = (process.env.NODE_PATH || '') - .split(path.delimiter) - .filter(folder => folder && !path.isAbsolute(folder)) - .map(folder => path.resolve(appDirectory, folder)) - .join(path.delimiter); - -// Grab NODE_ENV and REACT_APP_* environment variables and prepare them to be -// injected into the application via DefinePlugin in Webpack configuration. -const REACT_APP = /^REACT_APP_/i; - -function getClientEnvironment(publicUrl) { - const raw = Object.keys(process.env) - .filter(key => REACT_APP.test(key)) - .reduce( - (env, key) => { - env[key] = process.env[key]; - return env; - }, - { - // Useful for determining whether we’re running in production mode. - // Most importantly, it switches React into the correct mode. - NODE_ENV: process.env.NODE_ENV || 'development', - // Useful for resolving the correct path to static assets in `public`. - // For example, . - // This should only be used as an escape hatch. Normally you would put - // images into the `src` and `import` them in code to get their paths. - PUBLIC_URL: publicUrl, - } - ); - // Stringify all values so we can feed into Webpack DefinePlugin - const stringified = { - 'process.env': Object.keys(raw).reduce((env, key) => { - env[key] = JSON.stringify(raw[key]); - return env; - }, {}), - }; - - return { raw, stringified }; -} - -module.exports = getClientEnvironment; diff --git a/packages/app/config/paths.js b/packages/app/config/paths.js deleted file mode 100644 index 66a9e73e11..0000000000 --- a/packages/app/config/paths.js +++ /dev/null @@ -1,55 +0,0 @@ -'use strict'; - -const path = require('path'); -const fs = require('fs'); -const url = require('url'); - -// Make sure any symlinks in the project folder are resolved: -// https://github.com/facebookincubator/create-react-app/issues/637 -const appDirectory = fs.realpathSync(process.cwd()); -const resolveApp = relativePath => path.resolve(appDirectory, relativePath); - -const envPublicUrl = process.env.PUBLIC_URL; - -function ensureSlash(path, needsSlash) { - const hasSlash = path.endsWith('/'); - if (hasSlash && !needsSlash) { - return path.substr(path, path.length - 1); - } else if (!hasSlash && needsSlash) { - return `${path}/`; - } else { - return path; - } -} - -const getPublicUrl = appPackageJson => - envPublicUrl || require(appPackageJson).homepage; - -// We use `PUBLIC_URL` environment variable or "homepage" field to infer -// "public path" at which the app is served. -// Webpack needs to know it to put the right ` - : ``; - }) - .join('\n'), - }), - // Makes some environment variables available in index.html. - // The public URL is available as %PUBLIC_URL% in index.html, e.g.: - // - // In development, this will be an empty string. - new InterpolateHtmlPlugin(env.raw), - // Add module names to factory functions so they appear in browser profiler. - new webpack.NamedModulesPlugin(), - // Makes some environment variables available to the JS code, for example: - // if (process.env.NODE_ENV === 'development') { ... }. See `./env.js`. - new webpack.DefinePlugin(globals), - // This is necessary to emit hot updates (currently CSS only): - new webpack.HotModuleReplacementPlugin(), - // Watcher doesn't work well if you mistype casing in a path so we use - // a plugin that prints an error when you attempt to do this. - // See https://github.com/facebookincubator/create-react-app/issues/240 - new CaseSensitivePathsPlugin(), - // If you require a missing module and then `npm install` it, you still have - // to restart the development server for Webpack to discover it. This plugin - // makes the discovery automatic so you don't have to restart. - // See https://github.com/facebookincubator/create-react-app/issues/186 - new WatchMissingNodeModulesPlugin(paths.appNodeModules), - // Moment.js is an extremely popular library that bundles large locale files - // by default due to how Webpack interprets its code. This is a practical - // solution that requires the user to opt into importing specific locales. - // https://github.com/jmblog/how-to-optimize-momentjs-with-webpack - // You can remove this if you don't use Moment.js: - new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/), - ], - // Some libraries import Node modules but don't use them in the browser. - // Tell Webpack to provide empty mocks for them so importing them works. - node: { - dgram: 'empty', - fs: 'empty', - net: 'empty', - tls: 'empty', - child_process: 'empty', - }, - // Turn off performance hints during development because we don't do any - // splitting or minification in interest of speed. These warnings become - // cumbersome. - performance: { - hints: false, - }, -}; diff --git a/packages/app/config/webpack.config.prod.js b/packages/app/config/webpack.config.prod.js deleted file mode 100644 index b40b00f587..0000000000 --- a/packages/app/config/webpack.config.prod.js +++ /dev/null @@ -1,380 +0,0 @@ -'use strict'; - -const autoprefixer = require('autoprefixer'); -const path = require('path'); -const webpack = require('webpack'); -const HtmlWebpackPlugin = require('html-webpack-plugin'); -const ExtractTextPlugin = require('extract-text-webpack-plugin'); -const ManifestPlugin = require('webpack-manifest-plugin'); -const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin'); -const SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin'); -const eslintFormatter = require('react-dev-utils/eslintFormatter'); -const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin'); -const BundleAnalyzerPlugin = require('webpack-bundle-analyzer') - .BundleAnalyzerPlugin; -const fs = require('fs'); -const paths = require('./paths'); -const getClientEnvironment = require('./env'); - -// Webpack uses `publicPath` to determine where the app is being served from. -// It requires a trailing slash, or the file assets will get an incorrect path. -const publicPath = paths.servedPath; -// Some apps do not use client-side routing with pushState. -// For these, "homepage" can be set to "." to enable relative asset paths. -const shouldUseRelativeAssetPaths = publicPath === './'; -// Source maps are resource heavy and can cause out of memory issue for large source files. -const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false'; -// `publicUrl` is just like `publicPath`, but we will provide it to our app -// as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript. -// Omit trailing slash as %PUBLIC_URL%/xyz looks better than %PUBLIC_URL%xyz. -const publicUrl = publicPath.slice(0, -1); -// Get environment variables to inject into our app. -const env = getClientEnvironment(publicUrl); -const manifest = JSON.parse( - fs.readFileSync(`${paths.appBuild}/manifest.webapp`, 'utf8') -); -const globals = Object.assign( - {}, - { - manifest: JSON.stringify(manifest), - }, - env.stringified -); - -// Assert this just to be safe. -// Development builds of React are slow and not intended for production. -if (env.stringified['process.env'].NODE_ENV !== '"production"') { - throw new Error('Production builds must have NODE_ENV=production.'); -} - -// Note: defined here because it will be used more than once. -const cssFilename = 'static/css/[name].[contenthash:8].css'; - -// ExtractTextPlugin expects the build output to be flat. -// (See https://github.com/webpack-contrib/extract-text-webpack-plugin/issues/27) -// However, our output is structured with css, js and media folders. -// To have this structure working with relative paths, we have to use custom options. -const extractTextPluginOptions = shouldUseRelativeAssetPaths - ? // Making sure that the publicPath goes back to to build folder. - { publicPath: Array(cssFilename.split('/').length).join('../') } - : {}; - -const scriptPrefix = manifest.activities.dhis.href; - -// This is the production configuration. -// It compiles slowly and is focused on producing a fast and minimal bundle. -// The development configuration is different and lives in a separate file. -module.exports = { - // Don't attempt to continue if there are any errors. - bail: true, - // We generate sourcemaps in production. This is slow but gives good results. - // You can exclude the *.map files from the build during deployment. - devtool: shouldUseSourceMap ? 'source-map' : false, - // In production, we only want to load the polyfills and the app code. - entry: [require.resolve('../../../config/polyfills'), paths.appIndexJs], - output: { - // The build folder. - path: paths.appBuild, - // Generated JS file names (with nested folders). - // There will be one main bundle, and one file per asynchronous chunk. - // We don't currently advertise code splitting but Webpack supports it. - filename: 'static/js/[name].[chunkhash:8].js', - chunkFilename: 'static/js/[name].[chunkhash:8].chunk.js', - // We inferred the "public path" (such as / or /my-project) from homepage. - publicPath: publicPath, - // Point sourcemap entries to original disk location (format as URL on Windows) - devtoolModuleFilenameTemplate: info => - path - .relative(paths.appSrc, info.absoluteResourcePath) - .replace(/\\/g, '/'), - }, - resolve: { - // This allows you to set a fallback for where Webpack should look for modules. - // We placed these paths second because we want `node_modules` to "win" - // if there are any conflicts. This matches Node resolution mechanism. - // https://github.com/facebookincubator/create-react-app/issues/253 - modules: ['node_modules', paths.appNodeModules].concat( - // It is guaranteed to exist because we tweak it in `env.js` - process.env.NODE_PATH.split(path.delimiter).filter(Boolean) - ), - // These are the reasonable defaults supported by the Node ecosystem. - // We also include JSX as a common component filename extension to support - // some tools, although we do not recommend using it, see: - // https://github.com/facebookincubator/create-react-app/issues/290 - // `web` extension prefixes have been added for better support - // for React Native Web. - extensions: ['.web.js', '.mjs', '.js', '.json', '.web.jsx', '.jsx'], - alias: { - // Support React Native Web - // https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/ - 'react-native': 'react-native-web', - }, - plugins: [ - // Prevents users from importing files from outside of src/ (or node_modules/). - // This often causes confusion because we only process files within src/ with babel. - // To fix this, we prevent you from importing files out of src/ -- if you'd like to, - // please link the files into your node_modules/ and let module-resolution kick in. - // Make sure your source files are compiled, as they will not be processed in any way. - new ModuleScopePlugin(paths.appSrc, [paths.appPackageJson]), - ], - }, - module: { - strictExportPresence: true, - rules: [ - // TODO: Disable require.ensure as it's not a standard language feature. - // We are waiting for https://github.com/facebookincubator/create-react-app/issues/2176. - // { parser: { requireEnsure: false } }, - - // First, run the linter. - // It's important to do this before Babel processes the JS. - { - test: /\.(js|jsx|mjs)$/, - enforce: 'pre', - use: [ - { - options: { - formatter: eslintFormatter, - eslintPath: require.resolve('eslint'), - }, - loader: require.resolve('eslint-loader'), - }, - ], - include: paths.appSrc, - }, - { - // "oneOf" will traverse all following loaders until one will - // match the requirements. When no loader matches it will fall - // back to the "file" loader at the end of the loader list. - oneOf: [ - // "url" loader works just like "file" loader but it also embeds - // assets smaller than specified size as data URLs to avoid requests. - { - test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/], - loader: require.resolve('url-loader'), - options: { - limit: 10000, - name: 'static/media/[name].[hash:8].[ext]', - }, - }, - // Process JS with Babel. - { - test: /@dhis2\/.*\.(js|jsx|mjs)$/, - loader: require.resolve('babel-loader'), - options: { - cacheDirectory: true, - }, - }, - { - test: /\.(js|jsx|mjs)$/, - include: paths.appSrc, - loader: require.resolve('babel-loader'), - options: { - compact: true, - }, - }, - // The notation here is somewhat confusing. - // "postcss" loader applies autoprefixer to our CSS. - // "css" loader resolves paths in CSS and adds assets as dependencies. - // "style" loader normally turns CSS into JS modules injecting