Fiqare perseo-fe improvements#419
Conversation
Merge by Jenkins
…js lib/models/entitiesStore.js lib/models/paths.js lib/models/postAction.js lib/models/rules.js lib/models/visualRules.js lib/myutils.js
Merge by Jenkins
Merge by Jenkins
Merge by Jenkins
Merge by Jenkins
Merge by Jenkins
Merge by Jenkins
Merge by Jenkins
Merge by Jenkins
| return myutils.respond(resp, err, data); | ||
| } | ||
| if (data && data.name) { | ||
| //resp.location(req.url.replace(new RegExp(req.params.id), '')+encodeURIComponent(data.name)); |
There was a problem hiding this comment.
@AlvaroVega maybe this is an old leftover? It's a good idea to remove it?
documentation/eslint.md
Outdated
| @@ -0,0 +1,74 @@ | |||
| # Development documentation (Third Iteration) | |||
There was a problem hiding this comment.
Not sure of understanding the purpose of this file...
Apart from the title (what is "third iteration"? maybe it makes sense in the context of fiQare project, but not this repo is project-agnostic), this seem to be just a description of eslint based on standard content.
I mean, I could understand a replacmente of jslint with eslint, as for instance is done by PR telefonicaid/iotagent-ul#408 in the case of IOTA-UL (although not in the scope of this PR but in a new one). However just including a piece of documentation about eslint in the repository doesn't have too much sense to me.
Maybe I'm not getting the point or something. Could you elaborate on this? If it is easier for you, you can tell me by email.
There was a problem hiding this comment.
This is a style guide made for the Fiqare project, if it is not useful for Perseo Front or for future developers we remove it from the PR.
There was a problem hiding this comment.
Yes, it seems to be too much fiQare-specific... Removing it from the PR sounds good to me.
|
At the present moment (January 7th, 2019), there are some comment threads (at least three) not yet answered/fixed so I understand the work on this PR is ongoing. @fiqare-emergya-dev, is my understanding correct? |
|
I've already reviewed the comment threads. |
| var transporter = nodemailer.createTransport(smtpTransport(config.smtp)); | ||
| var transporter = nodemailer.createTransport(config.smtp); |
There was a problem hiding this comment.
Why this change (along with the removal in L28) is actually needed?
There was a problem hiding this comment.
The function createTransport accepts the configuration as a string, so the deleted var in L28 was no necessary and redundant.
lib/models/emailAction.js
Outdated
| metrics.IncMetrics(event.service, event.subservice, metrics.actionEmail); | ||
|
|
||
| transporter.sendMail(mailOptions, function(err, info) { | ||
| transporter.sendMail(mailOptions, (err, info) => { |
There was a problem hiding this comment.
I understand the preferred code style is currently function(error,info) over (err, info) =>, so this change probably should be rolled-back.
lib/models/rules.js
Outdated
| MaxNameLength = 50, | ||
| errors = {}; | ||
| errors = {}, | ||
| logger = require('logops'); |
There was a problem hiding this comment.
Better to have all the require() together. Pleace move up (just afeter actions declaration).
lib/perseo.js
Outdated
| swagger: '2.0', // Specification (optional, defaults to swagger: '2.0') | ||
| info: { | ||
| title: 'Perseo Front-End', // Title (required) | ||
| version: '1.7.0-fiqare' // Version (required) |
There was a problem hiding this comment.
This should be got from packages.json
| "nodemailer-smtp-transport": "~0.1.13", | ||
| "request": "2.88.0", | ||
| "smpp": "0.3.1", | ||
| "swagger-jsdoc": "~3.4.0", |
There was a problem hiding this comment.
documentation/development.md documentation should be modified to include a section about swagger (similar to what it has been done i n telefonicaid/iotagent-ul#412)
|
I have done a new review round. Please, find my new comments in the PR. In addition to them, a couple of additional comments:
Thanks! |
README.md
Outdated
| > does not need to be released as under the same license, or even released as open source. | ||
|
|
||
|
|
||
| ## User & Programmers Manual |
There was a problem hiding this comment.
I think README.md file is not the right place to include this. In addition, it should be simplified: you have already included the needed packages in packages.json and so on, so please focus just in the usage.
In sum, It should be included in development.md, just after the last item (Prettify Code) and be like this:
### Swagger
In order to run Swagger, you need to execute the Perseo FE (as explained [here](deployment.md) and then you
can access to:
<server_host>:9090/api-docs
The swagger documentation provided at /api-docs covers all the HTTP endpoint exposed by Perseo FE.
lib/models/rulesStore.js
Outdated
| function findAll(service, subservice, callback) { | ||
| var criterion = {}; | ||
|
|
||
There was a problem hiding this comment.
Remove this extra whitespace, pls.
lib/perseo.js
Outdated
| d = domain.create(), | ||
| swaggerJsdoc = require('swagger-jsdoc'), | ||
| swaggerUi = require('swagger-ui-express'), | ||
| pjson = require('./package.json'); |
There was a problem hiding this comment.
| pjson = require('./package.json'); | |
| pjson = require('../package.json'); |
Not sure, please check.
There was a problem hiding this comment.
it is correct
| function raise(alarm, context, message) { | ||
| var state = alarms[alarm]; | ||
| context = (process.domain && process.domain.context) || {}; | ||
|
|
There was a problem hiding this comment.
CHANGES_NEXT_RELEASE entries should be added regarding the changes in this documentation. Suggestion:
- Add: /api-docs endpoint providing swagger-based documentation of the HTTP endpoints exposed by Perseo FE
- Hardening: software quality improvement based on ISO25010 recommendations
| should.equal(m.services.unknownt.sum.actionEntityUpdate, 1); | ||
| should.equal(m.services.unknownt.sum.okActionEntityUpdate, 0); | ||
| should.equal(m.services.unknownt.sum.failedActionEntityUpdate, 1); | ||
| should.equal(m.services.unknownt.sum.failedActionEntityUpdate, 0); |
There was a problem hiding this comment.
In order not disturb @fiqare-emergya-dev (a conflict will happen when #425 gets merged), let's keep as it is now in this PR. I'll fix it in the prelanding branch (hardening/fiqare-perseo-fe-improvements-prelanding)
NTC (just informative)
lib/models/updateAction.js
Outdated
| } else { | ||
| callback(err, data); | ||
| } | ||
| callback(err, data); |
There was a problem hiding this comment.
I think this change is not correct... the callback() needs to be changed in any case and, after this change, it is only called when the execution flow goes by the "else" part.
fgalan
left a comment
There was a problem hiding this comment.
LGTM. Thanks for your contribution and your effort along the several review rounds! :)
A PR will follow to this one for the definitive merge into master, after some minor adaptations.
4877a73
into
telefonicaid:hardening/fiqare-perseo-fe-improvements-prelanding
This pull request contains the improvements made by the Emergya team for perseo-fe. These improvements are part of the fiQare project, which is based on ISO 25010 to improve software quality. More info: https://fiqare.eu/
Changes related to variable changes have been removed in this PR.
Swagger is provided for HTTP protocol in:
<server_host>:9090/api-docs