Skip to content
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

Conversation

fiqare-emergya-dev
Copy link
Contributor

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

Note: npm install is needed

fiqare-emergya-dev and others added 30 commits February 12, 2019 15:00
…js lib/models/entitiesStore.js lib/models/paths.js lib/models/postAction.js lib/models/rules.js lib/models/visualRules.js lib/myutils.js
@@ -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));
Copy link
Member

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?

Copy link
Member

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

Copy link
Member

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.

@@ -0,0 +1,74 @@
# Development documentation (Third Iteration)
Copy link
Member

@fgalan fgalan Dec 18, 2019

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.

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in ce583be

@fgalan
Copy link
Member

fgalan commented Jan 7, 2020

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?

@fiqare-emergya-dev
Copy link
Contributor Author

I've already reviewed the comment threads.

Comment on lines -34 to +33
var transporter = nodemailer.createTransport(smtpTransport(config.smtp));
var transporter = nodemailer.createTransport(config.smtp);
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. NTC.

@@ -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) => {
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 9c80eb9

@@ -33,7 +33,8 @@ var util = require('util'),
actions = require('./actions'),
namePattern = /^[a-zA-Z0-9_-]+$/,
MaxNameLength = 50,
errors = {};
errors = {},
logger = require('logops');
Copy link
Member

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).

Copy link
Contributor Author

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)
Copy link
Member

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

Copy link
Contributor Author

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",
Copy link
Member

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)

Copy link
Contributor Author

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

@fgalan
Copy link
Member

fgalan commented Jan 14, 2020

I have done a new review round. Please, find my new comments in the PR.

In addition to them, a couple of additional comments:

  • It would be great if you could squash & rebase your PR to pass from 107 commits to 1 commit (or a small number)
  • Review Travis CI results, as it seems the PR is not passing the tests

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
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 210813b

@@ -97,7 +97,7 @@ function search(rule, callback) {

function findAll(service, subservice, callback) {
var criterion = {};

Copy link
Member

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.

Copy link
Contributor Author

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');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pjson = require('./package.json');
pjson = require('../package.json');

Not sure, please check.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is correct

Copy link
Member

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) || {};

Copy link
Member

@fgalan fgalan Jan 30, 2020

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 

Copy link
Contributor Author

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);
Copy link
Member

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

Copy link
Member

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)

Comment on lines 191 to 192
} else {
callback(err, data);
}
callback(err, data);
Copy link
Member

@fgalan fgalan Feb 6, 2020

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in c29e89f

@fgalan fgalan changed the base branch from master to hardening/fiqare-perseo-fe-improvements-prelanding February 6, 2020 08:30
Copy link
Member

@fgalan fgalan left a 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.

@fgalan fgalan merged commit 4877a73 into telefonicaid:hardening/fiqare-perseo-fe-improvements-prelanding Feb 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants