-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fiqare perseo-fe improvements #419
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
@@ -127,7 +127,6 @@ function PutVR(req, resp) { | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AlvaroVega maybe this is an old leftover? It's a good idea to remove it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it could be deleted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thus, change is fine. NTC.
documentation/eslint.md
Outdated
@@ -0,0 +1,74 @@ | |||
# Development documentation (Third Iteration) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it seems to be too much fiQare-specific... Removing it from the PR sounds good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in ce583be
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change (along with the removal in L28) is actually needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function createTransport accepts the configuration as a string, so the deleted var in L28 was no necessary and redundant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. NTC.
lib/models/emailAction.js
Outdated
@@ -50,7 +49,7 @@ function SendMail(action, event, callback) { | |||
|
|||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand the preferred code style is currently function(error,info)
over (err, info) =>
, so this change probably should be rolled-back.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 9c80eb9
lib/models/rules.js
Outdated
@@ -33,7 +33,8 @@ var util = require('util'), | |||
actions = require('./actions'), | |||
namePattern = /^[a-zA-Z0-9_-]+$/, | |||
MaxNameLength = 50, | |||
errors = {}; | |||
errors = {}, | |||
logger = require('logops'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to have all the require() together. Pleace move up (just afeter actions
declaration).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 9c80eb9
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be got from packages.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 9c80eb9
@@ -65,10 +65,12 @@ | |||
"nodemailer": "~1.11.0", | |||
"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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
readme.md updated in 9c80eb9
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
@@ -49,3 +49,28 @@ wish to make a clarifying public statement as follows: | |||
> incorporate enhancements is considered a derivative work of the product. Software that merely uses or aggregates (i.e. | |||
> links to) an otherwise unmodified version of existing software is not considered a derivative work, and therefore it | |||
> 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 210813b
lib/models/rulesStore.js
Outdated
@@ -97,7 +97,7 @@ function search(rule, callback) { | |||
|
|||
function findAll(service, subservice, callback) { | |||
var criterion = {}; | |||
|
|||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this extra whitespace, pls.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 210813b
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pjson = require('./package.json'); | |
pjson = require('../package.json'); |
Not sure, please check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is correct
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. Fixed in df81a41
@@ -30,6 +30,7 @@ var util = require('util'), | |||
function raise(alarm, context, message) { | |||
var state = alarms[alarm]; | |||
context = (process.domain && process.domain.context) || {}; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 210813b
@@ -226,13 +226,13 @@ describe('Metrics', function() { | |||
|
|||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is going to be handled in another PR: #425
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in c29e89f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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