From 5f1dff32c27555c620e6e5ec25ef49e2ae0bd9d7 Mon Sep 17 00:00:00 2001 From: Shijun Sun <30999793+AllForNothing@users.noreply.github.com> Date: Fri, 2 Dec 2022 12:51:38 +0800 Subject: [PATCH] Change inputs type from text to number (#17897) 1.Fixes #17890 2.Update isDBAuth function Signed-off-by: AllForNothing Signed-off-by: AllForNothing --- .../harbor-shell/harbor-shell.component.html | 2 +- .../harbor-shell/harbor-shell.component.ts | 25 +++++++++-------- .../system/system-settings.component.html | 18 ++++++------- .../system/system-settings.component.scss | 11 ++++++++ .../system/system-settings.component.ts | 27 ------------------- 5 files changed, 35 insertions(+), 48 deletions(-) diff --git a/src/portal/src/app/base/harbor-shell/harbor-shell.component.html b/src/portal/src/app/base/harbor-shell/harbor-shell.component.html index 17cc33f56..0d0b529f7 100644 --- a/src/portal/src/app/base/harbor-shell/harbor-shell.component.html +++ b/src/portal/src/app/base/harbor-shell/harbor-shell.component.html @@ -92,7 +92,7 @@ {{ 'SYSTEM_ROBOT.ROBOT_ACCOUNT_NAV' | translate }} diff --git a/src/portal/src/app/base/harbor-shell/harbor-shell.component.ts b/src/portal/src/app/base/harbor-shell/harbor-shell.component.ts index 2b9e3df2a..81b82d347 100644 --- a/src/portal/src/app/base/harbor-shell/harbor-shell.component.ts +++ b/src/portal/src/app/base/harbor-shell/harbor-shell.component.ts @@ -29,7 +29,10 @@ import { NavigatorComponent } from '../../shared/components/navigator/navigator. import { SessionService } from '../../shared/services/session.service'; import { AboutDialogComponent } from '../../shared/components/about-dialog/about-dialog.component'; import { SearchTriggerService } from '../../shared/components/global-search/search-trigger.service'; -import { CommonRoutes } from '../../shared/entities/shared.const'; +import { + CommonRoutes, + CONFIG_AUTH_MODE, +} from '../../shared/entities/shared.const'; import { THEME_ARRAY, ThemeInterface } from '../../services/theme'; import { clone, DEFAULT_PAGE_SIZE } from '../../shared/units/utils'; import { ThemeService } from '../../services/theme.service'; @@ -70,9 +73,6 @@ export class HarborShellComponent implements OnInit, OnDestroy { searchSub: Subscription; searchCloseSub: Subscription; - isLdapMode: boolean; - isOidcMode: boolean; - isHttpAuthMode: boolean; showScannerInfo: boolean = false; scannerDocUrl: string = SCANNERS_DOC; themeArray: ThemeInterface[] = clone(THEME_ARRAY); @@ -104,13 +104,6 @@ export class HarborShellComponent implements OnInit, OnDestroy { } ); } - if (this.appConfigService.isLdapMode()) { - this.isLdapMode = true; - } else if (this.appConfigService.isHttpAuthMode()) { - this.isHttpAuthMode = true; - } else if (this.appConfigService.isOidcMode()) { - this.isOidcMode = true; - } this.searchSub = this.searchTrigger.searchTriggerChan$.subscribe( searchEvt => { if (searchEvt && searchEvt.trim() !== '') { @@ -139,6 +132,16 @@ export class HarborShellComponent implements OnInit, OnDestroy { this.styleMode = localStorage.getItem(HAS_STYLE_MODE); } } + isDBAuth(): boolean { + if (this.appConfigService?.configurations?.auth_mode) { + return ( + this.appConfigService.configurations.auth_mode === + CONFIG_AUTH_MODE.DB_AUTH + ); + } + return true; + } + publishScrollEvent() { if (this.scrollDiv && this.scrollDiv.nativeElement) { this.event.publish(HarborEvent.SCROLL, { diff --git a/src/portal/src/app/base/left-side-nav/config/system/system-settings.component.html b/src/portal/src/app/base/left-side-nav/config/system/system-settings.component.html index 0a55adbc0..64e48997a 100644 --- a/src/portal/src/app/base/left-side-nav/config/system/system-settings.component.html +++ b/src/portal/src/app/base/left-side-nav/config/system/system-settings.component.html @@ -57,13 +57,13 @@ {{ 'TOOLTIP.NUMBER_REQUIRED' | translate @@ -90,13 +90,13 @@ {{ 'TOOLTIP.NUMBER_REQUIRED' | translate @@ -155,13 +155,13 @@ {{ 'ROBOT_ACCOUNT.NUMBER_REQUIRED' | translate diff --git a/src/portal/src/app/base/left-side-nav/config/system/system-settings.component.scss b/src/portal/src/app/base/left-side-nav/config/system/system-settings.component.scss index 042bc73c9..629c4c979 100644 --- a/src/portal/src/app/base/left-side-nav/config/system/system-settings.component.scss +++ b/src/portal/src/app/base/left-side-nav/config/system/system-settings.component.scss @@ -154,3 +154,14 @@ .pro-creation { width: 12rem; } + +input::-webkit-outer-spin-button, +input::-webkit-inner-spin-button { + appearance: none; + margin: 0; +} + +/* Firefox */ +input[type=number] { + appearance: textfield; +} diff --git a/src/portal/src/app/base/left-side-nav/config/system/system-settings.component.ts b/src/portal/src/app/base/left-side-nav/config/system/system-settings.component.ts index 8fe2f1bde..d6b4e2c48 100644 --- a/src/portal/src/app/base/left-side-nav/config/system/system-settings.component.ts +++ b/src/portal/src/app/base/left-side-nav/config/system/system-settings.component.ts @@ -56,33 +56,6 @@ export class SystemSettingsComponent implements OnInit { ); } - get tokenExpirationValue() { - return this.currentConfig.token_expiration.value; - } - - set tokenExpirationValue(v) { - // convert string to number - this.currentConfig.token_expiration.value = +v; - } - - get sessionTimeout() { - return this.currentConfig.session_timeout.value; - } - - set sessionTimeout(v) { - // convert string to number - this.currentConfig.session_timeout.value = +v; - } - - get robotTokenExpirationValue() { - return this.currentConfig.robot_token_duration.value; - } - - set robotTokenExpirationValue(v) { - // convert string to number - this.currentConfig.robot_token_duration.value = +v; - } - robotNamePrefixEditable(): boolean { return ( this.currentConfig &&