Skip to content

Commit

Permalink
feat(admin-web-angular) : Update to angular 9 (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
suryasingh authored Mar 22, 2020
1 parent 5c84146 commit 4e7a016
Show file tree
Hide file tree
Showing 45 changed files with 1,236 additions and 222 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
"conventional-changelog-cli": "^2.0.17",
"conventional-changelog-core": "^4.0.3",
"copy-webpack-plugin": "^5.0.5",
"core-js": "^3.1.4",
"core-js": "^3.6.4",
"coveralls": "^3.0.4",
"cpr": "^3.0.1",
"cross-env": "^6.0.3",
Expand Down
8 changes: 7 additions & 1 deletion packages/admin-web-angular/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@
},
"configurations": {
"production": {
"budgets": [
{
"type": "anyComponentStyle",
"maximumWarning": "6kb"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
Expand Down Expand Up @@ -171,7 +177,7 @@
"schematics": {
"@schematics/angular:component": {
"prefix": "ea",
"styleext": "scss"
"style": "scss"
},
"@schematics/angular:directive": {
"prefix": "ea"
Expand Down
57 changes: 39 additions & 18 deletions packages/admin-web-angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,27 +42,27 @@
},
"dependencies": {
"@agm/core": "^1.1.0",
"@angular/animations": "^8.2.14",
"@angular/cdk": "^8.2.3",
"@angular/common": "^8.2.14",
"@angular/compiler": "^8.2.14",
"@angular/core": "^8.2.14",
"@angular/forms": "^8.2.14",
"@angular/platform-browser": "^8.2.14",
"@angular/platform-browser-dynamic": "^8.2.14",
"@angular/router": "^8.2.14",
"@angular/animations": "~9.0.3",
"@angular/common": "~9.0.3",
"@angular/compiler": "~9.0.3",
"@angular/core": "~9.0.3",
"@angular/forms": "~9.0.3",
"@angular/platform-browser": "~9.0.3",
"@angular/platform-browser-dynamic": "~9.0.3",
"@angular/router": "~9.0.3",
"@angular/cdk": "^9.1.3",
"@nebular/auth": "^5.0.0",
"@nebular/bootstrap": "^5.0.0",
"@nebular/eva-icons": "^5.0.0",
"@nebular/security": "^5.0.0",
"@nebular/theme": "^5.0.0",
"@asymmetrik/ngx-leaflet": "^6.0.1",
"@ever-platform/common": "file:../common",
"@ever-platform/common-angular": "file:../common-angular",
"@fortawesome/fontawesome-free": "^5.10.0",
"@nebular/auth": "^4.1.3",
"@nebular/bootstrap": "^4.1.3",
"@nebular/eva-icons": "^4.1.3",
"@nebular/security": "^4.1.3",
"@nebular/theme": "^4.1.3",
"@ng-bootstrap/ng-bootstrap": "^5.1.0",
"@ng-select/ng-select": "^3.0.4",
"@ngx-translate/core": "^11.0.1",
"@ngx-translate/core": "^12.1.2",
"@ngx-translate/http-loader": "^4.0.0",
"@swimlane/ngx-charts": "^12.0.1",
"angular-2-dropdown-multiselect": "^1.9.0",
Expand All @@ -83,7 +83,7 @@
"chart.js": "^2.8.0",
"ckeditor": "^4.11.4",
"classlist.js": "1.1.20150312",
"core-js": "^3.1.3",
"core-js": "^3.6.4",
"cryptiles": "^4.1.3",
"echarts": "^4.2.1",
"eva-icons": "^1.1.1",
Expand Down Expand Up @@ -130,9 +130,30 @@
"tslib": "^1.10.0",
"typeface-exo": "^0.0.61",
"uuid": "^3.3.2",
"web-animations-js": "^2.3.1",
"web-animations-js": "^2.3.2",
"zen-observable": "^0.8.14",
"zone.js": "^0.9.1"
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.900.7",
"@angular/cli": "~9.0.4",
"@angular/compiler-cli": "~9.0.3",
"@angular/language-service": "~9.0.3",
"@types/node": "^12.11.1",
"@types/jasmine": "~3.5.0",
"@types/jasminewd2": "~2.0.3",
"codelyzer": "^5.1.2",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.3.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~2.1.0",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.2",
"protractor": "~5.4.3",
"ts-node": "~8.3.0",
"tslint": "~5.18.0",
"typescript": "~3.7.5"
},
"engines": {
"node": ">=10.15.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/admin-web-angular/src/app/@core/core.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ export class CoreModule {
throwIfAlreadyLoaded(parentModule, 'CoreModule');
}

static forRoot(): ModuleWithProviders {
const providers: ModuleWithProviders = {
static forRoot(): ModuleWithProviders<CoreModule> {
const providers: ModuleWithProviders<CoreModule> = {
ngModule: CoreModule,
providers: [...NB_CORE_PROVIDERS]
};
Expand Down
4 changes: 2 additions & 2 deletions packages/admin-web-angular/src/app/@core/data/data.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ const SERVICES = [
providers: [...SERVICES]
})
export class DataModule {
static forRoot(): ModuleWithProviders {
const providers: ModuleWithProviders = {
static forRoot(): ModuleWithProviders<DataModule> {
const providers: ModuleWithProviders<DataModule> = {
ngModule: DataModule,
providers: [...SERVICES]
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import GeoLocation from '@modules/server.common/entities/GeoLocation';
import User from '@modules/server.common/entities/User';
import { generateObjectIdString } from '@modules/server.common/utils';
import { environment } from 'environments/environment';
import { Injectable } from "@angular/core";

const lng = environment['DEFAULT_LONGITUDE'];
const lat = environment['DEFAULT_LATITUDE'];

@Injectable()
export class AdminStorageService extends StorageService {
isConnected: boolean = false;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import Admin from '@modules/server.common/entities/Admin';
import User from '@modules/server.common/entities/User';
import { Injectable } from "@angular/core";

@Injectable()
export class Store {
get token(): string | null {
return localStorage.getItem('token') || null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ import { TranslateService } from '@ngx-translate/core';
styleUrls: ['./carrier-mutation.component.scss']
})
export class CarrierMutationComponent {
@ViewChild('basicInfoForm', { static: false })
@ViewChild('basicInfoForm')
basicInfoForm: BasicInfoFormComponent;

@ViewChild('locationForm', { static: false })
@ViewChild('locationForm')
locationForm: LocationFormComponent;

readonly form: FormGroup = this.formBuilder.group({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export type CarrierBasicInfo = Pick<
styleUrls: ['basic-info-form.component.scss']
})
export class BasicInfoFormComponent implements OnInit, AfterViewInit {
@ViewChild('logoImagePreview', { static: false })
@ViewChild('logoImagePreview')
logoImagePreview: ElementRef;

uploaderPlaceholder: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class LocationFormComponent implements AfterViewInit {
google.maps.places.PlaceGeometry | google.maps.GeocoderGeometry
>();

@ViewChild('autocomplete', { static: false })
@ViewChild('autocomplete')
searchElement: ElementRef;

public showCoordinates: boolean = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import { countriesDefaultCurrencies } from '@modules/server.common/entities/Curr
templateUrl: './payment-gateways.component.html'
})
export class PaymentGatewaysComponent implements OnChanges {
@ViewChild('stripeGateway', { static: false })
@ViewChild('stripeGateway')
stripeGateway: StripeGatewayComponent;

@ViewChild('payPalGateway', { static: false })
@ViewChild('payPalGateway')
payPalGateway: PayPalGatewayComponent;

@Input()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ import { TranslateService } from '@ngx-translate/core';
templateUrl: 'basic-info-form.component.html'
})
export class BasicInfoFormComponent implements OnDestroy, OnInit {
@ViewChild('fileInput', { static: false })
@ViewChild('fileInput')
fileInput: any;
@ViewChild('productImagePreview', { static: false })
@ViewChild('productImagePreview')
productImagePreview: ElementRef;

@Input()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export type CustomerBasicInfo = Pick<
})
export class BasicInfoFormComponent
implements OnInit, OnDestroy, AfterViewInit {
@ViewChild('logoImagePreview', { static: false })
@ViewChild('logoImagePreview')
logoImagePreview: ElementRef;

@Input()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import { TranslateService } from '@ngx-translate/core';
styleUrls: ['/user-mutation.component.scss']
})
export class UserMutationComponent {
@ViewChild('basicInfoForm', { static: false })
@ViewChild('basicInfoForm')
basicInfoForm: BasicInfoFormComponent;

@ViewChild('locationForm', { static: false })
@ViewChild('locationForm')
locationForm: LocationFormComponent;

mapTypeEmitter = new EventEmitter<string>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@ export class WarehouseProductCreateComponent implements OnInit, OnDestroy {
@ViewChild('warehouseAddChoice', { static: true })
warehouseAddChoice: WarehouseAddChoiceComponent;

@ViewChild('basicInfoForm', { static: false })
@ViewChild('basicInfoForm')
basicInfoForm: BasicInfoFormComponent;

@ViewChild('productsTable', { static: false })
@ViewChild('productsTable')
productsTable: ProductsTableComponent;

@ViewChild('addWarehouseProductsTable', { static: false })
@ViewChild('addWarehouseProductsTable')
addWarehouseProductsTable: AddWarehouseProductsComponent;

@ViewChild('wizzardFrom', { static: false })
@ViewChild('wizzardFrom')
wizzardFrom: WizardComponent;

@ViewChild('wizzardFromStep1', { static: true })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ export type WarehouseManageTabsDetails = Pick<
})
export class WarehouseManageTabsDetailsComponent
implements OnInit, AfterViewInit {
@ViewChild('fileInput', { static: false })
@ViewChild('fileInput')
fileInput: ElementRef;
@ViewChild('logoPreview', { static: false })
@ViewChild('logoPreview')
logoPreviewElement: ElementRef;

@Input()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,25 @@ export class WarehouseManageTabsComponent {
@Input()
readonly form: FormGroup;

@ViewChild('detailsComponent', { static: false })
@ViewChild('detailsComponent')
readonly detailsComponent: WarehouseManageTabsDetailsComponent;

@ViewChild('accountComponent', { static: false })
@ViewChild('accountComponent')
readonly accountComponent: WarehouseManageTabsAccountComponent;

@ViewChild('contactInfoForm', { static: false })
@ViewChild('contactInfoForm')
readonly contactInfoForm: ContactInfoFormComponent;

@ViewChild('locationForm', { static: false })
@ViewChild('locationForm')
readonly locationForm: LocationFormComponent;

@ViewChild('paymentsSettingsForm', { static: false })
@ViewChild('paymentsSettingsForm')
readonly paymentsSettingsForm: PaymentsSettingsFormComponent;

@ViewChild('deliveryAreasForm', { static: false })
@ViewChild('deliveryAreasForm')
readonly deliveryAreasForm: WarehouseManageTabsDeliveryAreasComponent;

@ViewChild('tabSet', { static: false })
@ViewChild('tabSet')
readonly tabSet;

mapCoordEmitter = new EventEmitter<number[]>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ export class WarehouseMutationComponent implements AfterViewInit {
public BUTTON_NEXT: string = 'BUTTON_NEXT';
public BUTTON_PREV: string = 'BUTTON_PREV';

@ViewChild('basicInfoForm', { static: false })
@ViewChild('basicInfoForm')
basicInfoForm: BasicInfoFormComponent;

@ViewChild('contactInfoForm', { static: true })
contactInfoForm: ContactInfoFormComponent;

@ViewChild('locationForm', { static: false })
@ViewChild('locationForm')
locationForm: LocationFormComponent;

@ViewChild('paymentsSettingsForm', { static: false })
@ViewChild('paymentsSettingsForm')
paymentsSettingsForm: PaymentsSettingsFormComponent;

mapCoordEmitter = new EventEmitter<number[]>();
Expand Down
4 changes: 2 additions & 2 deletions packages/admin-web-angular/src/app/@theme/theme.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ const NB_THEME_PROVIDERS = [
entryComponents: [...ENTRY_COMPONENTS]
})
export class ThemeModule {
static forRoot(): ModuleWithProviders {
const providers: ModuleWithProviders = {
static forRoot(): ModuleWithProviders<ThemeModule> {
const providers: ModuleWithProviders<ThemeModule> = {
ngModule: ThemeModule,
providers: [...NB_THEME_PROVIDERS]
};
Expand Down
10 changes: 3 additions & 7 deletions packages/admin-web-angular/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import { GoogleMapsLoader } from '@modules/client.common.angular2/services/googl
import { MaintenanceService } from '@modules/client.common.angular2/services/maintenance.service';
import { AppModuleGuard } from './app.module.guard';
import { MaintenanceModuleGuard } from './pages/+maintenance-info/maintenance-info.module.guard';
import { first } from 'rxjs/operators';
import { ServerConnectionService } from '@modules/client.common.angular2/services/server-connection.service';

// It's more 'standard' way to use Font-Awesome module and special package,
Expand Down Expand Up @@ -155,23 +154,20 @@ export function HttpLoaderFactory(http: HttpClient) {
}

export function googleMapsLoaderFactory(provider: GoogleMapsLoader) {
const loader = () => provider.load(environment.GOOGLE_MAPS_API_KEY);
return loader;
return () => provider.load(environment.GOOGLE_MAPS_API_KEY);
}

export function serverConnectionFactory(
provider: ServerConnectionService,
store: Store
) {
const loader = () => provider.load(environment.SERVICES_ENDPOINT, store);
return loader;
return () => provider.load(environment.SERVICES_ENDPOINT, store);
}

export function maintenanceFactory(provider: MaintenanceService) {
const loader = () =>
return () =>
provider.load(
environment['SETTINGS_APP_TYPE'],
environment['SETTINGS_MAINTENANCE_API_URL']
);
return loader;
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import { first, map, switchMap } from 'rxjs/operators';
styleUrls: ['./carrier-edit.component.scss']
})
export class CarrierEditComponent implements OnInit {
@ViewChild('basicInfoForm', { static: false })
@ViewChild('basicInfoForm')
basicInfoForm: BasicInfoFormComponent;

@ViewChild('locationForm', { static: false })
@ViewChild('locationForm')
locationForm: LocationFormComponent;

mapTypeEmitter = new EventEmitter<string>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ export const routes: Routes = [
},
{
path: 'edit',
loadChildren: './+carrier-edit/carrier-edit.module#CarrierEditModule'
loadChildren: () => import('./+carrier-edit/carrier-edit.module').then(m => m.CarrierEditModule)
}
];
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const routes: Routes = [
},
{
path: ':id',
loadChildren: './+carrier/carrier.module#CarrierModule'
loadChildren: () => import('./+carrier/carrier.module').then(m => m.CarrierModule)
}
];

Expand Down
Loading

0 comments on commit 4e7a016

Please sign in to comment.