Skip to content

Commit

Permalink
Merge pull request #50 from sonalake/feature/compatibility-5.7.1
Browse files Browse the repository at this point in the history
Feature/compatibility 5.7.1
  • Loading branch information
jduggan83 authored Dec 20, 2018
2 parents e898fa6 + 69b8885 commit b91934e
Show file tree
Hide file tree
Showing 33 changed files with 93 additions and 109 deletions.
4 changes: 2 additions & 2 deletions generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,9 @@ module.exports = JhipsterGenerator.extend({
partialFiles.angular.appLayoutsNavbarComponentTs(this)
);
this.rewriteFile(
`${this.webappDir}app/core/auth/principal.service.ts`,
`${this.webappDir}app/core/auth/account.service.ts`,
'getImageUrl(): string {',
partialFiles.angular.appSharedAuthPrincipalServiceTs(this)
partialFiles.angular.appAccountServiceTs(this)
);
this.rewriteFile(
`${this.webappDir}app/shared/index.ts`,
Expand Down
2 changes: 1 addition & 1 deletion generators/app/partials/angular/navbar.component.ts.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const tmpl = context => `has${context.tenantNameUpperFirst}() {
return this.principal.get${context.tenantNameUpperFirst}() ? true : false;
return this.accountService.get${context.tenantNameUpperFirst}() ? true : false;
}`;

module.exports = {
Expand Down
4 changes: 2 additions & 2 deletions generators/app/partials/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const appAdminIndexTs = require('./angular/admin-index.ts.js');
const appLayoutsNavbarComponentHtml = require('./angular/navbar.component.html.js');
const appLayoutsNavbarComponentTs = require('./angular/navbar.component.ts.js');
const appSharedAuthPrincipalServiceTs = require('./angular/principal.service.ts.js');
const appAccountServiceTs = require('./angular/account.service.ts.js');
const e2eAdminSpecTs = require('./angular/administration.spec.ts.js');
const userMgmtDialogComponentSpecTs = require('./angular/user-management-dialog.component.spec.ts.js');
const tenantResource = require('./server/_TenantResource.js');
Expand All @@ -12,7 +12,7 @@ module.exports = {
appAdminIndexTs: appAdminIndexTs.tmpl,
appLayoutsNavbarComponentHtml: appLayoutsNavbarComponentHtml.tmpl,
appLayoutsNavbarComponentTs: appLayoutsNavbarComponentTs.tmpl,
appSharedAuthPrincipalServiceTs: appSharedAuthPrincipalServiceTs.tmpl,
appAccountServiceTs: appAccountServiceTs.tmpl,
e2eAdminSpecTs: e2eAdminSpecTs.tmpl,
userMgmtDialogComponentSpecTs: userMgmtDialogComponentSpecTs.tmpl
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { JhiEventManager, JhiAlertService } from 'ng-jhipster';

import { <%= tenantNameUpperFirst %> } from './<%= tenantNameLowerFirst %>.model';
import { <%= tenantNameUpperFirst %>Service } from '../../shared';
import { Principal } from '../../core';
import { AccountService } from '../../core';
import { <%= tenantNameUpperFirst %>MgmtDeleteDialogComponent } from '../';

@Component({
Expand All @@ -58,7 +58,7 @@ export class <%= tenantNameUpperFirst %>MgmtComponent implements OnInit, OnDestr
constructor(
private <%= tenantNameLowerFirst %>Service: <%= tenantNameUpperFirst %>Service,
private alertService: JhiAlertService,
private principal: Principal,
private accountService: AccountService,
<%_ if (prodDatabaseType !== 'cassandra') { _%>
private parseLinks: JhiParseLinks,
private activatedRoute: ActivatedRoute,
Expand All @@ -79,7 +79,7 @@ export class <%= tenantNameUpperFirst %>MgmtComponent implements OnInit, OnDestr
}

ngOnInit() {
this.principal.identity().then(account => {
this.accountService.identity().then(account => {
this.currentAccount = account;
this.loadAll();
this.registerChangeIn<%= tenantNamePluralUpperFirst %>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@
-%>
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { <% if (enableTranslation) { %>JhiLanguageHelper,<% } %> User, UserService } from 'app/core';
import { <% if (enableTranslation) { %>JhiLanguageHelper,<% } %> User, UserService, AccountService } from 'app/core';
import { HttpResponse } from '@angular/common/http';

import { Principal } from '../../core';
import { <%= tenantNameUpperFirst %> } from './../<%= tenantNameLowerFirst %>-management/<%= tenantNameLowerFirst %>.model';
import { <%= tenantNameUpperFirst %>Service } from '../../shared';

Expand All @@ -45,10 +44,10 @@ export class UserMgmtUpdateComponent implements OnInit {
private userService: UserService,
private route: ActivatedRoute,
private router: Router,
private principal: Principal,
private accountService: AccountService,
private <%= tenantNameLowerFirst %>Service: <%= tenantNameUpperFirst %>Service
) {
this.principal.identity().then(account => {
this.accountService.identity().then(account => {
this.currentAccount = account;
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@
import { Injectable } from '@angular/core';
import { ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot } from '@angular/router';

import { Principal } from '../';
import { AccountService } from '../';
import { StateStorageService } from './state-storage.service';

@Injectable({ providedIn: 'root' })
export class <%= tenantNameUpperFirst %>RouteAccessService implements CanActivate {

constructor(private router: Router,
private principal: Principal,
private accountService: AccountService,
private stateStorageService: StateStorageService) {
}

canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean | Promise<boolean> {
const principal = this.principal;
return Promise.resolve(principal.identity().then(account => {
const accountService = this.accountService;
return Promise.resolve(accountService.identity().then(account => {
if (account.<%= tenantNameLowerFirst %> === null) {
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion generators/entity/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ module.exports = JhipsterGenerator.extend({

this.replaceContent(
`${webappDir}app/entities/${entityName}/${entityName}-update.component.ts`,
'private activatedRoute: ActivatedRoute) {}',
'protected activatedRoute: ActivatedRoute) {}',
partialFiles.angular.entityUpdateCompTsConstr(this),
false
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const tmpl = (context) => {
const template = `private activatedRoute: ActivatedRoute, private ${context.tenantNameLowerFirst}Service: ${context.tenantNameUpperFirst}Service, private principal: Principal) {
this.principal.identity().then(account => {
const template = `private activatedRoute: ActivatedRoute, private ${context.tenantNameLowerFirst}Service: ${context.tenantNameUpperFirst}Service, private accountService: AccountService) {
this.accountService.identity().then(account => {
this.currentAccount = account;
});
}`;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const tmpl = (context) => {
let template =`import { ${context.tenantNameUpperFirst} } from '../../admin/${context.tenantNameLowerFirst}-management/${context.tenantNameLowerFirst}.model';
import { ${context.tenantNameUpperFirst}Service } from '../../shared/${context.tenantNameLowerFirst}/${context.tenantNameLowerFirst}.service';
import { Principal} from 'app/core';`;
import { AccountService} from 'app/core';`;

return template;
};

module.exports = {
tmpl
};
};
Loading

0 comments on commit b91934e

Please sign in to comment.