Feature Unit/System Tests Language Change NPM Resource Changed PR-5.3-dev Pending

User tests: Successful: Unsuccessful:

avatar Elfangor93
Elfangor93
8 Jul 2024

This is a redo of PR #43748 since new features have to go into 5.2-dev.

The idea for this PR came from a workshop in which we analysed a survey in the joomla community of the D-A-CH region. The survey and the workshop was organized by Oliver Schuldt and @SniperSister. Thank you very much for your effort.

What is this module going to improve?

One of the points that was mentioned very frequently in the survey is that there is no good entry point for new, interested volunteers. It is difficult and confusing for newcomers to get the necessary information on how to participate in the Joomla! community. This is what we want to solve with the help of this backend dashboard module.
It provides the most important information and links to join and participate in the Joomla community at the most visible place; The dashboard/cpanel of the backend.
The links and information are retrieved from an API endpoint at joomla.org based on the user's current location. This ensures that the user sees the information that is most relevant to him and minimises the barrier to make it as easy as possible to get started in the community.

The module provides the following information:

  • Contact and links to your local Joomla community.
  • News about Joomla! and its community.
  • Upcoming events in your region.
  • Motivation to volunteer.

The current location of the user gets evaluated in the following order. If the location couldnt be found the next approach is used:

  1. Manually selected location
  2. Automatically detect the current position by the browser
  3. Fallback location: London (UK, lat: 51.5000, long: 0.0000)

Info about API endpoint

Main entry point
In order to fetch local community information, the module calls an endpoint (API). The endpoint used by the module is set in the module settings and gets set during installation. In this PR for testing reasons it is set to be https://test.joomla.spuur.ch/joomla-community-api/links.php.
This is just a proof-of-concept endpoint set up to test this PR. It will be exchanged when the PR is in a state ready to be merged. The final endpoint will be hosted at https://www.joomla.org/. It is thought that we could expand the already existing https://community.joomla.org/user-groups.html directory. Such that every Joomla user group or association can enter the information and links there which they want show to the users close to them in this directory. The API will then fetch the data from the directory and provide it as json response to the module.

