Skip to content

Commit

Permalink
Show banner message on log in page
Browse files Browse the repository at this point in the history
1. Fixes goharbor#19076

Signed-off-by: AllForNothing <[email protected]>
  • Loading branch information
AllForNothing authored and AllForNothing committed Aug 3, 2023
1 parent 1d81b3d commit 32d2913
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 22 deletions.
1 change: 1 addition & 0 deletions src/portal/src/app/account/sign-in/sign-in.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<clr-main-container>
<app-app-level-alerts></app-app-level-alerts>
<navigator (showDialogModalAction)="openModal($event)"></navigator>
<search-result></search-result>
<div
Expand Down
2 changes: 0 additions & 2 deletions src/portal/src/app/base/base.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import { PasswordSettingComponent } from './password-setting/password-setting.co
import { AccountSettingsModalComponent } from './account-settings/account-settings-modal.component';
import { ForgotPasswordComponent } from './password-setting/forgot-password/forgot-password.component';
import { GlobalConfirmationDialogComponent } from './global-confirmation-dialog/global-confirmation-dialog.component';
import { AppLevelAlertsComponent } from './harbor-shell/app-level-alerts/app-level-alerts.component';

const routes: Routes = [
{
Expand Down Expand Up @@ -173,7 +172,6 @@ const routes: Routes = [
AccountSettingsModalComponent,
ForgotPasswordComponent,
GlobalConfirmationDialogComponent,
AppLevelAlertsComponent,
],
})
export class BaseModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,7 @@
min="{{ currentDate | date : 'yyyy-MM-dd' }}"
max="{{ messageToDate | date : 'yyyy-MM-dd' }}"
clrDate
readonly
[(ngModel)]="messageFromDate"
[ngModelOptions]="{ standalone: true }"
[disabled]="
Expand All @@ -463,6 +464,7 @@
<input
class="date"
clrDate
readonly
type="date"
id="to"
min="{{ minDateForEndDay() | date : 'yyyy-MM-dd' }}"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { AppLevelAlertsComponent } from './app-level-alerts.component';
import { SharedTestingModule } from '../../../shared/shared.module';
import { SharedTestingModule } from '../../shared.module';
import { HttpHeaders, HttpResponse } from '@angular/common/http';
import { of } from 'rxjs';
import { delay } from 'rxjs/operators';
import { Scanner } from '../../left-side-nav/interrogation-services/scanner/scanner';
import { Scanner } from '../../../base/left-side-nav/interrogation-services/scanner/scanner';
import { ScannerService } from 'ng-swagger-gen/services/scanner.service';
import { SessionService } from 'src/app/shared/services/session.service';
import { AppConfigService } from '../../../services/app-config.service';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
import { Component, OnDestroy, OnInit } from '@angular/core';
import { SCANNERS_DOC } from '../../left-side-nav/interrogation-services/scanner/scanner';
import { SessionService } from '../../../shared/services/session.service';
import { DEFAULT_PAGE_SIZE, delUrlParam } from '../../../shared/units/utils';
import { SCANNERS_DOC } from '../../../base/left-side-nav/interrogation-services/scanner/scanner';
import { SessionService } from '../../services/session.service';
import { DEFAULT_PAGE_SIZE, delUrlParam } from '../../units/utils';
import { forkJoin, Observable, Subscription } from 'rxjs';
import { Project } from '../../../../../ng-swagger-gen/models/project';
import { ScannerService } from '../../../../../ng-swagger-gen/services/scanner.service';
import { UN_LOGGED_PARAM } from '../../../account/sign-in/sign-in.service';
import {
CommonRoutes,
httpStatusCode,
} from '../../../shared/entities/shared.const';
import { CommonRoutes, httpStatusCode } from '../../entities/shared.const';
import { ActivatedRoute, Router } from '@angular/router';
import { MessageService } from '../../../shared/components/global-message/message.service';
import { Message } from '../../../shared/components/global-message/message';
import { JobServiceDashboardHealthCheckService } from '../../left-side-nav/job-service-dashboard/job-service-dashboard-health-check.service';
import { MessageService } from '../global-message/message.service';
import { Message } from '../global-message/message';
import { JobServiceDashboardHealthCheckService } from '../../../base/left-side-nav/job-service-dashboard/job-service-dashboard-health-check.service';
import { AppConfigService } from '../../../services/app-config.service';
import {
BannerMessage,
BannerMessageType,
} from '../../left-side-nav/config/config';
} from '../../../base/left-side-nav/config/config';
const HAS_SHOWED_SCANNER_INFO: string = 'hasShowScannerInfo';
const YES: string = 'yes';
@Component({
Expand Down Expand Up @@ -191,13 +188,10 @@ export class AppLevelAlertsComponent implements OnInit, OnDestroy {
}

hasValidBannerMessage(): boolean {
if (
this.appConfigService.getConfig()?.banner_message &&
this.appConfigService.getConfig()?.current_time
) {
const current = new Date(
this.appConfigService.getConfig()?.current_time
);
const current: Date = this.appConfigService.getConfig()?.current_time
? new Date(this.appConfigService.getConfig()?.current_time)
: new Date();
if (this.appConfigService.getConfig()?.banner_message) {
const bm = JSON.parse(
this.appConfigService.getConfig()?.banner_message
) as BannerMessage;
Expand Down
3 changes: 3 additions & 0 deletions src/portal/src/app/shared/shared.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ import { LabelSelectorComponent } from './components/label-selector/label-select
import { ScrollSectionDirective } from './directives/scroll/scroll-section.directive';
import { ScrollManagerService } from './directives/scroll/scroll-manager.service';
import { ScrollAnchorDirective } from './directives/scroll/scroll-anchor.directive';
import { AppLevelAlertsComponent } from './components/app-level-alerts/app-level-alerts.component';

// ClarityIcons is publicly accessible from the browser's window object.
declare const ClarityIcons: ClarityIconsApi;
Expand Down Expand Up @@ -147,6 +148,7 @@ ClarityIcons.add({
HarborDatetimePipe,
RemainingTimeComponent,
LabelSelectorComponent,
AppLevelAlertsComponent,
],
exports: [
TranslateModule,
Expand Down Expand Up @@ -188,6 +190,7 @@ ClarityIcons.add({
HarborDatetimePipe,
RemainingTimeComponent,
LabelSelectorComponent,
AppLevelAlertsComponent,
],
providers: [
{ provide: EndpointService, useClass: EndpointDefaultService },
Expand Down

0 comments on commit 32d2913

Please sign in to comment.