Coder Social home page Coder Social logo

mraible / 21-points Goto Github PK

View Code? Open in Web Editor NEW
285.0 28.0 134.0 42.95 MB

❤️ 21-Points Health is an app you can use to monitor your health.

Home Page: http://www.21-points.com

JavaScript 0.51% Java 41.84% HTML 13.90% CSS 0.29% TypeScript 42.13% Shell 0.21% Dockerfile 0.11% SCSS 0.91% Procfile 0.01% Batchfile 0.08%
jhipster spring-boot angular webpack gradle java typescript health bootstrap

21-points's Introduction

21-Points Health

Build Status Known Vulnerabilities

To track your health and improve your life. 😊

This application was generated using JHipster 7.9.3, and serves as the sample application in the JHipster Mini-Book.

Project Structure

Node is required for generation and recommended for development. package.json is always generated for a better development experience with prettier, commit hooks, scripts and so on.

In the project root, JHipster generates configuration files for tools like git, prettier, eslint, husky, and others that are well known and you can find references in the web.

/src/* structure follows default Java structure.

  • .yo-rc.json - Yeoman configuration file JHipster configuration is stored in this file at generator-jhipster key. You may find generator-jhipster-* for specific blueprints configuration.

  • .yo-resolve (optional) - Yeoman conflict resolver Allows to use a specific action when conflicts are found skipping prompts for files that matches a pattern. Each line should match [pattern] [action] with pattern been a Minimatch pattern and action been one of skip (default if ommited) or force. Lines starting with # are considered comments and are ignored.

  • .jhipster/*.json - JHipster entity configuration files

  • npmw - wrapper to use locally installed npm. JHipster installs Node and npm locally using the build tool by default. This wrapper makes sure npm is installed locally and uses it avoiding some differences different versions can cause. By using ./npmw instead of the traditional npm you can configure a Node-less environment to develop or test your application.

  • /src/main/docker - Docker configurations for the application and services that the application depends on

Development

Before you can build this project, you must install and configure the following dependencies on your machine:

  1. Node.js: We use Node to run a development web server and build the project. Depending on your system, you can install Node either from source or as a pre-packaged bundle.

After installing Node, you should be able to run the following command to install development tools. You will only need to run this command when dependencies change in package.json.

npm install

We use npm scripts and Angular CLI with Webpack as our build system.

Run the following commands in two separate terminals to create a blissful development experience where your browser auto-refreshes when files change on your hard drive.

./gradlew -x webapp
npm start

Npm is also used to manage CSS and JavaScript dependencies used in this application. You can upgrade dependencies by specifying a newer version in package.json. You can also run npm update and npm install to manage dependencies. Add the help flag on any command to see how you can use it. For example, npm help update.

The npm run command will list all of the scripts available to run for this project.

PWA Support

JHipster ships with PWA (Progressive Web App) support, and it's turned off by default. One of the main components of a PWA is a service worker.

The service worker initialization code is disabled by default. To enable it, uncomment the following code in src/main/webapp/app/app.module.ts:

ServiceWorkerModule.register('ngsw-worker.js', { enabled: false }),

Managing dependencies

For example, to add Leaflet library as a runtime dependency of your application, you would run following command:

npm install --save --save-exact leaflet

To benefit from TypeScript type definitions from DefinitelyTyped repository in development, you would run following command:

npm install -D --save-exact @types/leaflet

Then you would import the JS and CSS files specified in library's installation instructions so that Webpack knows about them: Edit src/main/webapp/app/app.module.ts file:

import 'leaflet/dist/leaflet.js';

Edit src/main/webapp/content/scss/vendor.scss file:

@import '~leaflet/dist/leaflet.css';

Note: There are still a few other things remaining to do for Leaflet that we won't detail here.

For further instructions on how to develop with JHipster, have a look at Using JHipster in development.

Using Angular CLI

You can also use Angular CLI to generate some custom client code.

For example, the following command:

ng generate component my-component

will generate few files:

create src/main/webapp/app/my-component/my-component.component.html
create src/main/webapp/app/my-component/my-component.component.ts
update src/main/webapp/app/app.module.ts

JHipster Control Center

JHipster Control Center can help you manage and control your application(s). You can start a local control center server (accessible on http://localhost:7419) with:

docker-compose -f src/main/docker/jhipster-control-center.yml up

Building for production

Packaging as jar

To build the final jar and optimize the TwentyOnePoints application for production, run:

./gradlew -Pprod clean bootJar

This will concatenate and minify the client CSS and JavaScript files. It will also modify index.html so it references these new files. To ensure everything worked, run:

java -jar build/libs/*.jar

Then navigate to http://localhost:8080 in your browser.

Refer to Using JHipster in production for more details.

Packaging as war

To package your application as a war in order to deploy it to an application server, run:

./gradlew -Pprod -Pwar clean bootWar

Testing

To launch your application's tests, run:

./gradlew test integrationTest jacocoTestReport

Client tests

Unit tests are run by Jest. They're located in src/test/javascript/ and can be run with:

npm test

UI end-to-end tests are powered by Cypress. They're located in src/test/javascript/cypress and can be run by starting Spring Boot in one terminal (./gradlew bootRun) and running the tests (npm run e2e) in a second one.

Lighthouse audits

You can execute automated [lighthouse audits][https://developers.google.com/web/tools/lighthouse/] with [cypress audits][https://github.com/mfrachet/cypress-audit] by running npm run e2e:cypress:audits. You should only run the audits when your application is packaged with the production profile. The lighthouse report is created in build/cypress/lhreport.html

For more information, refer to the Running tests page.

Code quality

Sonar is used to analyse code quality. You can start a local Sonar server (accessible on http://localhost:9001) with:

docker-compose -f src/main/docker/sonar.yml up -d

Note: we have turned off authentication in src/main/docker/sonar.yml for out of the box experience while trying out SonarQube, for real use cases turn it back on.

You can run a Sonar analysis with using the sonar-scanner or by using the gradle plugin.

Then, run a Sonar analysis:

./gradlew -Pprod clean check jacocoTestReport sonarqube

For more information, refer to the Code quality page.

Using Docker to simplify development (optional)

You can use Docker to improve your JHipster development experience. A number of docker-compose configuration are available in the src/main/docker folder to launch required third party services.

For example, to start a postgresql database in a docker container, run:

docker-compose -f src/main/docker/postgresql.yml up -d

To stop it and remove the container, run:

docker-compose -f src/main/docker/postgresql.yml down

You can also fully dockerize your application and all the services that it depends on. To achieve this, first build a docker image of your app by running:

npm run java:docker

Or build an arm64 docker image when using an arm64 processor os like macOS with M1 processor family running:

npm run java:docker:arm64

Then run:

docker-compose -f src/main/docker/app.yml up -d

When running Docker Desktop on MacOS Big Sur or later, consider enabling experimental Use the new Virtualization framework for better processing performance (disk access performance is worse).

For more information refer to Using Docker and Docker-Compose, this page also contains information on the docker-compose sub-generator (jhipster docker-compose), which is able to generate docker configurations for one or several JHipster applications.

Continuous Integration (optional)

To configure CI for your project, run the ci-cd sub-generator (jhipster ci-cd), this will let you generate configuration files for a number of Continuous Integration systems. Consult the Setting up Continuous Integration page for more information.

21-points's People

Contributors

dependabot[bot] avatar ghanquez avatar github-actions[bot] avatar imgbot[bot] avatar mraible avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

21-points's Issues

The drinking thing..

This is probably just me and my lack of never having learnt a proper english.

If the ultimate target is to reach 21 points then I would have to enjoy a nice dark ale all 7 days in the week to get to the max of 7 x 3 points. Probably not the most healthy option ;-) and during summer time I would not mind.

Maybe it's just a matter of wording.
What about changing the question from "Did you drink?" to "No alcohol consumed?"?

Otherwise not checking the checkbox "Did you drink?" should count as a good thing and add to the total points.

Failed to sign in

Hello,
I’m not able to sign in. After the registration page, I click on the URL, then I input the correct password but always the same error message “Failed to sign in! Please check your credentials and try again.”
I had the same error trying to resetting the password.

BR

How to enable ripple effect for the buttons?

After we add bootstrap-material-design the ripples.css and ripple.js are already included on the project, but still cannot make the buttons have ripple effect. How to enable ripple effect for the buttons?

translation-not-found

Adding preferences, if Weekly Points Goal is below min required value (10) the error message "translation-not-found[error.Min]" is shown. It seems that there should be a i18n message for "error.Min" key.
The same happens with "error.Max" if value above defined maximum (21).

Seems like jhipster does not generate those messages and some manual steps must be done on applications using Min and Max validations.

PS: Project just downloaded from repo, built and run.

Screen-shots attached with the problematic messages.
screenshot from 2018-03-09 10-03-11
screenshot from 2018-03-09 10-10-48

CRUD on same window

Thanks for develop 21 Points based on JHipster, incredible sample thought !

For CRUD I'd like conventional window, which it using same window with parent instead of a pop-up window.
Could you show me how to doing this ?

thanks in advance @mraible

questions about front end

I have 2 questions:

  1. Why is pointsListModification only broadcast from the PointsDeleteDialog component? Should it be broadcast elsewhere too? (for example in create() in PointsService)?

  2. I am trying to understand how the content in home.component.html is shown when the application is accessed initially. I don't see a route for it in app-routing.module.ts and I don't see a jhi-home tag in any of the html templates. How does this work?

Error starting Tomcat

I've had some sucess with jhipster building a couple of small demos yet I am having trouble building 21points.

29> ./gradlew
:generateMainMapperClasses
:compileJava
:compileScala UP-TO-DATE
:bower
:processResources
:classes
:findMainClass
:bootRun
[INFO] org.jhipster.health.Application - Starting Application on MainMac.local with PID 70659 (/Users/mattkraus/web/21-points/build/classes/main started by mattkraus in /Users/mattkraus/web/21-points)
[DEBUG] org.jhipster.health.Application - Running with Spring Boot v1.2.5.RELEASE, Spring v4.1.7.RELEASE
[DEBUG] org.jboss.logging - Logging Provider: org.jboss.logging.Slf4jLoggerProvider
[DEBUG] org.jhipster.health.config.AsyncConfiguration - Creating Async Task Executor
[DEBUG] org.jhipster.health.config.MetricsConfiguration - Registering JVM gauges
[INFO] org.jhipster.health.config.MetricsConfiguration - Initializing Metrics JMX reporting
[DEBUG] org.jhipster.health.config.DatabaseConfiguration - Configuring Datasource
[ERROR] org.springframework.boot.context.embedded.tomcat.TomcatStarter - Error starting Tomcat context: org.springframework.beans.factory.BeanCreationException
[WARN] org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext - Exception encountered during context initialization - cancelling refresh attempt
org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:133) [spring-boot-1.2.5.RELEASE.jar:1.2.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:474) ~[spring-context-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) [spring-boot-1.2.5.RELEASE.jar:1.2.5.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:686) [spring-boot-1.2.5.RELEASE.jar:1.2.5.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:320) [spring-boot-1.2.5.RELEASE.jar:1.2.5.RELEASE]
at org.jhipster.health.Application.main(Application.java:72) [main/:na]
Caused by: org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.initialize(TomcatEmbeddedServletContainer.java:98) ~[spring-boot-1.2.5.RELEASE.jar:1.2.5.RELEASE]
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.(TomcatEmbeddedServletContainer.java:75) ~[spring-boot-1.2.5.RELEASE.jar:1.2.5.RELEASE]
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getTomcatEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:378) ~[spring-boot-1.2.5.RELEASE.jar:1.2.5.RELEASE]
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getEmbeddedServletCr(TomcatEmbeddedServletContainerFactory.java:155) ~[spring-boot-1.2.5.RELEASE.jar:1.2.5.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:157) [spring-boot-1.2.5.RELEASE.jar:1.2.5.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:130) [spring-boot-1.2.5.RELEASE.jar:1.2.5.RELEASE]
... 5 common frames omitted

Line 72 in Application.java is: Environment env = app.run(args).getEnvironment();
/**
* Main method, used to run the application.
*/
public static void main(String[] args) throws UnknownHostException {
SpringApplication app = new SpringApplication(Application.class);
app.setShowBanner(false);
SimpleCommandLinePropertySource source = new SimpleCommandLinePropertySource(args);
addDefaultProfile(app, source);
addLiquibaseScanPackages();
Environment env = app.run(args).getEnvironment();// Line 72
log.info("Access URLs:\n----------------------------------------------------------\n\t" +
"Local: \t\thttp://127.0.0.1:{}\n\t" +
"External: \thttp://{}:{}\n----------------------------------------------------------",
env.getProperty("server.port"),
InetAddress.getLocalHost().getHostAddress(),
env.getProperty("server.port"));

}

