Skip to content

Commit

Permalink
Merge pull request #1012 from adshares/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
m-pilarczyk authored Mar 15, 2023
2 parents 65a4590 + 5e0088f commit 45d484f
Show file tree
Hide file tree
Showing 14 changed files with 96 additions and 33 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [2.4.5] - 2023-03-15
### Added
- Server maintenance page
- Default message for rejected site

## [2.4.4] - 2023-02-28
### Added
- Warning before deposit if automatic withdrawal is active
Expand Down Expand Up @@ -561,7 +566,8 @@ Display admin role on screen smaller than 1800px
- Publisher features (Sites & AdUnits)


[Unreleased]: https://github.com/adshares/adpanel/compare/v2.4.4...develop
[Unreleased]: https://github.com/adshares/adpanel/compare/v2.4.5...develop
[2.4.5]: https://github.com/adshares/adpanel/compare/v2.4.4...v2.4.5
[2.4.4]: https://github.com/adshares/adpanel/compare/v2.4.3...v2.4.4
[2.4.3]: https://github.com/adshares/adpanel/compare/v2.4.2...v2.4.3
[2.4.2]: https://github.com/adshares/adpanel/compare/v2.4.1...v2.4.2
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "adpanel",
"version": "2.4.4",
"version": "2.4.5",
"scripts": {
"ng": "ng",
"start": "ng serve adshares",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { Error4xxComponent } from 'common/info/page-not-found/error4xx.component';
import { ServiceUnavailableComponent } from 'common/info/service-unavailable/service-unavailable.component';
import { HTTP_FORBIDDEN, HTTP_NOT_FOUND } from 'common/utilities/codes';

const appRoutes: Routes = [
{ path: '403', component: Error4xxComponent, data: { code: HTTP_FORBIDDEN } },
{ path: '404', component: Error4xxComponent, data: { code: HTTP_NOT_FOUND } },
{ path: '503', component: ServiceUnavailableComponent, pathMatch: 'full' },
{ path: '**', redirectTo: '/404' },
];

@NgModule({
imports: [RouterModule.forRoot(appRoutes)],
exports: [RouterModule],
})
export class App4xxRoutingModule {}
export class AppErrorRoutingModule {}
2 changes: 1 addition & 1 deletion src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div [@fadeAnimation]="getRouterOutletState(o)" *ngIf="info; else loading">
<div [@fadeAnimation]="getRouterOutletState(o)" *ngIf="isLoaded; else loading">
<app-impersonation></app-impersonation>
<router-outlet #o="outlet"></router-outlet>
</div>
Expand Down
15 changes: 13 additions & 2 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, NavigationEnd, Router } from '@angular/router';
import { ActivatedRoute, NavigationEnd, NavigationStart, Router } from '@angular/router';
import { Store } from '@ngrx/store';

import { HandleSubscriptionComponent } from 'common/handle-subscription.component';
Expand All @@ -14,6 +14,7 @@ import { Info } from 'models/info.model';

import { appSettings } from 'app-settings';
import { environment } from 'environments/environment';
import { filter } from 'rxjs/operators';

