From f53e2c028625d8d93a7f50e353df8a302a4eaea7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Borja=20Garc=C3=ADa=20Rodr=C3=ADguez?= Date: Mon, 21 Dec 2020 15:47:17 +0100 Subject: [PATCH] remove campaings from SPA --- src/Web/WebSPA/Client/modules/app.module.ts | 4 +- src/Web/WebSPA/Client/modules/app.routes.ts | 4 - .../campaigns-detail.component.html | 17 ---- .../campaigns-detail.component.scss | 57 -------------- .../campaigns-detail.component.ts | 30 ------- .../campaigns/campaigns.component.html | 43 ---------- .../campaigns/campaigns.component.scss | 78 ------------------- .../modules/campaigns/campaigns.component.ts | 67 ---------------- .../modules/campaigns/campaigns.module.ts | 15 ---- .../modules/campaigns/campaigns.service.ts | 47 ----------- .../shared/components/identity/identity.html | 7 -- src/docker-compose.yml | 6 +- 12 files changed, 4 insertions(+), 371 deletions(-) delete mode 100644 src/Web/WebSPA/Client/modules/campaigns/campaigns-detail/campaigns-detail.component.html delete mode 100644 src/Web/WebSPA/Client/modules/campaigns/campaigns-detail/campaigns-detail.component.scss delete mode 100644 src/Web/WebSPA/Client/modules/campaigns/campaigns-detail/campaigns-detail.component.ts delete mode 100644 src/Web/WebSPA/Client/modules/campaigns/campaigns.component.html delete mode 100644 src/Web/WebSPA/Client/modules/campaigns/campaigns.component.scss delete mode 100644 src/Web/WebSPA/Client/modules/campaigns/campaigns.component.ts delete mode 100644 src/Web/WebSPA/Client/modules/campaigns/campaigns.module.ts delete mode 100644 src/Web/WebSPA/Client/modules/campaigns/campaigns.service.ts diff --git a/src/Web/WebSPA/Client/modules/app.module.ts b/src/Web/WebSPA/Client/modules/app.module.ts index 4232ae314..b3693dfcb 100644 --- a/src/Web/WebSPA/Client/modules/app.module.ts +++ b/src/Web/WebSPA/Client/modules/app.module.ts @@ -10,7 +10,6 @@ import { SharedModule } from './shared/shared.module'; import { CatalogModule } from './catalog/catalog.module'; import { OrdersModule } from './orders/orders.module'; import { BasketModule } from './basket/basket.module'; -import { CampaignsModule } from './campaigns/campaigns.module'; import { ToastrModule } from 'ngx-toastr'; @NgModule({ @@ -25,8 +24,7 @@ import { ToastrModule } from 'ngx-toastr'; SharedModule.forRoot(), CatalogModule, OrdersModule, - BasketModule, - CampaignsModule + BasketModule ], providers: [ AppService diff --git a/src/Web/WebSPA/Client/modules/app.routes.ts b/src/Web/WebSPA/Client/modules/app.routes.ts index 32e712514..474d292a2 100644 --- a/src/Web/WebSPA/Client/modules/app.routes.ts +++ b/src/Web/WebSPA/Client/modules/app.routes.ts @@ -5,8 +5,6 @@ import { CatalogComponent } from './catalog/catalog.component'; import { OrdersComponent } from './orders/orders.component'; import { OrdersDetailComponent } from './orders/orders-detail/orders-detail.component'; import { OrdersNewComponent } from './orders/orders-new/orders-new.component'; -import { CampaignsComponent } from './campaigns/campaigns.component'; -import { CampaignsDetailComponent } from './campaigns/campaigns-detail/campaigns-detail.component'; export const routes: Routes = [ { path: '', redirectTo: 'catalog', pathMatch: 'full' }, @@ -15,8 +13,6 @@ export const routes: Routes = [ { path: 'orders', component: OrdersComponent }, { path: 'orders/:id', component: OrdersDetailComponent }, { path: 'order', component: OrdersNewComponent }, - { path: 'campaigns', component: CampaignsComponent }, - { path: 'campaigns/:id', component: CampaignsDetailComponent } ]; export const routing = RouterModule.forRoot(routes); diff --git a/src/Web/WebSPA/Client/modules/campaigns/campaigns-detail/campaigns-detail.component.html b/src/Web/WebSPA/Client/modules/campaigns/campaigns-detail/campaigns-detail.component.html deleted file mode 100644 index bcedc4da2..000000000 --- a/src/Web/WebSPA/Client/modules/campaigns/campaigns-detail/campaigns-detail.component.html +++ /dev/null @@ -1,17 +0,0 @@ -Back to campaigns -
-
-
- {{campaign.name}} -
-

{{campaign.name}}

-

{{campaign.description}}

-
- -
-
-
diff --git a/src/Web/WebSPA/Client/modules/campaigns/campaigns-detail/campaigns-detail.component.scss b/src/Web/WebSPA/Client/modules/campaigns/campaigns-detail/campaigns-detail.component.scss deleted file mode 100644 index 7abe3ca15..000000000 --- a/src/Web/WebSPA/Client/modules/campaigns/campaigns-detail/campaigns-detail.component.scss +++ /dev/null @@ -1,57 +0,0 @@ -@import '../../variables'; - -.esh-campaign_detail { - min-height: 80vh; - margin-top: 1rem; - - &-section { - padding: 1rem 0; - - &--right { - text-align: right; - } - } - - &-titles { - padding-bottom: 1rem; - padding-top: 2rem; - } - - &-title { - text-transform: uppercase; - } - - &-items { - &--border { - border-bottom: $border-light solid $color-foreground-bright; - padding: .5rem 0; - - &:last-of-type { - border-color: transparent; - } - } - } - - $item-height: 8rem; - - &-item { - font-size: $font-size-m; - font-weight: $font-weight-semilight; - - &--middle { - line-height: $item-height; - - @media screen and (max-width: $media-screen-s) { - line-height: $font-size-m; - } - } - - &--mark { - color: $color-secondary; - } - } - - &-image { - height: $item-height; - } -} diff --git a/src/Web/WebSPA/Client/modules/campaigns/campaigns-detail/campaigns-detail.component.ts b/src/Web/WebSPA/Client/modules/campaigns/campaigns-detail/campaigns-detail.component.ts deleted file mode 100644 index fc9dae9de..000000000 --- a/src/Web/WebSPA/Client/modules/campaigns/campaigns-detail/campaigns-detail.component.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { Component, OnInit } from '@angular/core'; -import { CampaignsService } from '../campaigns.service'; -import { ICampaignItem } from '../../shared/models/campaignItem.model'; -import { ActivatedRoute } from '@angular/router'; - -@Component({ - selector: 'esh-campaigns_detail', - styleUrls: ['./campaigns-detail.component.scss'], - templateUrl: './campaigns-detail.component.html' -}) -export class CampaignsDetailComponent implements OnInit { - public campaign: ICampaignItem = {}; - - constructor(private service: CampaignsService, private route: ActivatedRoute) { } - - ngOnInit() { - this.route.params.subscribe(params => { - let id = +params['id']; // (+) converts string 'id' to a number - this.getCampaign(id); - }); - } - - getCampaign(id: number) { - this.service.getCampaign(id).subscribe(campaign => { - this.campaign = campaign; - console.log('campaign retrieved: ' + campaign.id); - console.log(this.campaign); - }); - } -} \ No newline at end of file diff --git a/src/Web/WebSPA/Client/modules/campaigns/campaigns.component.html b/src/Web/WebSPA/Client/modules/campaigns/campaigns.component.html deleted file mode 100644 index 41f83c715..000000000 --- a/src/Web/WebSPA/Client/modules/campaigns/campaigns.component.html +++ /dev/null @@ -1,43 +0,0 @@ -Back to catalog -
- -
- -
- -
-
- -
- {{item.name}} -
-

{{item.name}}

- - - - -
- -
- -
-
-
- -
-
-
- THERE ARE NO RESULTS THAT MATCH YOUR SEARCH -
-
-
-
- - diff --git a/src/Web/WebSPA/Client/modules/campaigns/campaigns.component.scss b/src/Web/WebSPA/Client/modules/campaigns/campaigns.component.scss deleted file mode 100644 index 514ccb435..000000000 --- a/src/Web/WebSPA/Client/modules/campaigns/campaigns.component.scss +++ /dev/null @@ -1,78 +0,0 @@ -@import '../variables'; - -.esh-campaign { - $banner-height: 260px; - - &-title { - position: relative; - top: $banner-height / 3.5; - } - - &-items { - margin-top: 1rem; - } - - &-item { - margin-bottom: 1.5rem; - text-align: center; - width: 33%; - display: inline-block; - float: none !important; - - @media screen and (max-width: $media-screen-m) { - width: 50%; - } - - @media screen and (max-width: $media-screen-s) { - width: 100%; - } - } - - &-thumbnail { - max-width: 370px; - width: 100%; - } - - &-button { - background-color: $color-secondary; - border: 0; - color: $color-foreground-brighter; - cursor: pointer; - font-size: $font-size-m; - height: 3rem; - margin-top: 1rem; - transition: all $animation-speed-default; - width: 80%; - - &.is-disabled { - opacity: .5; - pointer-events: none; - } - - &:hover { - background-color: $color-secondary-darker; - transition: all $animation-speed-default; - } - } - - &-name { - font-size: $font-size-m; - font-weight: $font-weight-semilight; - margin-top: .5rem; - text-align: center; - text-transform: uppercase; - } - - &-alert { - margin-top: 10px; - } -} - -.esh-campaigns-card { - - &-footer-text { - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - } -} \ No newline at end of file diff --git a/src/Web/WebSPA/Client/modules/campaigns/campaigns.component.ts b/src/Web/WebSPA/Client/modules/campaigns/campaigns.component.ts deleted file mode 100644 index 0fb52728e..000000000 --- a/src/Web/WebSPA/Client/modules/campaigns/campaigns.component.ts +++ /dev/null @@ -1,67 +0,0 @@ -import { Component, OnInit } from '@angular/core'; -import { CampaignsService } from './campaigns.service'; -import { ICampaign } from '../shared/models/campaign.model'; -import { IPager } from '../shared/models/pager.model'; -import { ConfigurationService } from '../shared/services/configuration.service'; -import { Observable } from 'rxjs'; -import { catchError } from 'rxjs/operators'; - -@Component({ - selector: 'esh-campaigns', - styleUrls: ['./campaigns.component.scss'], - templateUrl: './campaigns.component.html' -}) -export class CampaignsComponent implements OnInit { - private interval = null; - paginationInfo: IPager; - campaigns: ICampaign; - isCampaignDetailFunctionEnabled: boolean = false; - errorReceived: boolean; - - constructor(private service: CampaignsService, private configurationService: ConfigurationService) { } - - ngOnInit() { - if (this.configurationService.isReady) { - this.isCampaignDetailFunctionEnabled = this.configurationService.serverSettings.activateCampaignDetailFunction; - this.getCampaigns(9, 0) - } else { - this.configurationService.settingsLoaded$.subscribe(x => { - this.isCampaignDetailFunctionEnabled = this.configurationService.serverSettings.activateCampaignDetailFunction; - this.getCampaigns(9, 0); - }); - } - } - - onPageChanged(value: any) { - console.log('campaigns pager event fired' + value); - //event.preventDefault(); - this.paginationInfo.actualPage = value; - this.getCampaigns(this.paginationInfo.itemsPage, value); - } - - getCampaigns(pageSize: number, pageIndex: number) { - this.errorReceived = false; - this.service.getCampaigns(pageIndex, pageSize) - .pipe(catchError((err) => this.handleError(err))) - .subscribe(campaigns => { - this.campaigns = campaigns; - this.paginationInfo = { - actualPage : campaigns.pageIndex, - itemsPage : campaigns.pageSize, - totalItems : campaigns.count, - totalPages: Math.ceil(campaigns.count / campaigns.pageSize), - items: campaigns.pageSize - }; - }); - } - - onNavigateToDetails(uri: string) { - window.open(uri, "_blank"); - } - - private handleError(error: any) { - this.errorReceived = true; - return Observable.throw(error); - } -} - diff --git a/src/Web/WebSPA/Client/modules/campaigns/campaigns.module.ts b/src/Web/WebSPA/Client/modules/campaigns/campaigns.module.ts deleted file mode 100644 index 4da504ed9..000000000 --- a/src/Web/WebSPA/Client/modules/campaigns/campaigns.module.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { NgModule } from '@angular/core'; -import { BrowserModule } from '@angular/platform-browser'; - -import { SharedModule } from '../shared/shared.module'; -import { CampaignsComponent } from './campaigns.component'; -import { CampaignsDetailComponent } from './campaigns-detail/campaigns-detail.component'; -import { CampaignsService } from './campaigns.service'; -import { Header } from '../shared/components/header/header'; - -@NgModule({ - imports: [BrowserModule, SharedModule], - declarations: [CampaignsComponent, CampaignsDetailComponent], - providers: [CampaignsService] -}) -export class CampaignsModule { } \ No newline at end of file diff --git a/src/Web/WebSPA/Client/modules/campaigns/campaigns.service.ts b/src/Web/WebSPA/Client/modules/campaigns/campaigns.service.ts deleted file mode 100644 index 2e9966a1d..000000000 --- a/src/Web/WebSPA/Client/modules/campaigns/campaigns.service.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { Injectable } from '@angular/core'; - -import { DataService } from '../shared/services/data.service'; -import { ICampaign } from '../shared/models/campaign.model'; -import { ICampaignItem } from '../shared/models/campaignItem.model'; -import { SecurityService } from '../shared/services/security.service'; -import { ConfigurationService } from '../shared/services/configuration.service'; - -import { Observable } from 'rxjs'; -import { tap } from 'rxjs/operators'; - -@Injectable() -export class CampaignsService { - private marketingUrl: string = ''; - private buyerId: string = ''; - constructor(private service: DataService, private identityService: SecurityService, private configurationService: ConfigurationService) { - if (this.identityService.IsAuthorized) { - if (this.identityService.UserData) { - this.buyerId = this.identityService.UserData.sub; - } - } - - if (this.configurationService.isReady) - this.marketingUrl = this.configurationService.serverSettings.marketingUrl; - else - this.configurationService.settingsLoaded$.subscribe(x => this.marketingUrl = this.configurationService.serverSettings.marketingUrl); - - } - - getCampaigns(pageIndex: number, pageSize: number): Observable { - let url = this.marketingUrl + '/m/api/v1/campaigns/user'; - url = url + '?pageIndex=' + pageIndex + '&pageSize=' + pageSize; - - return this.service.get(url).pipe(tap((response: any) => { - return response; - })); - } - - getCampaign(id: number): Observable { - let url = this.marketingUrl + '/m/api/v1/campaigns/' + id; - - return this.service.get(url).pipe(tap((response: any) => { - return response; - })); - } -} - diff --git a/src/Web/WebSPA/Client/modules/shared/components/identity/identity.html b/src/Web/WebSPA/Client/modules/shared/components/identity/identity.html index 961929bfb..9dce33adc 100644 --- a/src/Web/WebSPA/Client/modules/shared/components/identity/identity.html +++ b/src/Web/WebSPA/Client/modules/shared/components/identity/identity.html @@ -25,13 +25,6 @@ -
- -
My campaigns
- -
-
diff --git a/src/docker-compose.yml b/src/docker-compose.yml index 74d606822..cf02d2307 100644 --- a/src/docker-compose.yml +++ b/src/docker-compose.yml @@ -136,9 +136,9 @@ services: dockerfile: Web/WebSPA/Dockerfile args: NODE_IMAGE: ${NODE_IMAGE:-node:10.13} -# depends_on: -# - webshoppingagg -# - webshoppingapigw + depends_on: + - webshoppingagg + - webshoppingapigw webmvc: image: ${REGISTRY:-eshop}/webmvc:${PLATFORM:-linux}-${TAG:-latest}