https://spring.io/blog/2014/03/07/deploying-spring-boot-applications
When you run your application, Spring Boot will detect that you have a Spring MVC controller and start up an embedded Apache Tomcat 7 instance, by default.

From IntelliJ, 61 tests pass successfully.

I'm on OS X v10.11.1.

Thanks

User Registration doesn't work

Hi Matt

Thanks for your wonderful demo about the JHipster project. Just want to let you know that the User registration doesn't work online.

I will try to go through the code and find out. But you may be able to fix it quicker :)

image

Registration takes too long to complete

This happens on Heroku:

#!shell
2015-09-28T22:48:48.266121+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=POST path="/api/register?cacheBuster=1443480498251" host=www.21-points.com request_id=3f3f9c84-592a-43b5-b2d0-f7338dbd3e96 fwd="50.205.250.184" dyno=web.1 connect=1ms service=30000ms status=503 bytes=0

I clicked register a 2nd time and it gave me a duplicate key error, implying that the first time actually did work. Then I received an activation email about a minute later. Investigate to see why registration is taking so long.
Screen Shot 2015-09-28 at 6.48.33 PM.png


Timestamps on weight and blood pressure screens are in UTC

The value stored in the database is 2018-11-13 13:06:00. However, the same value returned from the API on 21-points.com is "timestamp":"2018-11-13T13:06:00Z". When I run things locally, the value is "timestamp":"2018-11-13T13:06:00-07:00". It seems I might need to change something on the server so it doesn't add the timezone.

