Skip to content

Commit

Permalink
Merge pull request #7 from jhipster/master
Browse files Browse the repository at this point in the history
Update fork
  • Loading branch information
pmverma authored Aug 14, 2019
2 parents dbe73f4 + 7179b7a commit 47594ff
Show file tree
Hide file tree
Showing 94 changed files with 645 additions and 360 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ services:
- docker
language: node_js
node_js:
- '10.16.0'
- '10.16.2'
addons:
apt:
sources:
Expand All @@ -42,7 +42,7 @@ env:
- JHI_JDK=8
# if JHI_LIB_BRANCH value is release, use the release from Maven
- JHI_LIB_REPO=https://github.com/jhipster/jhipster.git
- JHI_LIB_BRANCH=release
- JHI_LIB_BRANCH=master
# if JHI_GEN_BRANCH value is release, use the release from NPM
- JHI_GEN_REPO=https://github.com/jhipster/generator-jhipster.git
- JHI_GEN_BRANCH=master
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ RUN \
apt-get install -y openjdk-11-jdk && \
update-java-alternatives -s java-1.11.0-openjdk-amd64 && \
# install node.js
wget https://nodejs.org/dist/v10.16.0/node-v10.16.0-linux-x64.tar.gz -O /tmp/node.tar.gz && \
wget https://nodejs.org/dist/v10.16.2/node-v10.16.2-linux-x64.tar.gz -O /tmp/node.tar.gz && \
tar -C /usr/local --strip-components 1 -xzf /tmp/node.tar.gz && \
# upgrade npm
npm install -g npm && \
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ Support this project by becoming a sponsor! [Become a sponsor](https://opencolle

[![Clay][clay-image]][clay-url]

[![UX Planet][uxplanet-image]][uxplanet-url]

[![PapersOwl][papersowl-image]][papersowl-url]

**Thank you to all our backers!**

[![Backers][backers-image]][backers-url]
Expand Down Expand Up @@ -121,6 +125,10 @@ Additional builds at [hipster-labs/jhipster-daily-builds](https://github.com/hip
[blokt-url]: https://blokt.com/
[clay-image]: https://www.jhipster.tech/images/open-collective/clay.png
[clay-url]: https://clay.global/
[uxplanet-image]: https://www.jhipster.tech/images/open-collective/uxplanet.png
[uxplanet-url]: https://uxplanet.org/
[papersowl-image]: https://www.jhipster.tech/images/open-collective/papersowl.png
[papersowl-url]: https://papersowl.com/
[issue-template]: https://github.com/jhipster/generator-jhipster/issues/new?template=BUG_REPORT.md
[feature-template]: https://github.com/jhipster/generator-jhipster/issues/new?template=FEATURE_REQUEST.md
[npmcharts-image]: https://img.shields.io/npm/dm/generator-jhipster.svg?label=Downloads&style=flat
Expand Down
4 changes: 2 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
JHI_JDK: 11
# if JHI_LIB_BRANCH value is release, use the release from Maven
JHI_LIB_REPO: https://github.com/jhipster/jhipster.git
JHI_LIB_BRANCH: release
JHI_LIB_BRANCH: master
# if JHI_GEN_BRANCH value is release, use the release from NPM
JHI_GEN_REPO: https://github.com/jhipster/generator-jhipster.git
JHI_GEN_BRANCH: master
Expand Down Expand Up @@ -90,7 +90,7 @@ jobs:
#----------------------------------------------------------------------
- task: NodeTool@0
inputs:
versionSpec: '10.16.0'
versionSpec: '10.16.2'
displayName: 'TOOLS: install Node.js'
- script: |
if [[ $JHI_JDK = '11' ]]; then
Expand Down
38 changes: 27 additions & 11 deletions generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -515,18 +515,34 @@ module.exports = class extends BaseGenerator {
const done = this.async();
this.isGitInstalled(code => {
if (code === 0 && this.gitInitialized) {
this.gitExec('add -A', { trace: false }, () => {
let commitMsg = `Initial application generated by JHipster-${this.jhipsterVersion}`;
if (this.blueprints && this.blueprints.length > 0) {
const bpInfo = this.blueprints
.map(bp => `${bp.name.replace('generator-jhipster-', '')}-${bp.version}`)
.join(', ');
commitMsg += ` with blueprints: ${bpInfo}`;
this.gitExec('log --oneline -n 1 -- .', { trace: false }, (code, commits) => {
if (code !== 0 || !commits || !commits.trim()) {
// if no files in Git from current folder then we assume that this is initial application generation
this.gitExec('add .', { trace: false }, () => {
let commitMsg = `Initial version of ${this.baseName} generated by JHipster-${this.jhipsterVersion}`;
if (this.blueprints && this.blueprints.length > 0) {
const bpInfo = this.blueprints
.map(bp => `${bp.name.replace('generator-jhipster-', '')}-${bp.version}`)
.join(', ');
commitMsg += ` with blueprints: ${bpInfo}`;
}
this.gitExec(`commit -m "${commitMsg}" -- .`, { trace: false }, () => {
this.log(chalk.green.bold(`Application successfully committed to Git from ${process.cwd()}.`));
done();
});
});
} else {
// if found files in Git from current folder then we assume that this is application regeneration
// if there are changes in current folder then inform user about manual commit needed
this.gitExec('diff --name-only .', { trace: false }, (code, diffs) => {
if (code === 0 && diffs && diffs.trim()) {
this.log(
`Found commits in Git from ${process.cwd()}. So we assume this is application regeneration. Therefore automatic Git commit is not done. You can do Git commit manually.`
);
}
done();
});
}
this.gitExec(`commit -am "${commitMsg}"`, { trace: false }, () => {
this.log(chalk.green.bold('Application successfully committed to Git.'));
done();
});
});
} else {
this.warning(
Expand Down
5 changes: 1 addition & 4 deletions generators/ci-cd/templates/travis.yml.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,12 @@
-%>
os:
- linux
dist: bionic
services:
- docker
language: node_js
node_js:
- "<%= NODE_VERSION %>"
jdk:
- oraclejdk8
sudo: false
cache:
directories:
- node
Expand All @@ -46,7 +44,6 @@ env:
- JHI_DISABLE_WEBPACK_LOGS=true
- NG_CLI_ANALYTICS="false"
before_install:
- jdk_switcher use oraclejdk8
- java -version
- sudo /etc/init.d/mysql stop
- sudo /etc/init.d/postgresql stop
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
-%>
import { Component, OnInit, OnDestroy } from '@angular/core';
import { HttpResponse } from '@angular/common/http';
import { Subscription } from 'rxjs';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';

<%_ if (prodDatabaseType !== 'cassandra') { _%>
Expand All @@ -41,8 +42,9 @@ export class UserMgmtComponent implements OnInit, OnDestroy {
users: User[];
error: any;
success: any;
userListSubscription: Subscription;
<%_ if (databaseType !== 'cassandra') { _%>
routeData: any;
routeData: Subscription;
links: any;
totalItems: any;
itemsPerPage: any;
Expand All @@ -67,10 +69,10 @@ export class UserMgmtComponent implements OnInit, OnDestroy {
<%_ if (databaseType !== 'cassandra') { _%>
this.itemsPerPage = ITEMS_PER_PAGE;
this.routeData = this.activatedRoute.data.subscribe((data) => {
this.page = data['pagingParams'].page;
this.previousPage = data['pagingParams'].page;
this.reverse = data['pagingParams'].ascending;
this.predicate = data['pagingParams'].predicate;
this.page = data.pagingParams.page;
this.previousPage = data.pagingParams.page;
this.reverse = data.pagingParams.ascending;
this.predicate = data.pagingParams.predicate;
});
<%_ } _%>
}
Expand All @@ -87,10 +89,13 @@ export class UserMgmtComponent implements OnInit, OnDestroy {
<%_ if (databaseType !== 'cassandra') { _%>
this.routeData.unsubscribe();
<%_ } _%>
if(this.userListSubscription) {
this.eventManager.destroy(this.userListSubscription);
}
}

registerChangeInUsers() {
this.eventManager.subscribe('userListModification', (response) => this.loadAll());
this.userListSubscription = this.eventManager.subscribe('userListModification', (response) => this.loadAll());
}

setActive(user, isActivated) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,15 @@ export class LoginService {
this.authServerProvider.logout().subscribe(response => {
const data = response.body;
let logoutUrl = data.logoutUrl;
const redirectUri = `${location.origin}${this.location.prepareExternalUrl('/')}`;

// if Keycloak, uri has protocol/openid-connect/token
if (logoutUrl.indexOf('/protocol') > -1) {
logoutUrl = logoutUrl + '?redirect_uri=' + window.location.origin;
logoutUrl = logoutUrl + '?redirect_uri=' + redirectUri;
} else {
// Okta
logoutUrl = logoutUrl + '?id_token_hint=' +
data.idToken + '&post_logout_redirect_uri=' + window.location.origin;
data.idToken + '&post_logout_redirect_uri=' + redirectUri;
}
window.location.href = logoutUrl;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
See the License for the specific language governing permissions and
limitations under the License.
-%>
import { Component, OnInit } from '@angular/core';
import { Component, OnInit<%_ if (authenticationType !== 'oauth2') { _%>, OnDestroy <%_ } _%> } from '@angular/core';
<%_ if (authenticationType !== 'oauth2') { _%>
import { Subscription } from 'rxjs';
import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
import { JhiEventManager } from 'ng-jhipster';
<%_ } _%>
Expand All @@ -32,9 +33,10 @@ import { <% if (authenticationType !== 'oauth2') { %>LoginModalService<% } else
]

})
export class HomeComponent implements OnInit {
export class HomeComponent implements OnInit <%_ if (authenticationType !== 'oauth2') { _%>, OnDestroy <%_ } _%> {
account: Account;
<%_ if (authenticationType !== 'oauth2') { _%>
authSubscription: Subscription;
modalRef: NgbModalRef;
<%_ } _%>

Expand All @@ -58,7 +60,7 @@ export class HomeComponent implements OnInit {
}

registerAuthenticationSuccess() {
this.eventManager.subscribe('authenticationSuccess', (message) => {
this.authSubscription = this.eventManager.subscribe('authenticationSuccess', (message) => {
this.accountService.identity().then((account) => {
this.account = account;
});
Expand All @@ -77,4 +79,12 @@ export class HomeComponent implements OnInit {
this.loginService.login();
<%_ }_%>
}

<%_ if (authenticationType !== 'oauth2') { _%>
ngOnDestroy() {
if(this.authSubscription) {
this.eventManager.destroy(this.authSubscription);
}
}
<%_ }_%>
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
limitations under the License.
-%>
<%_
const tsKeyId = generateTestEntityId(pkType, prodDatabaseType);
const tsKeyId = generateTestEntityId(pkType);
_%>
import { ComponentFixture, TestBed, async, inject, fakeAsync, tick } from '@angular/core/testing';
import { HttpResponse } from '@angular/common/http';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
limitations under the License.
-%>
<%_
const tsKeyId = generateTestEntityId(pkType, prodDatabaseType);
const tsKeyId = generateTestEntityId(pkType);
_%>
import { ComponentFixture, TestBed, async, inject, fakeAsync, tick } from '@angular/core/testing';
import { Observable, of } from 'rxjs';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import { MockActivatedRoute, MockRouter } from './helpers/mock-route.service';
import { MockActiveModal } from './helpers/mock-active-modal.service';
import { MockEventManager } from './helpers/mock-event-manager.service';
<%_
const tsKeyId = generateTestEntityId(pkType, prodDatabaseType);
const tsKeyId = generateTestEntityId(pkType);
_%>

@NgModule({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ const webpack = require('webpack');
const { BaseHrefWebpackPlugin } = require('base-href-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const rxPaths = require('rxjs/_esm5/path-mapping');
<%_ if (enableTranslation) { _%>
const MergeJsonWebpackPlugin = require("merge-jsons-webpack-plugin");
<%_ } if (buildTool === undefined) { _%>
Expand All @@ -33,9 +32,9 @@ module.exports = (options) => ({
resolve: {
extensions: ['.ts', '.js'],
modules: ['node_modules'],
mainFields: [ 'es2015', 'browser', 'module', 'main'],
alias: {
app: utils.root('<%= MAIN_SRC_DIR %>app/'),
...rxPaths()
app: utils.root('<%= MAIN_SRC_DIR %>app/')
}
},
stats: {
Expand Down
6 changes: 3 additions & 3 deletions generators/client/templates/react/package.json.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ limitations under the License.
"@types/jest": "24.0.11",
"@types/lodash": "4.14.123",
<%_ if (protractorTests) { _%>
"@types/mocha": "5.2.6",
"@types/mocha": "5.2.7",
<%_ } _%>
"@types/node": "10.14.3",
"@types/react": "16.8.10",
Expand All @@ -82,7 +82,7 @@ limitations under the License.
"@types/react-router-dom": "4.3.1",
"@types/redux": "3.6.31",
<%_ if (protractorTests) { _%>
"@types/selenium-webdriver": "3.0.15",
"@types/selenium-webdriver": "4.0.0",
<%_ } _%>
"@types/webpack-env": "1.13.9",
"autoprefixer": "9.5.0",
Expand Down Expand Up @@ -164,7 +164,7 @@ limitations under the License.
"tslint-react": "3.6.0",
"typescript": "3.3.4000",
<%_ if (protractorTests) { _%>
"webdriver-manager": "12.1.4",
"webdriver-manager": "12.1.5",
<%_ } _%>
"webpack": "4.28.4",
"webpack-cli": "3.3.0",
Expand Down
17 changes: 7 additions & 10 deletions generators/common/templates/README.md.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -131,20 +131,18 @@ security:
Create an OIDC App in Okta to get a `{clientId}` and `{clientSecret}`. To do this, log in to your Okta Developer account and navigate to **Applications** > **Add Application**. Click **Web** and click the **Next** button. Give the app a name you’ll remember, specify `http://localhost:8080` as a Base URI, and `http://localhost:8080/login/oauth2/code/oidc` as a Login Redirect URI. Click **Done**, then Edit and add `http://localhost:8080` as a Logout redirect URI. Copy and paste the client ID and secret into your `application.yml` file.
> **TIP:** If you want to use the [Ionic Module for JHipster](https://www.npmjs.com/package/generator-jhipster-ionic), you'll need to add `http://localhost:8100` as a **Login redirect URI** as well.
Create a `ROLE_ADMIN` and `ROLE_USER` group and add users into them. Modify e2e tests to use this account when running integration tests. You'll need to change credentials in `src/test/javascript/e2e/account/account.spec.ts` and `src/test/javascript/e2e/admin/administration.spec.ts`.
Navigate to **API** > **Authorization Servers**, click the **Authorization Servers** tab and edit the default one. Click the **Claims** tab and **Add Claim**. Name it "roles", and include it in the ID Token. Set the value type to "Groups" and set the filter to be a Regex of `.*`.
Navigate to **API** > **Authorization Servers**, click the **Authorization Servers** tab and edit the default one. Click the **Claims** tab and **Add Claim**. Name it "groups", and include it in the ID Token. Set the value type to "Groups" and set the filter to be a Regex of `.*`.
After making these changes, you should be good to go! If you have any issues, please post them to [Stack Overflow](https://stackoverflow.com/questions/tagged/jhipster). Make sure to tag your question with "jhipster" and "okta".
<%_ } _%>
### Service workers
### PWA Support
Service workers are commented by default, to enable them please uncomment the following code.
JHipster ships with PWA (Progressive Web App) support, and it's disabled by default. One of the main components of a PWA is a service worker.
* The service worker registering script in index.html
The service worker initialization code is commented out by default. To enable it, uncomment the following code in `src/main/webapp/index.html`:
```html
<script>
Expand All @@ -156,7 +154,7 @@ Service workers are commented by default, to enable them please uncomment the fo
</script>
```
Note: workbox creates the respective service worker and dynamically generate the `service-worker.js`
Note: [Workbox](https://developers.google.com/web/tools/workbox/) powers JHipster's service worker. It dynamically generates the `service-worker.js` file.
### Managing dependencies
Expand All @@ -180,13 +178,13 @@ Edit [<%= CLIENT_MAIN_SRC_DIR %>content/css/vendor.css](<%= CLIENT_MAIN_SRC_DIR
@import '~leaflet/dist/leaflet.css';
~~~
<%_ } _%>
Note: there are still few other things remaining to do for Leaflet that we won't detail here.
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][].
<%_ if (clientFramework === 'angularX' && applicationType !== 'microservice') { _%>
### Using angular-cli
### Using Angular CLI
You can also use [Angular CLI][] to generate some custom client code.
Expand All @@ -200,7 +198,6 @@ will generate few files:
create <%= CLIENT_MAIN_SRC_DIR %>app/my-component/my-component.component.ts
update <%= CLIENT_MAIN_SRC_DIR %>app/app.module.ts
<%_ } _%>
<%_ if (enableSwaggerCodegen) { _%>
### Doing API-First development using openapi-generator
Expand Down
Loading

0 comments on commit 47594ff

Please sign in to comment.