未验证 提交 46f3b002 编写于 作者: S Sebastian Florek 提交者: GitHub

Add more strict rxjs lint rules and get rid of rxjs 5 usages (#5478)

* Add more strict rxjs lint rules and get rid of rxjs 5 usages

* Use proper naming suffix for private var

* Fix conflicts
上级 f0acd2eb
......@@ -2,9 +2,14 @@ root = true
[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 2
insert_final_newline = true
max_line_length = 120
trim_trailing_whitespace = true
[*.go]
indent_style = tab
[*.md]
max_line_length = off
trim_trailing_whitespace = false
......@@ -5,13 +5,12 @@ const modifiedConfig = _.merge(
{},
gtsConfig,
{
insertPragma: false,
printWidth: 120,
requirePragma: false,
// Print semicolons at the ends of statements.
semi: true,
tabWidth: 2,
trailingComma: 'all',
useTabs: false,
// Include parentheses around a sole arrow function parameter (x => x).
arrowParens: 'avoid',
// Specify the line length that the printer will wrap on.
printWidth: 120,
}
)
......
此差异已折叠。
......@@ -425,11 +425,11 @@
<context context-type="linenumber">24</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">../src/app/frontend/resource/workloads/replicationcontroller/detail/template.html</context>
<context context-type="sourcefile">../src/app/frontend/resource/workloads/replicaset/detail/template.html</context>
<context context-type="linenumber">22</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">../src/app/frontend/resource/workloads/replicaset/detail/template.html</context>
<context context-type="sourcefile">../src/app/frontend/resource/workloads/replicationcontroller/detail/template.html</context>
<context context-type="linenumber">22</context>
</context-group>
<context-group purpose="location">
......@@ -600,27 +600,46 @@
<context context-type="linenumber">101</context>
</context-group>
</trans-unit>
<trans-unit id="53d3c87046022140381be2fc9b864d6fdd9f2cc8" datatype="html">
<source>Label Selector</source>
<trans-unit id="65f15d6396a9b96f745b7306df38ba538e190640" datatype="html">
<source>Pods: </source>
<context-group purpose="location">
<context context-type="sourcefile">../src/app/frontend/resource/workloads/replicationcontroller/detail/template.html</context>
<context context-type="linenumber">30</context>
<context context-type="sourcefile">../src/app/frontend/resource/workloads/replicaset/detail/template.html</context>
<context context-type="linenumber">28</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">../src/app/frontend/resource/workloads/statefulset/detail/template.html</context>
<context context-type="sourcefile">../src/app/frontend/resource/workloads/deployment/detail/template.html</context>
<context context-type="linenumber">214</context>
</context-group>
</trans-unit>
<trans-unit id="5de9d226db382155f482a557b832da6d63108112" datatype="html">
<source>Selector</source>
<context-group purpose="location">
<context context-type="sourcefile">../src/app/frontend/resource/workloads/replicaset/detail/template.html</context>
<context context-type="linenumber">38</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">../src/app/frontend/resource/workloads/daemonset/detail/template.html</context>
<context context-type="linenumber">30</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">../src/app/frontend/resource/workloads/deployment/detail/template.html</context>
<context context-type="linenumber">71</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">../src/app/frontend/resource/discovery/service/detail/template.html</context>
<context context-type="linenumber">44</context>
</context-group>
</trans-unit>
<trans-unit id="b73f7f5060fb22a1e9ec462b1bb02493fa3ab866" datatype="html">
<source>Images</source>
<context-group purpose="location">
<context context-type="sourcefile">../src/app/frontend/resource/workloads/replicationcontroller/detail/template.html</context>
<context context-type="linenumber">39</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">../src/app/frontend/resource/workloads/replicaset/detail/template.html</context>
<context context-type="linenumber">47</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">../src/app/frontend/resource/workloads/replicationcontroller/detail/template.html</context>
<context context-type="linenumber">39</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">../src/app/frontend/common/components/creator/template.html</context>
<context context-type="linenumber">90</context>
......@@ -668,14 +687,14 @@
</trans-unit>
<trans-unit id="318e1e7193512514e192cab4e4b6b722548b017b" datatype="html">
<source>Init images</source>
<context-group purpose="location">
<context context-type="sourcefile">../src/app/frontend/resource/workloads/replicationcontroller/detail/template.html</context>
<context context-type="linenumber">48</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">../src/app/frontend/resource/workloads/replicaset/detail/template.html</context>
<context context-type="linenumber">56</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">../src/app/frontend/resource/workloads/replicationcontroller/detail/template.html</context>
<context context-type="linenumber">48</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">../src/app/frontend/resource/workloads/daemonset/detail/template.html</context>
<context context-type="linenumber">48</context>
......@@ -693,34 +712,15 @@
<context context-type="linenumber">48</context>
</context-group>
</trans-unit>
<trans-unit id="65f15d6396a9b96f745b7306df38ba538e190640" datatype="html">
<source>Pods: </source>
<context-group purpose="location">
<context context-type="sourcefile">../src/app/frontend/resource/workloads/replicaset/detail/template.html</context>
<context context-type="linenumber">28</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">../src/app/frontend/resource/workloads/deployment/detail/template.html</context>
<context context-type="linenumber">214</context>
</context-group>
</trans-unit>
<trans-unit id="5de9d226db382155f482a557b832da6d63108112" datatype="html">
<source>Selector</source>
<context-group purpose="location">
<context context-type="sourcefile">../src/app/frontend/resource/workloads/replicaset/detail/template.html</context>
<context context-type="linenumber">38</context>
</context-group>
<trans-unit id="53d3c87046022140381be2fc9b864d6fdd9f2cc8" datatype="html">
<source>Label Selector</source>
<context-group purpose="location">
<context context-type="sourcefile">../src/app/frontend/resource/workloads/daemonset/detail/template.html</context>
<context context-type="sourcefile">../src/app/frontend/resource/workloads/replicationcontroller/detail/template.html</context>
<context context-type="linenumber">30</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">../src/app/frontend/resource/workloads/deployment/detail/template.html</context>
<context context-type="linenumber">71</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">../src/app/frontend/resource/discovery/service/detail/template.html</context>
<context context-type="linenumber">44</context>
<context context-type="sourcefile">../src/app/frontend/resource/workloads/statefulset/detail/template.html</context>
<context context-type="linenumber">30</context>
</context-group>
</trans-unit>
<trans-unit id="5ca707824ab93066c7d9b44e1b8bf216725c2c22" datatype="html">
......
......@@ -54,7 +54,7 @@
"fix:i18n": "ng xi18n --outFile ../i18n/messages.xlf && aio/scripts/xliffmerge.sh",
"clean": "rm -rf .go_workspace .tmp coverage dist npm-debug.log",
"postversion": "node aio/scripts/version.js",
"postinstall": "node aio/scripts/version.js && command -v golangci-lint >/dev/null 2>&1 || { curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.23.6; } && go mod download && ngcc"
"postinstall": "node aio/scripts/version.js && command -v golangci-lint >/dev/null 2>&1 || { curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.23.6; } && go mod download && ./aio/scripts/install-codegen.sh && ngcc"
},
"husky": {
"hooks": {
......@@ -235,7 +235,8 @@
"prefer-rest-params": "error",
"rxjs/no-ignored-observable": "error",
"rxjs/no-unbound-methods": "error",
"rxjs/no-unsafe-takeuntil": "error"
"rxjs/no-unsafe-takeuntil": "error",
"rxjs/no-nested-subscribe": "error"
},
"overrides": [
{
......
......@@ -40,7 +40,7 @@ export class ChromeComponent implements OnInit {
private readonly http_: HttpClient,
private readonly router_: Router,
@Inject(DOCUMENT) private readonly document_: Document,
private readonly globalSettings_: GlobalSettingsService,
private readonly globalSettings_: GlobalSettingsService
) {}
ngOnInit(): void {
......@@ -85,7 +85,7 @@ export class ChromeComponent implements OnInit {
private registerVisibilityChangeHandler_(): void {
if (typeof this.document_.addEventListener === 'undefined') {
console.log(
'Your browser does not support Page Visibility API. Page cannot properly stop background tasks when tab is inactive.',
'Your browser does not support Page Visibility API. Page cannot properly stop background tasks when tab is inactive.'
);
return;
}
......
......@@ -31,7 +31,7 @@ const rollInOut = trigger('rollInOut', [
keyframes([
style({width: '16px', 'border-radius': '50%', color: 'rgba(0,0,0,0)'}),
style({width: '72px', 'border-radius': '8px'}),
]),
])
),
]),
......@@ -41,7 +41,7 @@ const rollInOut = trigger('rollInOut', [
keyframes([
style({width: '72px', 'border-radius': '8px', color: 'rgba(0,0,0,0)'}),
style({width: '16px', 'border-radius': '50%'}),
]),
])
),
]),
]);
......@@ -74,8 +74,8 @@ export class NavItemComponent implements OnInit, OnDestroy {
tap(
state =>
(this.animationState =
state === NamespacedIndicatorState.Leave ? NamespacedIndicatorState.Leave : this.animationState),
),
state === NamespacedIndicatorState.Leave ? NamespacedIndicatorState.Leave : this.animationState)
)
)
.pipe(debounceTime(this.debounceTime_))
.pipe(takeUntil(this.unsubscribe_))
......
......@@ -29,7 +29,7 @@ export class SearchComponent implements OnInit {
constructor(
private readonly router_: Router,
private readonly activatedRoute_: ActivatedRoute,
private readonly paramsService_: ParamsService,
private readonly paramsService_: ParamsService
) {}
ngOnInit(): void {
......
......@@ -31,7 +31,7 @@ export class ActionbarDetailDeleteComponent implements OnInit {
constructor(
private readonly verber_: VerberService,
private readonly route_: ActivatedRoute,
private readonly router_: Router,
private readonly router_: Router
) {}
ngOnInit(): void {
......
......@@ -13,9 +13,7 @@
// limitations under the License.
import {Component, Input} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {ObjectMeta, TypeMeta} from '@api/backendapi';
import {Subscription} from 'rxjs/Subscription';
import {VerberService} from '../../../../services/global/verber';
......
......@@ -31,7 +31,7 @@ export class ActionbarDetailLogsComponent {
'log',
this.resourceMeta.objectMeta.name,
this.resourceMeta.objectMeta.namespace,
this.resourceMeta.typeMeta.kind,
this.resourceMeta.typeMeta.kind
);
}
}
......@@ -37,7 +37,7 @@ export class ActionbarDetailPinComponent {
this.objectMeta.name,
this.objectMeta.namespace,
this.displayName,
this.namespaced,
this.namespaced
);
}
}
......
......@@ -14,7 +14,6 @@
import {Component, Input} from '@angular/core';
import {ObjectMeta, TypeMeta} from '@api/backendapi';
import {Subscription} from 'rxjs/Subscription';
import {VerberService} from '../../../../services/global/verber';
......
......@@ -14,7 +14,6 @@
import {Component, Input} from '@angular/core';
import {ObjectMeta, TypeMeta} from '@api/backendapi';
import {Subscription} from 'rxjs/Subscription';
import {VerberService} from '../../../../services/global/verber';
......
......@@ -15,7 +15,6 @@
import {Component, OnDestroy, OnInit} from '@angular/core';
import {Subject} from 'rxjs';
import {takeUntil} from 'rxjs/operators';
import {Subscription} from 'rxjs/Subscription';
import {ActionbarService, ResourceMeta} from '../../../services/global/actionbar';
@Component({
......@@ -27,22 +26,22 @@ export class DefaultActionbar implements OnInit, OnDestroy {
isVisible = false;
resourceMeta: ResourceMeta;
private _unsubscribe = new Subject<void>();
private unsubscribe_ = new Subject<void>();
constructor(private readonly actionbar_: ActionbarService) {}
ngOnInit(): void {
this.actionbar_.onInit.pipe(takeUntil(this._unsubscribe)).subscribe((resourceMeta: ResourceMeta) => {
this.actionbar_.onInit.pipe(takeUntil(this.unsubscribe_)).subscribe((resourceMeta: ResourceMeta) => {
this.resourceMeta = resourceMeta;
this.isInitialized = true;
this.isVisible = true;
});
this.actionbar_.onDetailsLeave.pipe(takeUntil(this._unsubscribe)).subscribe(() => (this.isVisible = false));
this.actionbar_.onDetailsLeave.pipe(takeUntil(this.unsubscribe_)).subscribe(() => (this.isVisible = false));
}
ngOnDestroy(): void {
this._unsubscribe.next();
this._unsubscribe.complete();
this.unsubscribe_.next();
this.unsubscribe_.complete();
}
}
......@@ -26,22 +26,22 @@ export class LogsDefaultActionbar implements OnInit, OnDestroy {
isVisible = false;
resourceMeta: ResourceMeta;
private _unsubscribe = new Subject<void>();
private unsubscribe_ = new Subject<void>();
constructor(private readonly actionbar_: ActionbarService) {}
ngOnInit(): void {
this.actionbar_.onInit.pipe(takeUntil(this._unsubscribe)).subscribe((resourceMeta: ResourceMeta) => {
this.actionbar_.onInit.pipe(takeUntil(this.unsubscribe_)).subscribe((resourceMeta: ResourceMeta) => {
this.resourceMeta = resourceMeta;
this.isInitialized = true;
this.isVisible = true;
});
this.actionbar_.onDetailsLeave.pipe(takeUntil(this._unsubscribe)).subscribe(() => (this.isVisible = false));
this.actionbar_.onDetailsLeave.pipe(takeUntil(this.unsubscribe_)).subscribe(() => (this.isVisible = false));
}
ngOnDestroy(): void {
this._unsubscribe.next();
this._unsubscribe.complete();
this.unsubscribe_.next();
this.unsubscribe_.complete();
}
}
......@@ -26,22 +26,22 @@ export class LogsExecDefaultActionbar implements OnInit, OnDestroy {
isVisible = false;
resourceMeta: ResourceMeta;
private _unsubscribe = new Subject<void>();
private unsubscribe_ = new Subject<void>();
constructor(private readonly actionbar_: ActionbarService) {}
ngOnInit(): void {
this.actionbar_.onInit.pipe(takeUntil(this._unsubscribe)).subscribe((resourceMeta: ResourceMeta) => {
this.actionbar_.onInit.pipe(takeUntil(this.unsubscribe_)).subscribe((resourceMeta: ResourceMeta) => {
this.resourceMeta = resourceMeta;
this.isInitialized = true;
this.isVisible = true;
});
this.actionbar_.onDetailsLeave.pipe(takeUntil(this._unsubscribe)).subscribe(() => (this.isVisible = false));
this.actionbar_.onDetailsLeave.pipe(takeUntil(this.unsubscribe_)).subscribe(() => (this.isVisible = false));
}
ngOnDestroy(): void {
this._unsubscribe.next();
this._unsubscribe.complete();
this.unsubscribe_.next();
this.unsubscribe_.complete();
}
}
......@@ -15,7 +15,6 @@
import {Component, OnDestroy, OnInit} from '@angular/core';
import {Subject} from 'rxjs';
import {takeUntil} from 'rxjs/operators';
import {Subscription} from 'rxjs/Subscription';
import {ActionbarService, ResourceMeta} from '../../../services/global/actionbar';
@Component({
......@@ -27,22 +26,22 @@ export class LogsScaleDefaultActionbar implements OnInit, OnDestroy {
isVisible = false;
resourceMeta: ResourceMeta;
private _unsubscribe = new Subject<void>();
private unsubscribe_ = new Subject<void>();
constructor(private readonly actionbar_: ActionbarService) {}
ngOnInit(): void {
this.actionbar_.onInit.pipe(takeUntil(this._unsubscribe)).subscribe((resourceMeta: ResourceMeta) => {
this.actionbar_.onInit.pipe(takeUntil(this.unsubscribe_)).subscribe((resourceMeta: ResourceMeta) => {
this.resourceMeta = resourceMeta;
this.isInitialized = true;
this.isVisible = true;
});
this.actionbar_.onDetailsLeave.pipe(takeUntil(this._unsubscribe)).subscribe(() => (this.isVisible = false));
this.actionbar_.onDetailsLeave.pipe(takeUntil(this.unsubscribe_)).subscribe(() => (this.isVisible = false));
}
ngOnDestroy(): void {
this._unsubscribe.next();
this._unsubscribe.complete();
this.unsubscribe_.next();
this.unsubscribe_.complete();
}
}
......@@ -15,7 +15,6 @@
import {Component, OnDestroy, OnInit} from '@angular/core';
import {Subject} from 'rxjs';
import {takeUntil} from 'rxjs/operators';
import {Subscription} from 'rxjs/Subscription';
import {ActionbarService, ResourceMeta} from '../../../services/global/actionbar';
@Component({
......@@ -27,22 +26,22 @@ export class PinDefaultActionbar implements OnInit, OnDestroy {
isVisible = false;
resourceMeta: ResourceMeta;
private _unsubscribe = new Subject<void>();
private unsubscribe_ = new Subject<void>();
constructor(private readonly actionbar_: ActionbarService) {}
ngOnInit(): void {
this.actionbar_.onInit.pipe(takeUntil(this._unsubscribe)).subscribe((resourceMeta: ResourceMeta) => {
this.actionbar_.onInit.pipe(takeUntil(this.unsubscribe_)).subscribe((resourceMeta: ResourceMeta) => {
this.resourceMeta = resourceMeta;
this.isInitialized = true;
this.isVisible = true;
});
this.actionbar_.onDetailsLeave.pipe(takeUntil(this._unsubscribe)).subscribe(() => (this.isVisible = false));
this.actionbar_.onDetailsLeave.pipe(takeUntil(this.unsubscribe_)).subscribe(() => (this.isVisible = false));
}
ngOnDestroy(): void {
this._unsubscribe.next();
this._unsubscribe.complete();
this.unsubscribe_.next();
this.unsubscribe_.complete();
}
}
......@@ -15,7 +15,6 @@
import {Component, OnDestroy, OnInit} from '@angular/core';
import {Subject} from 'rxjs';
import {takeUntil} from 'rxjs/operators';
import {Subscription} from 'rxjs/Subscription';
import {ActionbarService, ResourceMeta} from '../../../services/global/actionbar';
@Component({
......@@ -27,23 +26,23 @@ export class ScaleDefaultActionbar implements OnInit, OnDestroy {
isVisible = false;
resourceMeta: ResourceMeta;
private _unsubscribe = new Subject<void>();
private unsubscribe_ = new Subject<void>();
constructor(private readonly actionbar_: ActionbarService) {}
ngOnInit(): void {
this.actionbar_.onInit.pipe(takeUntil(this._unsubscribe)).subscribe((resourceMeta: ResourceMeta) => {
this.actionbar_.onInit.pipe(takeUntil(this.unsubscribe_)).subscribe((resourceMeta: ResourceMeta) => {
this.resourceMeta = resourceMeta;
this.isInitialized = true;
this.isVisible = true;
});
this.actionbar_.onDetailsLeave.pipe(takeUntil(this._unsubscribe)).subscribe(() => (this.isVisible = false));
this.actionbar_.onDetailsLeave.pipe(takeUntil(this.unsubscribe_)).subscribe(() => (this.isVisible = false));
}
ngOnDestroy(): void {
this._unsubscribe.next();
this._unsubscribe.complete();
this.unsubscribe_.next();
this.unsubscribe_.complete();
}
scalable(): boolean {
......
......@@ -13,7 +13,7 @@
// limitations under the License.
import {Component, OnDestroy, OnInit} from '@angular/core';
import {Subject, Subscription} from 'rxjs';
import {Subject} from 'rxjs';
import {takeUntil} from 'rxjs/operators';
import {ActionbarService, ResourceMeta} from '../../../services/global/actionbar';
......@@ -26,22 +26,22 @@ export class TriggerDefaultActionbar implements OnInit, OnDestroy {
isVisible = false;
resourceMeta: ResourceMeta;
private _unsubscribe = new Subject<void>();
private unsubscribe_ = new Subject<void>();
constructor(private readonly actionbar_: ActionbarService) {}
ngOnInit(): void {
this.actionbar_.onInit.pipe(takeUntil(this._unsubscribe)).subscribe((resourceMeta: ResourceMeta) => {
this.actionbar_.onInit.pipe(takeUntil(this.unsubscribe_)).subscribe((resourceMeta: ResourceMeta) => {
this.resourceMeta = resourceMeta;
this.isInitialized = true;
this.isVisible = true;
});
this.actionbar_.onDetailsLeave.pipe(takeUntil(this._unsubscribe)).subscribe(() => (this.isVisible = false));
this.actionbar_.onDetailsLeave.pipe(takeUntil(this.unsubscribe_)).subscribe(() => (this.isVisible = false));
}
ngOnDestroy(): void {
this._unsubscribe.next();
this._unsubscribe.complete();
this.unsubscribe_.next();
this.unsubscribe_.complete();
}
}
......@@ -15,11 +15,11 @@
import {Component, OnInit} from '@angular/core';
import {ActivatedRoute, NavigationEnd, Params, Route, Router} from '@angular/router';
import {Breadcrumb} from '@api/frontendapi';
import {distinctUntilChanged, filter} from 'rxjs/operators';
import {POD_DETAIL_ROUTE} from '../../../resource/workloads/pod/routing';
import {SEARCH_QUERY_STATE_PARAM} from '../../params/params';
import {REPLICATIONCONTROLLER_DETAIL_ROUTE} from '../../../resource/workloads/replicationcontroller/routing';
import {REPLICASET_DETAIL_ROUTE} from '../../../resource/workloads/replicaset/routing';
import {distinctUntilChanged, filter} from 'rxjs/operators';
import {REPLICATIONCONTROLLER_DETAIL_ROUTE} from '../../../resource/workloads/replicationcontroller/routing';
import {SEARCH_QUERY_STATE_PARAM} from '../../params/params';
export const LOGS_PARENT_PLACEHOLDER = '___LOGS_PARENT_PLACEHOLDER___';
export const EXEC_PARENT_PLACEHOLDER = '___EXEC_PARENT_PLACEHOLDER___';
......@@ -44,7 +44,7 @@ export class BreadcrumbsComponent implements OnInit {
this._router.events
.pipe(
filter(event => event instanceof NavigationEnd),
distinctUntilChanged(),
distinctUntilChanged()
)
.subscribe(() => {
this._initBreadcrumbs();
......
......@@ -47,7 +47,7 @@ const URL_REGEXP = new RegExp(
'){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]-*)*' +
'[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]' +
'+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))\\.?)(?::\\d{2,5})?(?:[/?#]\\S*)?$',
'i',
'i'
);
const MAX_CHIP_VALUE_LENGTH = 63;
......@@ -67,7 +67,7 @@ export class ChipsComponent implements OnInit, OnChanges {
constructor(
private readonly _globalSettingsService: GlobalSettingsService,
private readonly _matDialog: MatDialog,
private readonly _changeDetectorRef: ChangeDetectorRef,
private readonly _changeDetectorRef: ChangeDetectorRef
) {}
ngOnInit(): void {
......
......@@ -30,7 +30,7 @@ export class CreatorCardComponent {
return this.kdState_.href(
this.creator.typeMeta.kind,
this.creator.objectMeta.name,
this.creator.objectMeta.namespace,
this.creator.objectMeta.namespace
);
}
}
......@@ -13,8 +13,8 @@
// limitations under the License.
import {ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnChanges, OnDestroy} from '@angular/core';
import {of, Subject, timer} from 'rxjs';
import {mergeMap, switchMap, take, takeUntil} from 'rxjs/operators';
import {Subject, timer} from 'rxjs';
import {switchMap, takeUntil} from 'rxjs/operators';
/**
* Display a date
......
......@@ -50,7 +50,7 @@ export class MenuComponent implements ActionColumn {
private readonly verber_: VerberService,
private readonly router_: Router,
private readonly kdState_: KdStateService,
private readonly pinner_: PinnerService,
private readonly pinner_: PinnerService
) {}
setObjectMeta(objectMeta: ObjectMeta): void {
......@@ -111,7 +111,7 @@ export class MenuComponent implements ActionColumn {
this.objectMeta.name,
this.objectMeta.namespace,
this.displayName ? this.displayName : this.objectMeta.name,
this.namespaced,
this.namespaced
);
}
......
......@@ -12,10 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import 'rxjs/add/operator/debounceTime';
import 'rxjs/add/operator/distinctUntilChanged';
import {Component, ElementRef, EventEmitter, OnDestroy, OnInit, ViewChild} from '@angular/core';
import {Component, EventEmitter, OnDestroy, OnInit} from '@angular/core';
import {ReplaySubject, Subject} from 'rxjs';
import {debounceTime, distinctUntilChanged, takeUntil} from 'rxjs/operators';
......
......@@ -25,7 +25,7 @@ export class NamespaceChangeDialog {
constructor(
public dialogRef: MatDialogRef<NamespaceChangeDialog>,
@Inject(MAT_DIALOG_DATA) public data: {namespace: string; newNamespace: string},
@Inject(MAT_DIALOG_DATA) public data: {namespace: string; newNamespace: string}
) {
this.namespace = data.namespace;
this.newNamespace = data.newNamespace;
......
......@@ -58,7 +58,7 @@ export class NamespaceSelectorComponent implements OnInit, OnDestroy {
private readonly kdState_: KdStateService,
private readonly notifications_: NotificationsService,
private readonly _activatedRoute: ActivatedRoute,
private readonly _historyService: HistoryService,
private readonly _historyService: HistoryService
) {}
ngOnInit(): void {
......@@ -82,7 +82,7 @@ export class NamespaceSelectorComponent implements OnInit, OnDestroy {
this.router_.events
.pipe(
filter(event => event instanceof NavigationEnd),
distinctUntilChanged(),
distinctUntilChanged()
)
.subscribe(() => {
this.resourceNamespaceParam = this._getCurrentResourceNamespaceParam();
......@@ -166,7 +166,7 @@ export class NamespaceSelectorComponent implements OnInit, OnDestroy {
() => {},
() => {
this.onNamespaceLoaded_();
},
}
);
}
......
......@@ -15,7 +15,7 @@
import {HttpParams} from '@angular/common/http';
import {ChangeDetectionStrategy, ChangeDetectorRef, Component, Input} from '@angular/core';
import {ClusterRole, ClusterRoleList} from '@api/backendapi';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs';
import {ResourceListBase} from '../../../resources/list';
import {NotificationsService} from '../../../services/global/notifications';
......@@ -35,7 +35,7 @@ export class ClusterRoleListComponent extends ResourceListBase<ClusterRoleList,
constructor(
private readonly clusterRole_: ResourceService<ClusterRoleList>,
notifications: NotificationsService,
cdr: ChangeDetectorRef,
cdr: ChangeDetectorRef
) {
super('clusterrole', notifications, cdr);
this.id = ListIdentifier.clusterRole;
......
......@@ -35,7 +35,7 @@ export class ClusterRoleBindingListComponent extends ResourceListBase<ClusterRol
constructor(
private readonly clusterRoleBinding_: ResourceService<ClusterRoleBindingList>,
notifications: NotificationsService,
cdr: ChangeDetectorRef,
cdr: ChangeDetectorRef
) {
super('clusterrolebinding', notifications, cdr);
this.id = ListIdentifier.clusterRoleBinding;
......
......@@ -14,7 +14,7 @@
import {HttpParams} from '@angular/common/http';
import {ChangeDetectionStrategy, ChangeDetectorRef, Component, Input} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs';
import {ConfigMap, ConfigMapList} from 'typings/backendapi';
import {ResourceListBase} from '../../../resources/list';
import {NotificationsService} from '../../../services/global/notifications';
......@@ -34,7 +34,7 @@ export class ConfigMapListComponent extends ResourceListBase<ConfigMapList, Conf
constructor(
private readonly configMap_: NamespacedResourceService<ConfigMapList>,
notifications: NotificationsService,
cdr: ChangeDetectorRef,
cdr: ChangeDetectorRef
) {
super('configmap', notifications, cdr);
this.id = ListIdentifier.configMap;
......
......@@ -35,7 +35,7 @@ export class CRDListComponent extends ResourceListWithStatuses<CRDList, CRD> {
constructor(
private readonly crd_: ResourceService<CRDList>,
notifications: NotificationsService,
cdr: ChangeDetectorRef,
cdr: ChangeDetectorRef
) {
super(Resource.crdFull, notifications, cdr);
this.id = ListIdentifier.crd;
......
......@@ -38,7 +38,7 @@ export class CRDObjectListComponent extends ResourceListBase<CRDObjectList, CRDO
private readonly crdObject_: NamespacedResourceService<CRDObjectList>,
private readonly activatedRoute_: ActivatedRoute,
notifications: NotificationsService,
cdr: ChangeDetectorRef,
cdr: ChangeDetectorRef
) {
super(activatedRoute_.params.pipe(map(params => `customresourcedefinition/${params.crdName}`)), notifications, cdr);
this.id = ListIdentifier.crdObject;
......
......@@ -15,7 +15,7 @@
import {HttpParams} from '@angular/common/http';
import {ChangeDetectionStrategy, ChangeDetectorRef, Component, Input} from '@angular/core';
import {CronJob, CronJobList, Metric} from '@api/backendapi';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs';
import {ResourceListWithStatuses} from '../../../resources/list';
import {NotificationsService} from '../../../services/global/notifications';
import {EndpointManager, Resource} from '../../../services/resource/endpoint';
......@@ -36,7 +36,7 @@ export class CronJobListComponent extends ResourceListWithStatuses<CronJobList,
constructor(
private readonly cronJob_: NamespacedResourceService<CronJobList>,
notifications: NotificationsService,
cdr: ChangeDetectorRef,
cdr: ChangeDetectorRef
) {
super('cronjob', notifications, cdr);
this.id = ListIdentifier.cronJob;
......
......@@ -15,7 +15,7 @@
import {HttpParams} from '@angular/common/http';
import {ChangeDetectionStrategy, ChangeDetectorRef, Component, Input} from '@angular/core';
import {DaemonSet, DaemonSetList, Event, Metric} from '@api/backendapi';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs';
import {ResourceListWithStatuses} from '../../../resources/list';
import {NotificationsService} from '../../../services/global/notifications';
......@@ -37,7 +37,7 @@ export class DaemonSetListComponent extends ResourceListWithStatuses<DaemonSetLi
constructor(
private readonly daemonSet_: NamespacedResourceService<DaemonSetList>,
notifications: NotificationsService,
cdr: ChangeDetectorRef,
cdr: ChangeDetectorRef
) {
super('daemonset', notifications, cdr);
this.id = ListIdentifier.daemonSet;
......
......@@ -15,7 +15,7 @@
import {HttpParams} from '@angular/common/http';
import {ChangeDetectionStrategy, ChangeDetectorRef, Component, Input} from '@angular/core';
import {Deployment, DeploymentList, Event, Metric} from '@api/backendapi';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs';
import {ResourceListWithStatuses} from '../../../resources/list';
import {NotificationsService} from '../../../services/global/notifications';
import {EndpointManager, Resource} from '../../../services/resource/endpoint';
......@@ -36,7 +36,7 @@ export class DeploymentListComponent extends ResourceListWithStatuses<Deployment
constructor(
private readonly deployment_: NamespacedResourceService<DeploymentList>,
notifications: NotificationsService,
cdr: ChangeDetectorRef,
cdr: ChangeDetectorRef
) {
super('deployment', notifications, cdr);
this.id = ListIdentifier.deployment;
......
......@@ -15,7 +15,7 @@
import {HttpParams} from '@angular/common/http';
import {ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnInit} from '@angular/core';
import {Event, EventList} from '@api/backendapi';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs';
import {ResourceListWithStatuses} from '../../../resources/list';
import {NotificationsService} from '../../../services/global/notifications';
......@@ -35,7 +35,7 @@ export class EventListComponent extends ResourceListWithStatuses<EventList, Even
constructor(
private readonly eventList: NamespacedResourceService<EventList>,
notifications: NotificationsService,
cdr: ChangeDetectorRef,
cdr: ChangeDetectorRef
) {
super('', notifications, cdr);
this.id = ListIdentifier.event;
......
......@@ -15,7 +15,7 @@
import {HttpParams} from '@angular/common/http';
import {ChangeDetectionStrategy, ChangeDetectorRef, Component, Input} from '@angular/core';
import {HorizontalPodAutoscaler, HorizontalPodAutoscalerList} from '@api/backendapi';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs';
import {ResourceListWithStatuses} from '../../../resources/list';
import {NotificationsService} from '../../../services/global/notifications';
import {EndpointManager, Resource} from '../../../services/resource/endpoint';
......@@ -37,7 +37,7 @@ export class HorizontalPodAutoscalerListComponent extends ResourceListWithStatus
constructor(
private readonly horizontalpodautoscaler_: NamespacedResourceService<HorizontalPodAutoscalerList>,
notifications: NotificationsService,
cdr: ChangeDetectorRef,
cdr: ChangeDetectorRef
) {
super('horizontalpodautoscaler', notifications, cdr);
this.id = ListIdentifier.horizontalpodautoscaler;
......
......@@ -14,7 +14,7 @@
import {HttpParams} from '@angular/common/http';
import {ChangeDetectionStrategy, ChangeDetectorRef, Component, Input} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs';
import {Ingress, IngressList} from 'typings/backendapi';
import {ResourceListBase} from '../../../resources/list';
......@@ -35,7 +35,7 @@ export class IngressListComponent extends ResourceListBase<IngressList, Ingress>
constructor(
private readonly ingress_: NamespacedResourceService<IngressList>,
notifications: NotificationsService,
cdr: ChangeDetectorRef,
cdr: ChangeDetectorRef
) {
super('ingress', notifications, cdr);
this.id = ListIdentifier.ingress;
......
......@@ -15,7 +15,7 @@
import {HttpParams} from '@angular/common/http';
import {ChangeDetectionStrategy, ChangeDetectorRef, Component, Input} from '@angular/core';
import {Event, Job, JobList, Metric} from '@api/backendapi';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs';
import {ResourceListWithStatuses} from '../../../resources/list';
import {NotificationsService} from '../../../services/global/notifications';
......@@ -38,7 +38,7 @@ export class JobListComponent extends ResourceListWithStatuses<JobList, Job> {
constructor(
private readonly job_: NamespacedResourceService<JobList>,
notifications: NotificationsService,
cdr: ChangeDetectorRef,
cdr: ChangeDetectorRef
) {
super('job', notifications, cdr);
this.id = ListIdentifier.job;
......
......@@ -15,7 +15,7 @@
import {HttpParams} from '@angular/common/http';
import {ChangeDetectionStrategy, ChangeDetectorRef, Component, Input} from '@angular/core';
import {Namespace, NamespaceList} from '@api/backendapi';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs';
import {ResourceListWithStatuses} from '../../../resources/list';
import {NotificationsService} from '../../../services/global/notifications';
......@@ -35,7 +35,7 @@ export class NamespaceListComponent extends ResourceListWithStatuses<NamespaceLi
constructor(
private readonly namespace_: ResourceService<NamespaceList>,
notifications: NotificationsService,
cdr: ChangeDetectorRef,
cdr: ChangeDetectorRef
) {
super('namespace', notifications, cdr);
this.id = ListIdentifier.namespace;
......
......@@ -14,7 +14,7 @@
import {HttpParams} from '@angular/common/http';
import {ChangeDetectionStrategy, ChangeDetectorRef, Component, Input} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs';
import {NetworkPolicy, NetworkPolicyList} from 'typings/backendapi';
import {ResourceListBase} from '../../../resources/list';
......@@ -35,7 +35,7 @@ export class NetworkPolicyListComponent extends ResourceListBase<NetworkPolicyLi
constructor(
private readonly networkPolicy_: NamespacedResourceService<NetworkPolicyList>,
notifications: NotificationsService,
cdr: ChangeDetectorRef,
cdr: ChangeDetectorRef
) {
super('networkpolicy', notifications, cdr);
this.id = ListIdentifier.networkPolicy;
......
......@@ -15,7 +15,7 @@
import {HttpParams} from '@angular/common/http';
import {ChangeDetectionStrategy, ChangeDetectorRef, Component, Input} from '@angular/core';
import {Metric, Node, NodeList} from '@api/backendapi';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs';
import {ResourceListWithStatuses} from '../../../resources/list';
import {NotificationsService} from '../../../services/global/notifications';
import {EndpointManager, Resource} from '../../../services/resource/endpoint';
......@@ -36,7 +36,7 @@ export class NodeListComponent extends ResourceListWithStatuses<NodeList, Node>
constructor(
private readonly node_: ResourceService<NodeList>,
notifications: NotificationsService,
cdr: ChangeDetectorRef,
cdr: ChangeDetectorRef
) {
super('node', notifications, cdr);
this.id = ListIdentifier.node;
......
......@@ -15,7 +15,7 @@
import {HttpParams} from '@angular/common/http';
import {ChangeDetectionStrategy, ChangeDetectorRef, Component, Input} from '@angular/core';
import {PersistentVolume, PersistentVolumeList} from '@api/backendapi';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs';
import {ResourceListWithStatuses} from '../../../resources/list';
import {NotificationsService} from '../../../services/global/notifications';
......@@ -35,7 +35,7 @@ export class PersistentVolumeListComponent extends ResourceListWithStatuses<Pers
constructor(
private readonly pv_: ResourceService<PersistentVolumeList>,
notifications: NotificationsService,
cdr: ChangeDetectorRef,
cdr: ChangeDetectorRef
) {
super('persistentvolume', notifications, cdr);
this.id = ListIdentifier.persistentVolume;
......
......@@ -14,7 +14,7 @@
import {HttpParams} from '@angular/common/http';
import {ChangeDetectionStrategy, ChangeDetectorRef, Component, Input} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs';
import {PersistentVolumeClaim, PersistentVolumeClaimList} from 'typings/backendapi';
import {ResourceListWithStatuses} from '../../../resources/list';
......@@ -38,7 +38,7 @@ export class PersistentVolumeClaimListComponent extends ResourceListWithStatuses
constructor(
private readonly persistentVolumeClaim_: NamespacedResourceService<PersistentVolumeClaimList>,
notifications: NotificationsService,
cdr: ChangeDetectorRef,
cdr: ChangeDetectorRef
) {
super('persistentvolumeclaim', notifications, cdr);
this.id = ListIdentifier.persistentVolumeClaim;
......
......@@ -15,7 +15,7 @@
import {HttpParams} from '@angular/common/http';
import {ChangeDetectionStrategy, ChangeDetectorRef, Component, Input} from '@angular/core';
import {Plugin, PluginList} from '@api/backendapi';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs';
import {ResourceListBase} from '../../../resources/list';
import {NotificationsService} from '../../../services/global/notifications';
import {EndpointManager, Resource} from '../../../services/resource/endpoint';
......@@ -34,7 +34,7 @@ export class PluginListComponent extends ResourceListBase<PluginList, Plugin> {
constructor(
private readonly plugin_: NamespacedResourceService<PluginList>,
notifications: NotificationsService,
cdr: ChangeDetectorRef,
cdr: ChangeDetectorRef
) {
super('plugin', notifications, cdr);
this.id = ListIdentifier.plugin;
......
......@@ -15,7 +15,7 @@
import {HttpParams} from '@angular/common/http';
import {ChangeDetectionStrategy, ChangeDetectorRef, Component, Input} from '@angular/core';
import {Event, Metric, Pod, PodList} from '@api/backendapi';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs';
import {ResourceListWithStatuses} from '../../../resources/list';
import {NotificationsService} from '../../../services/global/notifications';
......@@ -37,7 +37,7 @@ export class PodListComponent extends ResourceListWithStatuses<PodList, Pod> {
constructor(
private readonly podList: NamespacedResourceService<PodList>,
notifications: NotificationsService,
cdr: ChangeDetectorRef,
cdr: ChangeDetectorRef
) {
super('pod', notifications, cdr);
this.id = ListIdentifier.pod;
......
......@@ -16,7 +16,7 @@ import {HttpParams} from '@angular/common/http';
import {ChangeDetectionStrategy, ChangeDetectorRef, Component, Input} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {Event, Metric, ReplicaSet, ReplicaSetList} from '@api/backendapi';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs';
import {ResourceListWithStatuses} from '../../../resources/list';
import {NotificationsService} from '../../../services/global/notifications';
......@@ -40,7 +40,7 @@ export class ReplicaSetListComponent extends ResourceListWithStatuses<ReplicaSet
private readonly replicaSet_: NamespacedResourceService<ReplicaSetList>,
private readonly activatedRoute_: ActivatedRoute,
notifications: NotificationsService,
cdr: ChangeDetectorRef,
cdr: ChangeDetectorRef
) {
super('replicaset', notifications, cdr);
this.id = ListIdentifier.replicaSet;
......
......@@ -15,7 +15,7 @@
import {HttpParams} from '@angular/common/http';
import {ChangeDetectionStrategy, ChangeDetectorRef, Component, Input} from '@angular/core';
import {Event, ReplicationController, ReplicationControllerList} from '@api/backendapi';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs';
import {ResourceListWithStatuses} from '../../../resources/list';
import {NotificationsService} from '../../../services/global/notifications';
......@@ -38,7 +38,7 @@ export class ReplicationControllerListComponent extends ResourceListWithStatuses
constructor(
private readonly replicationController_: NamespacedResourceService<ReplicationControllerList>,
notifications: NotificationsService,
cdr: ChangeDetectorRef,
cdr: ChangeDetectorRef
) {
super('replicationcontroller', notifications, cdr);
this.id = ListIdentifier.replicationController;
......
......@@ -15,7 +15,7 @@
import {HttpParams} from '@angular/common/http';
import {ChangeDetectionStrategy, ChangeDetectorRef, Component, Input} from '@angular/core';
import {Role, RoleList, ServiceAccount, ServiceAccountList} from '@api/backendapi';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs';
import {ResourceListBase} from '../../../resources/list';
import {NotificationsService} from '../../../services/global/notifications';
......@@ -35,7 +35,7 @@ export class RoleListComponent extends ResourceListBase<RoleList, Role> {
constructor(
private readonly role_: NamespacedResourceService<RoleList>,
notifications: NotificationsService,
cdr: ChangeDetectorRef,
cdr: ChangeDetectorRef
) {
super('role', notifications, cdr);
this.id = ListIdentifier.role;
......
......@@ -35,7 +35,7 @@ export class RoleBindingListComponent extends ResourceListBase<RoleBindingList,
constructor(
private readonly roleBinding_: NamespacedResourceService<RoleBindingList>,
notifications: NotificationsService,
cdr: ChangeDetectorRef,
cdr: ChangeDetectorRef
) {
super('rolebinding', notifications, cdr);
this.id = ListIdentifier.roleBinding;
......
......@@ -14,7 +14,7 @@
import {HttpParams} from '@angular/common/http';
import {ChangeDetectionStrategy, ChangeDetectorRef, Component, Input} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs';
import {Secret, SecretList} from 'typings/backendapi';
import {ResourceListBase} from '../../../resources/list';
import {NotificationsService} from '../../../services/global/notifications';
......@@ -35,7 +35,7 @@ export class SecretListComponent extends ResourceListBase<SecretList, Secret> {
constructor(
private readonly secret_: NamespacedResourceService<SecretList>,
notifications: NotificationsService,
cdr: ChangeDetectorRef,
cdr: ChangeDetectorRef
) {
super('secret', notifications, cdr);
this.id = ListIdentifier.secret;
......
......@@ -14,7 +14,7 @@
import {HttpParams} from '@angular/common/http';
import {ChangeDetectionStrategy, ChangeDetectorRef, Component, Input} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs';
import {Service, ServiceList} from 'typings/backendapi';
import {ResourceListWithStatuses} from '../../../resources/list';
......@@ -35,7 +35,7 @@ export class ServiceListComponent extends ResourceListWithStatuses<ServiceList,
constructor(
private readonly service_: NamespacedResourceService<ServiceList>,
notifications: NotificationsService,
cdr: ChangeDetectorRef,
cdr: ChangeDetectorRef
) {
super('service', notifications, cdr);
this.id = ListIdentifier.service;
......
......@@ -14,7 +14,7 @@
import {HttpParams} from '@angular/common/http';
import {ChangeDetectionStrategy, ChangeDetectorRef, Component, Input} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs';
import {ServiceAccount, ServiceAccountList} from 'typings/backendapi';
import {ResourceListBase} from '../../../resources/list';
......@@ -35,7 +35,7 @@ export class ServiceAccountListComponent extends ResourceListBase<ServiceAccount
constructor(
private readonly serviceAccount_: NamespacedResourceService<ServiceAccountList>,
notifications: NotificationsService,
cdr: ChangeDetectorRef,
cdr: ChangeDetectorRef
) {
super('serviceaccount', notifications, cdr);
this.id = ListIdentifier.serviceAccount;
......
......@@ -15,7 +15,7 @@
import {HttpParams} from '@angular/common/http';
import {ChangeDetectionStrategy, ChangeDetectorRef, Component, Input} from '@angular/core';
import {Event, Metric, StatefulSet, StatefulSetList} from '@api/backendapi';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs';
import {ResourceListWithStatuses} from '../../../resources/list';
import {NotificationsService} from '../../../services/global/notifications';
import {EndpointManager, Resource} from '../../../services/resource/endpoint';
......@@ -36,7 +36,7 @@ export class StatefulSetListComponent extends ResourceListWithStatuses<StatefulS
constructor(
private readonly statefulSet_: NamespacedResourceService<StatefulSetList>,
notifications: NotificationsService,
cdr: ChangeDetectorRef,
cdr: ChangeDetectorRef
) {
super('statefulset', notifications, cdr);
this.id = ListIdentifier.statefulSet;
......
......@@ -15,7 +15,7 @@
import {HttpParams} from '@angular/common/http';
import {ChangeDetectionStrategy, ChangeDetectorRef, Component, Input} from '@angular/core';
import {StorageClass, StorageClassList} from '@api/backendapi';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs';
import {ResourceListBase} from '../../../resources/list';
import {NotificationsService} from '../../../services/global/notifications';
......@@ -35,7 +35,7 @@ export class StorageClassListComponent extends ResourceListBase<StorageClassList
constructor(
private readonly sc_: ResourceService<StorageClassList>,
notifications: NotificationsService,
cdr: ChangeDetectorRef,
cdr: ChangeDetectorRef
) {
super('storageclass', notifications, cdr);
this.id = ListIdentifier.storageClass;
......
......@@ -110,7 +110,7 @@ describe('WorkloadStatusComponent', () => {
testHostFixture.detectChanges();
const debugElements = testHostFixture.debugElement.queryAll(
By.css('kd-card mat-card div mat-card-content div.kd-graph-title'),
By.css('kd-card mat-card div mat-card-content div.kd-graph-title')
);
debugElements.forEach(debugElement => {
......
......@@ -23,7 +23,7 @@ import {ResourceMeta} from '../../services/global/actionbar';
export class DeleteResourceDialog {
constructor(
public dialogRef: MatDialogRef<DeleteResourceDialog>,
@Inject(MAT_DIALOG_DATA) public data: ResourceMeta,
@Inject(MAT_DIALOG_DATA) public data: ResourceMeta
) {}
onNoClick(): void {
......
......@@ -42,7 +42,7 @@ export class LogsDownloadDialog implements OnDestroy {
public dialogRef: MatDialogRef<LogsDownloadDialog>,
@Inject(MAT_DIALOG_DATA) public data: LogsDownloadDialogMeta,
private readonly logService: LogService,
private readonly http_: HttpClient,
private readonly http_: HttpClient
) {
const logUrl = `api/v1/log/file/${data.namespace}/${data.pod}/${
data.container
......@@ -62,7 +62,7 @@ export class LogsDownloadDialog implements OnDestroy {
},
error => {
this.error = error.status;
},
}
);
}
......
......@@ -36,7 +36,7 @@ export class EditResourceDialog implements OnInit {
constructor(
public dialogRef: MatDialogRef<EditResourceDialog>,
@Inject(MAT_DIALOG_DATA) public data: ResourceMeta,
private readonly http_: HttpClient,
private readonly http_: HttpClient
) {}
ngOnInit(): void {
......
......@@ -30,7 +30,7 @@ export class ScaleResourceDialog implements OnInit {
constructor(
public dialogRef: MatDialogRef<ScaleResourceDialog>,
@Inject(MAT_DIALOG_DATA) public data: ResourceMeta,
private readonly http_: HttpClient,
private readonly http_: HttpClient
) {}
ngOnInit(): void {
......
......@@ -23,7 +23,7 @@ import {ResourceMeta} from '../../services/global/actionbar';
export class TriggerResourceDialog {
constructor(
public dialogRef: MatDialogRef<TriggerResourceDialog>,
@Inject(MAT_DIALOG_DATA) public data: ResourceMeta,
@Inject(MAT_DIALOG_DATA) public data: ResourceMeta
) {}
onNoClick(): void {
......
......@@ -21,7 +21,7 @@ import {takeUntil} from 'rxjs/operators';
export class AutofocusDirective implements AfterViewInit, OnDestroy {
@Input() opened: Observable<boolean>;
private readonly _unsubscribe = new Subject<void>();
private readonly unsubscribe_ = new Subject<void>();
constructor(private readonly _el: ElementRef) {}
......@@ -31,12 +31,12 @@ export class AutofocusDirective implements AfterViewInit, OnDestroy {
}
this.opened
.pipe(takeUntil(this._unsubscribe))
.pipe(takeUntil(this.unsubscribe_))
.subscribe(opened => (opened ? setTimeout(() => this._el.nativeElement.focus()) : null));
}
ngOnDestroy(): void {
this._unsubscribe.next();
this._unsubscribe.complete();
this.unsubscribe_.next();
this.unsubscribe_.complete();
}
}
......@@ -74,7 +74,7 @@ export class GroupedResourceList {
this.resourcesRatio.cronJobRatio = Helper.getResourceRatio(
cronJobs.status,
cronJobs.listMeta.totalItems,
ResourceRatioModes.Suspendable,
ResourceRatioModes.Suspendable
);
break;
}
......@@ -87,7 +87,7 @@ export class GroupedResourceList {
const deployments = list as DeploymentList;
this.resourcesRatio.deploymentRatio = Helper.getResourceRatio(
deployments.status,
deployments.listMeta.totalItems,
deployments.listMeta.totalItems
);
break;
}
......@@ -96,7 +96,7 @@ export class GroupedResourceList {
this.resourcesRatio.jobRatio = Helper.getResourceRatio(
jobs.status,
jobs.listMeta.totalItems,
ResourceRatioModes.Completable,
ResourceRatioModes.Completable
);
break;
}
......@@ -105,7 +105,7 @@ export class GroupedResourceList {
this.resourcesRatio.podRatio = Helper.getResourceRatio(
pods.status,
pods.listMeta.totalItems,
ResourceRatioModes.Completable,
ResourceRatioModes.Completable
);
this.cumulativeMetrics = pods.cumulativeMetrics;
break;
......@@ -114,7 +114,7 @@ export class GroupedResourceList {
const replicaSets = list as ReplicaSetList;
this.resourcesRatio.replicaSetRatio = Helper.getResourceRatio(
replicaSets.status,
replicaSets.listMeta.totalItems,
replicaSets.listMeta.totalItems
);
break;
}
......@@ -122,7 +122,7 @@ export class GroupedResourceList {
const replicationControllers = list as ReplicationControllerList;
this.resourcesRatio.replicationControllerRatio = Helper.getResourceRatio(
replicationControllers.status,
replicationControllers.listMeta.totalItems,
replicationControllers.listMeta.totalItems
);
break;
}
......@@ -130,7 +130,7 @@ export class GroupedResourceList {
const statefulSets = list as StatefulSetList;
this.resourcesRatio.statefulSetRatio = Helper.getResourceRatio(
statefulSets.status,
statefulSets.listMeta.totalItems,
statefulSets.listMeta.totalItems
);
break;
}
......
......@@ -87,7 +87,7 @@ export abstract class ResourceListBase<T extends ResourceList, R extends Resourc
protected constructor(
stateName: string | Observable<string>,
private readonly notifications_: NotificationsService,
protected readonly cdr_: ChangeDetectorRef,
protected readonly cdr_: ChangeDetectorRef
) {
this.settingsService_ = GlobalServicesModule.injector.get(GlobalSettingsService);
this.kdState_ = GlobalServicesModule.injector.get(KdStateService);
......@@ -377,7 +377,7 @@ export abstract class ResourceListWithStatuses<T extends ResourceList, R extends
protected constructor(
stateName: string,
private readonly notifications: NotificationsService,
cdr: ChangeDetectorRef,
cdr: ChangeDetectorRef
) {
super(stateName, notifications, cdr);
}
......
......@@ -54,7 +54,7 @@ export class CreateService {
private readonly csrfToken_: CsrfTokenService,
private readonly matDialog_: MatDialog,
private readonly router_: Router,
@Inject(CONFIG_DI_TOKEN) private readonly CONFIG: Config,
@Inject(CONFIG_DI_TOKEN) private readonly CONFIG: Config
) {}
async createContent(content: string, validate = true, name = ''): Promise<AppDeploymentContentResponse> {
......
......@@ -26,20 +26,20 @@ export class AssetsService {
constructor(
@Inject(MatIconRegistry) private readonly iconRegistry_: MatIconRegistry,
@Inject(DomSanitizer) private readonly sanitizer_: DomSanitizer,
@Inject(DomSanitizer) private readonly sanitizer_: DomSanitizer
) {
iconRegistry_.addSvgIcon(
this.appLogoIcon_,
sanitizer_.bypassSecurityTrustResourceUrl(`${this.assetsPath_}/${this.appLogoSvg_}`),
sanitizer_.bypassSecurityTrustResourceUrl(`${this.assetsPath_}/${this.appLogoSvg_}`)
);
iconRegistry_.addSvgIcon(
this.appLogoTextIcon_,
sanitizer_.bypassSecurityTrustResourceUrl(`${this.assetsPath_}/${this.appLogoTextSvg_}`),
sanitizer_.bypassSecurityTrustResourceUrl(`${this.assetsPath_}/${this.appLogoTextSvg_}`)
);
iconRegistry_.addSvgIcon('pin', sanitizer_.bypassSecurityTrustResourceUrl(`${this.assetsPath_}/pin.svg`));
iconRegistry_.addSvgIcon(
'pin-crossed',
sanitizer_.bypassSecurityTrustResourceUrl(`${this.assetsPath_}/pin-crossed.svg`),
sanitizer_.bypassSecurityTrustResourceUrl(`${this.assetsPath_}/pin-crossed.svg`)
);
}
......
......@@ -12,15 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import 'rxjs/add/operator/first';
import 'rxjs/add/operator/switchMap';
import {HttpClient, HttpHeaders} from '@angular/common/http';
import {Injectable} from '@angular/core';
import {Router} from '@angular/router';
import {CookieService} from 'ngx-cookie-service';
import {of} from 'rxjs';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs';
import {first, switchMap} from 'rxjs/operators';
import {AuthResponse, CsrfToken, LoginSpec, LoginStatus} from 'typings/backendapi';
......@@ -39,7 +36,7 @@ export class AuthService {
private readonly router_: Router,
private readonly http_: HttpClient,
private readonly csrfTokenService_: CsrfTokenService,
private readonly stateService_: KdStateService,
private readonly stateService_: KdStateService
) {
this.init_();
}
......@@ -94,8 +91,8 @@ export class AuthService {
switchMap((csrfToken: CsrfToken) =>
this.http_.post<AuthResponse>('api/v1/login', loginSpec, {
headers: new HttpHeaders().set(this._config.csrfHeaderName, csrfToken.token),
}),
),
})
)
)
.pipe(
switchMap((authResponse: AuthResponse) => {
......@@ -104,7 +101,7 @@ export class AuthService {
}
return of(authResponse.errors);
}),
})
);
}
......@@ -130,9 +127,9 @@ export class AuthService {
{jweToken: token},
{
headers: new HttpHeaders().set(this._config.csrfHeaderName, csrfToken.token),
},
}
);
}),
})
)
.pipe(first())
.subscribe((authResponse: AuthResponse) => {
......
......@@ -12,12 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import 'rxjs/add/operator/catch';
import {HttpClient} from '@angular/common/http';
import {Injectable} from '@angular/core';
import {CanIResponse} from '@api/backendapi';
import {Observable} from 'rxjs/Observable';
import {Observable, throwError} from 'rxjs';
import {catchError, switchMap} from 'rxjs/operators';
import {ERRORS} from '../../errors/errors';
......@@ -30,15 +29,15 @@ export class AuthorizerService {
proxyGET<T>(url: string): Observable<T> {
return this.http_
.get<CanIResponse>(`${url}${this.authorizationSubUrl_}`)
.switchMap<CanIResponse, T>(response => {
if (!response.allowed) {
return Observable.throwError(ERRORS.forbidden);
}
.pipe(
switchMap(response => {
if (!response.allowed) {
return throwError(ERRORS.forbidden);
}
return this.http_.get<T>(url);
})
.catch(e => {
return Observable.throwError(e);
});
return this.http_.get<T>(url);
})
)
.pipe(catchError(e => throwError(e)));
}
}
......@@ -16,7 +16,7 @@ import {HttpClient} from '@angular/common/http';
import {Injectable} from '@angular/core';
import {AppConfig} from '@api/backendapi';
import {VersionInfo} from '@api/frontendapi';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs';
import {version} from '../../../environments/version';
@Injectable()
......
......@@ -15,7 +15,7 @@
import {HttpClient} from '@angular/common/http';
import {Injectable} from '@angular/core';
import {CsrfToken} from '@api/backendapi';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs';
@Injectable()
export class CsrfTokenService {
......
......@@ -17,7 +17,7 @@ import {EventEmitter, Injectable} from '@angular/core';
import {GlobalSettings} from '@api/backendapi';
import {onSettingsFailCallback, onSettingsLoadCallback} from '@api/frontendapi';
import {of, ReplaySubject, Subject} from 'rxjs';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs';
import {catchError, switchMap, takeUntil} from 'rxjs/operators';
import {AuthorizerService} from './authorizer';
......@@ -70,7 +70,7 @@ export class GlobalSettingsService {
this.isInitialized_ = false;
this.onSettingsUpdate.next();
if (onFail) onFail(err);
},
}
);
}
......
......@@ -15,7 +15,7 @@
import {HttpEvent, HttpHandler, HttpInterceptor, HttpRequest} from '@angular/common/http';
import {Injectable} from '@angular/core';
import {CookieService} from 'ngx-cookie-service';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs';
import {CONFIG} from '../../../index.config';
/* tslint:disable */
......
......@@ -14,7 +14,7 @@
import {HttpClient, HttpParams} from '@angular/common/http';
import {Injectable} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs';
@Injectable()
export class LogService {
......
......@@ -93,7 +93,7 @@ export function init(
pinner: PinnerService,
config: ConfigService,
history: HistoryService,
pluginsConfig: PluginsConfigService,
pluginsConfig: PluginsConfigService
): Function {
return () => {
globalSettings.init();
......
......@@ -14,8 +14,8 @@
import {Injectable} from '@angular/core';
import {ActivatedRoute, NavigationEnd, Params, Router} from '@angular/router';
import {Subject} from 'rxjs';
import {filter} from 'rxjs/operators';
import {combineLatest, Subject} from 'rxjs';
import {filter, map, switchMap} from 'rxjs/operators';
@Injectable()
export class ParamsService {
......@@ -25,22 +25,24 @@ export class ParamsService {
private queryParamMap_: Params = {};
constructor(private router_: Router, private route_: ActivatedRoute) {
this.router_.events.pipe(filter(event => event instanceof NavigationEnd)).subscribe(() => {
let active = this.route_;
while (active.firstChild) {
active = active.firstChild;
}
this.router_.events
.pipe(filter(event => event instanceof NavigationEnd))
.pipe(
map(() => {
let active = this.route_;
while (active.firstChild) {
active = active.firstChild;
}
active.params.subscribe((params: Params) => {
return active;
})
)
.pipe(switchMap(active => combineLatest([active.params, active.queryParams])))
.subscribe(([params, queryParams]) => {
this.copyParams_(params, this.params_);
this.copyParams_(queryParams, this.queryParamMap_);
this.onParamChange.next();
});
active.params.subscribe((params: Params) => {
this.copyParams_(params, this.queryParamMap_);
this.onParamChange.next();
});
});
}
getRouteParam(name: string) {
......
......@@ -30,7 +30,7 @@ export class PinnerService {
constructor(
private readonly dialog_: MatDialog,
private readonly http_: HttpClient,
private readonly verber_: VerberService,
private readonly verber_: VerberService
) {}
init(): void {
......
......@@ -15,7 +15,7 @@
import {HttpClient} from '@angular/common/http';
import {Injectable} from '@angular/core';
import {PluginMetadata, PluginsConfig} from '@api/frontendapi';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs';
@Injectable()
export class PluginsConfigService {
......
......@@ -32,7 +32,7 @@ export class TitleService {
() => {
this.clusterName = '';
this.apply_();
},
}
);
}
......
......@@ -16,6 +16,7 @@ import {HttpClient, HttpErrorResponse, HttpHeaders} from '@angular/common/http';
import {EventEmitter, Injectable} from '@angular/core';
import {MatDialog, MatDialogConfig} from '@angular/material/dialog';
import {ObjectMeta, TypeMeta} from '@api/backendapi';
import {filter, switchMap} from 'rxjs/operators';
import {AlertDialog, AlertDialogConfig} from '../../dialogs/alert/dialog';
import {DeleteResourceDialog} from '../../dialogs/deleteresource/dialog';
......@@ -40,14 +41,14 @@ export class VerberService {
this.dialog_
.open(DeleteResourceDialog, dialogConfig)
.afterClosed()
.subscribe(doDelete => {
if (doDelete) {
.pipe(filter(doDelete => doDelete))
.pipe(
switchMap(_ => {
const url = RawResource.getUrl(typeMeta, objectMeta);
this.http_
.delete(url, {responseType: 'text'})
.subscribe(() => this.onDelete.emit(true), this.handleErrorResponse_.bind(this));
}
});
return this.http_.delete(url, {responseType: 'text'});
})
)
.subscribe(_ => this.onDelete.emit(true), this.handleErrorResponse_.bind(this));
}
showEditDialog(displayName: string, typeMeta: TypeMeta, objectMeta: ObjectMeta): void {
......@@ -55,14 +56,14 @@ export class VerberService {
this.dialog_
.open(EditResourceDialog, dialogConfig)
.afterClosed()
.subscribe(result => {
if (result) {
.pipe(filter(result => result))
.pipe(
switchMap(result => {
const url = RawResource.getUrl(typeMeta, objectMeta);
this.http_
.put(url, JSON.parse(result), {headers: this.getHttpHeaders_(), responseType: 'text'})
.subscribe(() => this.onEdit.emit(true), this.handleErrorResponse_.bind(this));
}
});
return this.http_.put(url, JSON.parse(result), {headers: this.getHttpHeaders_(), responseType: 'text'});
})
)
.subscribe(_ => this.onEdit.emit(true), this.handleErrorResponse_.bind(this));
}
showScaleDialog(displayName: string, typeMeta: TypeMeta, objectMeta: ObjectMeta): void {
......@@ -70,20 +71,17 @@ export class VerberService {
this.dialog_
.open(ScaleResourceDialog, dialogConfig)
.afterClosed()
.subscribe(result => {
if (Number.isInteger(result)) {
const url =
`api/v1/scale/${typeMeta.kind}` +
(objectMeta.namespace ? `/${objectMeta.namespace}` : '') +
`/${objectMeta.name}/`;
.pipe(filter(result => Number.isInteger(result)))
.pipe(
switchMap(result => {
const url = `api/v1/scale/${typeMeta.kind}${objectMeta.namespace ? `/${objectMeta.namespace}` : ''}/${
objectMeta.name
}/`;
this.http_
.put(url, result, {
params: {scaleBy: result},
})
.subscribe(() => this.onScale.emit(true), this.handleErrorResponse_.bind(this));
}
});
return this.http_.put(url, result, {params: {scaleBy: result}});
})
)
.subscribe(_ => this.onScale.emit(true), this.handleErrorResponse_.bind(this));
}
showTriggerDialog(displayName: string, typeMeta: TypeMeta, objectMeta: ObjectMeta): void {
......@@ -91,14 +89,14 @@ export class VerberService {
this.dialog_
.open(TriggerResourceDialog, dialogConfig)
.afterClosed()
.subscribe(result => {
if (result) {
.pipe(filter(result => result))
.pipe(
switchMap(_ => {
const url = `api/v1/cronjob/${objectMeta.namespace}/${objectMeta.name}/trigger`;
this.http_
.put(url, {}, {responseType: 'text'})
.subscribe(() => this.onTrigger.emit(true), this.handleErrorResponse_.bind(this));
}
});
return this.http_.put(url, {}, {responseType: 'text'});
})
)
.subscribe(_ => this.onTrigger.emit(true), this.handleErrorResponse_.bind(this));
}
getDialogConfig_(displayName: string, typeMeta: TypeMeta, objectMeta: ObjectMeta): MatDialogConfig<ResourceMeta> {
......
......@@ -16,7 +16,7 @@ import {Injectable} from '@angular/core';
import {CanActivate, Router, UrlTree} from '@angular/router';
import {LoginStatus} from '@api/backendapi';
import {Observable, of} from 'rxjs';
import {first, switchMap} from 'rxjs/operators';
import {catchError, first, switchMap} from 'rxjs/operators';
import {AuthService} from '../global/authentication';
@Injectable()
......@@ -37,10 +37,8 @@ export class AuthGuard implements CanActivate {
}
return of(true);
}),
})
)
.catch(() => {
return this.router_.navigate(['login']);
});
.pipe(catchError(_ => this.router_.navigate(['login'])));
}
}
......@@ -16,7 +16,7 @@ import {Injectable} from '@angular/core';
import {CanActivate, Router, UrlTree} from '@angular/router';
import {LoginStatus} from '@api/backendapi';
import {Observable, of} from 'rxjs';
import {first, switchMap} from 'rxjs/operators';
import {catchError, first, switchMap} from 'rxjs/operators';
import {AuthService} from '../global/authentication';
@Injectable()
......@@ -34,10 +34,8 @@ export class LoginGuard implements CanActivate {
}
return of(true);
}),
})
)
.catch(() => {
return this.router_.navigate(['overview']);
});
.pipe(catchError(_ => this.router_.navigate(['overview'])));
}
}
......@@ -28,7 +28,7 @@ export class SearchGuard implements CanDeactivate<SearchComponent> {
_cmp: SearchComponent,
_route: ActivatedRouteSnapshot,
_routeSnapshot: RouterStateSnapshot,
nextState?: RouterStateSnapshot,
nextState?: RouterStateSnapshot
): boolean | UrlTree {
let url = nextState.url;
const queryParams = this.getQueryParams_(url);
......
......@@ -31,7 +31,7 @@ export class ClientPluginLoaderService extends PluginLoaderService {
window.define(externalKey, [], () => {
// @ts-ignore
return PLUGIN_EXTERNALS_MAP[externalKey];
}),
})
);
}
......
......@@ -15,7 +15,7 @@
import {HttpClient, HttpParams} from '@angular/common/http';
import {Injectable} from '@angular/core';
import {timer} from 'rxjs';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs';
import {publishReplay, refCount, switchMap, switchMapTo} from 'rxjs/operators';
import {ResourceBase} from '../../resources/resource';
......@@ -43,12 +43,12 @@ export class ResourceService<T> extends ResourceBase<T> {
let interval = this.settings_.getResourceAutoRefreshTimeInterval();
interval = interval === 0 ? undefined : interval * 1000;
return timer(0, interval);
}),
})
)
.pipe(
switchMapTo(
this.http_.get<T>(endpoint, {params}),
),
this.http_.get<T>(endpoint, {params})
)
)
.pipe(publishReplay(1))
.pipe(refCount());
......@@ -60,7 +60,7 @@ export class NamespacedResourceService<T> extends ResourceBase<T> {
constructor(
readonly http: HttpClient,
private readonly namespace_: NamespaceService,
private readonly settings_: GlobalSettingsService,
private readonly settings_: GlobalSettingsService
) {
super(http);
}
......@@ -87,12 +87,12 @@ export class NamespacedResourceService<T> extends ResourceBase<T> {
let interval = this.settings_.getResourceAutoRefreshTimeInterval();
interval = interval === 0 ? undefined : interval * 1000;
return timer(0, interval);
}),
})
)
.pipe(
switchMapTo(
this.http_.get<T>(endpoint, {params}),
),
this.http_.get<T>(endpoint, {params})
)
)
.pipe(publishReplay(1))
.pipe(refCount());
......
......@@ -47,7 +47,7 @@ export class CRDObjectDetailComponent implements OnInit, OnDestroy {
private readonly activatedRoute_: ActivatedRoute,
private readonly notifications_: NotificationsService,
private readonly http_: HttpClient,
private readonly renderer_: Renderer2,
private readonly renderer_: Renderer2
) {}
ngOnInit(): void {
......
......@@ -36,7 +36,7 @@ export class CRDDetailComponent implements OnInit, OnDestroy {
private readonly crd_: ResourceService<CRDDetail>,
private readonly actionbar_: ActionbarService,
private readonly activatedRoute_: ActivatedRoute,
private readonly notifications_: NotificationsService,
private readonly notifications_: NotificationsService
) {}
ngOnInit(): void {
......
......@@ -32,7 +32,7 @@ export class CreateFromFileComponent {
constructor(
private readonly namespace_: NamespaceService,
private readonly create_: CreateService,
private readonly history_: HistoryService,
private readonly history_: HistoryService
) {}
isCreateDisabled(): boolean {
......
......@@ -26,6 +26,7 @@ import {
Protocols,
SecretList,
} from '@api/backendapi';
import {take} from 'rxjs/operators';
import {CreateService} from '../../../common/services/create/service';
import {HistoryService} from '../../../common/services/global/history';
......@@ -64,7 +65,7 @@ export class CreateFromFormComponent implements OnInit {
private readonly http_: HttpClient,
private readonly route_: ActivatedRoute,
private readonly fb_: FormBuilder,
private readonly dialog_: MatDialog,
private readonly dialog_: MatDialog
) {}
ngOnInit(): void {
......@@ -99,7 +100,7 @@ export class CreateFromFormComponent implements OnInit {
this.namespace.patchValue(
!this.namespace_.areMultipleNamespacesSelected()
? this.route_.snapshot.params.namespace || this.namespaces[0]
: this.namespaces[0],
: this.namespaces[0]
);
});
this.http_
......@@ -209,7 +210,7 @@ export class CreateFromFormComponent implements OnInit {
const dialogDef = this.dialog_.open(CreateNamespaceDialog, dialogData);
dialogDef
.afterClosed()
.take(1)
.pipe(take(1))
.subscribe(answer => {
/**
* Handles namespace dialog result. If namespace was created successfully then it
......@@ -229,7 +230,7 @@ export class CreateFromFormComponent implements OnInit {
const dialogDef = this.dialog_.open(CreateSecretDialog, dialogData);
dialogDef
.afterClosed()
.take(1)
.pipe(take(1))
.subscribe(response => {
/**
* Handles create secret dialog result. If the secret was created successfully, then it
......
......@@ -16,6 +16,7 @@ import {HttpClient, HttpHeaders} from '@angular/common/http';
import {Component, Inject, OnInit} from '@angular/core';
import {AbstractControl, FormBuilder, FormGroup, Validators} from '@angular/forms';
import {MAT_DIALOG_DATA, MatDialog, MatDialogRef} from '@angular/material/dialog';
import {switchMap} from 'rxjs/operators';
import {AlertDialog, AlertDialogConfig} from '../../../../common/dialogs/alert/dialog';
import {CsrfTokenService} from '../../../../common/services/global/csrftoken';
import {CONFIG} from '../../../../index.config';
......@@ -51,7 +52,7 @@ export class CreateNamespaceDialog implements OnInit {
private readonly http_: HttpClient,
private readonly csrfToken_: CsrfTokenService,
private readonly matDialog_: MatDialog,
private readonly fb_: FormBuilder,
private readonly fb_: FormBuilder
) {}
ngOnInit(): void {
......@@ -76,32 +77,30 @@ export class CreateNamespaceDialog implements OnInit {
const namespaceSpec = {name: this.namespace.value};
const tokenPromise = this.csrfToken_.getTokenForAction('namespace');
tokenPromise.subscribe(csrfToken => {
return this.http_
.post<{valid: boolean}>(
'api/v1/namespace',
{...namespaceSpec},
{
headers: new HttpHeaders().set(this.config_.csrfHeaderName, csrfToken.token),
},
tokenPromise
.pipe(
switchMap(csrfToken =>
this.http_.post<{valid: boolean}>(
'api/v1/namespace',
{...namespaceSpec},
{headers: new HttpHeaders().set(this.config_.csrfHeaderName, csrfToken.token)}
)
)
.subscribe(
() => {
// this.log_.info('Successfully created namespace:', savedConfig);
this.dialogRef.close(this.namespace.value);
},
error => {
// this.log_.info('Error creating namespace:', err);
this.dialogRef.close();
const configData: AlertDialogConfig = {
title: 'Error creating namespace',
message: error.data,
confirmLabel: 'OK',
};
this.matDialog_.open(AlertDialog, {data: configData});
},
);
});
)
.subscribe(
() => {
this.dialogRef.close(this.namespace.value);
},
error => {
this.dialogRef.close();
const configData: AlertDialogConfig = {
title: 'Error creating namespace',
message: error.data,
confirmLabel: 'OK',
};
this.matDialog_.open(AlertDialog, {data: configData});
}
);
}
/**
......
......@@ -16,6 +16,7 @@ import {HttpClient, HttpHeaders} from '@angular/common/http';
import {Component, Inject, OnInit} from '@angular/core';
import {AbstractControl, FormBuilder, FormGroup, Validators} from '@angular/forms';
import {MAT_DIALOG_DATA, MatDialog, MatDialogRef} from '@angular/material/dialog';
import {switchMap} from 'rxjs/operators';
import {AlertDialog, AlertDialogConfig} from '../../../../common/dialogs/alert/dialog';
import {CsrfTokenService} from '../../../../common/services/global/csrftoken';
import {CONFIG} from '../../../../index.config';
......@@ -54,7 +55,7 @@ export class CreateSecretDialog implements OnInit {
private readonly http_: HttpClient,
private readonly csrfToken_: CsrfTokenService,
private readonly matDialog_: MatDialog,
private readonly fb_: FormBuilder,
private readonly fb_: FormBuilder
) {}
ngOnInit(): void {
......@@ -91,32 +92,30 @@ export class CreateSecretDialog implements OnInit {
};
const tokenPromise = this.csrfToken_.getTokenForAction('secret');
tokenPromise.subscribe(csrfToken => {
return this.http_
.post<{valid: boolean}>(
'api/v1/secret/',
{...secretSpec},
{
headers: new HttpHeaders().set(this.config_.csrfHeaderName, csrfToken.token),
},
tokenPromise
.pipe(
switchMap(csrfToken =>
this.http_.post<{valid: boolean}>(
'api/v1/secret/',
{...secretSpec},
{headers: new HttpHeaders().set(this.config_.csrfHeaderName, csrfToken.token)}
)
)
.subscribe(
() => {
// this.log_.info('Successfully created namespace:', savedConfig);
this.dialogRef.close(this.secretName.value);
},
error => {
// this.log_.info('Error creating namespace:', err);
this.dialogRef.close();
const configData: AlertDialogConfig = {
title: 'Error creating secret',
message: error.data,
confirmLabel: 'OK',
};
this.matDialog_.open(AlertDialog, {data: configData});
},
);
});
)
.subscribe(
() => {
this.dialogRef.close(this.secretName.value);
},
error => {
this.dialogRef.close();
const configData: AlertDialogConfig = {
title: 'Error creating secret',
message: error.data,
confirmLabel: 'OK',
};
this.matDialog_.open(AlertDialog, {data: configData});
}
);
}
/**
......
......@@ -93,7 +93,7 @@ export class DeployLabelComponent implements ControlValueAccessor {
Validators.compose([Validators.maxLength(253), FormValidators.labelValuePattern]),
],
editable,
}),
})
);
}
......
......@@ -105,7 +105,7 @@ export class PortMappingsComponent implements OnInit, ControlValueAccessor {
first(() => !this.portMappingForm.pending),
map(() => {
return this.portMappingForm.invalid ? {error: true} : null;
}),
})
);
}
......
......@@ -15,7 +15,7 @@
import {HttpClient} from '@angular/common/http';
import {Directive, forwardRef, Input} from '@angular/core';
import {AbstractControl, AsyncValidator, AsyncValidatorFn, NG_ASYNC_VALIDATORS} from '@angular/forms';
import {Observable} from 'rxjs/Observable';
import {Observable, of} from 'rxjs';
import {debounceTime, map} from 'rxjs/operators';
export const uniqueNameValidationKey = 'uniqueName';
......@@ -49,7 +49,7 @@ export class UniqueNameValidator implements AsyncValidator {
export function validateUniqueName(http: HttpClient, namespace: string): AsyncValidatorFn {
return (control: AbstractControl): Observable<{[key: string]: boolean} | null> => {
if (!control.value) {
return Observable.of(null);
return of(null);
}
return http
.post<{valid: boolean}>('api/v1/appdeployment/validate/name', {
......@@ -58,7 +58,7 @@ export function validateUniqueName(http: HttpClient, namespace: string): AsyncVa
})
.pipe(
debounceTime(500),
map(res => (!res.valid ? {[uniqueNameValidationKey]: control.value} : null)),
map(res => (!res.valid ? {[uniqueNameValidationKey]: control.value} : null))
);
};
}
......@@ -13,9 +13,9 @@
// limitations under the License.
import {HttpClient} from '@angular/common/http';
import {Attribute, Directive, forwardRef, Injector, Input, OnChanges, SimpleChanges} from '@angular/core';
import {AbstractControl, AsyncValidator, FormControl, NG_ASYNC_VALIDATORS, NgModel, Validator} from '@angular/forms';
import {Observable} from 'rxjs/Observable';
import {Directive, forwardRef, Input} from '@angular/core';
import {AbstractControl, AsyncValidator, NG_ASYNC_VALIDATORS, Validator} from '@angular/forms';
import {Observable, of} from 'rxjs';
import {debounceTime, map} from 'rxjs/operators';
export const uniqueNameValidationKey = 'validImageReference';
......@@ -41,7 +41,7 @@ export class ValidImageReferenceValidator implements AsyncValidator, Validator {
validate(control: AbstractControl): Observable<{[key: string]: string}> {
if (!control.value) {
return Observable.of(null);
return of(null);
}
return this.http
.post<{valid: boolean; reason: string}>('api/v1/appdeployment/validate/imagereference', {
......@@ -49,7 +49,7 @@ export class ValidImageReferenceValidator implements AsyncValidator, Validator {
})
.pipe(
debounceTime(500),
map(res => (!res.valid ? {[uniqueNameValidationKey]: res.reason} : null)),
map(res => (!res.valid ? {[uniqueNameValidationKey]: res.reason} : null))
);
}
}
......@@ -15,8 +15,8 @@
import {HttpClient} from '@angular/common/http';
import {Directive, forwardRef, Input} from '@angular/core';
import {AbstractControl, AsyncValidator, AsyncValidatorFn, NG_ASYNC_VALIDATORS} from '@angular/forms';
import {Observable} from 'rxjs/Observable';
import {debounceTime, map} from 'rxjs/operators';
import {Observable, of} from 'rxjs';
import {debounceTime, first, map} from 'rxjs/operators';
export const validProtocolValidationKey = 'validProtocol';
......@@ -49,7 +49,7 @@ export class ProtocolValidator implements AsyncValidator {
export function validateProtocol(http: HttpClient, isExternal: boolean): AsyncValidatorFn {
return (control: AbstractControl): Observable<{[key: string]: boolean} | null> => {
if (!control.value) {
return Observable.of(null);
return of(null);
}
const protocol = control.value;
return http
......@@ -57,12 +57,12 @@ export function validateProtocol(http: HttpClient, isExternal: boolean): AsyncVa
protocol,
isExternal,
})
.first()
.pipe(first())
.pipe(
debounceTime(500),
map(res => {
return !res.valid ? {[validProtocolValidationKey]: true} : null;
}),
})
);
};
}
......@@ -29,7 +29,7 @@ export class CreateFromInputComponent {
constructor(
private readonly namespace_: NamespaceService,
private readonly create_: CreateService,
private readonly history_: HistoryService,
private readonly history_: HistoryService
) {}
isCreateDisabled(): boolean {
......
......@@ -33,7 +33,7 @@ export class RootComponent implements OnInit {
private readonly settings_: LocalSettingsService,
private readonly overlayContainer_: OverlayContainer,
private readonly kdRootRef: ElementRef,
private readonly titleService_: TitleService,
private readonly titleService_: TitleService
) {
this.isLightThemeEnabled_ = this.themeService_.isLightThemeEnabled();
}
......
......@@ -56,7 +56,7 @@ export class LoginComponent implements OnInit {
private readonly ngZone_: NgZone,
private readonly route_: ActivatedRoute,
private readonly pluginConfigService_: PluginsConfigService,
@Inject(CONFIG_DI_TOKEN) private readonly CONFIG: Config,
@Inject(CONFIG_DI_TOKEN) private readonly CONFIG: Config
) {}
ngOnInit(): void {
......@@ -98,7 +98,7 @@ export class LoginComponent implements OnInit {
null,
null,
false,
'Strict',
'Strict'
);
this.authService_.login(this.getLoginSpec_()).subscribe(
......@@ -115,7 +115,7 @@ export class LoginComponent implements OnInit {
},
(err: HttpErrorResponse) => {
this.errors = [AsKdError(err)];
},
}
);
}
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册