Skip to content

Commit

Permalink
jhipster#135 Save previous values used for generation
Browse files Browse the repository at this point in the history
  • Loading branch information
cmoine committed Oct 9, 2019
1 parent f0abd71 commit 917c1bf
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/main/webapp/app/home/generator/generator.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
import { Component, OnInit } from '@angular/core';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { LocalStorageService } from 'ngx-webstorage';

import { GitConfigurationModel, GitConfigurationService } from 'app/core';
import { JHipsterConfigurationModel } from './jhipster.configuration.model';
Expand Down Expand Up @@ -103,9 +104,18 @@ export class GeneratorComponent implements OnInit {
constructor(
private modalService: NgbModal,
private generatorService: GeneratorService,
private gitConfigurationService: GitConfigurationService
private gitConfigurationService: GitConfigurationService,
private $localStorage: LocalStorageService
) {
this.newGenerator();
Object.keys(this.model).forEach(
function(key) {
const value = this.$localStorage.retrieve('JHipsterConfigurationModel.' + key);
if (value) {
this.model[key] = value;
}
}.bind(this)
);
}

ngOnInit() {
Expand Down Expand Up @@ -197,6 +207,12 @@ export class GeneratorComponent implements OnInit {
a.click();
window.document.body.removeChild(a);
URL.revokeObjectURL(fileURL);

Object.keys(this.model).forEach(
function(key) {
this.$localStorage.store('JHipsterConfigurationModel.' + key, this.model[key]);
}.bind(this)
);
}

newGenerator() {
Expand Down

0 comments on commit 917c1bf

Please sign in to comment.