@Component({
selector: 'app-root',
Expand All @@ -25,6 +26,7 @@ export class AppComponent extends HandleSubscriptionComponent implements OnInit
private readonly MODE_INITIALIZATION = 'initialization';
name: string = null;
info: Info = null;
isLoaded = false;

constructor(
private store: Store<AppState>,
Expand All @@ -39,13 +41,22 @@ export class AppComponent extends HandleSubscriptionComponent implements OnInit
getRouterOutletState = outlet => (outlet.isActivated ? outlet.activatedRoute : '');

ngOnInit(): void {
this.router.events.pipe(filter(event => event instanceof NavigationStart)).subscribe((event: NavigationStart) => {
if ('/503' === event.url) {
this.isLoaded = true;
}
});
this.name = environment.name;
const infoSubscription = this.store.select('state', 'common', 'info').subscribe((info: Info) => {
if (!this.isOauth() && environment.adControllerUrl && this.MODE_INITIALIZATION === info?.mode) {
if (null === info) {
return;
}
if (!this.isOauth() && environment.adControllerUrl && this.MODE_INITIALIZATION === info.mode) {
window.location.href = environment.adControllerUrl;
return;
}
this.info = info;
this.isLoaded = true;
});
this.subscriptions.push(infoSubscription);
this.loadInfo();
Expand Down
4 changes: 2 additions & 2 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import { DATE_PICKER_FORMATS } from 'common/utilities/consts';
import { ImpersonationService } from './impersonation/impersonation.service';
import { ImpersonationModule } from './impersonation/impersonation.module';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { App4xxRoutingModule } from './app4xx-routing.module';
import { AppErrorRoutingModule } from './app-error-routing.module';
import { AgencyModule } from 'agency/agency.module';

const appModules = [
Expand Down Expand Up @@ -72,7 +72,7 @@ const appModules = [
AuthEffects,
]),
...appModules,
App4xxRoutingModule,
AppErrorRoutingModule,
],
providers: [
{
Expand Down
2 changes: 2 additions & 0 deletions src/app/common/common.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ import { ReportsListItemComponent } from 'common/components/reports-list/reports
import { BidStrategySettingsComponent } from 'common/components/bid-strategy/bid-strategy-settings/bid-strategy-settings.component';
import { InfoPageComponent } from 'common/info/info-page/info-page.component';
import { Error4xxComponent } from 'common/info/page-not-found/error4xx.component';
import { ServiceUnavailableComponent } from 'common/info/service-unavailable/service-unavailable.component';
import { MediaResolver } from 'common/resolvers/media.resolver';
import { SettingsNavigationComponent } from 'settings/settings-navigation/settings-navigation.component';
import { ModelPreviewComponent } from 'common/components/model-preview/model-preview.component';
Expand Down Expand Up @@ -130,6 +131,7 @@ const appComponents = [
BidStrategySettingsComponent,
InfoPageComponent,
Error4xxComponent,
ServiceUnavailableComponent,
SettingsNavigationComponent,
FormatNumberWithCommaPipe,
];
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<info-page>
<div class="col row--gap32">
<h1 class="ap-heading ap-heading--h2 ap-heading--secondary">503</h1>
<p class="ap-copy ap-copy--semi ap-copy--medium ap-copy--light">We’ll be back soon!</p>
<p class="ap-copy ap-copy--light">
Sorry for the inconvenience but we’re performing some maintenance at the moment.
</p>
<p class="ap-copy">
<a href="/">Back to the main page</a>
</p>
</div>
</info-page>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Component } from '@angular/core';

@Component({
selector: 'app-service-unavailable',
templateUrl: './service-unavailable.component.html',
})
export class ServiceUnavailableComponent {}
10 changes: 8 additions & 2 deletions src/app/common/request.interceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { ErrorResponseDialogComponent } from 'common/dialog/error-response-dialo
import { environment } from 'environments/environment';
import { HandleSubscriptionComponent } from 'common/handle-subscription.component';
import { ImpersonationService } from '../impersonation/impersonation.service';
import { HTTP_INTERNAL_SERVER_ERROR, HTTP_UNAUTHORIZED } from 'common/utilities/codes';
import { HTTP_INTERNAL_SERVER_ERROR, HTTP_SERVICE_UNAVAILABLE, HTTP_UNAUTHORIZED } from 'common/utilities/codes';

@Injectable()
export class RequestInterceptor extends HandleSubscriptionComponent implements HttpInterceptor {
Expand Down Expand Up @@ -137,7 +137,13 @@ export class RequestInterceptor extends HandleSubscriptionComponent implements H
return err;
}

if (err instanceof HttpErrorResponse && err.status === 0 && err.statusText == 'Unknown Error') {
if (err instanceof HttpErrorResponse && err.status === HTTP_SERVICE_UNAVAILABLE) {
this.session.drop();
this.router.navigate(['/503']);
return err;
}

if (err instanceof HttpErrorResponse && err.status === 0 && err.statusText === 'Unknown Error') {
this.onConnectionFailure();
return err;
}
Expand Down
4 changes: 2 additions & 2 deletions src/app/publisher/site-details/site-details.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
matTooltipClass="ap-mat-tooltip"
matTooltipPosition="right"></fa-icon>
<fa-icon
*ngIf="siteStatusEnum.REJECTED === site.status && site.rejectReason"
*ngIf="siteStatusEnum.REJECTED === site.status"
[icon]="faQuestionCircle"
[matTooltip]="site.rejectReason"
[matTooltip]="site.rejectReason || 'Domain rejected'"
class="ap-icon ap-icon--append"
matTooltipClass="ap-mat-tooltip"
matTooltipPosition="right"></fa-icon>
Expand Down
8 changes: 7 additions & 1 deletion src/app/store/common/common.effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { UPDATE_CAMPAIGN_FAILURE, UpdateCampaignFailure } from 'store/advertiser
import { ErrorResponseDialogComponent } from 'common/dialog/error-response-dialog/error-response-dialog.component';
import { SuccessSnackbarComponent } from 'common/dialog/success-snackbar/success-snackbar.component';
import { UserConfirmResponseDialogComponent } from 'common/dialog/user-confirm-response-dialog/user-confirm-response-dialog.component';
import { HTTP_SERVICE_UNAVAILABLE } from 'common/utilities/codes';
import { SessionService } from '../../session.service';

@Injectable()
Expand All @@ -45,7 +46,12 @@ export class CommonEffects {
placeholders: this.service.getLoginPlaceholders(),
}).pipe(
switchMap(result => [new LoadInfoSuccess(result.info), new LoadPlaceholdersSuccess(result.placeholders)]),
catchError(error => observableOf(new ShowDialogOnError(error.message)))
catchError(error => {
if (HTTP_SERVICE_UNAVAILABLE === error.status) {
return [];
}
return observableOf(new ShowDialogOnError(error.message));
})
)
)
)
Expand Down
20 changes: 12 additions & 8 deletions src/styles/_colors.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@
--dark: #000000;
--light: #ffffff;
--gray: #bfbfbf;
--error: #ff414d;
--error-bg: #ffa0a6;
--danger: #ff414d;
--danger-bg: #ffa0a6;
--warning: #ffb400;
--warning-bg: #f8e7bf;
--success: #19ad42;
--success-bg: #8debc8;
--info: #003d4d;
--info-bg: #96dfef;
--muted: #606060;
--muted-bg: #809EA6;
}

$primary: var(--primary);
Expand All @@ -27,20 +29,22 @@ $body-color: var(--body-color);
$dark: var(--dark);
$light: var(--light);
$gray: var(--gray);
$error: var(--error);
$error-bg: var(--error-bg);
$danger: var(--danger);
$danger-bg: var(--danger-bg);
$warning: var(--warning);
$warning-bg: var(--warning-bg);
$success: var(--success);
$success-bg: var(--success-bg);
$info: var(--info);
$info-bg: var(--info-bg);
$muted: var(--muted);
$muted-bg: var(--muted-bg);

$palette-colors: (
primary: (
base: $primary,
dark: $primary-alt,
light: #809ea6,
light: $muted-bg,
),
secondary: (
base: $secondary,
Expand Down Expand Up @@ -69,12 +73,12 @@ $palette-colors: (
light: $body-bg,
),
error: (
base: $error,
base: $danger,
dark: #a0000a,
light: $error-bg,
light: $danger-bg,
),
error-bg: (
base: $error-bg,
base: $danger-bg,
),
warning: (
base: $warning,
Expand Down
31 changes: 19 additions & 12 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@


"@adshares/ads-connector@^1.0.4":
version "1.0.4"
resolved "https://registry.yarnpkg.com/@adshares/ads-connector/-/ads-connector-1.0.4.tgz#fa346e8a2d6be116ea3e4c3d87af55b558d4b4fd"
integrity sha512-t/+yUvsH3pds3Yp+9z9r1QkVBZT6FX/uK3rmKsalzcZrjTledky0STwo35fOPs140OjUiH4sEQxtXpClKpyviw==
version "1.0.5"
resolved "https://registry.yarnpkg.com/@adshares/ads-connector/-/ads-connector-1.0.5.tgz#46eb0cf8b893d5c81007bf12e8017a7e69de2c6b"
integrity sha512-8rizdcJvLDgpCVGiykVPFkhmwDVOnPp4+/ClOYCyntfuh7jcAGGwi07H1W9aKb0BdsPNJXqzAxnxq1sJaDP/nQ==
dependencies:
"@adshares/ads-wallet" "^1.0.1"
"@babel/runtime" "^7.15.4"

"@adshares/ads-wallet@^1.0.1":
version "1.0.2"
resolved "https://registry.yarnpkg.com/@adshares/ads-wallet/-/ads-wallet-1.0.2.tgz#8eaea0599b668fa5395c13a3f9bab1843c6bed47"
integrity sha512-rj4NMDCqoAhDX2Pb0aYE6D0PAPXd9JRWxtQV5t5lTEsI79uj0yAujGVrvcMGjM/yom/tgtiDe3g0pcoNLSNSag==
version "1.0.3"
resolved "https://registry.yarnpkg.com/@adshares/ads-wallet/-/ads-wallet-1.0.3.tgz#e4305621d67ffe7bab3f8c0fad28c7a47347ab20"
integrity sha512-Qfc6JW7zHhcbUg8L+XKRjHOhrSwLQCLsLEIOJd2xA92CH//GNzG/Gl5/gBXPAGaIsClpNRnm3T3sNYwwaL1arQ==
dependencies:
"@babel/runtime" "^7.15.4"

Expand Down Expand Up @@ -1257,7 +1257,14 @@
dependencies:
regenerator-runtime "^0.13.11"

"@babel/runtime@^7.15.4", "@babel/runtime@^7.8.4":
"@babel/runtime@^7.15.4":
version "7.21.0"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.21.0.tgz#5b55c9d394e5fcf304909a8b00c07dc217b56673"
integrity sha512-xwII0//EObnq89Ji5AKYQaRYiW/nZ3llSv29d49IuxPhKbtJoLP+9QUUZ4nVragQVtaVGeZrpB+ZtG/Pdy/POw==
dependencies:
regenerator-runtime "^0.13.11"

"@babel/runtime@^7.8.4":
version "7.18.3"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.18.3.tgz#c7b654b57f6f63cf7f8b418ac9ca04408c4579f4"
integrity sha512-38Y8f7YUhce/K7RMwTp7m0uCumpv9hZkitCbBClqQIow1qSbCvGkcegKOXpEWCQLfWmevgRiWokZ1GkpfhbZug==
Expand Down Expand Up @@ -6461,9 +6468,9 @@ mock-fs@^4.1.0:
integrity sha512-qYvlv/exQ4+svI3UOvPUpLDF0OMX5euvUH0Ny4N5QyRyhNdgAgUrVH3iUINSzEPLvx0kbo/Bp28GJKIqvE7URw==

moment@^2.22.2:
version "2.29.3"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.3.tgz#edd47411c322413999f7a5940d526de183c031f3"
integrity sha512-c6YRvhEo//6T2Jz/vVtYzqBzwvPT95JBQ+smCytzf7c50oMZRsR/a4w88aD34I+/QVSfnoAnSBFPJHItlOMJVw==
version "2.29.4"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.4.tgz#3dbe052889fe7c1b2ed966fcb3a77328964ef108"
integrity sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==

[email protected]:
version "2.0.0"
Expand Down Expand Up @@ -7751,12 +7758,12 @@ regenerate@^1.4.2:
resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.4.2.tgz#b9346d8827e8f5a32f7ba29637d398b69014848a"
integrity sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A==

[email protected], regenerator-runtime@^0.13.4:
[email protected]:
version "0.13.9"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz#8925742a98ffd90814988d7566ad30ca3b263b52"
integrity sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==

regenerator-runtime@^0.13.11:
regenerator-runtime@^0.13.11, regenerator-runtime@^0.13.4:
version "0.13.11"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz#f6dca3e7ceec20590d07ada785636a90cdca17f9"
integrity sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==
Expand Down

0 comments on commit 45d484f

Please sign in to comment.