Search function exposes data leakage and a security issue

Hi Matt,

First of all, good work on 21-points. Been using your project to learn up on JHipster and it really helps.

Anyway, was going through the code and it occurred to me that even if I'm logged in as myself (john), and if I go to "Daily Points" and do a search with the following search parameter - o*, all points that match that parameter will appear. Not just mine. (See screenshot below)

screenshot 2018-10-27 at 12 19 47 am

I was even able to edit the fields of a Point entry that belongs to others and save successfully. (I reverted what I edited so as not to tamper with other user's data).

So there are 2 issues here -

  1. Searching allows a user to search for all items that belongs to all users; not just himself/herself (Not sure how to fix this)
  2. Once I was able to see other user's data, I was able to edit and save successfully. (Should be easily fixable)

duplicate key value violates unique constraint "pk_jhi_persistent_audit_event"

Login and registration fail every-so-often and it seems to be caused by the sequence keys in some of the auditing tables:

2017-12-19T02:44:25.564551+00:00 app[web.1]: 2017-12-19 02:44:25.564  WARN 4 --- [ XNIO-2 task-26] o.h.engine.jdbc.spi.SqlExceptionHelper   : SQL Error: 0, SQLState: 23505
2017-12-19T02:44:25.564734+00:00 app[web.1]: 2017-12-19 02:44:25.564 ERROR 4 --- [ XNIO-2 task-26] o.h.engine.jdbc.spi.SqlExceptionHelper   : ERROR: duplicate key value violates unique constraint "pk_jhi_persistent_audit_event"
2017-12-19T02:44:25.564737+00:00 app[web.1]:   Detail: Key (event_id)=(42094) already exists.
2017-12-19T02:44:25.565215+00:00 app[web.1]: 2017-12-19 02:44:25.565 ERROR 4 --- [ XNIO-2 task-26] o.h.i.ExceptionMapperStandardImpl        : HHH000346: Error during managed flush [org.hibernate.exception.ConstraintViolationException: could not execute statement]
2017-12-19T02:44:25.567741+00:00 app[web.1]: 2017-12-19 02:44:25.567 ERROR 4 --- [ XNIO-2 task-26] o.j.h.w.rest.errors.ExceptionTranslator  : An unexpected error occurred: could not execute statement; SQL [n/a]; constraint [pk_jhi_persistent_audit_event]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement
2017-12-19T02:44:27.820781+00:00 heroku[web.1]: Process running mem=523M(102.1%)
2017-12-19T02:44:27.820897+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2017-12-19T02:44:25.571359+00:00 heroku[router]: at=info method=POST path="/api/authenticate" host=www.21-points.com request_id=b54f7527-7479-42ee-acaa-d6794567c118 fwd="75.171.150.21" dyno=web.1 connect=0ms service=156ms status=500 bytes=550 protocol=https

Question posted to Stack Overflow on December 19, 2017.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.