News feed
The news feed is fetched from a source which provides an XML/RSS feed. The source is declared in the response of the main entry point API. This could e.g be a website with a category blog of Joomla articles from which the view format RSS is requested.
(e.g. https://community.joomla.org/blogs?format=feed&type=rss)

Events feed
The upcoming events are fetched from a middle ware API endpoint hosted at the same location as the main entry point API for the links. It will parse a calendar from https://community.joomla.org/events.html based on the current location.
(e.g. https://test.joomla.spuur.ch/joomla-community-api/events.php)

The module can also be found in this repository. Here is an installable version of the module if you dont want to build Joomla from source to test this PR:
https://github.com/Elfangor93/mod_community_info

Summary of Changes

  • Added the module "mod_community_info" to the administrator dashboard on the first possible position on the module position "cpanel".

Testing Instructions

  1. Install Joomla from source (or use the installable module)
  2. Activate debug in the Joomla global configuration.
  3. Visit the administrator dashboard.
  4. Allow your browser to get your current location or click on "Choose location" to manually choose your location.
  5. Look at the browser console to see the activities of the module when evaluating your location and fetch content.
  6. Exchange endpoint in the module parameters to simulate different locations

Actual result BEFORE applying this Pull Request

No community module in the administrator dashboard.

Expected result AFTER applying this Pull Request

New module called "Joomla! Community and News" (mod_community_info) community module in the administrator dashboard.

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

avatar Elfangor93 Elfangor93 - open - 8 Jul 2024
avatar Elfangor93 Elfangor93 - change - 8 Jul 2024
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 8 Jul 2024
Category Administration Language & Strings Modules Repository NPM Change JavaScript SQL Installation
avatar Elfangor93 Elfangor93 - change - 8 Jul 2024
Labels Added: Language Change NPM Resource Changed PR-5.2-dev
avatar Elfangor93 Elfangor93 - change - 8 Jul 2024
The description was changed
avatar Elfangor93 Elfangor93 - edited - 8 Jul 2024
avatar Elfangor93 Elfangor93 - change - 8 Jul 2024
The description was changed
avatar Elfangor93 Elfangor93 - edited - 8 Jul 2024
avatar brianteeman
brianteeman - comment - 8 Jul 2024

the list of countries is a non-standard list that has been modified from a questionable source. We should not be reinventing the wheel for a list of countries that we will need to maintain ourselves. There are ISO standards for this which are actively maintained and do not contain the modifications you have made to satisfy one single country. This is wrong.

avatar Elfangor93
Elfangor93 - comment - 8 Jul 2024

There are ISO standards for this which are actively maintained and do not contain the modifications you have made to satisfy one single country.

Can you point me to the ISO standard you are looking for? Then I can update the list accordingly.
I see that the current langages supported by Joomla are the following: https://update.joomla.org/language/translationlist_5.xml

So I guess it would make sense to create a list with countires based on the ISO standard and map to each a language tag available at https://update.joomla.org/language/translationlist_5.xml, right?

avatar brianteeman
brianteeman - comment - 8 Jul 2024

There are ISO standards for this which are actively maintained and do not contain the modifications you have made to satisfy one single country.

Can you point me to the ISO standard you are looking for? Then I can update the list accordingly. I see that the current langages supported by Joomla are the following: https://update.joomla.org/language/translationlist_5.xml

So I guess it would make sense to create a list with countires based on the ISO standard and map to each a language tag available at https://update.joomla.org/language/translationlist_5.xml, right?

No. You should not be creating your own list. That is a maintenance nightmare.

avatar dgrammatiko
dgrammatiko - comment - 8 Jul 2024

Please fix the CS:

+ npm run lint:js

> joomla@5.2.0 lint:js
> eslint --config build/.eslintrc --ignore-pattern '/media/' --ext .es6.js,.es6,.vue .


/drone/src/build/media_source/mod_community_info/js/community-info.es6.js
    3:3    error    Trailing spaces not allowed                                          no-trailing-spaces
    5:73   error    Trailing spaces not allowed                                          no-trailing-spaces
    7:5    error    'openModal' is never reassigned. Use 'const' instead                 prefer-const
    7:5    error    'openModal' is assigned a value but never used                       no-unused-vars
    7:25   error    Missing space before function parentheses                            space-before-function-paren
    7:35   error    'location' is defined but never used                                 no-unused-vars
    8:7    error    'modal' is never reassigned. Use 'const' instead                     prefer-const
    8:12   error    Multiple spaces found before '='                                     no-multi-spaces
    9:7    error    'modalBody' is never reassigned. Use 'const' instead                 prefer-const
    9:16   error    Multiple spaces found before '='                                     no-multi-spaces
   10:22   error    Multiple spaces found before '='                                     no-multi-spaces
   10:50   error    Unexpected string concatenation                                      prefer-template
   10:61   error    Operator '+' must be spaced                                          space-infix-ops
   10:69   error    Operator '+' must be spaced                                          space-infix-ops
   12:3    error    'bsmodal' is not defined                                             no-undef
   12:67   error    A space is required after '{'                                        object-curly-spacing
   12:83   error    A space is required before '}'                                       object-curly-spacing
   13:3    error    'bsmodal' is not defined                                             no-undef
   14:1    error    Trailing spaces not allowed                                          no-trailing-spaces
   15:3    error    Expected space(s) after "if"                                         keyword-spacing
   15:14   error    Expected '===' and instead saw '=='                                  eqeqeq
   17:74   error    Unexpected unnamed function                                          func-names
   17:74   error    Unexpected function expression                                       prefer-arrow-callback
   17:82   error    Missing space before function parentheses                            space-before-function-paren
   26:2    error    Missing semicolon                                                    semi
   31:5    error    'autoLoc' is never reassigned. Use 'const' instead                   prefer-const
   31:5    error    'autoLoc' is assigned a value but never used                         no-unused-vars
   31:29   error    Missing space before function parentheses                            space-before-function-paren
   32:7    error    'location' is never reassigned. Use 'const' instead                  prefer-const
   32:24   error    'getCurrentLocation' was used before it was defined                  no-use-before-define
   34:3    error    Use array destructuring                                              prefer-destructuring
   35:3    error    Use array destructuring                                              prefer-destructuring
   40:2    error    Missing semicolon                                                    semi
   45:5    error    'saveLoc' is never reassigned. Use 'const' instead                   prefer-const
   45:5    error    'saveLoc' is assigned a value but never used                         no-unused-vars
   45:23   error    Missing space before function parentheses                            space-before-function-paren
   49:2    error    Missing semicolon                                                    semi
   54:5    error    'searchLocation' is never reassigned. Use 'const' instead            prefer-const
   54:5    error    'searchLocation' is assigned a value but never used                  no-unused-vars
   54:36   error    Missing space before function parentheses                            space-before-function-paren
   55:7    error    'search' is never reassigned. Use 'const' instead                    prefer-const
   58:7    error    'res' is never reassigned. Use 'const' instead                       prefer-const
   58:19   error    'fetchAPI' was used before it was defined                            no-use-before-define
   58:76   error    A space is required after ','                                        comma-spacing
   58:77   error    A space is required after '{'                                        object-curly-spacing
   58:78   error    Unnecessarily quoted property 'q' found                              quote-props
   58:91   error    Unnecessarily quoted property 'format' found                         quote-props
   58:109  error    A space is required before '}'                                       object-curly-spacing
   60:3    warning  Unexpected console statement                                         no-console
   62:3    error    Expected space(s) after "if"                                         keyword-spacing
   64:18   error    Unexpected string concatenation                                      prefer-template
   64:54   error    Operator '+' must be spaced                                          space-infix-ops
   64:79   error    Operator '+' must be spaced                                          space-infix-ops
   66:7    error    'selected' is not defined                                            no-undef
   68:9    error    'selected' is not defined                                            no-undef
   71:16   error    Unexpected string concatenation                                      prefer-template
   71:35   error    Operator '+' must be spaced                                          space-infix-ops
   71:36   error    'selected' is not defined                                            no-undef
   71:44   error    Operator '+' must be spaced                                          space-infix-ops
   71:54   error    Operator '+' must be spaced                                          space-infix-ops
   71:65   error    Operator '+' must be spaced                                          space-infix-ops
   71:69   error    Operator '+' must be spaced                                          space-infix-ops
   71:80   error    Operator '+' must be spaced                                          space-infix-ops
   71:85   error    Operator '+' must be spaced                                          space-infix-ops
   71:97   error    Operator '+' must be spaced                                          space-infix-ops
   71:102  error    Operator '+' must be spaced                                          space-infix-ops
   73:5    error    Assignment (=) can be replaced with operator assignment (+=)         operator-assignment
   73:14   error    Unexpected string concatenation                                      prefer-template
   88:62   error    Unexpected string concatenation                                      prefer-template
   88:67   error    Operator '+' must be spaced                                          space-infix-ops
   88:121  error    Operator '+' must be spaced                                          space-infix-ops
   93:2    error    Missing semicolon                                                    semi
   98:5    error    'locationSelectChange' is never reassigned. Use 'const' instead      prefer-const
   98:5    error    'locationSelectChange' is assigned a value but never used            no-unused-vars
   98:36   error    Missing space before function parentheses                            space-before-function-paren
   99:7    error    'selectedValue' is never reassigned. Use 'const' instead             prefer-const
  102:3    error    Use array destructuring                                              prefer-destructuring
  103:3    error    Use array destructuring                                              prefer-destructuring
  107:2    error    Missing semicolon                                                    semi
  111:3    error    Trailing spaces not allowed                                          no-trailing-spaces
  115:3    error    Trailing spaces not allowed                                          no-trailing-spaces
  119:5    error    'ajaxLocation' is never reassigned. Use 'const' instead              prefer-const
  119:5    error    'ajaxLocation' is assigned a value but never used                    no-unused-vars
  119:34   error    Missing space before function parentheses                            space-before-function-paren
  119:45   error    Identifier 'module_id' is not in camel case                          camelcase
  121:7    error    'formData' is never reassigned. Use 'const' instead                  prefer-const
  126:7    error    'parameters' is never reassigned. Use 'const' instead                prefer-const
  136:7    error    'url' is never reassigned. Use 'const' instead                       prefer-const
  139:7    error    'response' is never reassigned. Use 'const' instead                  prefer-const
  140:7    error    'txt' is never reassigned. Use 'const' instead                       prefer-const
  140:10   error    Multiple spaces found before '='                                     no-multi-spaces
  144:9    error    'message' is never reassigned. Use 'const' instead                   prefer-const
  145:9    error    'message2' is never reassigned. Use 'const' instead                  prefer-const
  146:27   error    A space is required after '{'                                        object-curly-spacing
  146:28   error    Unnecessarily quoted property 'error' found                          quote-props
  146:36   error    Missing space before value for key 'error'                           key-spacing
  146:37   error    Unexpected string concatenation                                      prefer-template
  146:44   error    Operator '+' must be spaced                                          space-infix-ops
  146:48   error    Operator '+' must be spaced                                          space-infix-ops
  146:49   error    'sprintf' was used before it was defined                             no-use-before-define
  146:84   error    A space is required before '}'                                       object-curly-spacing
  148:5    warning  Unexpected console statement                                         no-console
  149:5    warning  Unexpected console statement                                         no-console
  149:17   error    Unexpected string concatenation                                      prefer-template
  149:32   error    Operator '+' must be spaced                                          space-infix-ops
  149:48   error    Operator '+' must be spaced                                          space-infix-ops
  149:62   error    Operator '+' must be spaced                                          space-infix-ops
  155:3    error    Expected space(s) after "if"                                         keyword-spacing
  157:9    error    'res' is never reassigned. Use 'const' instead                       prefer-const
  166:9    error    'message' is never reassigned. Use 'const' instead                   prefer-const
  167:9    error    'message2' is never reassigned. Use 'const' instead                  prefer-const
  168:27   error    A space is required after '{'                                        object-curly-spacing
  168:28   error    Unnecessarily quoted property 'error' found                          quote-props
  168:36   error    Missing space before value for key 'error'                           key-spacing
  168:37   error    Unexpected string concatenation                                      prefer-template
  168:44   error    Operator '+' must be spaced                                          space-infix-ops
  168:48   error    Operator '+' must be spaced                                          space-infix-ops
  168:49   error    'sprintf' was used before it was defined                             no-use-before-define
  168:80   error    A space is required before '}'                                       object-curly-spacing
  170:5    warning  Unexpected console statement                                         no-console
  171:5    warning  Unexpected console statement                                         no-console
  174:9    error    'split' is never reassigned. Use 'const' instead                     prefer-const
  175:9    error    'temp' is never reassigned. Use 'const' instead                      prefer-const
  175:13   error    Multiple spaces found before '='                                     no-multi-spaces
  175:28   error    Unexpected string concatenation                                      prefer-template
  175:32   error    Operator '+' must be spaced                                          space-infix-ops
  176:9    error    'data' is never reassigned. Use 'const' instead                      prefer-const
  176:9    error    'data' is already declared in the upper scope on line 153 column 7   no-shadow
  176:13   error    Multiple spaces found before '='                                     no-multi-spaces
  178:9    error    'message' is never reassigned. Use 'const' instead                   prefer-const
  179:9    error    'message2' is never reassigned. Use 'const' instead                  prefer-const
  180:27   error    A space is required after '{'                                        object-curly-spacing
  180:28   error    Unnecessarily quoted property 'error' found                          quote-props
  180:36   error    Missing space before value for key 'error'                           key-spacing
  180:37   error    Unexpected string concatenation                                      prefer-template
  180:44   error    Operator '+' must be spaced                                          space-infix-ops
  180:48   error    Operator '+' must be spaced                                          space-infix-ops
  180:49   error    'sprintf' was used before it was defined                             no-use-before-define
  180:83   error    A space is required before '}'                                       object-curly-spacing
  181:5    warning  Unexpected console statement                                         no-console
  182:5    warning  Unexpected console statement                                         no-console
  182:17   error    Unexpected string concatenation                                      prefer-template
  182:28   error    Operator '+' must be spaced                                          space-infix-ops
  183:5    warning  Unexpected console statement                                         no-console
  183:17   error    Unexpected string concatenation                                      prefer-template
  183:29   error    Operator '+' must be spaced                                          space-infix-ops
  184:5    warning  Unexpected console statement                                         no-console
  184:17   error    Unexpected string concatenation                                      prefer-template
  184:25   error    Operator '+' must be spaced                                          space-infix-ops
  187:3    error    Async function expected no return value                              consistent-return
  192:3    error    Trailing spaces not allowed                                          no-trailing-spaces
  196:3    error    Trailing spaces not allowed                                          no-trailing-spaces
  199:30   error    Missing space before function parentheses                            space-before-function-paren
  199:45   error    Operator '=' must be spaced                                          space-infix-ops
  199:56   error    Operator '=' must be spaced                                          space-infix-ops
  200:7    error    'urlSearchParams' is never reassigned. Use 'const' instead           prefer-const
  202:3    error    Expected space(s) after "if"                                         keyword-spacing
  202:36   error    Expected '!==' and instead saw '!='                                  eqeqeq
  203:5    error    Assignment to function parameter 'url'                               no-param-reassign
  203:11   error    Unexpected string concatenation                                      prefer-template
  203:14   error    Operator '+' must be spaced                                          space-infix-ops
  203:18   error    Operator '+' must be spaced                                          space-infix-ops
  207:7    error    'parameters' is never reassigned. Use 'const' instead                prefer-const
  212:29   error    Missing trailing comma                                               comma-dangle
  216:7    error    'response' is never reassigned. Use 'const' instead                  prefer-const
  220:9    error    'message' is never reassigned. Use 'const' instead                   prefer-const
  221:27   error    A space is required after '{'                                        object-curly-spacing
  221:28   error    Unnecessarily quoted property 'error' found                          quote-props
  221:36   error    Missing space before value for key 'error'                           key-spacing
  221:37   error    'sprintf' was used before it was defined                             no-use-before-define
  221:97   error    A space is required before '}'                                       object-curly-spacing
  222:5    warning  Unexpected console statement                                         no-console
  222:17   error    Unexpected string concatenation                                      prefer-template
  222:77   error    Operator '+' must be spaced                                          space-infix-ops
  222:93   error    Operator '+' must be spaced                                          space-infix-ops
  222:107  error    Operator '+' must be spaced                                          space-infix-ops
  227:7    error    'txt' is never reassigned. Use 'const' instead                       prefer-const
  227:10   error    Multiple spaces found before '='                                     no-multi-spaces
  228:12   error    Multiple spaces found before '='                                     no-multi-spaces
  232:3    error    Expected space(s) after "if"                                         keyword-spacing
  232:13   error    Expected '===' and instead saw '=='                                  eqeqeq
  235:14   error    'error' is already declared in the upper scope on line 228 column 7  no-shadow
  236:7    error    Do not assign to the exception parameter                             no-ex-assign
  236:12   error    Multiple spaces found before '='                                     no-multi-spaces
  239:10   error    Expected space(s) after "if"                                         keyword-spacing
  239:20   error    Expected '===' and instead saw '=='                                  eqeqeq
  240:9    error    'parser' is never reassigned. Use 'const' instead                    prefer-const
  241:40   error    Strings must use singlequote                                         quotes
  243:5    error    Expected space(s) after "if"                                         keyword-spacing
  243:34   error    Strings must use singlequote                                         quotes
  244:12   error    Multiple spaces found before '='                                     no-multi-spaces
  245:45   error    Strings must use singlequote                                         quotes
  251:3    error    Expected space(s) after "if"                                         keyword-spacing
  253:9    error    'message' is never reassigned. Use 'const' instead                   prefer-const
  254:27   error    A space is required after '{'                                        object-curly-spacing
  254:28   error    Unnecessarily quoted property 'error' found                          quote-props
  254:36   error    Missing space before value for key 'error'                           key-spacing
  254:37   error    'sprintf' was used before it was defined                             no-use-before-define
  254:75   error    A space is required before '}'                                       object-curly-spacing
  255:5    warning  Unexpected console statement                                         no-console
  255:17   error    Unexpected string concatenation                                      prefer-template
  255:89   error    Operator '+' must be spaced                                          space-infix-ops
  257:5    error    Async function expected no return value                              consistent-return
  259:2    error    Missing semicolon                                                    semi
  263:3    error    Trailing spaces not allowed                                          no-trailing-spaces
  266:40   error    Missing space before function parentheses                            space-before-function-paren
  275:11   error    Expected the Promise rejection reason to be an Error                 prefer-promise-reject-errors
  275:18   error    Unexpected string concatenation                                      prefer-template
  275:67   error    Operator '+' must be spaced                                          space-infix-ops
  275:71   error    Operator '+' must be spaced                                          space-infix-ops
  276:10   error    Missing trailing comma                                               comma-dangle
  286:3    error    Trailing spaces not allowed                                          no-trailing-spaces
  288:3    error    Trailing spaces not allowed                                          no-trailing-spaces
  291:23   error    Missing space before function parentheses                            space-before-function-paren
  292:3    error    Unexpected var, use let or const instead                             no-var
  292:41   error    Use the rest parameters instead of 'arguments'                       prefer-rest-params
  293:3    error    Unexpected var, use let or const instead                             no-var
  294:30   error    Unexpected unnamed function                                          func-names
  294:30   error    Unexpected function expression                                       prefer-arrow-callback
  294:38   error    Missing space before function parentheses                            space-before-function-paren
  295:17   error    Unary operator '++' used                                             no-plusplus
  297:2    error    Missing semicolon                                                    semi

✖ 222 problems (211 errors, 11 warnings)
  172 errors and 0 warnings potentially fixable with the `--fix` option.
avatar brianteeman
brianteeman - comment - 8 Jul 2024

Please change this to draft until it actually works. That way testers like myself wont waste time on this until you think it is ready.

avatar Elfangor93
Elfangor93 - comment - 8 Jul 2024

I was able to reduce the JS errors from npm run lint:js to

 76:5   warning  Unexpected console statement                                           no-console
 109:5   warning  Unexpected console statement                                         no-console
 126:3   warning  Unexpected console statement                                         no-console
 201:5   warning  Unexpected console statement                                         no-console
 202:5   warning  Unexpected console statement                                         no-console
 222:5   warning  Unexpected console statement                                         no-console
 223:5   warning  Unexpected console statement                                         no-console
 233:5   warning  Unexpected console statement                                         no-console
 234:5   warning  Unexpected console statement                                         no-console
 235:5   warning  Unexpected console statement                                         no-console
 236:5   warning  Unexpected console statement                                         no-console
 245:7   error    'autoLoc' is assigned a value but never used                        no-unused-vars
 260:7   error    'saveLoc' is assigned a value but never used                        no-unused-vars
 269:7   error    'locationSelectChange' is assigned a value but never used  no-unused-vars
 287:38  error    'location' is defined but never used                                     no-unused-vars
 336:7   error    'iniModule' is assigned a value but never used                    no-unused-vars
 368:7   warning  Unexpected console statement                                         no-console
 371:7   warning  Unexpected console statement                                         no-console
 373:7   warning  Unexpected console statement                                         no-console

@dgrammatiko How do I make the no-unused-vars disappear?

avatar dgrammatiko
dgrammatiko - comment - 8 Jul 2024

@dgrammatiko How do I make the no-unused-vars disappear?

I'm guessing those functions/variables are not used inside the script but rather in the inline script thus the tools assume not used anywhere? Move all the JS code in the file that would allow the tools to be more accurate on the code sniffing

avatar Elfangor93 Elfangor93 - change - 8 Jul 2024
The description was changed
avatar Elfangor93 Elfangor93 - edited - 8 Jul 2024
avatar Elfangor93 Elfangor93 - change - 8 Jul 2024
The description was changed
avatar Elfangor93 Elfangor93 - edited - 8 Jul 2024
avatar Elfangor93
Elfangor93 - comment - 8 Jul 2024

I guess now its ready for testing again...

avatar brianteeman
brianteeman - comment - 8 Jul 2024

I guess now its ready for testing again...

previous reported xml errors still present

image

No link to set the location
No indication of the location

image

avatar brianteeman
brianteeman - comment - 10 Jul 2024

previous reported issues still present but now with additional issue

image

avatar Elfangor93
Elfangor93 - comment - 11 Jul 2024

previous reported issues still present but now with additional issue

Seems like there is a problem in the installation script. Can you try to add https://test.joomla.spuur.ch/joomla-community-api/links.php to the module configurations by hand?

grafik

avatar Elfangor93 Elfangor93 - change - 11 Jul 2024
The description was changed
avatar Elfangor93 Elfangor93 - edited - 11 Jul 2024
avatar Elfangor93
Elfangor93 - comment - 12 Jul 2024

The last commits were a rebase with the joomla:5.2-dev branch in order to make drone work correctly.

avatar joomla-cms-bot joomla-cms-bot - change - 12 Jul 2024
Category Administration Language & Strings Modules Repository NPM Change JavaScript SQL Installation Administration Language & Strings Modules Repository NPM Change JavaScript SQL Installation Postgresql
avatar Elfangor93
Elfangor93 - comment - 24 Aug 2024

@richard67 Do you mind looking over the installation sql files of this PR, if everything is correctly added. Its my first PR with core database changes...

avatar richard67
richard67 - comment - 24 Aug 2024

@richard67 Do you mind looking over the installation sql files of this PR, if everything is correctly added. Its my first PR with core database changes...

I don't know if I will have the time today to review ALL SQL changes (including the assets table).

But what is missing is a new update SQL script for each database. You could name it "5.2.0-2024-08-24.sql".

You could look up in existing update SQL scripts how we add new modules. E.g. we insert them with asset ID zero and do not insert assets into the assets table on update.

avatar richard67
richard67 - comment - 24 Aug 2024

@Elfangor93 Regarding how the update SQL script for adding a new module you can check PR #43738 as example. In that case it is a site module (client_id=0), in your case it is an admin module (client_id=1).

avatar joomla-cms-bot joomla-cms-bot - change - 24 Aug 2024
Category Administration Language & Strings Modules Repository NPM Change JavaScript SQL Installation Postgresql SQL Administration com_admin Postgresql Language & Strings Modules Repository NPM Change JavaScript Installation
avatar Elfangor93 Elfangor93 - change - 24 Aug 2024
The description was changed
avatar Elfangor93 Elfangor93 - edited - 24 Aug 2024
avatar Elfangor93 Elfangor93 - change - 24 Aug 2024
The description was changed
avatar Elfangor93 Elfangor93 - edited - 24 Aug 2024
avatar Elfangor93 Elfangor93 - change - 24 Aug 2024
The description was changed
avatar Elfangor93 Elfangor93 - edited - 24 Aug 2024
avatar Elfangor93 Elfangor93 - change - 24 Aug 2024
The description was changed
avatar Elfangor93 Elfangor93 - edited - 24 Aug 2024
avatar Elfangor93 Elfangor93 - change - 24 Aug 2024
The description was changed
avatar Elfangor93 Elfangor93 - edited - 24 Aug 2024
avatar Quy
Quy - comment - 25 Aug 2024

43753-install

avatar Elfangor93 Elfangor93 - change - 26 Aug 2024
The description was changed
avatar Elfangor93 Elfangor93 - edited - 26 Aug 2024
avatar Elfangor93
Elfangor93 - comment - 27 Aug 2024

43753-install

Im not an sql expert. Anyone an idea whats the problem?

avatar richard67
richard67 - comment - 27 Aug 2024

Im not an sql expert. Anyone an idea whats the problem?

@Elfangor93 For the base.sql file for MySQL see my latest review comment. The base.sql for PostgreSQL is not complete compared to the one for MySQL, it is missing the insert into the extensions table and for the module.

avatar richard67
richard67 - comment - 28 Aug 2024

@Elfangor93 The system tests are failing at test "Test that modules administrator API endpoint 1) can deliver a list of administrator modules". See the log here https://ci.joomla.org/joomla/joomla-cms/78449/1/22 . It seems it gets 'mod_community_info' where it expects to get 'mod_sampledata'. It might be that the system tests need some adjustment for your PR. @muhme Could you have a look if this is the case?

avatar muhme
muhme - comment - 28 Aug 2024

@Elfangor93 The system tests are failing at test "Test that modules administrator API endpoint 1) can deliver a list of administrator modules". See the log here https://ci.joomla.org/joomla/joomla-cms/78449/1/22 . It seems it gets 'mod_community_info' where it expects to get 'mod_sampledata'. It might be that the system tests need some adjustment for your PR. @muhme Could you have a look if this is the case?

AS @richard67 wrote, the reason is, the test expects the first module returned by API is mod_sampledata. That is now no more true, the first module now returned is mod_community_info.

A fix for this is in tests/System/integration/api/com_modules/Administrator.cy.js:

  it('can deliver a list of administrator modules', () => {
    cy.api_get('/modules/administrator')
      .then((response) => {
        // Search for the module 'mod_sampledata' in any entry
        const modules = response.body.data.map(item => item.attributes.module);
        expect(modules).to.satisfy(modulesArray => modulesArray.some(module => module.includes('mod_sampledata')));
      });
  });

@Elfangor93 Would you like to checkin, or should I make a PR to Elfangor93:mod_community_info?

avatar Elfangor93
Elfangor93 - comment - 28 Aug 2024

A fix for this is in tests/System/integration/api/com_modules/Administrator.cy.js

Your suggestion looks completely different than what is currently available in Administrator.cy.js:

it('can deliver a list of administrator modules', () => {
    cy.api_get('/modules/administrator')
      .then((response) => cy.wrap(response).its('body').its('data.0').its('attributes')
        .its('module')
        .should('include', 'mod_sampledata'));
  });

I'm not sure what to change here. @muhme would be helpful to receive a PR. Thanks for your help!

avatar richard67
richard67 - comment - 28 Aug 2024

Other problem. Drone can't build the packages for testing. Reason: node build/build.js --versioning fails:

> node build/build.js --versioning

[Error: ENOENT: no such file or directory, lstat '/drone/src/build/tmp/1724864249/media/mod_community_info/js/community-info.es6.js'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'lstat',
  path: '/drone/src/build/tmp/1724864249/media/mod_community_info/js/community-info.es6.js'
}
`npm run versioning` did not complete as expected.

@dgrammatiko Does it need to add the path to the new module's JS somewhere in the build JS scripts?

avatar dgrammatiko
dgrammatiko - comment - 28 Aug 2024
avatar Elfangor93
Elfangor93 - comment - 29 Aug 2024

#43753 (comment)

This comment was somehow overlooked by me. Thank you for your help!

avatar joomla-cms-bot joomla-cms-bot - change - 1 Sep 2024
Category Administration Language & Strings Modules Repository NPM Change JavaScript SQL Installation Postgresql com_admin SQL Administration com_admin Postgresql Language & Strings Modules Repository NPM Change JavaScript Installation Unit Tests
avatar Elfangor93
Elfangor93 - comment - 1 Sep 2024

Drone is still failing. Any ideas @muhme?

avatar richard67 richard67 - change - 1 Sep 2024
Labels Added: Unit/System Tests
avatar richard67
richard67 - comment - 1 Sep 2024

Drone is still failing. Any ideas @muhme?

@Elfangor93 I've updated the branch to latest 5.2-dev to see if that helps with Drone. I've also had again a quick look on the base.sql files and have noticed that some lft and rgt values where not increased where they should have been increased. In general all lft and rgt values need to be increased by 2 for assets where the lft value is greater that the old rgt value of com_modules. This has been done for some, but for some it has not been done, e.g. com_users, com_wrapper, com_finder, ...

The following drawing shows the principle of our nested tables (or nested set if you search for in in Wikipedia) for the user groups table. The numbers inside the boxes are the ids (not relevant for the nested set). Left and right beside the boxes are the lft and rgt values. The thin arrows show how they are incremented. The level can be seen by the tree structure.

usergroup-tree-calculation

Maybe that helps you to fix your base.sql changes. I know it is some work to manually do that, and if you need help I can help when I find the time. But maybe you can fix it yourself with the above information.

avatar muhme
muhme - comment - 1 Sep 2024

Drone is still failing. Any ideas @muhme?

@Elfangor93 What I see in drone logs is that for the phpmin-system-mysql all test specs passed. I can reproduce this with JBT, installation with mysqli is working and all test specs passed:

scripts/create.sh 52 https://github.com/Elfangor93/joomla-cms:mod_community_info mysqli
scripts/test.sh

Drone log problem is in phpmax-system-postgres. Already the Joomla Installation with postgresql fails with:

42601, 7, ERROR: VALUES lists must all be the same length LINE 28: (0, 'mod_community_info', 'module', 'mod_community_info', ''... ^

Tested with the following (additionally opened the Cypress GUI to be able to copy and paste the error that can already be seen on the screenshot):

scripts/create.sh 52 https://github.com/Elfangor93/joomla-cms:mod_community_info pgsql
scripts/cypress.sh 52 local

Therefore the problem is not in System Tests, it is in the PostgreSQL scripts.

avatar richard67
richard67 - comment - 1 Sep 2024

Drone log problem is in phpmax-system-postgres. Already the Joomla Installation with postgresql fails with:

42601, 7, ERROR: VALUES lists must all be the same length LINE 28: (0, 'mod_community_info', 'module', 'mod_community_info', ''... ^

Therefore the problem is not in System Tests, it is in the PostgreSQL scripts.

@muhme Thanks for the hint. I should have seen that when reviewing the base.sql for PostgreSQL. Seems I need either glasses or more coffee. This will be fixed with my code change suggestion.

avatar dgrammatiko
dgrammatiko - comment - 1 Sep 2024

@Elfangor93 please remove the code for the debug part and all the console logs. It's like you're doing this in PHP

if (JDEBUG) {
  var_dump($this);
} else {
  /* some other code */
}

If you want to debug javascript there's the debugger statement which gives you all the step functionality and observability of the variables. Console logs are not for production...

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/debugger

avatar Elfangor93
Elfangor93 - comment - 2 Sep 2024

Console logs are not for production...

@dgrammatiko And what would be the equivalent of Joomla\CMS\Log\Log::add($txt, $priority);?
When I dont want to throw an error, but want to give some information why something is not wroking as expected?
As a website administrator, I would expect this kind of information to be found in the browser console, no?

In idea:
I could post the logging information with the help of com_ajax to the module helper and process them there with the help of the Joomla logger (Joomla\CMS\Log\Log). Would you like this approach more?

avatar dgrammatiko
dgrammatiko - comment - 2 Sep 2024

As a website administrator, I would expect this kind of information to be found in the browser console, no?

No, the developer should be able to work out the bug/error through the Error, no need to dump things in the console and also it'snot something that Joomla does either for JS or PHP!

And what would be the equivalent of Joomla\CMS\Log\Log::add($txt, $priority);?

That's not 1 to 1 to console.log. The equivalent of console.log in php is the var_dump. Why is it though so important to log something? Use the debugger statements when you developing/debugging the script you get way more power than console.log

Would you like this approach more?

The thing is that in Joomla we don't do any of that. The JS code is expected to be production grade (tested, debugged, etc) and personally I don't like the idea that there are code dumps in the client side. Anyways ask the maintainers, if they're ok probably you can do it (I'm not a maintainer).

avatar HLeithner
HLeithner - comment - 2 Sep 2024

This pull request has been automatically rebased to 5.3-dev.

avatar HLeithner HLeithner - change - 2 Sep 2024
Title
[5.2] Add community info module for admin dashboard
[5.3] Add community info module for admin dashboard
avatar HLeithner HLeithner - edited - 2 Sep 2024
avatar Elfangor93
Elfangor93 - comment - 2 Sep 2024

The thing is that in Joomla we don't do any of that. The JS code is expected to be production grade (tested, debugged, etc) and personally I don't like the idea that there are code dumps in the client side.

The module if fetching data asynchronous from openstreetmap to provide the manual location selection. If something fails during this fetch I would like to log something about the error.
External API: https://nominatim.openstreetmap.org/search.php

For all the rest I guess I can remove any reporting in the JS and add logging in the module helper instead.

avatar dgrammatiko
dgrammatiko - comment - 2 Sep 2024

@Elfangor93 all I'm saying is that we don't do such things with production code in this project...

avatar Elfangor93 Elfangor93 - change - 21 Sep 2024
Labels Added: Feature PR-5.3-dev
Removed: PR-5.2-dev
avatar Elfangor93
Elfangor93 - comment - 21 Sep 2024

I've also had again a quick look on the base.sql files and have noticed that some lft and rgt values where not increased where they should have been increased.

@richard67 I hope, I catched now all of them and the insert statement is now correct. Thanks for helping me with this!

avatar brianteeman
brianteeman - comment - 22 Sep 2024

There are still a lot of code issues with this PR but I think its really unfair to keep asking for changes if this has no chance of being accepted.

Add a Comment

Login with GitHub to post a comment