Commit 0d127765 by Tuukka Kivilahti

fixed xeii's comments

1 parent 9a876f0a
Pipeline #34 passed
in 0 seconds
Showing with 239 additions and 828 deletions
......@@ -40,3 +40,4 @@ package-lock.json
#System Files
.DS_Store
Thumbs.db
......@@ -12,10 +12,10 @@ Kehittäminen on nopeampaa jos saa muutokset suoraan käyttöön, tämän takia
ng-palvelimessa on bugi, ja se ei osaa jakaa tavaraa muusta hakemistosta kuin /.
moyaproxy.conf.json sisältää proxyasetukset porttiin 8080.
moyaproxy.conf.json sisältää proxyasetukset localhostin porttiin 8080.
Käyttö:
`ng serve --preserve-symlinks --proxy-config=moyaproxy.conf.json --base-href=/`
`npm run start`
Tämän jälkeen kirjaa selaimesi sisään moyaan: http://localhost:4200/MoyaWeb/ ja surffata softaan: http://localhost:4200/
......
{
"compileOnSave": false,
"compilerOptions": {
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "commonjs",
"moduleResolution": "node",
"outDir": "../dist/out-tsc-e2e",
"sourceMap": true,
"target": "es5",
"typeRoots": [
"../node_modules/@types"
]
}
}
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var core_1 = require('@angular/core');
var AppComponent = (function () {
function AppComponent(router, zone) {
this.router = router;
this.zone = zone;
this.counter = 4;
this.title = 'app works!';
window.angularRoute = (function (url) {
zone.run(function () {
router.navigateByUrl(url);
});
});
// Enable change detection sometimes to see that it's not overflooded.
// bcause it takes time
//zone.onMicrotaskEmpty.subscribe(() => {console.log(".");}); // <-- Print "." everytime change detection is possibly
}
AppComponent = __decorate([
core_1.Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
], AppComponent);
return AppComponent;
}());
exports.AppComponent = AppComponent;
......@@ -14,21 +14,21 @@ describe('AppComponent', () => {
});
it('should create the app', async(() => {
let fixture = TestBed.createComponent(AppComponent);
let app = fixture.debugElement.componentInstance;
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
}));
it(`should have as title 'app works!'`, async(() => {
let fixture = TestBed.createComponent(AppComponent);
let app = fixture.debugElement.componentInstance;
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app.title).toEqual('app works!');
}));
it('should render title in a h1 tag', async(() => {
let fixture = TestBed.createComponent(AppComponent);
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
let compiled = fixture.debugElement.nativeElement;
const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('h1').textContent).toContain('app works!');
}));
});
import {Component, NgZone} from '@angular/core';
import {Router} from '@angular/router';
import {TranslateService} from "@ngx-translate/core";
import {DEFAULT_LOCALE, MoyaLocaleService} from "./components/moya-locale/moya-locale.service";
import {TranslateService} from '@ngx-translate/core';
import {DEFAULT_LOCALE, MoyaLocaleService} from './components/moya-locale/moya-locale.service';
declare var window: any;
......
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var platform_browser_1 = require('@angular/platform-browser');
var core_1 = require('@angular/core');
var forms_1 = require('@angular/forms');
var http_1 = require('@angular/http');
var app_component_1 = require('./app.component');
var viplist_component_1 = require('./viplist/viplist.component');
var ng2_bootstrap_1 = require("ng2-bootstrap");
var moya_angular_common_1 = require("moya-angular-common");
var router_1 = require('@angular/router');
var test_component_1 = require("./test/test.component");
var old_moya_component_1 = require('./old-moya/old-moya.component');
var safe_pipe_1 = require('./safe.pipe');
var appRoutes = [
{ path: 'vip/viplist', component: viplist_component_1.ViplistComponent },
{ path: 'test', component: test_component_1.TestComponent },
{ path: 'old', component: old_moya_component_1.OldMoyaComponent }
];
var AppModule = (function () {
function AppModule() {
}
AppModule = __decorate([
core_1.NgModule({
declarations: [
app_component_1.AppComponent,
viplist_component_1.ViplistComponent,
test_component_1.TestComponent,
old_moya_component_1.OldMoyaComponent,
safe_pipe_1.SafePipe,
],
imports: [
platform_browser_1.BrowserModule,
forms_1.FormsModule,
http_1.HttpModule,
ng2_bootstrap_1.AlertModule.forRoot(),
moya_angular_common_1.MoyaRestModule.forRoot(),
router_1.RouterModule.forRoot(appRoutes)
],
providers: [],
bootstrap: [app_component_1.AppComponent]
})
], AppModule);
return AppModule;
}());
exports.AppModule = AppModule;
......@@ -18,15 +18,17 @@ import {UserMenuComponent} from './menu/user-menu/user-menu.component';
import {UserComponent} from './pages/user/user.component';
import {InfoComponent} from './pages/info/info.component';
import {AdminComponent} from './pages/admin/admin.component';
import {HttpClient, HttpClientModule} from '@angular/common/http';
import {CommonModule} from "@angular/common";
import {CacheService} from "./shared/services/cache.service";
import {MoyaRestModule} from "./moya-rest";
import {SafePipe} from "./shared/pipes/safe.pipe";
import {TranslateLoader, TranslateModule} from "@ngx-translate/core";
import {TranslateHttpLoader} from "@ngx-translate/http-loader";
import {MoyaLocaleService} from "./components/moya-locale/moya-locale.service";
import {HTTP_INTERCEPTORS, HttpClient, HttpClientModule} from '@angular/common/http';
import {CommonModule} from '@angular/common';
import {CacheService} from './shared/services/cache.service';
import {SafePipe} from './shared/pipes/safe.pipe';
import {TranslateLoader, TranslateModule} from '@ngx-translate/core';
import {TranslateHttpLoader} from '@ngx-translate/http-loader';
import {MoyaLocaleService} from './components/moya-locale/moya-locale.service';
import { MoyaLocaleComponent } from './components/moya-locale/moya-locale.component';
import {ErrorInterceptor} from './shared/interceptors/error.interceptor';
import {ViplistService} from './shared/services/viplist.service';
import {UserService} from './shared/services/user.service';
const appRoutes: Routes = [
{
......@@ -83,19 +85,22 @@ const appRoutes: Routes = [
FormsModule,
HttpClientModule,
AlertModule.forRoot(),
MoyaRestModule,
RouterModule.forRoot(appRoutes),
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: function (http: HttpClient) {
return new TranslateHttpLoader(http, "assets/i18n/", ".json");
return new TranslateHttpLoader(http, 'assets/i18n/', '.json');
},
deps: [HttpClient]
}
})
],
providers: [CacheService, MoyaLocaleService],
providers: [
CacheService,
MoyaLocaleService,
{ provide: HTTP_INTERCEPTORS, useClass: ErrorInterceptor, multi: true },
UserService],
bootstrap: [AppComponent]
})
export class AppModule {
......
import { Component, OnInit } from '@angular/core';
import {DEFAULT_LOCALE, MoyaLocaleService} from "./moya-locale.service";
import {TranslateService} from "@ngx-translate/core";
import {DEFAULT_LOCALE, MoyaLocaleService} from './moya-locale.service';
import {TranslateService} from '@ngx-translate/core';
const ENGLISH = "en";
const FINNISH = "fi";
const SWEDISH = "sv";
const ENGLISH = 'en';
const FINNISH = 'fi';
const SWEDISH = 'sv';
......@@ -16,24 +16,24 @@ const SWEDISH = "sv";
})
export class MoyaLocaleComponent implements OnInit {
fiSelected : boolean = true;
svSelected : boolean = true;
enSelected : boolean = true;
fiSelected = true;
svSelected = true;
enSelected = true;
constructor(private localeService : MoyaLocaleService, private translate : TranslateService) {
constructor(private localeService: MoyaLocaleService, private translate: TranslateService) {
// fallback language
translate.setDefaultLang(DEFAULT_LOCALE);
this.selectLocale(DEFAULT_LOCALE);
}
ngOnInit() {
this.localeService.getUserLocale().subscribe(locale => { this.selectLocale(locale)} );
this.localeService.getUserLocale().subscribe(locale => { this.selectLocale(locale); } );
}
selectLocale(locale : string, save :boolean = false):void {
selectLocale(locale: string, save = false): void {
if(![ENGLISH, FINNISH, SWEDISH].includes(locale)) {
if (![ENGLISH, FINNISH, SWEDISH].includes(locale)) {
return;
}
......@@ -53,7 +53,7 @@ export class MoyaLocaleComponent implements OnInit {
break;
}
if(save) {
if (save) {
this.localeService.setUserLocale(locale).subscribe();
}
......
import { Injectable } from '@angular/core';
import {MoyaRestService} from "../../shared/services/moya-rest.service";
import {Observable} from "rxjs/Observable";
import {MoyaLocale} from "./moya-locale.model";
import {Observable} from 'rxjs/Observable';
import {MoyaLocale} from './moya-locale.model';
import {MOYA_BASE_URL, MoyaRestTool} from '../../shared/tools/moya-rest.tool';
import {HttpClient} from '@angular/common/http';
import 'rxjs/add/operator/catch';
export const DEFAULT_LOCALE = "fi";
const LOCALSTORAGE_NAME = "currently used locale code";
export const DEFAULT_LOCALE = 'fi';
const LOCALSTORAGE_NAME = 'currently used locale code';
@Injectable()
export class MoyaLocaleService {
constructor(private moyaRest : MoyaRestService) { }
constructor(private http: HttpClient) { }
/**
......@@ -24,21 +26,20 @@ export class MoyaLocaleService {
* @return {Observable<string>} Return current locale as a string. No errors.
*/
public getUserLocale(): Observable<string> {
return this.moyaRest.get("/v3/locale/").catch(x => null ).map(untypedLocale => {
const locale = untypedLocale as MoyaLocale;
return this.http.get<MoyaLocale>(MOYA_BASE_URL + '/v3/locale/').catch(x => Observable.of(new MoyaLocale())).map(locale => {
if (locale && locale.userLocale) {
return locale.userLocale;
}
let storageLocale = localStorage.getItem(LOCALSTORAGE_NAME);
const storageLocale = localStorage.getItem(LOCALSTORAGE_NAME);
if(storageLocale) {
if (storageLocale) {
return storageLocale;
}
if(locale.eventLocale) {
if (locale.eventLocale) {
return locale.eventLocale;
}
......@@ -56,14 +57,14 @@ export class MoyaLocaleService {
*/
public setUserLocale(locale: string): Observable<any> {
let newLocale: MoyaLocale = new MoyaLocale();
const newLocale: MoyaLocale = new MoyaLocale();
newLocale.userLocale = locale;
// let's save locale to database, if it fails, we save it into localstorage. No errors to show for user.
return this.moyaRest.post("/v3/locale/", newLocale).first().catch(x => {
return this.http.post(MOYA_BASE_URL + '/v3/locale/', newLocale).first().catch(x => {
localStorage.setItem(LOCALSTORAGE_NAME, locale);
return "ok";
return 'ok';
});
}
......
......@@ -6,7 +6,7 @@ import {MenuGroup} from '../models/menu-group.model';
export class MENU {
static ADMIN: MenuGroup[]= [
static ADMIN: MenuGroup[] = [
{
'name': 'Kauppa',
'items': [
......
......@@ -9,7 +9,7 @@ import {MENU} from '../defines/menu';
})
export class InfoMenuComponent implements OnInit {
menu: MenuGroup[]= MENU.INFO;
menu: MenuGroup[] = MENU.INFO;
constructor() { }
......
......@@ -9,7 +9,7 @@ import {MENU} from '../defines/menu';
})
export class UserMenuComponent implements OnInit {
menu: MenuGroup[]= MENU.USER;
menu: MenuGroup[] = MENU.USER;
constructor() { }
......
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var core_1 = require('@angular/core');
var common_1 = require('@angular/common');
var http_1 = require("@angular/http");
var moya_rest_service_1 = require("../shared/services/moya-rest.service");
var viplist_service_1 = require("../shared/services/viplist.service");
var cache_service_1 = require("../shared/services/cache.service");
var user_service_1 = require("../shared/services/user.service");
var MoyaRestModule = (function () {
function MoyaRestModule() {
}
MoyaRestModule.forRoot = function () {
return {
ngModule: MoyaRestModule,
providers: [
moya_rest_service_1.MoyaRestService,
viplist_service_1.ViplistService,
cache_service_1.CacheService,
user_service_1.UserService
]
};
};
MoyaRestModule = __decorate([
core_1.NgModule({
imports: [
common_1.CommonModule,
http_1.HttpModule
],
declarations: []
})
], MoyaRestModule);
return MoyaRestModule;
}());
exports.MoyaRestModule = MoyaRestModule;
import {NgModule, ModuleWithProviders, NgZone, Injector} from '@angular/core';
import { CommonModule } from '@angular/common';
import {MoyaRestService} from "../shared/services/moya-rest.service";
import {ViplistService} from "../shared/services/viplist.service";
import {CacheService} from "../shared/services/cache.service";
import {UserService} from "../shared/services/user.service";
import {HttpClientModule} from "@angular/common/http";
import {HttpModule} from "@angular/http";
export * from "../shared/services/moya-rest.service";
export * from "../shared/services/viplist.service";
export * from "../shared/services/cache.service";
export * from "../shared/services/user.service";
export * from "../shared/models/user.model";
export * from "../shared/models/vip.model";
export * from "../shared/models/vip-product.model";
export * from "../shared/models/vip-product-delivery.model";
@NgModule({
imports: [
CommonModule,
HttpClientModule
],
declarations: [ ],
providers: [
MoyaRestService,
ViplistService,
CacheService,
UserService,
HttpClientModule
/*{ provide: NgZone, useFactory: () => new NgZone({}) },
{ provide: Injector, useFactory: () => Injector.create({providers: []}) } */
],
exports: [
],
})
export class MoyaRestModule {
/*
static forRoot(): ModuleWithProviders {
return {
ngModule: MoyaRestModule,
providers: [
MoyaRestService,
ViplistService,
CacheService,
UserService,
HttpClientModule
/*{ provide: NgZone, useFactory: () => new NgZone({}) },
{ provide: Injector, useFactory: () => Injector.create({providers: []}) }
]
};
}*/
}
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var core_1 = require('@angular/core');
var common_1 = require("@angular/common");
var OldMoyaComponent = (function () {
function OldMoyaComponent(location) {
this.location = location;
this.frameUrl = "/MoyaWeb/";
}
OldMoyaComponent.prototype.ngOnInit = function () {
};
OldMoyaComponent.prototype.logIt = function () {
console.log(this.frameUrl);
console.log(this.frametus.nativeElement.contentWindow.location.href);
console.log(location.path(true));
};
__decorate([
core_1.ViewChild('frametus')
], OldMoyaComponent.prototype, "frametus", void 0);
OldMoyaComponent = __decorate([
core_1.Component({
selector: 'app-old-moya',
providers: [common_1.Location, { provide: common_1.LocationStrategy, useClass: common_1.PathLocationStrategy }],
templateUrl: './old-moya.component.html',
styleUrls: ['./old-moya.component.css']
})
], OldMoyaComponent);
return OldMoyaComponent;
}());
exports.OldMoyaComponent = OldMoyaComponent;
......@@ -25,7 +25,7 @@ export class OldMoyaComponent implements OnInit {
route.queryParamMap.map(a => a.get('p')).subscribe(x => {
console.log(x);
if (x) {
this.frameUrl = '/MoyaWeb/' + x.replace("::", "?");
this.frameUrl = '/MoyaWeb/' + x.replace('::', '?');
}
});
}
......@@ -34,10 +34,10 @@ export class OldMoyaComponent implements OnInit {
ngOnInit() { }
changeUrl() {
let tmpFrameUrl = this.iframe.nativeElement.contentWindow.location.href.split('/MoyaWeb/', 2);
const tmpFrameUrl = this.iframe.nativeElement.contentWindow.location.href.split('/MoyaWeb/', 2);
if (tmpFrameUrl.length > 1) {
this.location.replaceState(this.location.path(false).split('?', 1)[0] + '?p=' + tmpFrameUrl[1].replace("?", "::") );
this.location.replaceState(this.location.path(false).split('?', 1)[0] + '?p=' + tmpFrameUrl[1].replace('?', '::') );
}
......
import {HttpEvent, HttpEventType, HttpHandler, HttpInterceptor, HttpRequest, HttpResponse} from '@angular/common/http';
import {Observable} from 'rxjs/Observable';
import 'rxjs/add/operator/catch';
export class ErrorInterceptor implements HttpInterceptor {
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<HttpEventType.Response>> {
return next.handle(req).catch(this.handleException);
}
private handleException(error: HttpResponse<any>) {
console.log('error on MOYA rest connection', error);
// TODO: add handlers to 403's and other "not logged in" or "invalid permissions"
// -statuscodes, and route them using some nice global parameter
return Observable.throw(error);
}
}
/**
* Created by tuukka on 15/02/17.
*/
"use strict";
// vim magic: %s/^\s*\w\+\s\+\(\w\+\)\s\+\(\w\+\)\s*.*;$/ \2: \L\1;/
(function (UserGender) {
UserGender[UserGender["MALE"] = 0] = "MALE";
UserGender[UserGender["FEMALE"] = 1] = "FEMALE";
UserGender[UserGender["UNSPECIFIED"] = 2] = "UNSPECIFIED";
})(exports.UserGender || (exports.UserGender = {}));
var UserGender = exports.UserGender;
var User = (function () {
function User() {
}
return User;
}());
exports.User = User;
/**
* Created by tuukka on 04/02/17.
*/
"use strict";
var VipProductDelivery = (function () {
function VipProductDelivery() {
}
return VipProductDelivery;
}());
exports.VipProductDelivery = VipProductDelivery;
"use strict";
/**
* Created by tuukka on 04/02/17.
*/
var VipProduct = (function () {
function VipProduct() {
}
return VipProduct;
}());
exports.VipProduct = VipProduct;
import {VipProductDelivery} from "./vip-product-delivery.model";
import {VipProductDelivery} from './vip-product-delivery.model';
/**
* Created by tuukka on 04/02/17.
*/
......@@ -25,7 +25,7 @@ export class VipProduct {
notes: string;
quantity: number;
delivered: number;
deliveries : VipProductDelivery[];
deliveries: VipProductDelivery[];
constructor() {}
......
"use strict";
/**
* Created by tuukka on 04/02/17.
*/
var Vip = (function () {
function Vip() {
}
return Vip;
}());
exports.Vip = Vip;
import {VipProduct} from "./vip-product.model";
import {User} from "./user.model";
import {VipProduct} from './vip-product.model';
import {User} from './user.model';
/**
* Created by tuukka on 04/02/17.
*/
......
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var core_1 = require("@angular/core");
var rxjs_1 = require("rxjs");
var DEFAULT_EXPIRE_MS = 300000; // 5min
var CachedItem = (function () {
function CachedItem(moduleName, path, value, isObservable) {
this.moduleName = moduleName;
this.path = path;
this.value = value;
this.expires = new Date();
this.expires.setTime(Date.now() + DEFAULT_EXPIRE_MS);
this.isObservable = isObservable;
}
CachedItem.prototype.isExpired = function () {
return this.expires.getTime() < Date.now();
};
return CachedItem;
}());
/**
* Basic cacheService.
*
* First this was part of moyaRestService, but I thinked that if cache is too easy to use, someone will kill this application with it.
* So let's make it litlebit harder
*/
var CacheService = (function () {
// TODO: timed clearup for cache to save memory
function CacheService(zone) {
this.zone = zone;
this.cache = new Map();
this.timerObservable = rxjs_1.Observable.timer(30000, 30000); // afther 0.5min, every 0.5min.
}
/**
* This will return observable with value from cache, or cache value from your observable and return it in observable.
*
* example: return cacheService.cacheObservable("mymodule",<url>, http.get(<url>).map(v => v.json()));
*
* @param moduleName
* @param cachePath
* @param source: {Observable<any>} Observable where the values, which are cached, is coming from
* @return {Observable<any>}: if value is in cache, this is observable made from this value. Otherwise this is source observable.
*/
CacheService.prototype.cacheObservable = function (moduleName, cachePath, source) {
var _this = this;
var cacheName = this.generateCachename(moduleName, cachePath);
if (this.cache.has(cacheName) && this.cache.get(cacheName).expires.getTime() < Date.now()) {
console.log(cacheName, " Expired version in cache");
this.cache.delete(cacheName);
}
if (!this.cache.has(cacheName)) {
/*
not in cache, let's change source to hot -observable, and return one instance from it
problem is, that before this observable is runned, there can be queries for this value from cache.
So, let's change this to hot-observable, and put that hot-observable into the cache.
And in first run, we change this hot observable to it's value.
Javascript is asynchronous, so there is no need to worry some weird things that could happen in multithreaded languages.
*/
console.log(cacheName, " not in cache");
var hotSource = source
.do(function (val) { return _this.cache.set(cacheName, new CachedItem(moduleName, cachePath, val)); })
.publishLast().refCount();
this.cache.set(cacheName, new CachedItem(moduleName, cachePath, hotSource, true));
this.checkCleanTimer();
return hotSource;
}
var cacheItem = this.cache.get(cacheName);
// if value is hotObservable, return it, otherwise create observable from value
if (cacheItem.isObservable) {
console.log(cacheName, " hot observable in cache ");
return cacheItem.value;
}
console.log(cacheName, " value in cache");
this.checkCleanTimer();
return rxjs_1.Observable.of(cacheItem.value);
};
CacheService.prototype.clean = function () {
this.cache.clear();
this.checkCleanTimer();
};
CacheService.prototype.cleanExpired = function () {
var _this = this;
this.cache.forEach(function (v, k) {
if (v.isExpired()) {
console.log(k, " Cache expired");
_this.cache.delete(k);
}
});
this.checkCleanTimer();
};
CacheService.prototype.checkCleanTimer = function () {
var _this = this;
if (this.cache.size > 0) {
if (!this.timerSubscription) {
console.log("adding clearing timer");
this.zone.runOutsideAngular(function () {
_this.timerSubscription = _this.timerObservable.subscribe(function (v) {
_this.cleanExpired();
});
});
}
}
else {
if (this.timerSubscription) {
console.log("removing clearing timer");
this.timerSubscription.unsubscribe();
}
}
};
/**
*
* @param moduleName
* @param cachePath
* @param value
*/
CacheService.prototype.set = function (moduleName, cachePath, value) {
var cacheName = this.generateCachename(moduleName, cachePath);
this.cache.set(cacheName, new CachedItem(moduleName, cachePath, value));
};
/**
* Get one value from cache.
*
* Now when there is this observablethingy. Make public afther rethinking this.
*
* @param moduleName
* @param cachePath
* @return {any|null} Null if nothing is in cache.
*/
CacheService.prototype.get = function (moduleName, cachePath) {
var cacheName = this.generateCachename(moduleName, cachePath);
if (this.cache.has(cacheName) && this.cache.get(cacheName).expires.getTime() < Date.now()) {
this.cache.delete(cacheName);
}
if (this.cache.has(cacheName)) {
return this.cache.get(cacheName);
}
return null;
};
CacheService.prototype.generateCachename = function (moduleName, cachePath) {
return moduleName + "::" + cachePath;
};
CacheService = __decorate([
core_1.Injectable()
], CacheService);
return CacheService;
}());
exports.CacheService = CacheService;
import {Injectable, NgZone} from "@angular/core";
import {Observable} from "rxjs/Observable";
import {Injectable, NgZone} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import 'rxjs/add/observable/timer';
import {forkJoin} from "rxjs/observable/forkJoin";
import "rxjs/add/operator/do";
import "rxjs/add/operator/publishLast";
import "rxjs/add/observable/of";
import {Subscription} from "rxjs/Subscription";
import {forkJoin} from 'rxjs/observable/forkJoin';
import 'rxjs/add/operator/do';
import 'rxjs/add/operator/publishLast';
import 'rxjs/add/observable/of';
import {Subscription} from 'rxjs/Subscription';
const DEFAULT_EXPIRE_MS = 300000; // 5min
......@@ -17,7 +17,7 @@ class CachedItem {
expires: Date;
isObservable: boolean;
constructor(moduleName: string, path: string, value: any, isObservable? : boolean) {
constructor(moduleName: string, path: string, value: any, isObservable?: boolean) {
this.moduleName = moduleName;
this.path = path;
this.value = value;
......@@ -42,7 +42,7 @@ class CachedItem {
@Injectable()
export class CacheService {
private timerSubscription : Subscription;
private timerSubscription: Subscription;
private timerObservable: Observable<any>;
......@@ -50,7 +50,7 @@ export class CacheService {
// TODO: timed clearup for cache to save memory
constructor(private zone : NgZone) {
constructor(private zone: NgZone) {
this.cache = new Map<string, CachedItem>();
this.timerObservable = Observable.timer(30000, 30000); // afther 0.5min, every 0.5min.
......@@ -68,15 +68,15 @@ export class CacheService {
* @return {Observable<any>}: if value is in cache, this is observable made from this value. Otherwise this is source observable.
*/
public cacheObservable(moduleName: string, cachePath: string, source: Observable<any>): Observable<any> {
let cacheName = this.generateCachename(moduleName, cachePath);
const cacheName = this.generateCachename(moduleName, cachePath);
if(this.cache.has(cacheName) && this.cache.get(cacheName).expires.getTime() < Date.now()) {
console.log(cacheName, " Expired version in cache");
if (this.cache.has(cacheName) && this.cache.get(cacheName).expires.getTime() < Date.now()) {
console.log(cacheName, ' Expired version in cache');
this.cache.delete(cacheName);
}
if(!this.cache.has(cacheName)) {
if (!this.cache.has(cacheName)) {
/*
not in cache, let's change source to hot -observable, and return one instance from it
problem is, that before this observable is runned, there can be queries for this value from cache.
......@@ -86,13 +86,13 @@ export class CacheService {
Javascript is asynchronous, so there is no need to worry some weird things that could happen in multithreaded languages.
*/
console.log(cacheName," not in cache");
console.log(cacheName, ' not in cache');
let hotSource = source
.do(val => this.cache.set(cacheName, new CachedItem(moduleName,cachePath, val)))
const hotSource = source
.do(val => this.cache.set(cacheName, new CachedItem(moduleName, cachePath, val)))
.publishLast().refCount();
this.cache.set(cacheName, new CachedItem(moduleName,cachePath, hotSource, true));
this.cache.set(cacheName, new CachedItem(moduleName, cachePath, hotSource, true));
this.checkCleanTimer();
......@@ -101,15 +101,15 @@ export class CacheService {
let cacheItem = this.cache.get(cacheName);
const cacheItem = this.cache.get(cacheName);
// if value is hotObservable, return it, otherwise create observable from value
if(cacheItem.isObservable) {
console.log(cacheName, " hot observable in cache ");
if (cacheItem.isObservable) {
console.log(cacheName, ' hot observable in cache ');
return cacheItem.value;
}
console.log(cacheName, " value in cache");
console.log(cacheName, ' value in cache');
this.checkCleanTimer();
return Observable.of(cacheItem.value);
......@@ -124,9 +124,9 @@ export class CacheService {
public cleanExpired(): void {
this.cache.forEach((v,k) => {
if(v.isExpired()) {
console.log(k, " Cache expired");
this.cache.forEach((v, k) => {
if (v.isExpired()) {
console.log(k, ' Cache expired');
this.cache.delete(k);
}});
......@@ -134,9 +134,9 @@ export class CacheService {
}
private checkCleanTimer() {
if(this.cache.size > 0) {
if(!this.timerSubscription) {
console.log("adding clearing timer");
if (this.cache.size > 0) {
if (!this.timerSubscription) {
console.log('adding clearing timer');
this.zone.runOutsideAngular(() => {
this.timerSubscription = this.timerObservable.subscribe(v => {
......@@ -146,9 +146,9 @@ export class CacheService {
}
} else {
if(this.timerSubscription) {
if (this.timerSubscription) {
console.log("removing clearing timer");
console.log('removing clearing timer');
this.timerSubscription.unsubscribe();
}
}
......@@ -163,9 +163,9 @@ export class CacheService {
* @param value
*/
private set(moduleName: string, cachePath: string, value: any): void {
let cacheName = this.generateCachename(moduleName, cachePath);
const cacheName = this.generateCachename(moduleName, cachePath);
this.cache.set(cacheName, new CachedItem(moduleName,cachePath, value));
this.cache.set(cacheName, new CachedItem(moduleName, cachePath, value));
}
/**
......@@ -178,14 +178,14 @@ export class CacheService {
* @return {any|null} Null if nothing is in cache.
*/
private get(moduleName: string, cachePath: string): CachedItem {
let cacheName = this.generateCachename(moduleName, cachePath);
const cacheName = this.generateCachename(moduleName, cachePath);
if(this.cache.has(cacheName) && this.cache.get(cacheName).expires.getTime() < Date.now()) {
if (this.cache.has(cacheName) && this.cache.get(cacheName).expires.getTime() < Date.now()) {
this.cache.delete(cacheName);
}
if(this.cache.has(cacheName)) {
if (this.cache.has(cacheName)) {
return this.cache.get(cacheName);
}
......@@ -194,7 +194,7 @@ export class CacheService {
private generateCachename(moduleName: string, cachePath: string): string {
return moduleName + "::" + cachePath;
return moduleName + '::' + cachePath;
}
}
/* tslint:disable:no-unused-variable */
import { TestBed, async, inject } from '@angular/core/testing';
import { MoyaRestService } from './moya-rest.service';
describe('MoyaRestService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [MoyaRestService]
});
});
it('should ...', inject([MoyaRestService], (service: MoyaRestService) => {
expect(service).toBeTruthy();
}));
});
import { Injectable } from '@angular/core';
import {Observable} from "rxjs/Observable";
import {HttpClient, HttpResponse} from "@angular/common/http";
import "rxjs/add/operator/catch";
import "rxjs/add/observable/throw";
@Injectable()
export class MoyaRestService {
constructor(private http: HttpClient) { }
post(subUrl: string, body: any, pathParameters?: Map<string, string>): Observable<Object> {
return this.http.post(this.genUrl(subUrl, pathParameters), body)
.catch(this.handleException);
}
put(subUrl: string, body: any, pathParameters?: Map<string, string>): Observable<Object> {
return this.http.put(this.genUrl(subUrl, pathParameters), body)
.catch(this.handleException);
}
delete(subUrl: string, pathParameters?: Map<string, string>): Observable<Object> {
return this.http.delete(this.genUrl(subUrl, pathParameters))
.catch(this.handleException);
}
get(subUrl: string, pathParameters?: Map<string, string>): Observable<Object> {
return this.http.get(this.genUrl(subUrl, pathParameters))
.catch(this.handleException);
}
private genUrl(subUrl: string, urlParams?: Map<string, string>): string {
let suffix = "";
if(urlParams) {
urlParams.forEach(function(value: string, key: string) {
if(suffix.length <= 0) {
suffix = "?";
} else {
suffix += "&";
}
suffix += key + "=" + value;
});
}
return "/MoyaWeb/rest/" + subUrl + suffix; // <-- TODO: kauneista
}
private handleException(error: HttpResponse<any> | any) {
console.log("error on MOYA rest connection", error);
// TODO: add handlers to 403's and other "not logged in" or "invalid permissions"
// -statuscodes, and route them using some nice global parameter
return Observable.throw(error);
}
}
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var core_1 = require("@angular/core");
var rxjs_1 = require("rxjs");
var UserService = (function () {
function UserService(moyaRest, cacheService) {
this.moyaRest = moyaRest;
this.cacheService = cacheService;
}
UserService.prototype.get = function (id) {
if (!id || id < 0) {
return rxjs_1.Observable.throw("There should be userid");
}
var path = "v2/user/" + id;
return this.cacheService.cacheObservable("moya:UserService", path, this.moyaRest.get(path)
.do(function (v) { console.log("getting user outside of cache", path); })
.map(function (res) { return (res.json()); }));
};
UserService = __decorate([
core_1.Injectable()
], UserService);
return UserService;
}());
exports.UserService = UserService;
import {Injectable} from "@angular/core";
import {User} from "../models/user.model";
import {MoyaRestService} from "./moya-rest.service";
import {CacheService} from "./cache.service";
import {Observable} from "rxjs/Observable";
import {Injectable} from '@angular/core';
import {User} from '../models/user.model';
import {CacheService} from './cache.service';
import {Observable} from 'rxjs/Observable';
import {HttpClient} from '@angular/common/http';
import {MOYA_BASE_URL} from '../tools/moya-rest.tool';
@Injectable()
export class UserService {
constructor(private moyaRest : MoyaRestService, private cacheService : CacheService) { }
constructor(private http: HttpClient, private cacheService: CacheService) { }
public get(id: number): Observable<User> {
if(!id || id < 0) {
return Observable.throw("There should be userid");
if (!id || id < 0) {
return Observable.throw('There should be userid');
}
let path = "v2/user/" + id;
const path = MOYA_BASE_URL + 'v2/user/' + id;
return this.cacheService.cacheObservable("moya:UserService", path,
this.moyaRest.get(path)
.do(v => {console.log("getting user outside of cache", path)})
.map(res => (<User> res)));
return this.cacheService.cacheObservable('moya:UserService', path,
this.http.get<User>(path)
.do(v => {console.log('getting user outside of cache', path); }));
}
}
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments)).next());
});
};
var core_1 = require('@angular/core');
var rxjs_1 = require("rxjs");
var ViplistService = (function () {
function ViplistService(moyaRestService, userService) {
this.moyaRestService = moyaRestService;
this.userService = userService;
}
/**
* get vips
* @param searchString: searchString, skip to return all vips
*/
ViplistService.prototype.get = function (searchString) {
var _this = this;
if (!searchString) {
return this.moyaRestService.get("v3/vip/all")
.switchMap(function (res) { return rxjs_1.Observable.forkJoin.apply(rxjs_1.Observable, res.json().map(function (apiRow) { return _this.hostPopulator(apiRow); })); });
}
return this.moyaRestService.get("v3/vip/search/" + searchString)
.switchMap(function (v) { return rxjs_1.Observable.forkJoin.apply(rxjs_1.Observable, v.json().map(function (x) { return _this.hostPopulator(x); })); });
};
/**
* Delete vip.
*
* @param vip
* @return Observable
*/
ViplistService.prototype.delete = function (vip) {
return __awaiter(this, void 0, Promise, function* () {
if (!vip.id)
throw new Error("TODO: errori, tyhmä vippi");
var res = yield this.moyaRestService.delete("v3/vip/" + vip.id)
.first()
.toPromise();
return res.ok;
});
};
/*
public deleteProm(vip: Vip): Promise<boolean> {
if (!vip.id)
throw new Error("TODO: errori, tyhmä vippi");
return this.moyaRestService.delete("v3/vip/" + vip.id)
.first()
.toPromise()
.then(r => r.ok);
}
*/
ViplistService.prototype.getWithId = function (id) {
return this.moyaRestService.get("v3/vip/" + id)
.map(function (v) { return v.json(); });
};
ViplistService.prototype.create = function (vip) {
return this.moyaRestService.post("v3/vip/create", vip)
.map(function (v) { return v.json(); });
};
ViplistService.prototype.hostPopulator = function (rawVip) {
return this.userService.get(rawVip.hostId)
.map(function (u) { rawVip.host = u; return rawVip; });
};
ViplistService = __decorate([
core_1.Injectable()
], ViplistService);
return ViplistService;
}());
exports.ViplistService = ViplistService;
import {Injectable} from '@angular/core';
import {MoyaRestService} from "./moya-rest.service";
import {Vip} from "../models/vip.model";
import {Response} from "@angular/http";
import {User} from "../models/user.model";
import {UserService} from "./user.service";
import {Observable} from "rxjs/Observable";
import "rxjs/add/operator/map";
import "rxjs/add/operator/switchMap";
import "rxjs/add/observable/forkJoin";
import "rxjs/add/operator/first";
import {HttpResponse} from "@angular/common/http";
import {Vip} from '../models/vip.model';
import {User} from '../models/user.model';
import {UserService} from './user.service';
import {Observable} from 'rxjs/Observable';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/switchMap';
import 'rxjs/add/observable/forkJoin';
import 'rxjs/add/operator/first';
import {HttpClient} from '@angular/common/http';
import {MOYA_BASE_URL} from '../tools/moya-rest.tool';
@Injectable()
export class ViplistService {
constructor(private moyaRestService: MoyaRestService, private userService : UserService) {
constructor(private http: HttpClient, private userService: UserService) {
}
......@@ -26,11 +25,11 @@ export class ViplistService {
public get(searchString?: string): Observable<Array<Vip>> {
if (!searchString) {
return this.moyaRestService.get("v3/vip/all")
return this.http.get(MOYA_BASE_URL + 'v3/vip/all')
.switchMap(res => Observable.forkJoin(...(res as Array<any>).map(apiRow => this.hostPopulator(apiRow))));
}
return this.moyaRestService.get("v3/vip/search/" + searchString)
return this.http.get(MOYA_BASE_URL + 'v3/vip/search/' + searchString)
.switchMap(v => Observable.forkJoin(...(v as Array<any>).map(x => this.hostPopulator(x))));
}
......@@ -43,10 +42,11 @@ export class ViplistService {
*/
public async delete(vip: Vip): Promise<boolean> {
if (!vip.id)
throw new Error("TODO: errori, tyhmä vippi");
if (!vip.id) {
throw new Error('TODO: errori, tyhmä vippi');
}
let res: any = await this.moyaRestService.delete("v3/vip/" + vip.id)
const res: any = await this.http.delete(MOYA_BASE_URL + 'v3/vip/' + vip.id)
.first()
.toPromise();
......@@ -55,19 +55,19 @@ export class ViplistService {
public getWithId(id: number): Observable<Vip> {
return this.moyaRestService.get("v3/vip/" + id).map(x => x as Vip);
return this.http.get(MOYA_BASE_URL + 'v3/vip/' + id).map(x => x as Vip);
}
public create(vip: Vip): Observable<Vip> {
return this.moyaRestService.post("v3/vip/create", vip).map(x => x as Vip);
return this.http.post(MOYA_BASE_URL + 'v3/vip/create', vip).map(x => x as Vip);
}
private hostPopulator(rawVip : any): Observable<Vip> {
private hostPopulator(rawVip: any): Observable<Vip> {
return this.userService.get(rawVip.hostId)
.map((u: User) => {rawVip.host = u; return <Vip> rawVip }).map(x => x as Vip);
.map((u: User) => {rawVip.host = u; return <Vip> rawVip; }).map(x => x as Vip);
}
......
export const MOYA_BASE_URL = '/MoyaWeb/rest/';
export abstract class MoyaRestTool {
/*
genUrl(subUrl: string, urlParams?: Map<string, string>): string {
let suffix = '';
if (urlParams) {
urlParams.forEach(function(value: string, key: string) {
if (suffix.length <= 0) {
suffix = '?';
} else {
suffix += '&';
}
suffix += key + '=' + value;
});
}
return '/MoyaWeb/rest/' + subUrl + suffix; // <-- TODO: kauneista
} */
}
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var core_1 = require('@angular/core');
var TestComponent = (function () {
function TestComponent() {
this.counter = 0;
}
TestComponent.prototype.ngOnInit = function () {
};
TestComponent.prototype.addOne = function () {
this.counter++;
};
__decorate([
core_1.Input()
], TestComponent.prototype, "counter", void 0);
TestComponent = __decorate([
core_1.Component({
selector: 'app-test',
templateUrl: './test.component.html',
styleUrls: ['./test.component.css']
})
], TestComponent);
return TestComponent;
}());
exports.TestComponent = TestComponent;
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var core_1 = require('@angular/core');
var ViplistComponent = (function () {
function ViplistComponent(viplistService) {
this.viplistService = viplistService;
}
ViplistComponent.prototype.ngOnInit = function () {
this.vips = this.viplistService.get();
};
ViplistComponent = __decorate([
core_1.Component({
selector: 'moya-viplist',
templateUrl: './viplist.component.html',
styleUrls: ['./viplist.component.css']
})
], ViplistComponent);
return ViplistComponent;
}());
exports.ViplistComponent = ViplistComponent;
import {Component, NgZone, OnInit} from '@angular/core';
import {Observable} from "rxjs/Observable";
import {Vip} from "../shared/models/vip.model";
import {ViplistService} from "../shared/services/viplist.service";
import {Observable} from 'rxjs/Observable';
import {Vip} from '../shared/models/vip.model';
import {ViplistService} from '../shared/services/viplist.service';
@Component({
selector: 'moya-viplist',
templateUrl: './viplist.component.html',
styleUrls: ['./viplist.component.scss']
styleUrls: ['./viplist.component.scss'],
providers: [ViplistService]
})
export class ViplistComponent implements OnInit {
......
......@@ -25,7 +25,7 @@ getTestBed().initTestEnvironment(
platformBrowserDynamicTesting()
);
// Then we find all the tests.
let context = require.context('./', true, /\.spec\.ts$/);
const context = require.context('./', true, /\.spec\.ts$/);
// And load the modules.
context.keys().map(context);
// Finally, start Karma to run the tests.
......
......@@ -3,18 +3,30 @@
"node_modules/codelyzer"
],
"rules": {
"arrow-return-shorthand": true,
"callable-types": true,
"class-name": true,
"comment-format": [
true,
"check-space"
],
"curly": true,
"deprecation": {
"severity": "warn"
},
"eofline": true,
"forin": true,
"import-blacklist": [
true,
"rxjs",
"rxjs/Rx"
],
"import-spacing": true,
"indent": [
true,
"spaces"
],
"interface-over-type-literal": true,
"label-position": true,
"max-line-length": [
true,
......@@ -23,8 +35,14 @@
"member-access": false,
"member-ordering": [
true,
"static-before-instance",
"variables-before-functions"
{
"order": [
"static-field",
"instance-field",
"static-method",
"instance-method"
]
}
],
"no-arg": true,
"no-bitwise": true,
......@@ -38,14 +56,22 @@
],
"no-construct": true,
"no-debugger": true,
"no-duplicate-variable": true,
"no-duplicate-super": true,
"no-empty": false,
"no-empty-interface": true,
"no-eval": true,
"no-inferrable-types": true,
"no-inferrable-types": [
true,
"ignore-params"
],
"no-misused-new": true,
"no-non-null-assertion": true,
"no-shadowed-variable": true,
"no-string-literal": false,
"no-string-throw": true,
"no-switch-case-fall-through": true,
"no-trailing-whitespace": true,
"no-unnecessary-initializer": true,
"no-unused-expression": true,
"no-use-before-declare": true,
"no-var-keyword": true,
......@@ -57,12 +83,14 @@
"check-else",
"check-whitespace"
],
"prefer-const": true,
"quotemark": [
true,
"single"
],
"radix": true,
"semicolon": [
true,
"always"
],
"triple-equals": [
......@@ -79,6 +107,7 @@
"variable-declaration": "nospace"
}
],
"unified-signatures": true,
"variable-name": false,
"whitespace": [
true,
......@@ -88,9 +117,19 @@
"check-separator",
"check-type"
],
"directive-selector": [true, "attribute", "", "camelCase"],
"component-selector": [true, "element", "", "kebab-case"],
"directive-selector": [
true,
"attribute",
"moya",
"camelCase"
],
"component-selector": [
true,
"element",
"moya",
"kebab-case"
],
"no-output-on-prefix": true,
"use-input-property-decorator": true,
"use-output-property-decorator": true,
"use-host-property-decorator": true,
......@@ -99,9 +138,6 @@
"use-life-cycle-interface": true,
"use-pipe-transform-interface": true,
"component-class-suffix": true,
"directive-class-suffix": true,
"no-access-missing-member": true,
"templates-use-public": true,
"invoke-injectable": true
"directive-class-suffix": true
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!