From 46f3b00231211b7334792a419a5890f00c5249d3 Mon Sep 17 00:00:00 2001 From: Sebastian Florek Date: Thu, 27 Aug 2020 15:19:48 +0200 Subject: [PATCH] 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 --- .editorconfig | 9 +- .prettierrc.js | 11 +- i18n/de/messages.de.xlf | 726 +++++++++++------- i18n/messages.xlf | 78 +- package.json | 5 +- src/app/frontend/chrome/component.ts | 4 +- src/app/frontend/chrome/nav/item/component.ts | 8 +- src/app/frontend/chrome/search/component.ts | 2 +- .../detailactions/delete/component.ts | 2 +- .../actionbar/detailactions/edit/component.ts | 2 - .../actionbar/detailactions/logs/component.ts | 2 +- .../actionbar/detailactions/pin/component.ts | 2 +- .../detailactions/scale/component.ts | 1 - .../detailactions/trigger/component.ts | 1 - .../actionbars/default/component.ts | 11 +- .../actionbars/logsdefault/component.ts | 10 +- .../actionbars/logsexecdefault/component.ts | 10 +- .../actionbars/logsscaledefault/component.ts | 11 +- .../actionbars/pindefault/component.ts | 11 +- .../actionbars/scaledefault/component.ts | 11 +- .../actionbars/triggerdefault/component.ts | 12 +- .../components/breadcrumbs/component.ts | 8 +- .../common/components/chips/component.ts | 4 +- .../common/components/creator/component.ts | 2 +- .../common/components/date/component.ts | 4 +- .../components/list/column/menu/component.ts | 4 +- .../components/list/filter/component.ts | 5 +- .../namespace/changedialog/dialog.ts | 2 +- .../common/components/namespace/component.ts | 6 +- .../resourcelist/clusterrole/component.ts | 4 +- .../clusterrolebinding/component.ts | 2 +- .../resourcelist/configmap/component.ts | 4 +- .../components/resourcelist/crd/component.ts | 2 +- .../resourcelist/crdobject/component.ts | 2 +- .../resourcelist/cronjob/component.ts | 4 +- .../resourcelist/daemonset/component.ts | 4 +- .../resourcelist/deployment/component.ts | 4 +- .../resourcelist/event/component.ts | 4 +- .../horizontalpodautoscaler/component.ts | 4 +- .../resourcelist/ingress/component.ts | 4 +- .../components/resourcelist/job/component.ts | 4 +- .../resourcelist/namespace/component.ts | 4 +- .../resourcelist/networkpolicy/component.ts | 4 +- .../components/resourcelist/node/component.ts | 4 +- .../persistentvolume/component.ts | 4 +- .../persistentvolumeclaim/component.ts | 4 +- .../resourcelist/plugin/component.ts | 4 +- .../components/resourcelist/pod/component.ts | 4 +- .../resourcelist/replicaset/component.ts | 4 +- .../replicationcontroller/component.ts | 4 +- .../components/resourcelist/role/component.ts | 4 +- .../resourcelist/rolebinding/component.ts | 2 +- .../resourcelist/secret/component.ts | 4 +- .../resourcelist/service/component.ts | 4 +- .../resourcelist/serviceaccount/component.ts | 4 +- .../resourcelist/statefulset/component.ts | 4 +- .../resourcelist/storageclass/component.ts | 4 +- .../workloadstatus/component.spec.ts | 2 +- .../common/dialogs/deleteresource/dialog.ts | 2 +- .../common/dialogs/download/dialog.ts | 4 +- .../common/dialogs/editresource/dialog.ts | 2 +- .../common/dialogs/scaleresource/dialog.ts | 2 +- .../common/dialogs/triggerresource/dialog.ts | 2 +- .../common/directives/autofocus/directive.ts | 8 +- .../frontend/common/resources/groupedlist.ts | 14 +- src/app/frontend/common/resources/list.ts | 4 +- .../common/services/create/service.ts | 2 +- .../frontend/common/services/global/assets.ts | 8 +- .../common/services/global/authentication.ts | 17 +- .../common/services/global/authorizer.ts | 23 +- .../frontend/common/services/global/config.ts | 2 +- .../common/services/global/csrftoken.ts | 2 +- .../common/services/global/globalsettings.ts | 4 +- .../common/services/global/interceptor.ts | 2 +- .../frontend/common/services/global/logs.ts | 2 +- .../frontend/common/services/global/module.ts | 2 +- .../frontend/common/services/global/params.ts | 30 +- .../frontend/common/services/global/pinner.ts | 2 +- .../frontend/common/services/global/plugin.ts | 2 +- .../frontend/common/services/global/title.ts | 2 +- .../frontend/common/services/global/verber.ts | 66 +- .../frontend/common/services/guard/auth.ts | 8 +- .../frontend/common/services/guard/login.ts | 8 +- .../frontend/common/services/guard/search.ts | 2 +- .../pluginloader/clientloader.service.ts | 2 +- .../common/services/resource/resource.ts | 16 +- src/app/frontend/crd/crdobject/component.ts | 2 +- src/app/frontend/crd/detail/component.ts | 2 +- .../frontend/create/from/file/component.ts | 2 +- .../frontend/create/from/form/component.ts | 9 +- .../from/form/createnamespace/dialog.ts | 51 +- .../create/from/form/createsecret/dialog.ts | 51 +- .../create/from/form/deploylabel/component.ts | 2 +- .../from/form/portmappings/component.ts | 2 +- .../form/validator/uniquename.validator.ts | 6 +- .../validimagereference.validator.ts | 10 +- .../form/validator/validprotocol.validator.ts | 10 +- .../frontend/create/from/input/component.ts | 2 +- src/app/frontend/index.component.ts | 2 +- src/app/frontend/login/component.ts | 6 +- src/app/frontend/logs/component.ts | 71 +- src/app/frontend/overview/component.spec.ts | 4 +- src/app/frontend/polyfills.ts | 3 - .../cluster/clusterrole/detail/component.ts | 14 +- .../clusterrolebinding/detail/component.ts | 4 +- .../namespace/detail/actionbar/component.ts | 10 +- .../cluster/namespace/detail/component.ts | 14 +- .../cluster/networkpolicy/detail/component.ts | 18 +- .../resource/cluster/node/detail/component.ts | 32 +- .../persistentvolume/detail/component.ts | 14 +- .../resource/cluster/role/detail/component.ts | 14 +- .../cluster/rolebinding/detail/component.ts | 4 +- .../serviceaccount/detail/component.ts | 16 +- .../config/configmap/detail/component.ts | 14 +- .../persistentvolumeclaim/detail/component.ts | 14 +- .../config/secret/detail/component.ts | 16 +- .../config/storageclass/detail/component.ts | 14 +- .../discovery/ingress/detail/component.ts | 16 +- .../discovery/service/detail/component.ts | 14 +- .../workloads/cronjob/detail/component.ts | 14 +- .../daemonset/detail/actionbar/component.ts | 10 +- .../workloads/daemonset/detail/component.ts | 14 +- .../workloads/deployment/detail/component.ts | 6 +- .../workloads/job/detail/component.ts | 14 +- .../workloads/pod/detail/component.ts | 14 +- .../workloads/replicaset/detail/component.ts | 14 +- .../replicationcontroller/detail/component.ts | 14 +- .../workloads/statefulset/detail/component.ts | 14 +- src/app/frontend/settings/global/component.ts | 60 +- src/app/frontend/shell/component.ts | 6 +- 130 files changed, 1074 insertions(+), 879 deletions(-) diff --git a/.editorconfig b/.editorconfig index bf6aa645e..d4fc26369 100644 --- a/.editorconfig +++ b/.editorconfig @@ -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 diff --git a/.prettierrc.js b/.prettierrc.js index c82a2a8cd..8efcb195a 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -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, } ) diff --git a/i18n/de/messages.de.xlf b/i18n/de/messages.de.xlf index 774a918fc..ab746038f 100644 --- a/i18n/de/messages.de.xlf +++ b/i18n/de/messages.de.xlf @@ -441,12 +441,16 @@ ../src/app/frontend/resource/workloads/pod/detail/template.html 24 + + ../src/app/frontend/resource/workloads/replicaset/detail/template.html + 22 + ../src/app/frontend/resource/workloads/replicationcontroller/detail/template.html 22 - ../src/app/frontend/resource/workloads/replicaset/detail/template.html + ../src/app/frontend/resource/cluster/clusterrolebinding/detail/template.html 22 @@ -466,7 +470,7 @@ 22 - ../src/app/frontend/resource/cluster/storageclass/detail/template.html + ../src/app/frontend/resource/cluster/rolebinding/detail/template.html 22 @@ -497,29 +501,21 @@ ../src/app/frontend/resource/config/persistentvolumeclaim/detail/template.html 22 + + ../src/app/frontend/resource/config/storageclass/detail/template.html + 22 + Workloads Workloads - - ../src/app/frontend/search/template.html - 36 - ../src/app/frontend/overview/template.html - 20 - - - - Discovery and Load Balancing - Discovery und Load Balancing - - ../src/app/frontend/overview/template.html - 47 + 19 ../src/app/frontend/search/template.html - 58 + 20 @@ -527,11 +523,11 @@ Konfiguration und Storage ../src/app/frontend/overview/template.html - 57 + 56 ../src/app/frontend/search/template.html - 68 + 52 @@ -545,9 +541,13 @@ Cluster Cluster + + ../src/app/frontend/overview/template.html + 71 + ../src/app/frontend/search/template.html - 20 + 66 @@ -613,6 +613,10 @@ ../src/app/frontend/common/components/resourcelist/clusterrole/template.html 44 + + ../src/app/frontend/common/components/resourcelist/clusterrolebinding/template.html + 44 + ../src/app/frontend/common/components/resourcelist/configmap/template.html 43 @@ -721,6 +725,14 @@ ../src/app/frontend/common/components/resourcelist/role/template.html 44 + + ../src/app/frontend/common/components/resourcelist/rolebinding/template.html + 44 + + + ../src/app/frontend/common/components/subject/template.html + 38 + ../src/app/frontend/resource/workloads/deployment/detail/template.html 224 @@ -813,6 +825,14 @@ ../src/app/frontend/common/components/resourcelist/role/template.html 54 + + ../src/app/frontend/common/components/resourcelist/rolebinding/template.html + 54 + + + ../src/app/frontend/common/components/subject/template.html + 50 + ../src/app/frontend/resource/workloads/deployment/detail/template.html 232 @@ -1210,6 +1230,340 @@ 21 + + Role Bindings + Role Bindings + + ../src/app/frontend/common/components/resourcelist/rolebinding/template.html + 21 + + + + Subjects + Subjects + + ../src/app/frontend/common/components/subject/template.html + 20 + + + + API Group + API Group + + ../src/app/frontend/common/components/subject/template.html + 65 + + + + Workloads + + Workloads + + + ../src/app/frontend/chrome/nav/template.html + 27 + + + + Cron Jobs + + Cron Jobs + + + ../src/app/frontend/chrome/nav/template.html + 32 + + + + Daemon Sets + + Daemon Sets + + + ../src/app/frontend/chrome/nav/template.html + 37 + + + + Deployments + + Deployments + + + ../src/app/frontend/chrome/nav/template.html + 42 + + + + Jobs + + Jobs + + + ../src/app/frontend/chrome/nav/template.html + 47 + + + + Pods + + Pods + + + ../src/app/frontend/chrome/nav/template.html + 52 + + + + Replica Sets + + Replica Sets + + + ../src/app/frontend/chrome/nav/template.html + 57 + + + + Replication Controllers + + Replication Controllers + + + ../src/app/frontend/chrome/nav/template.html + 62 + + + + Stateful Sets + + Stateful Sets + + + ../src/app/frontend/chrome/nav/template.html + 67 + + + + Service + + Service + + + ../src/app/frontend/chrome/nav/template.html + 75 + + + + Ingresses + + Ingresses + + + ../src/app/frontend/chrome/nav/template.html + 80 + + + + Services + + Services + + + ../src/app/frontend/chrome/nav/template.html + 85 + + + + Config and Storage + + Config and Storage + + + ../src/app/frontend/chrome/nav/template.html + 92 + + + + Config Maps + + Config Maps + + + ../src/app/frontend/chrome/nav/template.html + 99 + + + + Persistent Volume Claims + + Persistent Volume Claims + + + ../src/app/frontend/chrome/nav/template.html + 105 + + + + Secrets + + Secrets + + + ../src/app/frontend/chrome/nav/template.html + 111 + + + + Storage Classes + + Storage Classes + + + ../src/app/frontend/chrome/nav/template.html + 116 + + + + Cluster + + Cluster + + + ../src/app/frontend/chrome/nav/template.html + 123 + + + + Cluster Role Bindings + + Cluster Role Bindings + + + ../src/app/frontend/chrome/nav/template.html + 128 + + + + Cluster Roles + + Cluster Roles + + + ../src/app/frontend/chrome/nav/template.html + 133 + + + + Namespaces + + Namespaces + + + ../src/app/frontend/chrome/nav/template.html + 138 + + + + Network Policies + + Network Policies + + + ../src/app/frontend/chrome/nav/template.html + 144 + + + + Nodes + + Nodes + + + ../src/app/frontend/chrome/nav/template.html + 149 + + + + Persistent Volumes + + Persistent Volumes + + + ../src/app/frontend/chrome/nav/template.html + 154 + + + + Role Bindings + + Role Bindings + + + ../src/app/frontend/chrome/nav/template.html + 160 + + + + Roles + + Roles + + + ../src/app/frontend/chrome/nav/template.html + 166 + + + + Service Accounts + + Service Accounts + + + ../src/app/frontend/chrome/nav/template.html + 172 + + + + Custom Resource Definitions + + Custom Resource Definitions + + + ../src/app/frontend/chrome/nav/template.html + 180 + + + + Plugins + + Plugins + + + ../src/app/frontend/chrome/nav/template.html + 191 + + + + Settings + + Settings + + + ../src/app/frontend/chrome/nav/template.html + 200 + + + + About + + About + + + ../src/app/frontend/chrome/nav/template.html + 206 + + Resource Quotas Ressourcen-Quotas @@ -1393,6 +1747,10 @@ ../src/app/frontend/common/components/resourcelist/clusterrole/template.html 23 + + ../src/app/frontend/common/components/resourcelist/clusterrolebinding/template.html + 23 + ../src/app/frontend/common/components/resourcelist/configmap/template.html 23 @@ -1513,6 +1871,14 @@ ../src/app/frontend/common/components/resourcelist/role/template.html 23 + + ../src/app/frontend/common/components/resourcelist/rolebinding/template.html + 23 + + + ../src/app/frontend/common/components/subject/template.html + 26 + Host @@ -1846,6 +2212,14 @@ 21 + + Cluster Role Bindings + Cluster Role Bindings + + ../src/app/frontend/common/components/resourcelist/clusterrolebinding/template.html + 21 + + Storage Classes Storage Classes @@ -1862,7 +2236,7 @@ 53 - ../src/app/frontend/resource/cluster/storageclass/detail/template.html + ../src/app/frontend/resource/config/storageclass/detail/template.html 29 @@ -1933,6 +2307,10 @@ ../src/app/frontend/common/components/resourcelist/clusterrole/template.html 55 + + ../src/app/frontend/common/components/resourcelist/clusterrolebinding/template.html + 55 + ../src/app/frontend/common/components/resourcelist/configmap/template.html 71 @@ -2033,6 +2411,10 @@ ../src/app/frontend/common/components/resourcelist/role/template.html 62 + + ../src/app/frontend/common/components/resourcelist/rolebinding/template.html + 62 + Config Maps @@ -2097,6 +2479,10 @@ ../src/app/frontend/common/components/creator/template.html 58 + + ../src/app/frontend/common/components/subject/template.html + 59 + ../src/app/frontend/crd/detail/template.html 72 @@ -2778,52 +3164,6 @@ 37 - - Cluster - - Cluster - - ../src/app/frontend/chrome/nav/template.html - 25 - - - - Cluster Roles - - Cluster Roles - - ../src/app/frontend/chrome/nav/template.html - 30 - - - - Namespaces - - Namespaces - - ../src/app/frontend/chrome/nav/template.html - 35 - - - - Network Policies - - Netzwerkregeln - - - ../src/app/frontend/chrome/nav/template.html - 41 - - - - Nodes - - Nodes - - ../src/app/frontend/chrome/nav/template.html - 46 - - Nodes Nodes @@ -2832,232 +3172,6 @@ 24 - - Persistent Volumes - - Persistent Volumes - - ../src/app/frontend/chrome/nav/template.html - 51 - - - - Roles - - Rollen - - - ../src/app/frontend/chrome/nav/template.html - 57 - - - - Storage Classes - - Storage Classes - - ../src/app/frontend/chrome/nav/template.html - 68 - - - - Workloads - - Workloads - - ../src/app/frontend/chrome/nav/template.html - 77 - - - - Cron Jobs - - Cron Jobs - - - ../src/app/frontend/chrome/nav/template.html - 82 - - - - Daemon Sets - - Daemon Sets - - - ../src/app/frontend/chrome/nav/template.html - 87 - - - - Deployments - - Deployments - - - ../src/app/frontend/chrome/nav/template.html - 92 - - - - Jobs - - Jobs - - - ../src/app/frontend/chrome/nav/template.html - 97 - - - - Stateful Sets - - Stateful Sets - - - ../src/app/frontend/chrome/nav/template.html - 117 - - - - Service - - Service - - - ../src/app/frontend/chrome/nav/template.html - 124 - - - - Pods - - Pods - - ../src/app/frontend/chrome/nav/template.html - 102 - - - - Replica Sets - - Replica Sets - - ../src/app/frontend/chrome/nav/template.html - 107 - - - - Replication Controllers - - Replication Controllers - - ../src/app/frontend/chrome/nav/template.html - 112 - - - - Ingresses - - Ingresses - - ../src/app/frontend/chrome/nav/template.html - 129 - - - - Services - - Services - - ../src/app/frontend/chrome/nav/template.html - 134 - - - - Config and Storage - - Konfiguration und Storage - - ../src/app/frontend/chrome/nav/template.html - 141 - - - - Config Maps - - Config Maps - - ../src/app/frontend/chrome/nav/template.html - 146 - - - - Persistent Volume Claims - - Persistent Volume Claims - - ../src/app/frontend/chrome/nav/template.html - 151 - - - - Secrets - - Secrets - - ../src/app/frontend/chrome/nav/template.html - 156 - - - - Service Accounts - - Service Accounts - - - ../src/app/frontend/chrome/nav/template.html - 63 - - - - Custom Resource Definitions - - Custom Resource Definitions - - - ../src/app/frontend/chrome/nav/template.html - 165 - - - - Plugins - - Plugins - - - ../src/app/frontend/chrome/nav/template.html - 178 - - - - Settings - - Einstellungen - - ../src/app/frontend/chrome/nav/template.html - 189 - - - - About - - Über - - ../src/app/frontend/chrome/nav/template.html - 195 - - Search Suchen @@ -3136,16 +3250,28 @@ 42 - - + + - + ../src/app/frontend/chrome/nav/pinner/template.html 22 + + Role Reference + Role Reference + + ../src/app/frontend/resource/cluster/clusterrolebinding/detail/template.html + 28 + + + ../src/app/frontend/resource/cluster/rolebinding/detail/template.html + 28 + + Kubernetes Dashboard Kubernetes Dashboard @@ -4078,10 +4204,18 @@ Service Service + + ../src/app/frontend/overview/template.html + 46 + ../src/app/frontend/create/from/form/portmappings/template.html 25 + + ../src/app/frontend/search/template.html + 42 + Port @@ -4686,7 +4820,7 @@ Parameter Parameter - ../src/app/frontend/resource/cluster/storageclass/detail/template.html + ../src/app/frontend/resource/config/storageclass/detail/template.html 37 diff --git a/i18n/messages.xlf b/i18n/messages.xlf index f0dc75db1..03f9a818c 100644 --- a/i18n/messages.xlf +++ b/i18n/messages.xlf @@ -425,11 +425,11 @@ 24 - ../src/app/frontend/resource/workloads/replicationcontroller/detail/template.html + ../src/app/frontend/resource/workloads/replicaset/detail/template.html 22 - ../src/app/frontend/resource/workloads/replicaset/detail/template.html + ../src/app/frontend/resource/workloads/replicationcontroller/detail/template.html 22 @@ -600,27 +600,46 @@ 101 - - Label Selector + + Pods:  - ../src/app/frontend/resource/workloads/replicationcontroller/detail/template.html - 30 + ../src/app/frontend/resource/workloads/replicaset/detail/template.html + 28 - ../src/app/frontend/resource/workloads/statefulset/detail/template.html + ../src/app/frontend/resource/workloads/deployment/detail/template.html + 214 + + + + Selector + + ../src/app/frontend/resource/workloads/replicaset/detail/template.html + 38 + + + ../src/app/frontend/resource/workloads/daemonset/detail/template.html 30 + + ../src/app/frontend/resource/workloads/deployment/detail/template.html + 71 + + + ../src/app/frontend/resource/discovery/service/detail/template.html + 44 + Images - - ../src/app/frontend/resource/workloads/replicationcontroller/detail/template.html - 39 - ../src/app/frontend/resource/workloads/replicaset/detail/template.html 47 + + ../src/app/frontend/resource/workloads/replicationcontroller/detail/template.html + 39 + ../src/app/frontend/common/components/creator/template.html 90 @@ -668,14 +687,14 @@ Init images - - ../src/app/frontend/resource/workloads/replicationcontroller/detail/template.html - 48 - ../src/app/frontend/resource/workloads/replicaset/detail/template.html 56 + + ../src/app/frontend/resource/workloads/replicationcontroller/detail/template.html + 48 + ../src/app/frontend/resource/workloads/daemonset/detail/template.html 48 @@ -693,34 +712,15 @@ 48 - - Pods:  - - ../src/app/frontend/resource/workloads/replicaset/detail/template.html - 28 - - - ../src/app/frontend/resource/workloads/deployment/detail/template.html - 214 - - - - Selector - - ../src/app/frontend/resource/workloads/replicaset/detail/template.html - 38 - + + Label Selector - ../src/app/frontend/resource/workloads/daemonset/detail/template.html + ../src/app/frontend/resource/workloads/replicationcontroller/detail/template.html 30 - ../src/app/frontend/resource/workloads/deployment/detail/template.html - 71 - - - ../src/app/frontend/resource/discovery/service/detail/template.html - 44 + ../src/app/frontend/resource/workloads/statefulset/detail/template.html + 30 diff --git a/package.json b/package.json index cb0fece8f..30859b89f 100644 --- a/package.json +++ b/package.json @@ -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": [ { diff --git a/src/app/frontend/chrome/component.ts b/src/app/frontend/chrome/component.ts index ff7853b45..053be1c9b 100644 --- a/src/app/frontend/chrome/component.ts +++ b/src/app/frontend/chrome/component.ts @@ -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; } diff --git a/src/app/frontend/chrome/nav/item/component.ts b/src/app/frontend/chrome/nav/item/component.ts index d1348c24f..27f16b812 100644 --- a/src/app/frontend/chrome/nav/item/component.ts +++ b/src/app/frontend/chrome/nav/item/component.ts @@ -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_)) diff --git a/src/app/frontend/chrome/search/component.ts b/src/app/frontend/chrome/search/component.ts index 5689fa194..ed391eceb 100644 --- a/src/app/frontend/chrome/search/component.ts +++ b/src/app/frontend/chrome/search/component.ts @@ -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 { diff --git a/src/app/frontend/common/components/actionbar/detailactions/delete/component.ts b/src/app/frontend/common/components/actionbar/detailactions/delete/component.ts index c088c6cbc..3414235ad 100644 --- a/src/app/frontend/common/components/actionbar/detailactions/delete/component.ts +++ b/src/app/frontend/common/components/actionbar/detailactions/delete/component.ts @@ -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 { diff --git a/src/app/frontend/common/components/actionbar/detailactions/edit/component.ts b/src/app/frontend/common/components/actionbar/detailactions/edit/component.ts index 64dacddbf..c92f90e57 100644 --- a/src/app/frontend/common/components/actionbar/detailactions/edit/component.ts +++ b/src/app/frontend/common/components/actionbar/detailactions/edit/component.ts @@ -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'; diff --git a/src/app/frontend/common/components/actionbar/detailactions/logs/component.ts b/src/app/frontend/common/components/actionbar/detailactions/logs/component.ts index a096eb836..493029fe3 100644 --- a/src/app/frontend/common/components/actionbar/detailactions/logs/component.ts +++ b/src/app/frontend/common/components/actionbar/detailactions/logs/component.ts @@ -31,7 +31,7 @@ export class ActionbarDetailLogsComponent { 'log', this.resourceMeta.objectMeta.name, this.resourceMeta.objectMeta.namespace, - this.resourceMeta.typeMeta.kind, + this.resourceMeta.typeMeta.kind ); } } diff --git a/src/app/frontend/common/components/actionbar/detailactions/pin/component.ts b/src/app/frontend/common/components/actionbar/detailactions/pin/component.ts index 8265c94ac..dd5477d15 100644 --- a/src/app/frontend/common/components/actionbar/detailactions/pin/component.ts +++ b/src/app/frontend/common/components/actionbar/detailactions/pin/component.ts @@ -37,7 +37,7 @@ export class ActionbarDetailPinComponent { this.objectMeta.name, this.objectMeta.namespace, this.displayName, - this.namespaced, + this.namespaced ); } } diff --git a/src/app/frontend/common/components/actionbar/detailactions/scale/component.ts b/src/app/frontend/common/components/actionbar/detailactions/scale/component.ts index c7871a62e..f056027af 100644 --- a/src/app/frontend/common/components/actionbar/detailactions/scale/component.ts +++ b/src/app/frontend/common/components/actionbar/detailactions/scale/component.ts @@ -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'; diff --git a/src/app/frontend/common/components/actionbar/detailactions/trigger/component.ts b/src/app/frontend/common/components/actionbar/detailactions/trigger/component.ts index 099978926..55f34a136 100644 --- a/src/app/frontend/common/components/actionbar/detailactions/trigger/component.ts +++ b/src/app/frontend/common/components/actionbar/detailactions/trigger/component.ts @@ -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'; diff --git a/src/app/frontend/common/components/actionbars/default/component.ts b/src/app/frontend/common/components/actionbars/default/component.ts index dee1334c5..ed8ab4f93 100644 --- a/src/app/frontend/common/components/actionbars/default/component.ts +++ b/src/app/frontend/common/components/actionbars/default/component.ts @@ -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(); + private unsubscribe_ = new Subject(); 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(); } } diff --git a/src/app/frontend/common/components/actionbars/logsdefault/component.ts b/src/app/frontend/common/components/actionbars/logsdefault/component.ts index 788e7da9d..2a54b98c1 100644 --- a/src/app/frontend/common/components/actionbars/logsdefault/component.ts +++ b/src/app/frontend/common/components/actionbars/logsdefault/component.ts @@ -26,22 +26,22 @@ export class LogsDefaultActionbar implements OnInit, OnDestroy { isVisible = false; resourceMeta: ResourceMeta; - private _unsubscribe = new Subject(); + private unsubscribe_ = new Subject(); 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(); } } diff --git a/src/app/frontend/common/components/actionbars/logsexecdefault/component.ts b/src/app/frontend/common/components/actionbars/logsexecdefault/component.ts index 89669a1be..ead814e35 100644 --- a/src/app/frontend/common/components/actionbars/logsexecdefault/component.ts +++ b/src/app/frontend/common/components/actionbars/logsexecdefault/component.ts @@ -26,22 +26,22 @@ export class LogsExecDefaultActionbar implements OnInit, OnDestroy { isVisible = false; resourceMeta: ResourceMeta; - private _unsubscribe = new Subject(); + private unsubscribe_ = new Subject(); 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(); } } diff --git a/src/app/frontend/common/components/actionbars/logsscaledefault/component.ts b/src/app/frontend/common/components/actionbars/logsscaledefault/component.ts index 619becabf..2a024c0ec 100644 --- a/src/app/frontend/common/components/actionbars/logsscaledefault/component.ts +++ b/src/app/frontend/common/components/actionbars/logsscaledefault/component.ts @@ -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(); + private unsubscribe_ = new Subject(); 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(); } } diff --git a/src/app/frontend/common/components/actionbars/pindefault/component.ts b/src/app/frontend/common/components/actionbars/pindefault/component.ts index ff00605f2..3c77ad32b 100644 --- a/src/app/frontend/common/components/actionbars/pindefault/component.ts +++ b/src/app/frontend/common/components/actionbars/pindefault/component.ts @@ -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(); + private unsubscribe_ = new Subject(); 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(); } } diff --git a/src/app/frontend/common/components/actionbars/scaledefault/component.ts b/src/app/frontend/common/components/actionbars/scaledefault/component.ts index f0abb7860..5de675de6 100644 --- a/src/app/frontend/common/components/actionbars/scaledefault/component.ts +++ b/src/app/frontend/common/components/actionbars/scaledefault/component.ts @@ -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(); + private unsubscribe_ = new Subject(); 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 { diff --git a/src/app/frontend/common/components/actionbars/triggerdefault/component.ts b/src/app/frontend/common/components/actionbars/triggerdefault/component.ts index 36a0cdd83..a115ddebd 100644 --- a/src/app/frontend/common/components/actionbars/triggerdefault/component.ts +++ b/src/app/frontend/common/components/actionbars/triggerdefault/component.ts @@ -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(); + private unsubscribe_ = new Subject(); 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(); } } diff --git a/src/app/frontend/common/components/breadcrumbs/component.ts b/src/app/frontend/common/components/breadcrumbs/component.ts index b78c4e24f..4c2c9f4cc 100644 --- a/src/app/frontend/common/components/breadcrumbs/component.ts +++ b/src/app/frontend/common/components/breadcrumbs/component.ts @@ -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(); diff --git a/src/app/frontend/common/components/chips/component.ts b/src/app/frontend/common/components/chips/component.ts index dcea7b87e..696718b1a 100644 --- a/src/app/frontend/common/components/chips/component.ts +++ b/src/app/frontend/common/components/chips/component.ts @@ -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 { diff --git a/src/app/frontend/common/components/creator/component.ts b/src/app/frontend/common/components/creator/component.ts index cfd01a7d1..256496917 100644 --- a/src/app/frontend/common/components/creator/component.ts +++ b/src/app/frontend/common/components/creator/component.ts @@ -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 ); } } diff --git a/src/app/frontend/common/components/date/component.ts b/src/app/frontend/common/components/date/component.ts index 456e340d0..9e06234c3 100644 --- a/src/app/frontend/common/components/date/component.ts +++ b/src/app/frontend/common/components/date/component.ts @@ -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 diff --git a/src/app/frontend/common/components/list/column/menu/component.ts b/src/app/frontend/common/components/list/column/menu/component.ts index 085076281..c04ba692a 100644 --- a/src/app/frontend/common/components/list/column/menu/component.ts +++ b/src/app/frontend/common/components/list/column/menu/component.ts @@ -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 ); } diff --git a/src/app/frontend/common/components/list/filter/component.ts b/src/app/frontend/common/components/list/filter/component.ts index b2594a2cf..debb2bff7 100644 --- a/src/app/frontend/common/components/list/filter/component.ts +++ b/src/app/frontend/common/components/list/filter/component.ts @@ -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'; diff --git a/src/app/frontend/common/components/namespace/changedialog/dialog.ts b/src/app/frontend/common/components/namespace/changedialog/dialog.ts index 3284c07e2..c292cca32 100644 --- a/src/app/frontend/common/components/namespace/changedialog/dialog.ts +++ b/src/app/frontend/common/components/namespace/changedialog/dialog.ts @@ -25,7 +25,7 @@ export class NamespaceChangeDialog { constructor( public dialogRef: MatDialogRef, - @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; diff --git a/src/app/frontend/common/components/namespace/component.ts b/src/app/frontend/common/components/namespace/component.ts index d91ad40a9..8ab07b5f0 100644 --- a/src/app/frontend/common/components/namespace/component.ts +++ b/src/app/frontend/common/components/namespace/component.ts @@ -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_(); - }, + } ); } diff --git a/src/app/frontend/common/components/resourcelist/clusterrole/component.ts b/src/app/frontend/common/components/resourcelist/clusterrole/component.ts index 6003f2d12..89f077d4c 100644 --- a/src/app/frontend/common/components/resourcelist/clusterrole/component.ts +++ b/src/app/frontend/common/components/resourcelist/clusterrole/component.ts @@ -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, notifications: NotificationsService, - cdr: ChangeDetectorRef, + cdr: ChangeDetectorRef ) { super('clusterrole', notifications, cdr); this.id = ListIdentifier.clusterRole; diff --git a/src/app/frontend/common/components/resourcelist/clusterrolebinding/component.ts b/src/app/frontend/common/components/resourcelist/clusterrolebinding/component.ts index 9a025f535..e4ebcc0d5 100644 --- a/src/app/frontend/common/components/resourcelist/clusterrolebinding/component.ts +++ b/src/app/frontend/common/components/resourcelist/clusterrolebinding/component.ts @@ -35,7 +35,7 @@ export class ClusterRoleBindingListComponent extends ResourceListBase, notifications: NotificationsService, - cdr: ChangeDetectorRef, + cdr: ChangeDetectorRef ) { super('clusterrolebinding', notifications, cdr); this.id = ListIdentifier.clusterRoleBinding; diff --git a/src/app/frontend/common/components/resourcelist/configmap/component.ts b/src/app/frontend/common/components/resourcelist/configmap/component.ts index b48373c08..4fcd300dc 100644 --- a/src/app/frontend/common/components/resourcelist/configmap/component.ts +++ b/src/app/frontend/common/components/resourcelist/configmap/component.ts @@ -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, notifications: NotificationsService, - cdr: ChangeDetectorRef, + cdr: ChangeDetectorRef ) { super('configmap', notifications, cdr); this.id = ListIdentifier.configMap; diff --git a/src/app/frontend/common/components/resourcelist/crd/component.ts b/src/app/frontend/common/components/resourcelist/crd/component.ts index d2daa88e0..329076109 100644 --- a/src/app/frontend/common/components/resourcelist/crd/component.ts +++ b/src/app/frontend/common/components/resourcelist/crd/component.ts @@ -35,7 +35,7 @@ export class CRDListComponent extends ResourceListWithStatuses { constructor( private readonly crd_: ResourceService, notifications: NotificationsService, - cdr: ChangeDetectorRef, + cdr: ChangeDetectorRef ) { super(Resource.crdFull, notifications, cdr); this.id = ListIdentifier.crd; diff --git a/src/app/frontend/common/components/resourcelist/crdobject/component.ts b/src/app/frontend/common/components/resourcelist/crdobject/component.ts index b2f138586..b56791a32 100644 --- a/src/app/frontend/common/components/resourcelist/crdobject/component.ts +++ b/src/app/frontend/common/components/resourcelist/crdobject/component.ts @@ -38,7 +38,7 @@ export class CRDObjectListComponent extends ResourceListBase, 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; diff --git a/src/app/frontend/common/components/resourcelist/cronjob/component.ts b/src/app/frontend/common/components/resourcelist/cronjob/component.ts index 1a02f91de..fd881c24b 100644 --- a/src/app/frontend/common/components/resourcelist/cronjob/component.ts +++ b/src/app/frontend/common/components/resourcelist/cronjob/component.ts @@ -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, notifications: NotificationsService, - cdr: ChangeDetectorRef, + cdr: ChangeDetectorRef ) { super('cronjob', notifications, cdr); this.id = ListIdentifier.cronJob; diff --git a/src/app/frontend/common/components/resourcelist/daemonset/component.ts b/src/app/frontend/common/components/resourcelist/daemonset/component.ts index 93d6f826f..5cb73445e 100644 --- a/src/app/frontend/common/components/resourcelist/daemonset/component.ts +++ b/src/app/frontend/common/components/resourcelist/daemonset/component.ts @@ -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, notifications: NotificationsService, - cdr: ChangeDetectorRef, + cdr: ChangeDetectorRef ) { super('daemonset', notifications, cdr); this.id = ListIdentifier.daemonSet; diff --git a/src/app/frontend/common/components/resourcelist/deployment/component.ts b/src/app/frontend/common/components/resourcelist/deployment/component.ts index 7c90f624a..05ef65e45 100644 --- a/src/app/frontend/common/components/resourcelist/deployment/component.ts +++ b/src/app/frontend/common/components/resourcelist/deployment/component.ts @@ -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, notifications: NotificationsService, - cdr: ChangeDetectorRef, + cdr: ChangeDetectorRef ) { super('deployment', notifications, cdr); this.id = ListIdentifier.deployment; diff --git a/src/app/frontend/common/components/resourcelist/event/component.ts b/src/app/frontend/common/components/resourcelist/event/component.ts index 366786b1e..927291cbe 100644 --- a/src/app/frontend/common/components/resourcelist/event/component.ts +++ b/src/app/frontend/common/components/resourcelist/event/component.ts @@ -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, notifications: NotificationsService, - cdr: ChangeDetectorRef, + cdr: ChangeDetectorRef ) { super('', notifications, cdr); this.id = ListIdentifier.event; diff --git a/src/app/frontend/common/components/resourcelist/horizontalpodautoscaler/component.ts b/src/app/frontend/common/components/resourcelist/horizontalpodautoscaler/component.ts index 87193d4a0..d73de1b3c 100644 --- a/src/app/frontend/common/components/resourcelist/horizontalpodautoscaler/component.ts +++ b/src/app/frontend/common/components/resourcelist/horizontalpodautoscaler/component.ts @@ -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, notifications: NotificationsService, - cdr: ChangeDetectorRef, + cdr: ChangeDetectorRef ) { super('horizontalpodautoscaler', notifications, cdr); this.id = ListIdentifier.horizontalpodautoscaler; diff --git a/src/app/frontend/common/components/resourcelist/ingress/component.ts b/src/app/frontend/common/components/resourcelist/ingress/component.ts index 18bcfdbb2..2bf1b3cb4 100644 --- a/src/app/frontend/common/components/resourcelist/ingress/component.ts +++ b/src/app/frontend/common/components/resourcelist/ingress/component.ts @@ -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 constructor( private readonly ingress_: NamespacedResourceService, notifications: NotificationsService, - cdr: ChangeDetectorRef, + cdr: ChangeDetectorRef ) { super('ingress', notifications, cdr); this.id = ListIdentifier.ingress; diff --git a/src/app/frontend/common/components/resourcelist/job/component.ts b/src/app/frontend/common/components/resourcelist/job/component.ts index c5fd43cc9..fb2be23d5 100644 --- a/src/app/frontend/common/components/resourcelist/job/component.ts +++ b/src/app/frontend/common/components/resourcelist/job/component.ts @@ -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 { constructor( private readonly job_: NamespacedResourceService, notifications: NotificationsService, - cdr: ChangeDetectorRef, + cdr: ChangeDetectorRef ) { super('job', notifications, cdr); this.id = ListIdentifier.job; diff --git a/src/app/frontend/common/components/resourcelist/namespace/component.ts b/src/app/frontend/common/components/resourcelist/namespace/component.ts index f325c3a65..73f5971de 100644 --- a/src/app/frontend/common/components/resourcelist/namespace/component.ts +++ b/src/app/frontend/common/components/resourcelist/namespace/component.ts @@ -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, notifications: NotificationsService, - cdr: ChangeDetectorRef, + cdr: ChangeDetectorRef ) { super('namespace', notifications, cdr); this.id = ListIdentifier.namespace; diff --git a/src/app/frontend/common/components/resourcelist/networkpolicy/component.ts b/src/app/frontend/common/components/resourcelist/networkpolicy/component.ts index 24d569ad5..afd61e958 100644 --- a/src/app/frontend/common/components/resourcelist/networkpolicy/component.ts +++ b/src/app/frontend/common/components/resourcelist/networkpolicy/component.ts @@ -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, notifications: NotificationsService, - cdr: ChangeDetectorRef, + cdr: ChangeDetectorRef ) { super('networkpolicy', notifications, cdr); this.id = ListIdentifier.networkPolicy; diff --git a/src/app/frontend/common/components/resourcelist/node/component.ts b/src/app/frontend/common/components/resourcelist/node/component.ts index 8b9414ea8..c4e08708a 100644 --- a/src/app/frontend/common/components/resourcelist/node/component.ts +++ b/src/app/frontend/common/components/resourcelist/node/component.ts @@ -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 constructor( private readonly node_: ResourceService, notifications: NotificationsService, - cdr: ChangeDetectorRef, + cdr: ChangeDetectorRef ) { super('node', notifications, cdr); this.id = ListIdentifier.node; diff --git a/src/app/frontend/common/components/resourcelist/persistentvolume/component.ts b/src/app/frontend/common/components/resourcelist/persistentvolume/component.ts index e31b7e4c3..f3c878b22 100644 --- a/src/app/frontend/common/components/resourcelist/persistentvolume/component.ts +++ b/src/app/frontend/common/components/resourcelist/persistentvolume/component.ts @@ -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, notifications: NotificationsService, - cdr: ChangeDetectorRef, + cdr: ChangeDetectorRef ) { super('persistentvolume', notifications, cdr); this.id = ListIdentifier.persistentVolume; diff --git a/src/app/frontend/common/components/resourcelist/persistentvolumeclaim/component.ts b/src/app/frontend/common/components/resourcelist/persistentvolumeclaim/component.ts index bc5f4024d..82dc19e5d 100644 --- a/src/app/frontend/common/components/resourcelist/persistentvolumeclaim/component.ts +++ b/src/app/frontend/common/components/resourcelist/persistentvolumeclaim/component.ts @@ -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, notifications: NotificationsService, - cdr: ChangeDetectorRef, + cdr: ChangeDetectorRef ) { super('persistentvolumeclaim', notifications, cdr); this.id = ListIdentifier.persistentVolumeClaim; diff --git a/src/app/frontend/common/components/resourcelist/plugin/component.ts b/src/app/frontend/common/components/resourcelist/plugin/component.ts index 8a9a791e3..fb26d2639 100644 --- a/src/app/frontend/common/components/resourcelist/plugin/component.ts +++ b/src/app/frontend/common/components/resourcelist/plugin/component.ts @@ -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 { constructor( private readonly plugin_: NamespacedResourceService, notifications: NotificationsService, - cdr: ChangeDetectorRef, + cdr: ChangeDetectorRef ) { super('plugin', notifications, cdr); this.id = ListIdentifier.plugin; diff --git a/src/app/frontend/common/components/resourcelist/pod/component.ts b/src/app/frontend/common/components/resourcelist/pod/component.ts index 448a36d68..dbad0b837 100644 --- a/src/app/frontend/common/components/resourcelist/pod/component.ts +++ b/src/app/frontend/common/components/resourcelist/pod/component.ts @@ -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 { constructor( private readonly podList: NamespacedResourceService, notifications: NotificationsService, - cdr: ChangeDetectorRef, + cdr: ChangeDetectorRef ) { super('pod', notifications, cdr); this.id = ListIdentifier.pod; diff --git a/src/app/frontend/common/components/resourcelist/replicaset/component.ts b/src/app/frontend/common/components/resourcelist/replicaset/component.ts index e41a50894..285a454e5 100644 --- a/src/app/frontend/common/components/resourcelist/replicaset/component.ts +++ b/src/app/frontend/common/components/resourcelist/replicaset/component.ts @@ -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, private readonly activatedRoute_: ActivatedRoute, notifications: NotificationsService, - cdr: ChangeDetectorRef, + cdr: ChangeDetectorRef ) { super('replicaset', notifications, cdr); this.id = ListIdentifier.replicaSet; diff --git a/src/app/frontend/common/components/resourcelist/replicationcontroller/component.ts b/src/app/frontend/common/components/resourcelist/replicationcontroller/component.ts index a4fdedc3f..bf7391500 100644 --- a/src/app/frontend/common/components/resourcelist/replicationcontroller/component.ts +++ b/src/app/frontend/common/components/resourcelist/replicationcontroller/component.ts @@ -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, notifications: NotificationsService, - cdr: ChangeDetectorRef, + cdr: ChangeDetectorRef ) { super('replicationcontroller', notifications, cdr); this.id = ListIdentifier.replicationController; diff --git a/src/app/frontend/common/components/resourcelist/role/component.ts b/src/app/frontend/common/components/resourcelist/role/component.ts index 31380a65e..4004a51f1 100644 --- a/src/app/frontend/common/components/resourcelist/role/component.ts +++ b/src/app/frontend/common/components/resourcelist/role/component.ts @@ -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 { constructor( private readonly role_: NamespacedResourceService, notifications: NotificationsService, - cdr: ChangeDetectorRef, + cdr: ChangeDetectorRef ) { super('role', notifications, cdr); this.id = ListIdentifier.role; diff --git a/src/app/frontend/common/components/resourcelist/rolebinding/component.ts b/src/app/frontend/common/components/resourcelist/rolebinding/component.ts index 35e687a39..d7443656e 100644 --- a/src/app/frontend/common/components/resourcelist/rolebinding/component.ts +++ b/src/app/frontend/common/components/resourcelist/rolebinding/component.ts @@ -35,7 +35,7 @@ export class RoleBindingListComponent extends ResourceListBase, notifications: NotificationsService, - cdr: ChangeDetectorRef, + cdr: ChangeDetectorRef ) { super('rolebinding', notifications, cdr); this.id = ListIdentifier.roleBinding; diff --git a/src/app/frontend/common/components/resourcelist/secret/component.ts b/src/app/frontend/common/components/resourcelist/secret/component.ts index 1daca09d6..30b95a40d 100644 --- a/src/app/frontend/common/components/resourcelist/secret/component.ts +++ b/src/app/frontend/common/components/resourcelist/secret/component.ts @@ -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 { constructor( private readonly secret_: NamespacedResourceService, notifications: NotificationsService, - cdr: ChangeDetectorRef, + cdr: ChangeDetectorRef ) { super('secret', notifications, cdr); this.id = ListIdentifier.secret; diff --git a/src/app/frontend/common/components/resourcelist/service/component.ts b/src/app/frontend/common/components/resourcelist/service/component.ts index 5a60bb986..9aadaa72e 100644 --- a/src/app/frontend/common/components/resourcelist/service/component.ts +++ b/src/app/frontend/common/components/resourcelist/service/component.ts @@ -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, notifications: NotificationsService, - cdr: ChangeDetectorRef, + cdr: ChangeDetectorRef ) { super('service', notifications, cdr); this.id = ListIdentifier.service; diff --git a/src/app/frontend/common/components/resourcelist/serviceaccount/component.ts b/src/app/frontend/common/components/resourcelist/serviceaccount/component.ts index 20d00a13a..f02811aa6 100644 --- a/src/app/frontend/common/components/resourcelist/serviceaccount/component.ts +++ b/src/app/frontend/common/components/resourcelist/serviceaccount/component.ts @@ -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, notifications: NotificationsService, - cdr: ChangeDetectorRef, + cdr: ChangeDetectorRef ) { super('serviceaccount', notifications, cdr); this.id = ListIdentifier.serviceAccount; diff --git a/src/app/frontend/common/components/resourcelist/statefulset/component.ts b/src/app/frontend/common/components/resourcelist/statefulset/component.ts index e222e2c05..b06509b21 100644 --- a/src/app/frontend/common/components/resourcelist/statefulset/component.ts +++ b/src/app/frontend/common/components/resourcelist/statefulset/component.ts @@ -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, notifications: NotificationsService, - cdr: ChangeDetectorRef, + cdr: ChangeDetectorRef ) { super('statefulset', notifications, cdr); this.id = ListIdentifier.statefulSet; diff --git a/src/app/frontend/common/components/resourcelist/storageclass/component.ts b/src/app/frontend/common/components/resourcelist/storageclass/component.ts index 715ac4d11..a52e9405a 100644 --- a/src/app/frontend/common/components/resourcelist/storageclass/component.ts +++ b/src/app/frontend/common/components/resourcelist/storageclass/component.ts @@ -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, notifications: NotificationsService, - cdr: ChangeDetectorRef, + cdr: ChangeDetectorRef ) { super('storageclass', notifications, cdr); this.id = ListIdentifier.storageClass; diff --git a/src/app/frontend/common/components/workloadstatus/component.spec.ts b/src/app/frontend/common/components/workloadstatus/component.spec.ts index 8f47fd649..77f6cb1b4 100644 --- a/src/app/frontend/common/components/workloadstatus/component.spec.ts +++ b/src/app/frontend/common/components/workloadstatus/component.spec.ts @@ -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 => { diff --git a/src/app/frontend/common/dialogs/deleteresource/dialog.ts b/src/app/frontend/common/dialogs/deleteresource/dialog.ts index d85b4baf3..49e9d6a13 100644 --- a/src/app/frontend/common/dialogs/deleteresource/dialog.ts +++ b/src/app/frontend/common/dialogs/deleteresource/dialog.ts @@ -23,7 +23,7 @@ import {ResourceMeta} from '../../services/global/actionbar'; export class DeleteResourceDialog { constructor( public dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) public data: ResourceMeta, + @Inject(MAT_DIALOG_DATA) public data: ResourceMeta ) {} onNoClick(): void { diff --git a/src/app/frontend/common/dialogs/download/dialog.ts b/src/app/frontend/common/dialogs/download/dialog.ts index 8f9a3fd10..b51df1b3c 100644 --- a/src/app/frontend/common/dialogs/download/dialog.ts +++ b/src/app/frontend/common/dialogs/download/dialog.ts @@ -42,7 +42,7 @@ export class LogsDownloadDialog implements OnDestroy { public dialogRef: MatDialogRef, @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; - }, + } ); } diff --git a/src/app/frontend/common/dialogs/editresource/dialog.ts b/src/app/frontend/common/dialogs/editresource/dialog.ts index faa08b0f5..34c270723 100644 --- a/src/app/frontend/common/dialogs/editresource/dialog.ts +++ b/src/app/frontend/common/dialogs/editresource/dialog.ts @@ -36,7 +36,7 @@ export class EditResourceDialog implements OnInit { constructor( public dialogRef: MatDialogRef, @Inject(MAT_DIALOG_DATA) public data: ResourceMeta, - private readonly http_: HttpClient, + private readonly http_: HttpClient ) {} ngOnInit(): void { diff --git a/src/app/frontend/common/dialogs/scaleresource/dialog.ts b/src/app/frontend/common/dialogs/scaleresource/dialog.ts index 5d5b46278..2b83687dd 100644 --- a/src/app/frontend/common/dialogs/scaleresource/dialog.ts +++ b/src/app/frontend/common/dialogs/scaleresource/dialog.ts @@ -30,7 +30,7 @@ export class ScaleResourceDialog implements OnInit { constructor( public dialogRef: MatDialogRef, @Inject(MAT_DIALOG_DATA) public data: ResourceMeta, - private readonly http_: HttpClient, + private readonly http_: HttpClient ) {} ngOnInit(): void { diff --git a/src/app/frontend/common/dialogs/triggerresource/dialog.ts b/src/app/frontend/common/dialogs/triggerresource/dialog.ts index 93829b4f5..13502dfdb 100644 --- a/src/app/frontend/common/dialogs/triggerresource/dialog.ts +++ b/src/app/frontend/common/dialogs/triggerresource/dialog.ts @@ -23,7 +23,7 @@ import {ResourceMeta} from '../../services/global/actionbar'; export class TriggerResourceDialog { constructor( public dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) public data: ResourceMeta, + @Inject(MAT_DIALOG_DATA) public data: ResourceMeta ) {} onNoClick(): void { diff --git a/src/app/frontend/common/directives/autofocus/directive.ts b/src/app/frontend/common/directives/autofocus/directive.ts index f869f2213..52feaccad 100644 --- a/src/app/frontend/common/directives/autofocus/directive.ts +++ b/src/app/frontend/common/directives/autofocus/directive.ts @@ -21,7 +21,7 @@ import {takeUntil} from 'rxjs/operators'; export class AutofocusDirective implements AfterViewInit, OnDestroy { @Input() opened: Observable; - private readonly _unsubscribe = new Subject(); + private readonly unsubscribe_ = new Subject(); 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(); } } diff --git a/src/app/frontend/common/resources/groupedlist.ts b/src/app/frontend/common/resources/groupedlist.ts index 343ea11be..22ef5533a 100644 --- a/src/app/frontend/common/resources/groupedlist.ts +++ b/src/app/frontend/common/resources/groupedlist.ts @@ -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; } diff --git a/src/app/frontend/common/resources/list.ts b/src/app/frontend/common/resources/list.ts index 371eea973..91e80ddce 100644 --- a/src/app/frontend/common/resources/list.ts +++ b/src/app/frontend/common/resources/list.ts @@ -87,7 +87,7 @@ export abstract class ResourceListBase, 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 { diff --git a/src/app/frontend/common/services/global/assets.ts b/src/app/frontend/common/services/global/assets.ts index e9550ee97..45d9099ff 100644 --- a/src/app/frontend/common/services/global/assets.ts +++ b/src/app/frontend/common/services/global/assets.ts @@ -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`) ); } diff --git a/src/app/frontend/common/services/global/authentication.ts b/src/app/frontend/common/services/global/authentication.ts index b9458de23..2aaf8b9fa 100644 --- a/src/app/frontend/common/services/global/authentication.ts +++ b/src/app/frontend/common/services/global/authentication.ts @@ -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('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) => { diff --git a/src/app/frontend/common/services/global/authorizer.ts b/src/app/frontend/common/services/global/authorizer.ts index 7d3347bea..03e5cb0a4 100644 --- a/src/app/frontend/common/services/global/authorizer.ts +++ b/src/app/frontend/common/services/global/authorizer.ts @@ -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(url: string): Observable { return this.http_ .get(`${url}${this.authorizationSubUrl_}`) - .switchMap(response => { - if (!response.allowed) { - return Observable.throwError(ERRORS.forbidden); - } + .pipe( + switchMap(response => { + if (!response.allowed) { + return throwError(ERRORS.forbidden); + } - return this.http_.get(url); - }) - .catch(e => { - return Observable.throwError(e); - }); + return this.http_.get(url); + }) + ) + .pipe(catchError(e => throwError(e))); } } diff --git a/src/app/frontend/common/services/global/config.ts b/src/app/frontend/common/services/global/config.ts index 015df6279..0c513185d 100644 --- a/src/app/frontend/common/services/global/config.ts +++ b/src/app/frontend/common/services/global/config.ts @@ -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() diff --git a/src/app/frontend/common/services/global/csrftoken.ts b/src/app/frontend/common/services/global/csrftoken.ts index c8bb87fb2..5a24262a8 100644 --- a/src/app/frontend/common/services/global/csrftoken.ts +++ b/src/app/frontend/common/services/global/csrftoken.ts @@ -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 { diff --git a/src/app/frontend/common/services/global/globalsettings.ts b/src/app/frontend/common/services/global/globalsettings.ts index 28820d398..15c625adc 100644 --- a/src/app/frontend/common/services/global/globalsettings.ts +++ b/src/app/frontend/common/services/global/globalsettings.ts @@ -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); - }, + } ); } diff --git a/src/app/frontend/common/services/global/interceptor.ts b/src/app/frontend/common/services/global/interceptor.ts index a9ee02af1..6c39423f3 100644 --- a/src/app/frontend/common/services/global/interceptor.ts +++ b/src/app/frontend/common/services/global/interceptor.ts @@ -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 */ diff --git a/src/app/frontend/common/services/global/logs.ts b/src/app/frontend/common/services/global/logs.ts index 773b0fcf0..129cd18da 100644 --- a/src/app/frontend/common/services/global/logs.ts +++ b/src/app/frontend/common/services/global/logs.ts @@ -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 { diff --git a/src/app/frontend/common/services/global/module.ts b/src/app/frontend/common/services/global/module.ts index e31486e52..5148e76e2 100644 --- a/src/app/frontend/common/services/global/module.ts +++ b/src/app/frontend/common/services/global/module.ts @@ -93,7 +93,7 @@ export function init( pinner: PinnerService, config: ConfigService, history: HistoryService, - pluginsConfig: PluginsConfigService, + pluginsConfig: PluginsConfigService ): Function { return () => { globalSettings.init(); diff --git a/src/app/frontend/common/services/global/params.ts b/src/app/frontend/common/services/global/params.ts index 074732705..7f879e4dc 100644 --- a/src/app/frontend/common/services/global/params.ts +++ b/src/app/frontend/common/services/global/params.ts @@ -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) { diff --git a/src/app/frontend/common/services/global/pinner.ts b/src/app/frontend/common/services/global/pinner.ts index a0e29958a..5700f446e 100644 --- a/src/app/frontend/common/services/global/pinner.ts +++ b/src/app/frontend/common/services/global/pinner.ts @@ -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 { diff --git a/src/app/frontend/common/services/global/plugin.ts b/src/app/frontend/common/services/global/plugin.ts index 94465c782..c5e16dd99 100644 --- a/src/app/frontend/common/services/global/plugin.ts +++ b/src/app/frontend/common/services/global/plugin.ts @@ -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 { diff --git a/src/app/frontend/common/services/global/title.ts b/src/app/frontend/common/services/global/title.ts index 74b96c1b2..56d80375a 100644 --- a/src/app/frontend/common/services/global/title.ts +++ b/src/app/frontend/common/services/global/title.ts @@ -32,7 +32,7 @@ export class TitleService { () => { this.clusterName = ''; this.apply_(); - }, + } ); } diff --git a/src/app/frontend/common/services/global/verber.ts b/src/app/frontend/common/services/global/verber.ts index 748a044d6..89c2388f4 100644 --- a/src/app/frontend/common/services/global/verber.ts +++ b/src/app/frontend/common/services/global/verber.ts @@ -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 { diff --git a/src/app/frontend/common/services/guard/auth.ts b/src/app/frontend/common/services/guard/auth.ts index e5d28a3bd..3bd6e5331 100644 --- a/src/app/frontend/common/services/guard/auth.ts +++ b/src/app/frontend/common/services/guard/auth.ts @@ -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']))); } } diff --git a/src/app/frontend/common/services/guard/login.ts b/src/app/frontend/common/services/guard/login.ts index 510aaf935..8e03cb4f8 100644 --- a/src/app/frontend/common/services/guard/login.ts +++ b/src/app/frontend/common/services/guard/login.ts @@ -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']))); } } diff --git a/src/app/frontend/common/services/guard/search.ts b/src/app/frontend/common/services/guard/search.ts index b0d66eee2..7f45827ae 100644 --- a/src/app/frontend/common/services/guard/search.ts +++ b/src/app/frontend/common/services/guard/search.ts @@ -28,7 +28,7 @@ export class SearchGuard implements CanDeactivate { _cmp: SearchComponent, _route: ActivatedRouteSnapshot, _routeSnapshot: RouterStateSnapshot, - nextState?: RouterStateSnapshot, + nextState?: RouterStateSnapshot ): boolean | UrlTree { let url = nextState.url; const queryParams = this.getQueryParams_(url); diff --git a/src/app/frontend/common/services/pluginloader/clientloader.service.ts b/src/app/frontend/common/services/pluginloader/clientloader.service.ts index 398467ac2..9be19fbbb 100644 --- a/src/app/frontend/common/services/pluginloader/clientloader.service.ts +++ b/src/app/frontend/common/services/pluginloader/clientloader.service.ts @@ -31,7 +31,7 @@ export class ClientPluginLoaderService extends PluginLoaderService { window.define(externalKey, [], () => { // @ts-ignore return PLUGIN_EXTERNALS_MAP[externalKey]; - }), + }) ); } diff --git a/src/app/frontend/common/services/resource/resource.ts b/src/app/frontend/common/services/resource/resource.ts index a902b44d3..818cd7324 100644 --- a/src/app/frontend/common/services/resource/resource.ts +++ b/src/app/frontend/common/services/resource/resource.ts @@ -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 extends ResourceBase { let interval = this.settings_.getResourceAutoRefreshTimeInterval(); interval = interval === 0 ? undefined : interval * 1000; return timer(0, interval); - }), + }) ) .pipe( switchMapTo( - this.http_.get(endpoint, {params}), - ), + this.http_.get(endpoint, {params}) + ) ) .pipe(publishReplay(1)) .pipe(refCount()); @@ -60,7 +60,7 @@ export class NamespacedResourceService extends ResourceBase { 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 extends ResourceBase { let interval = this.settings_.getResourceAutoRefreshTimeInterval(); interval = interval === 0 ? undefined : interval * 1000; return timer(0, interval); - }), + }) ) .pipe( switchMapTo( - this.http_.get(endpoint, {params}), - ), + this.http_.get(endpoint, {params}) + ) ) .pipe(publishReplay(1)) .pipe(refCount()); diff --git a/src/app/frontend/crd/crdobject/component.ts b/src/app/frontend/crd/crdobject/component.ts index 03aae0fbb..cbb8de482 100644 --- a/src/app/frontend/crd/crdobject/component.ts +++ b/src/app/frontend/crd/crdobject/component.ts @@ -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 { diff --git a/src/app/frontend/crd/detail/component.ts b/src/app/frontend/crd/detail/component.ts index 3bf45d765..ca0e1d334 100644 --- a/src/app/frontend/crd/detail/component.ts +++ b/src/app/frontend/crd/detail/component.ts @@ -36,7 +36,7 @@ export class CRDDetailComponent implements OnInit, OnDestroy { private readonly crd_: ResourceService, private readonly actionbar_: ActionbarService, private readonly activatedRoute_: ActivatedRoute, - private readonly notifications_: NotificationsService, + private readonly notifications_: NotificationsService ) {} ngOnInit(): void { diff --git a/src/app/frontend/create/from/file/component.ts b/src/app/frontend/create/from/file/component.ts index 017bc8aaa..2ba442f44 100644 --- a/src/app/frontend/create/from/file/component.ts +++ b/src/app/frontend/create/from/file/component.ts @@ -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 { diff --git a/src/app/frontend/create/from/form/component.ts b/src/app/frontend/create/from/form/component.ts index c60935b09..c7dd5c169 100644 --- a/src/app/frontend/create/from/form/component.ts +++ b/src/app/frontend/create/from/form/component.ts @@ -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 diff --git a/src/app/frontend/create/from/form/createnamespace/dialog.ts b/src/app/frontend/create/from/form/createnamespace/dialog.ts index d416a6c05..f8fc4f37b 100644 --- a/src/app/frontend/create/from/form/createnamespace/dialog.ts +++ b/src/app/frontend/create/from/form/createnamespace/dialog.ts @@ -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}); + } + ); } /** diff --git a/src/app/frontend/create/from/form/createsecret/dialog.ts b/src/app/frontend/create/from/form/createsecret/dialog.ts index 9e93bb2cb..866642b4b 100644 --- a/src/app/frontend/create/from/form/createsecret/dialog.ts +++ b/src/app/frontend/create/from/form/createsecret/dialog.ts @@ -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}); + } + ); } /** diff --git a/src/app/frontend/create/from/form/deploylabel/component.ts b/src/app/frontend/create/from/form/deploylabel/component.ts index 175829850..626c4bb63 100644 --- a/src/app/frontend/create/from/form/deploylabel/component.ts +++ b/src/app/frontend/create/from/form/deploylabel/component.ts @@ -93,7 +93,7 @@ export class DeployLabelComponent implements ControlValueAccessor { Validators.compose([Validators.maxLength(253), FormValidators.labelValuePattern]), ], editable, - }), + }) ); } diff --git a/src/app/frontend/create/from/form/portmappings/component.ts b/src/app/frontend/create/from/form/portmappings/component.ts index 0c1fb5c15..d1e59ee85 100644 --- a/src/app/frontend/create/from/form/portmappings/component.ts +++ b/src/app/frontend/create/from/form/portmappings/component.ts @@ -105,7 +105,7 @@ export class PortMappingsComponent implements OnInit, ControlValueAccessor { first(() => !this.portMappingForm.pending), map(() => { return this.portMappingForm.invalid ? {error: true} : null; - }), + }) ); } diff --git a/src/app/frontend/create/from/form/validator/uniquename.validator.ts b/src/app/frontend/create/from/form/validator/uniquename.validator.ts index 4dd39ad24..925585ee3 100644 --- a/src/app/frontend/create/from/form/validator/uniquename.validator.ts +++ b/src/app/frontend/create/from/form/validator/uniquename.validator.ts @@ -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)) ); }; } diff --git a/src/app/frontend/create/from/form/validator/validimagereference.validator.ts b/src/app/frontend/create/from/form/validator/validimagereference.validator.ts index 11c2de047..d5d807ad3 100644 --- a/src/app/frontend/create/from/form/validator/validimagereference.validator.ts +++ b/src/app/frontend/create/from/form/validator/validimagereference.validator.ts @@ -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)) ); } } diff --git a/src/app/frontend/create/from/form/validator/validprotocol.validator.ts b/src/app/frontend/create/from/form/validator/validprotocol.validator.ts index 02e3e0f47..ff60fb02d 100644 --- a/src/app/frontend/create/from/form/validator/validprotocol.validator.ts +++ b/src/app/frontend/create/from/form/validator/validprotocol.validator.ts @@ -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; - }), + }) ); }; } diff --git a/src/app/frontend/create/from/input/component.ts b/src/app/frontend/create/from/input/component.ts index d9e2071ba..f68bb5e40 100644 --- a/src/app/frontend/create/from/input/component.ts +++ b/src/app/frontend/create/from/input/component.ts @@ -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 { diff --git a/src/app/frontend/index.component.ts b/src/app/frontend/index.component.ts index 953211810..acb3e7901 100644 --- a/src/app/frontend/index.component.ts +++ b/src/app/frontend/index.component.ts @@ -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(); } diff --git a/src/app/frontend/login/component.ts b/src/app/frontend/login/component.ts index bb25600e3..0fa0d55b1 100644 --- a/src/app/frontend/login/component.ts +++ b/src/app/frontend/login/component.ts @@ -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)]; - }, + } ); } diff --git a/src/app/frontend/logs/component.ts b/src/app/frontend/logs/component.ts index 18a798302..8dbafbd7d 100644 --- a/src/app/frontend/logs/component.ts +++ b/src/app/frontend/logs/component.ts @@ -20,8 +20,8 @@ import {LogDetails, LogLine, LogSelection, LogSources} from '@api/backendapi'; import {GlobalSettingsService} from 'common/services/global/globalsettings'; import {LogService} from 'common/services/global/logs'; import {NotificationSeverity, NotificationsService} from 'common/services/global/notifications'; -import {Subject, Subscription, timer} from 'rxjs'; -import {switchMap, takeUntil} from 'rxjs/operators'; +import {Observable, Subject, Subscription, timer} from 'rxjs'; +import {switchMap, takeUntil, tap} from 'rxjs/operators'; import {LogsDownloadDialog} from '../common/dialogs/download/dialog'; @@ -49,6 +49,7 @@ type ScrollPosition = 'TOP' | 'BOTTOM'; styleUrls: ['./style.scss'], }) export class LogsComponent implements OnDestroy { + private refreshUnsubscribe_ = new Subject(); private unsubscribe_ = new Subject(); readonly refreshInterval: number; @@ -64,9 +65,6 @@ export class LogsComponent implements OnDestroy { totalItems = 0; itemsPerPage = 10; currentSelection: LogSelection; - intervalSubscription: Subscription; - sourceSubscription: Subscription; - logsSubscription: Subscription; isLoading: boolean; logsAutorefreshEnabled = false; @@ -76,7 +74,7 @@ export class LogsComponent implements OnDestroy { private readonly settingsService_: GlobalSettingsService, private readonly dialog_: MatDialog, private readonly notifications_: NotificationsService, - private readonly _router: Router, + private readonly _router: Router ) { this.logService = logService; this.isLoading = true; @@ -87,21 +85,23 @@ export class LogsComponent implements OnDestroy { const resourceName = this.activatedRoute_.snapshot.params.resourceName; const containerName = this.activatedRoute_.snapshot.queryParams.container; - this.sourceSubscription = logService - .getResource(`source/${namespace}/${resourceName}/${resourceType}`) - .subscribe((data: LogSources) => { - this.logSources = data; - this.pod = data.podNames[0]; // Pick first pod (cannot use resource name as it may - // not be a pod). - this.container = containerName ? containerName : data.containerNames[0]; // Pick from URL or first. - this.appendContainerParam(); - - this.logsSubscription = this.logService - .getResource(`${namespace}/${this.pod}/${this.container}`) - .subscribe((data: LogDetails) => { - this.updateUiModel(data); - this.isLoading = false; - }); + logService + .getResource(`source/${namespace}/${resourceName}/${resourceType}`) + .pipe( + switchMap>(data => { + this.logSources = data; + this.pod = data.podNames[0]; // Pick first pod (cannot use resource name as it may + // not be a pod). + this.container = containerName ? containerName : data.containerNames[0]; // Pick from URL or first. + this.appendContainerParam(); + + return this.logService.getResource(`${namespace}/${this.pod}/${this.container}`); + }) + ) + .pipe(takeUntil(this.unsubscribe_)) + .subscribe(data => { + this.updateUiModel(data); + this.isLoading = false; }); } @@ -111,15 +111,11 @@ export class LogsComponent implements OnDestroy { queryParamsHandling: 'merge', }); - if (this.intervalSubscription) { - this.intervalSubscription.unsubscribe(); - } - if (this.sourceSubscription) { - this.sourceSubscription.unsubscribe(); - } - if (this.logsSubscription) { - this.logsSubscription.unsubscribe(); - } + this.unsubscribe_.next(); + this.unsubscribe_.complete(); + + this.refreshUnsubscribe_.next(); + this.refreshUnsubscribe_.complete(); } /** @@ -191,7 +187,7 @@ export class LogsComponent implements OnDestroy { this.currentSelection.referencePoint.lineNum, this.currentSelection.offsetFrom - logsPerView, this.currentSelection.offsetFrom, - this.scrollToBottom.bind(this), + this.scrollToBottom.bind(this) ); } @@ -205,7 +201,7 @@ export class LogsComponent implements OnDestroy { this.currentSelection.referencePoint.lineNum, this.currentSelection.offsetTo, this.currentSelection.offsetTo + logsPerView, - this.scrollToTop.bind(this), + this.scrollToTop.bind(this) ); } @@ -223,7 +219,7 @@ export class LogsComponent implements OnDestroy { referenceLinenum: number, offsetFrom: number, offsetTo: number, - onLoad?: Function, + onLoad?: Function ): void { const namespace = this.activatedRoute_.snapshot.params.resourceNamespace; const params = new HttpParams() @@ -233,8 +229,9 @@ export class LogsComponent implements OnDestroy { .set('offsetFrom', `${offsetFrom}`) .set('offsetTo', `${offsetTo}`) .set('previous', `${this.logService.getPrevious()}`); - this.logsSubscription = this.logService + this.logService .getResource(`${namespace}/${this.pod}/${this.container}`, params) + .pipe(takeUntil(this.unsubscribe_)) .subscribe((podLogs: LogDetails) => { this.updateUiModel(podLogs); if (onLoad) { @@ -286,7 +283,7 @@ export class LogsComponent implements OnDestroy { toggleIntervalFunction(): void { this.logsAutorefreshEnabled = !this.logsAutorefreshEnabled; if (!this.logsAutorefreshEnabled) { - this.unsubscribe_.next(); + this.refreshUnsubscribe_.next(); return; } @@ -295,9 +292,9 @@ export class LogsComponent implements OnDestroy { switchMap(_ => { const interval = this.settingsService_.getLogsAutoRefreshTimeInterval() * 1000; return timer(0, interval === 0 ? undefined : interval); - }), + }) ) - .pipe(takeUntil(this.unsubscribe_)) + .pipe(takeUntil(this.refreshUnsubscribe_)) .subscribe(_ => this.loadNewest()); } diff --git a/src/app/frontend/overview/component.spec.ts b/src/app/frontend/overview/component.spec.ts index f53fe6eaf..4d17f9fa8 100644 --- a/src/app/frontend/overview/component.spec.ts +++ b/src/app/frontend/overview/component.spec.ts @@ -133,7 +133,7 @@ describe('OverviewComponent', () => { podRatio: Helper.getResourceRatio( mockPodsData.status, mockPodsData.listMeta.totalItems, - ResourceRatioModes.Completable, + ResourceRatioModes.Completable ), }); @@ -157,7 +157,7 @@ describe('OverviewComponent', () => { cronJobRatio: Helper.getResourceRatio( mockCronJobsData.status, mockCronJobsData.listMeta.totalItems, - ResourceRatioModes.Suspendable, + ResourceRatioModes.Suspendable ), }); diff --git a/src/app/frontend/polyfills.ts b/src/app/frontend/polyfills.ts index ac518b94a..85e543e37 100644 --- a/src/app/frontend/polyfills.ts +++ b/src/app/frontend/polyfills.ts @@ -26,9 +26,6 @@ import 'web-animations-js'; // Zone JS is required by default for Angular itself. import 'zone.js/dist/zone'; -// RxJS is required to support additional Observable methods such as map or switchMap. -import 'rxjs/Rx'; - // Load `$localize` onto the global scope - used if i18n tags appear in Angular templates. import '@angular/localize/init'; diff --git a/src/app/frontend/resource/cluster/clusterrole/detail/component.ts b/src/app/frontend/resource/cluster/clusterrole/detail/component.ts index 974ba9248..2d17faee0 100644 --- a/src/app/frontend/resource/cluster/clusterrole/detail/component.ts +++ b/src/app/frontend/resource/cluster/clusterrole/detail/component.ts @@ -15,7 +15,8 @@ import {Component, OnDestroy, OnInit} from '@angular/core'; import {ActivatedRoute} from '@angular/router'; import {ClusterRoleDetail} from '@api/backendapi'; -import {Subscription} from 'rxjs/Subscription'; +import {Subject} from 'rxjs'; +import {takeUntil} from 'rxjs/operators'; import {ActionbarService, ResourceMeta} from '../../../../common/services/global/actionbar'; import {NotificationsService} from '../../../../common/services/global/notifications'; @@ -27,8 +28,9 @@ import {ResourceService} from '../../../../common/services/resource/resource'; templateUrl: './template.html', }) export class ClusterRoleDetailComponent implements OnInit, OnDestroy { - private clusterRoleSubscription_: Subscription; + private readonly unsubscribe_ = new Subject(); private readonly endpoint_ = EndpointManager.resource(Resource.clusterRole); + clusterRole: ClusterRoleDetail; isInitialized = false; @@ -36,14 +38,15 @@ export class ClusterRoleDetailComponent implements OnInit, OnDestroy { private readonly clusterRole_: ResourceService, private readonly actionbar_: ActionbarService, private readonly route_: ActivatedRoute, - private readonly notifications_: NotificationsService, + private readonly notifications_: NotificationsService ) {} ngOnInit(): void { const resourceName = this.route_.snapshot.params.resourceName; - this.clusterRoleSubscription_ = this.clusterRole_ + this.clusterRole_ .get(this.endpoint_.detail(), resourceName) + .pipe(takeUntil(this.unsubscribe_)) .subscribe((d: ClusterRoleDetail) => { this.clusterRole = d; this.notifications_.pushErrors(d.errors); @@ -53,7 +56,8 @@ export class ClusterRoleDetailComponent implements OnInit, OnDestroy { } ngOnDestroy(): void { - this.clusterRoleSubscription_.unsubscribe(); + this.unsubscribe_.next(); + this.unsubscribe_.complete(); this.actionbar_.onDetailsLeave.emit(); } } diff --git a/src/app/frontend/resource/cluster/clusterrolebinding/detail/component.ts b/src/app/frontend/resource/cluster/clusterrolebinding/detail/component.ts index 873efd680..da2894f19 100644 --- a/src/app/frontend/resource/cluster/clusterrolebinding/detail/component.ts +++ b/src/app/frontend/resource/cluster/clusterrolebinding/detail/component.ts @@ -41,7 +41,7 @@ export class ClusterRoleBindingDetailComponent implements OnInit, OnDestroy { private readonly actionbar_: ActionbarService, private readonly route_: ActivatedRoute, private readonly notifications_: NotificationsService, - private readonly kdState_: KdStateService, + private readonly kdState_: KdStateService ) {} ngOnInit(): void { @@ -68,7 +68,7 @@ export class ClusterRoleBindingDetailComponent implements OnInit, OnDestroy { return this.kdState_.href( this.clusterRoleBinding.roleRef.kind.toLowerCase(), this.clusterRoleBinding.roleRef.name, - this.clusterRoleBinding.objectMeta.namespace, + this.clusterRoleBinding.objectMeta.namespace ); } } diff --git a/src/app/frontend/resource/cluster/namespace/detail/actionbar/component.ts b/src/app/frontend/resource/cluster/namespace/detail/actionbar/component.ts index 3afa80013..3e3936e51 100644 --- a/src/app/frontend/resource/cluster/namespace/detail/actionbar/component.ts +++ b/src/app/frontend/resource/cluster/namespace/detail/actionbar/component.ts @@ -29,23 +29,23 @@ export class ActionbarComponent implements OnInit { isVisible = false; resourceMeta: ResourceMeta; - private _unsubscribe = new Subject(); + private unsubscribe_ = new Subject(); constructor(private readonly actionbar_: ActionbarService, private readonly router_: Router) {} 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(); } onClick(): void { diff --git a/src/app/frontend/resource/cluster/namespace/detail/component.ts b/src/app/frontend/resource/cluster/namespace/detail/component.ts index e91e41a70..4fb826465 100644 --- a/src/app/frontend/resource/cluster/namespace/detail/component.ts +++ b/src/app/frontend/resource/cluster/namespace/detail/component.ts @@ -15,7 +15,8 @@ import {Component, OnDestroy, OnInit} from '@angular/core'; import {ActivatedRoute} from '@angular/router'; import {NamespaceDetail} from '@api/backendapi'; -import {Subscription} from 'rxjs/Subscription'; +import {Subject} from 'rxjs'; +import {takeUntil} from 'rxjs/operators'; import {ActionbarService, ResourceMeta} from '../../../../common/services/global/actionbar'; import {NotificationsService} from '../../../../common/services/global/notifications'; @@ -27,8 +28,9 @@ import {ResourceService} from '../../../../common/services/resource/resource'; templateUrl: './template.html', }) export class NamespaceDetailComponent implements OnInit, OnDestroy { - private namespaceSubscription_: Subscription; private readonly endpoint_ = EndpointManager.resource(Resource.namespace); + private readonly unsubscribe_ = new Subject(); + namespace: NamespaceDetail; isInitialized = false; eventListEndpoint: string; @@ -37,7 +39,7 @@ export class NamespaceDetailComponent implements OnInit, OnDestroy { private readonly namespace_: ResourceService, private readonly actionbar_: ActionbarService, private readonly activatedRoute_: ActivatedRoute, - private readonly notifications_: NotificationsService, + private readonly notifications_: NotificationsService ) {} ngOnInit(): void { @@ -45,8 +47,9 @@ export class NamespaceDetailComponent implements OnInit, OnDestroy { this.eventListEndpoint = this.endpoint_.child(resourceName, Resource.event); - this.namespaceSubscription_ = this.namespace_ + this.namespace_ .get(this.endpoint_.detail(), resourceName) + .pipe(takeUntil(this.unsubscribe_)) .subscribe((d: NamespaceDetail) => { this.namespace = d; this.notifications_.pushErrors(d.errors); @@ -56,7 +59,8 @@ export class NamespaceDetailComponent implements OnInit, OnDestroy { } ngOnDestroy(): void { - this.namespaceSubscription_.unsubscribe(); + this.unsubscribe_.next(); + this.unsubscribe_.complete(); this.actionbar_.onDetailsLeave.emit(); } } diff --git a/src/app/frontend/resource/cluster/networkpolicy/detail/component.ts b/src/app/frontend/resource/cluster/networkpolicy/detail/component.ts index 09f4799bd..0a83e4317 100644 --- a/src/app/frontend/resource/cluster/networkpolicy/detail/component.ts +++ b/src/app/frontend/resource/cluster/networkpolicy/detail/component.ts @@ -12,26 +12,26 @@ // See the License for the specific language governing permissions and // limitations under the License. -import 'rxjs/add/operator/startWith'; - import {Component, OnDestroy, OnInit} from '@angular/core'; import {ActivatedRoute} from '@angular/router'; import {NetworkPolicyDetail} from '@api/backendapi'; -import {Subscription} from 'rxjs/Subscription'; +import {dump} from 'js-yaml'; +import {Subject} from 'rxjs'; +import {takeUntil} from 'rxjs/operators'; import {ActionbarService, ResourceMeta} from '../../../../common/services/global/actionbar'; import {NotificationsService} from '../../../../common/services/global/notifications'; import {EndpointManager, Resource} from '../../../../common/services/resource/endpoint'; import {NamespacedResourceService} from '../../../../common/services/resource/resource'; -import {dump} from 'js-yaml'; @Component({ selector: 'kd-network-policy-detail', templateUrl: './template.html', }) export class NetworkPolicyDetailComponent implements OnInit, OnDestroy { - private networkPolicySubscription_: Subscription; private readonly endpoint_ = EndpointManager.resource(Resource.networkPolicy, true); + private readonly unsubscribe_ = new Subject(); + networkPolicy: NetworkPolicyDetail; isInitialized = false; @@ -39,15 +39,16 @@ export class NetworkPolicyDetailComponent implements OnInit, OnDestroy { private readonly networkPolicy_: NamespacedResourceService, private readonly actionbar_: ActionbarService, private readonly activatedRoute_: ActivatedRoute, - private readonly notifications_: NotificationsService, + private readonly notifications_: NotificationsService ) {} ngOnInit(): void { const resourceName = this.activatedRoute_.snapshot.params.resourceName; const resourceNamespace = this.activatedRoute_.snapshot.params.resourceNamespace; - this.networkPolicySubscription_ = this.networkPolicy_ + this.networkPolicy_ .get(this.endpoint_.detail(), resourceName, resourceNamespace) + .pipe(takeUntil(this.unsubscribe_)) .subscribe((d: NetworkPolicyDetail) => { this.networkPolicy = d; this.notifications_.pushErrors(d.errors); @@ -57,7 +58,8 @@ export class NetworkPolicyDetailComponent implements OnInit, OnDestroy { } ngOnDestroy(): void { - this.networkPolicySubscription_.unsubscribe(); + this.unsubscribe_.next(); + this.unsubscribe_.complete(); this.actionbar_.onDetailsLeave.emit(); } diff --git a/src/app/frontend/resource/cluster/node/detail/component.ts b/src/app/frontend/resource/cluster/node/detail/component.ts index c58ef114d..cbb78579b 100644 --- a/src/app/frontend/resource/cluster/node/detail/component.ts +++ b/src/app/frontend/resource/cluster/node/detail/component.ts @@ -15,22 +15,24 @@ import {Component, OnDestroy, OnInit} from '@angular/core'; import {ActivatedRoute} from '@angular/router'; import {NodeAddress, NodeDetail, NodeTaint} from '@api/backendapi'; -import {Subscription} from 'rxjs/Subscription'; +import {RatioItem} from '@api/frontendapi'; +import {Subject} from 'rxjs'; +import {takeUntil} from 'rxjs/operators'; +import {FormattedValue} from '../../../../common/components/graph/helper'; import {ActionbarService, ResourceMeta} from '../../../../common/services/global/actionbar'; import {NotificationsService} from '../../../../common/services/global/notifications'; import {EndpointManager, Resource} from '../../../../common/services/resource/endpoint'; import {ResourceService} from '../../../../common/services/resource/resource'; -import {RatioItem} from '@api/frontendapi'; -import {FormattedValue} from '../../../../common/components/graph/helper'; @Component({ selector: 'kd-node-detail', templateUrl: './template.html', }) export class NodeDetailComponent implements OnInit, OnDestroy { - private nodeSubscription_: Subscription; private readonly endpoint_ = EndpointManager.resource(Resource.node); + private readonly unsubscribe_ = new Subject(); + node: NodeDetail; isInitialized = false; podListEndpoint: string; @@ -52,7 +54,7 @@ export class NodeDetailComponent implements OnInit, OnDestroy { private readonly node_: ResourceService, private readonly actionbar_: ActionbarService, private readonly activatedRoute_: ActivatedRoute, - private readonly notifications_: NotificationsService, + private readonly notifications_: NotificationsService ) {} ngOnInit(): void { @@ -61,17 +63,21 @@ export class NodeDetailComponent implements OnInit, OnDestroy { this.podListEndpoint = this.endpoint_.child(resourceName, Resource.pod); this.eventListEndpoint = this.endpoint_.child(resourceName, Resource.event); - this.nodeSubscription_ = this.node_.get(this.endpoint_.detail(), resourceName).subscribe((d: NodeDetail) => { - this.node = d; - this._getAllocation(); - this.notifications_.pushErrors(d.errors); - this.actionbar_.onInit.emit(new ResourceMeta('Node', d.objectMeta, d.typeMeta)); - this.isInitialized = true; - }); + this.node_ + .get(this.endpoint_.detail(), resourceName) + .pipe(takeUntil(this.unsubscribe_)) + .subscribe((d: NodeDetail) => { + this.node = d; + this._getAllocation(); + this.notifications_.pushErrors(d.errors); + this.actionbar_.onInit.emit(new ResourceMeta('Node', d.objectMeta, d.typeMeta)); + this.isInitialized = true; + }); } ngOnDestroy(): void { - this.nodeSubscription_.unsubscribe(); + this.unsubscribe_.next(); + this.unsubscribe_.complete(); this.actionbar_.onDetailsLeave.emit(); } diff --git a/src/app/frontend/resource/cluster/persistentvolume/detail/component.ts b/src/app/frontend/resource/cluster/persistentvolume/detail/component.ts index eb118f736..2c12af48e 100644 --- a/src/app/frontend/resource/cluster/persistentvolume/detail/component.ts +++ b/src/app/frontend/resource/cluster/persistentvolume/detail/component.ts @@ -16,7 +16,8 @@ import {Component, OnDestroy, OnInit} from '@angular/core'; import {MatTableDataSource} from '@angular/material/table'; import {ActivatedRoute} from '@angular/router'; import {CapacityItem, PersistentVolumeDetail} from '@api/backendapi'; -import {Subscription} from 'rxjs/Subscription'; +import {Subject} from 'rxjs'; +import {takeUntil} from 'rxjs/operators'; import {ActionbarService, ResourceMeta} from '../../../../common/services/global/actionbar'; import {NotificationsService} from '../../../../common/services/global/notifications'; @@ -28,8 +29,9 @@ import {ResourceService} from '../../../../common/services/resource/resource'; templateUrl: './template.html', }) export class PersistentVolumeDetailComponent implements OnInit, OnDestroy { - private persistentVolumeSubscription_: Subscription; private readonly endpoint_ = EndpointManager.resource(Resource.persistentVolume); + private readonly unsubscribe_ = new Subject(); + persistentVolume: PersistentVolumeDetail; isInitialized = false; @@ -37,14 +39,15 @@ export class PersistentVolumeDetailComponent implements OnInit, OnDestroy { private readonly persistentVolume_: ResourceService, private readonly actionbar_: ActionbarService, private readonly activatedRoute_: ActivatedRoute, - private readonly notifications_: NotificationsService, + private readonly notifications_: NotificationsService ) {} ngOnInit(): void { const resourceName = this.activatedRoute_.snapshot.params.resourceName; - this.persistentVolumeSubscription_ = this.persistentVolume_ + this.persistentVolume_ .get(this.endpoint_.detail(), resourceName) + .pipe(takeUntil(this.unsubscribe_)) .subscribe((d: PersistentVolumeDetail) => { this.persistentVolume = d; this.notifications_.pushErrors(d.errors); @@ -54,7 +57,8 @@ export class PersistentVolumeDetailComponent implements OnInit, OnDestroy { } ngOnDestroy(): void { - this.persistentVolumeSubscription_.unsubscribe(); + this.unsubscribe_.next(); + this.unsubscribe_.complete(); this.actionbar_.onDetailsLeave.emit(); } diff --git a/src/app/frontend/resource/cluster/role/detail/component.ts b/src/app/frontend/resource/cluster/role/detail/component.ts index 4f480296e..f072dcc86 100644 --- a/src/app/frontend/resource/cluster/role/detail/component.ts +++ b/src/app/frontend/resource/cluster/role/detail/component.ts @@ -15,7 +15,8 @@ import {Component, OnDestroy, OnInit} from '@angular/core'; import {ActivatedRoute} from '@angular/router'; import {RoleDetail} from '@api/backendapi'; -import {Subscription} from 'rxjs/Subscription'; +import {Subject} from 'rxjs'; +import {takeUntil} from 'rxjs/operators'; import {ActionbarService, ResourceMeta} from '../../../../common/services/global/actionbar'; import {NotificationsService} from '../../../../common/services/global/notifications'; @@ -27,8 +28,9 @@ import {NamespacedResourceService} from '../../../../common/services/resource/re templateUrl: './template.html', }) export class RoleDetailComponent implements OnInit, OnDestroy { - private roleSubscription_: Subscription; private readonly endpoint_ = EndpointManager.resource(Resource.role, true); + private readonly unsubscribe_ = new Subject(); + role: RoleDetail; isInitialized = false; @@ -36,15 +38,16 @@ export class RoleDetailComponent implements OnInit, OnDestroy { private readonly role_: NamespacedResourceService, private readonly actionbar_: ActionbarService, private readonly route_: ActivatedRoute, - private readonly notifications_: NotificationsService, + private readonly notifications_: NotificationsService ) {} ngOnInit(): void { const resourceName = this.route_.snapshot.params.resourceName; const resourceNamespace = this.route_.snapshot.params.resourceNamespace; - this.roleSubscription_ = this.role_ + this.role_ .get(this.endpoint_.detail(), resourceName, resourceNamespace) + .pipe(takeUntil(this.unsubscribe_)) .subscribe((d: RoleDetail) => { this.role = d; this.notifications_.pushErrors(d.errors); @@ -54,7 +57,8 @@ export class RoleDetailComponent implements OnInit, OnDestroy { } ngOnDestroy(): void { - this.roleSubscription_.unsubscribe(); + this.unsubscribe_.next(); + this.unsubscribe_.complete(); this.actionbar_.onDetailsLeave.emit(); } } diff --git a/src/app/frontend/resource/cluster/rolebinding/detail/component.ts b/src/app/frontend/resource/cluster/rolebinding/detail/component.ts index 2345599f2..0c85dfdaf 100644 --- a/src/app/frontend/resource/cluster/rolebinding/detail/component.ts +++ b/src/app/frontend/resource/cluster/rolebinding/detail/component.ts @@ -39,7 +39,7 @@ export class RoleBingingDetailComponent implements OnInit, OnDestroy { private readonly actionbar_: ActionbarService, private readonly route_: ActivatedRoute, private readonly notifications_: NotificationsService, - private readonly kdState_: KdStateService, + private readonly kdState_: KdStateService ) {} ngOnInit(): void { @@ -67,7 +67,7 @@ export class RoleBingingDetailComponent implements OnInit, OnDestroy { return this.kdState_.href( this.roleBinding.roleRef.kind.toLowerCase(), this.roleBinding.roleRef.name, - this.roleBinding.objectMeta.namespace, + this.roleBinding.objectMeta.namespace ); } } diff --git a/src/app/frontend/resource/cluster/serviceaccount/detail/component.ts b/src/app/frontend/resource/cluster/serviceaccount/detail/component.ts index 5903a8178..44a744f4f 100644 --- a/src/app/frontend/resource/cluster/serviceaccount/detail/component.ts +++ b/src/app/frontend/resource/cluster/serviceaccount/detail/component.ts @@ -12,12 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -import 'rxjs/add/operator/startWith'; - import {Component, OnDestroy, OnInit} from '@angular/core'; import {ActivatedRoute} from '@angular/router'; import {ServiceAccountDetail} from '@api/backendapi'; -import {Subscription} from 'rxjs/Subscription'; +import {Subject} from 'rxjs'; +import {takeUntil} from 'rxjs/operators'; import {ActionbarService, ResourceMeta} from '../../../../common/services/global/actionbar'; import {NotificationsService} from '../../../../common/services/global/notifications'; @@ -29,8 +28,9 @@ import {NamespacedResourceService} from '../../../../common/services/resource/re templateUrl: './template.html', }) export class ServiceAccountDetailComponent implements OnInit, OnDestroy { - private serviceAccountSubscription_: Subscription; private readonly endpoint_ = EndpointManager.resource(Resource.serviceAccount, true); + private readonly unsubscribe_ = new Subject(); + secretListEndpoint: string; imagePullSecretListEndpoint: string; serviceAccount: ServiceAccountDetail; @@ -40,7 +40,7 @@ export class ServiceAccountDetailComponent implements OnInit, OnDestroy { private readonly serviceAccount_: NamespacedResourceService, private readonly actionbar_: ActionbarService, private readonly activatedRoute_: ActivatedRoute, - private readonly notifications_: NotificationsService, + private readonly notifications_: NotificationsService ) {} ngOnInit(): void { @@ -50,8 +50,9 @@ export class ServiceAccountDetailComponent implements OnInit, OnDestroy { this.secretListEndpoint = this.endpoint_.child(resourceName, Resource.secret, resourceNamespace); this.imagePullSecretListEndpoint = this.endpoint_.child(resourceName, Resource.imagePullSecret, resourceNamespace); - this.serviceAccountSubscription_ = this.serviceAccount_ + this.serviceAccount_ .get(this.endpoint_.detail(), resourceName, resourceNamespace) + .pipe(takeUntil(this.unsubscribe_)) .subscribe((d: ServiceAccountDetail) => { this.serviceAccount = d; this.notifications_.pushErrors(d.errors); @@ -61,7 +62,8 @@ export class ServiceAccountDetailComponent implements OnInit, OnDestroy { } ngOnDestroy(): void { - this.serviceAccountSubscription_.unsubscribe(); + this.unsubscribe_.next(); + this.unsubscribe_.complete(); this.actionbar_.onDetailsLeave.emit(); } } diff --git a/src/app/frontend/resource/config/configmap/detail/component.ts b/src/app/frontend/resource/config/configmap/detail/component.ts index f612d0c8a..9aff91fec 100644 --- a/src/app/frontend/resource/config/configmap/detail/component.ts +++ b/src/app/frontend/resource/config/configmap/detail/component.ts @@ -15,7 +15,8 @@ import {Component, OnDestroy, OnInit} from '@angular/core'; import {ActivatedRoute} from '@angular/router'; import {ConfigMapDetail} from '@api/backendapi'; -import {Subscription} from 'rxjs/Subscription'; +import {Subject} from 'rxjs'; +import {takeUntil} from 'rxjs/operators'; import {ActionbarService, ResourceMeta} from '../../../../common/services/global/actionbar'; import {NotificationsService} from '../../../../common/services/global/notifications'; @@ -27,8 +28,9 @@ import {NamespacedResourceService} from '../../../../common/services/resource/re templateUrl: './template.html', }) export class ConfigMapDetailComponent implements OnInit, OnDestroy { - private configMapSubscription_: Subscription; private endpoint_ = EndpointManager.resource(Resource.configMap, true); + private readonly unsubscribe_ = new Subject(); + configMap: ConfigMapDetail; isInitialized = false; @@ -36,15 +38,16 @@ export class ConfigMapDetailComponent implements OnInit, OnDestroy { private readonly configMap_: NamespacedResourceService, private readonly actionbar_: ActionbarService, private readonly activatedRoute_: ActivatedRoute, - private readonly notifications_: NotificationsService, + private readonly notifications_: NotificationsService ) {} ngOnInit(): void { const resourceName = this.activatedRoute_.snapshot.params.resourceName; const resourceNamespace = this.activatedRoute_.snapshot.params.resourceNamespace; - this.configMapSubscription_ = this.configMap_ + this.configMap_ .get(this.endpoint_.detail(), resourceName, resourceNamespace) + .pipe(takeUntil(this.unsubscribe_)) .subscribe((d: ConfigMapDetail) => { this.configMap = d; this.notifications_.pushErrors(d.errors); @@ -54,7 +57,8 @@ export class ConfigMapDetailComponent implements OnInit, OnDestroy { } ngOnDestroy(): void { - this.configMapSubscription_.unsubscribe(); + this.unsubscribe_.next(); + this.unsubscribe_.complete(); this.actionbar_.onDetailsLeave.emit(); } diff --git a/src/app/frontend/resource/config/persistentvolumeclaim/detail/component.ts b/src/app/frontend/resource/config/persistentvolumeclaim/detail/component.ts index e9029402b..88df3bafd 100644 --- a/src/app/frontend/resource/config/persistentvolumeclaim/detail/component.ts +++ b/src/app/frontend/resource/config/persistentvolumeclaim/detail/component.ts @@ -15,7 +15,8 @@ import {Component, OnDestroy, OnInit} from '@angular/core'; import {ActivatedRoute} from '@angular/router'; import {PersistentVolumeClaimDetail} from '@api/backendapi'; -import {Subscription} from 'rxjs/Subscription'; +import {Subject} from 'rxjs'; +import {takeUntil} from 'rxjs/operators'; import {ActionbarService, ResourceMeta} from '../../../../common/services/global/actionbar'; import {NotificationsService} from '../../../../common/services/global/notifications'; @@ -27,8 +28,9 @@ import {NamespacedResourceService} from '../../../../common/services/resource/re templateUrl: './template.html', }) export class PersistentVolumeClaimDetailComponent implements OnInit, OnDestroy { - private persistentVolumeClaimSubscription_: Subscription; private readonly endpoint_ = EndpointManager.resource(Resource.persistentVolumeClaim, true); + private readonly unsubscribe_ = new Subject(); + persistentVolumeClaim: PersistentVolumeClaimDetail; isInitialized = false; @@ -36,15 +38,16 @@ export class PersistentVolumeClaimDetailComponent implements OnInit, OnDestroy { private readonly persistentVolumeClaim_: NamespacedResourceService, private readonly actionbar_: ActionbarService, private readonly activatedRoute_: ActivatedRoute, - private readonly notifications_: NotificationsService, + private readonly notifications_: NotificationsService ) {} ngOnInit(): void { const resourceName = this.activatedRoute_.snapshot.params.resourceName; const resourceNamespace = this.activatedRoute_.snapshot.params.resourceNamespace; - this.persistentVolumeClaimSubscription_ = this.persistentVolumeClaim_ + this.persistentVolumeClaim_ .get(this.endpoint_.detail(), resourceName, resourceNamespace) + .pipe(takeUntil(this.unsubscribe_)) .subscribe((d: PersistentVolumeClaimDetail) => { this.persistentVolumeClaim = d; this.notifications_.pushErrors(d.errors); @@ -54,7 +57,8 @@ export class PersistentVolumeClaimDetailComponent implements OnInit, OnDestroy { } ngOnDestroy(): void { - this.persistentVolumeClaimSubscription_.unsubscribe(); + this.unsubscribe_.next(); + this.unsubscribe_.complete(); this.actionbar_.onDetailsLeave.emit(); } } diff --git a/src/app/frontend/resource/config/secret/detail/component.ts b/src/app/frontend/resource/config/secret/detail/component.ts index e5db900af..276ebbcee 100644 --- a/src/app/frontend/resource/config/secret/detail/component.ts +++ b/src/app/frontend/resource/config/secret/detail/component.ts @@ -15,21 +15,23 @@ import {Component, OnDestroy, OnInit} from '@angular/core'; import {ActivatedRoute} from '@angular/router'; import {SecretDetail} from '@api/backendapi'; -import {Subscription} from 'rxjs/Subscription'; +import {Subject} from 'rxjs'; +import {takeUntil} from 'rxjs/operators'; +import {HiddenPropertyMode} from '../../../../common/components/hiddenproperty/component'; import {ActionbarService, ResourceMeta} from '../../../../common/services/global/actionbar'; import {NotificationsService} from '../../../../common/services/global/notifications'; import {EndpointManager, Resource} from '../../../../common/services/resource/endpoint'; import {NamespacedResourceService} from '../../../../common/services/resource/resource'; -import {HiddenPropertyMode} from '../../../../common/components/hiddenproperty/component'; @Component({ selector: 'kd-secret-detail', templateUrl: './template.html', }) export class SecretDetailComponent implements OnInit, OnDestroy { - private secretSubscription_: Subscription; private readonly endpoint_ = EndpointManager.resource(Resource.secret, true); + private readonly unsubscribe_ = new Subject(); + secret: SecretDetail; isInitialized = false; HiddenPropertyMode = HiddenPropertyMode; @@ -38,15 +40,16 @@ export class SecretDetailComponent implements OnInit, OnDestroy { private readonly secret_: NamespacedResourceService, private readonly actionbar_: ActionbarService, private readonly activatedRoute_: ActivatedRoute, - private readonly notifications_: NotificationsService, + private readonly notifications_: NotificationsService ) {} ngOnInit(): void { const resourceName = this.activatedRoute_.snapshot.params.resourceName; const resourceNamespace = this.activatedRoute_.snapshot.params.resourceNamespace; - this.secretSubscription_ = this.secret_ + this.secret_ .get(this.endpoint_.detail(), resourceName, resourceNamespace) + .pipe(takeUntil(this.unsubscribe_)) .subscribe((d: SecretDetail) => { this.secret = d; this.notifications_.pushErrors(d.errors); @@ -56,7 +59,8 @@ export class SecretDetailComponent implements OnInit, OnDestroy { } ngOnDestroy(): void { - this.secretSubscription_.unsubscribe(); + this.unsubscribe_.next(); + this.unsubscribe_.complete(); this.actionbar_.onDetailsLeave.emit(); } diff --git a/src/app/frontend/resource/config/storageclass/detail/component.ts b/src/app/frontend/resource/config/storageclass/detail/component.ts index 6c8ae3263..37184aa91 100644 --- a/src/app/frontend/resource/config/storageclass/detail/component.ts +++ b/src/app/frontend/resource/config/storageclass/detail/component.ts @@ -15,7 +15,8 @@ import {Component, OnDestroy, OnInit} from '@angular/core'; import {ActivatedRoute} from '@angular/router'; import {StorageClassDetail} from '@api/backendapi'; -import {Subscription} from 'rxjs/Subscription'; +import {Subject} from 'rxjs'; +import {takeUntil} from 'rxjs/operators'; import {ActionbarService, ResourceMeta} from '../../../../common/services/global/actionbar'; import {NotificationsService} from '../../../../common/services/global/notifications'; @@ -28,8 +29,9 @@ import {ResourceService} from '../../../../common/services/resource/resource'; styleUrls: ['./style.scss'], }) export class StorageClassDetailComponent implements OnInit, OnDestroy { - private storageClassSubscription_: Subscription; private readonly endpoint_ = EndpointManager.resource(Resource.storageClass); + private readonly unsubscribe_ = new Subject(); + storageClass: StorageClassDetail; pvListEndpoint: string; isInitialized = false; @@ -38,7 +40,7 @@ export class StorageClassDetailComponent implements OnInit, OnDestroy { private readonly storageClass_: ResourceService, private readonly actionbar_: ActionbarService, private readonly activatedRoute_: ActivatedRoute, - private readonly notifications_: NotificationsService, + private readonly notifications_: NotificationsService ) {} ngOnInit(): void { @@ -46,8 +48,9 @@ export class StorageClassDetailComponent implements OnInit, OnDestroy { this.pvListEndpoint = this.endpoint_.child(resourceName, Resource.persistentVolume); - this.storageClassSubscription_ = this.storageClass_ + this.storageClass_ .get(this.endpoint_.detail(), resourceName) + .pipe(takeUntil(this.unsubscribe_)) .subscribe((d: StorageClassDetail) => { this.storageClass = d; this.notifications_.pushErrors(d.errors); @@ -57,7 +60,8 @@ export class StorageClassDetailComponent implements OnInit, OnDestroy { } ngOnDestroy(): void { - this.storageClassSubscription_.unsubscribe(); + this.unsubscribe_.next(); + this.unsubscribe_.complete(); this.actionbar_.onDetailsLeave.emit(); } diff --git a/src/app/frontend/resource/discovery/ingress/detail/component.ts b/src/app/frontend/resource/discovery/ingress/detail/component.ts index 592eb154e..6de7ee751 100644 --- a/src/app/frontend/resource/discovery/ingress/detail/component.ts +++ b/src/app/frontend/resource/discovery/ingress/detail/component.ts @@ -12,12 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -import 'rxjs/add/operator/startWith'; - import {Component, OnDestroy, OnInit} from '@angular/core'; import {ActivatedRoute} from '@angular/router'; import {IngressDetail} from '@api/backendapi'; -import {Subscription} from 'rxjs/Subscription'; +import {Subject} from 'rxjs'; +import {takeUntil} from 'rxjs/operators'; import {ActionbarService, ResourceMeta} from '../../../../common/services/global/actionbar'; import {NotificationsService} from '../../../../common/services/global/notifications'; @@ -29,8 +28,9 @@ import {NamespacedResourceService} from '../../../../common/services/resource/re templateUrl: './template.html', }) export class IngressDetailComponent implements OnInit, OnDestroy { - private ingressSubscription_: Subscription; private readonly endpoint_ = EndpointManager.resource(Resource.ingress, true); + private readonly unsubscribe_ = new Subject(); + ingress: IngressDetail; isInitialized = false; @@ -38,15 +38,16 @@ export class IngressDetailComponent implements OnInit, OnDestroy { private readonly ingress_: NamespacedResourceService, private readonly actionbar_: ActionbarService, private readonly activatedRoute_: ActivatedRoute, - private readonly notifications_: NotificationsService, + private readonly notifications_: NotificationsService ) {} ngOnInit(): void { const resourceName = this.activatedRoute_.snapshot.params.resourceName; const resourceNamespace = this.activatedRoute_.snapshot.params.resourceNamespace; - this.ingressSubscription_ = this.ingress_ + this.ingress_ .get(this.endpoint_.detail(), resourceName, resourceNamespace) + .pipe(takeUntil(this.unsubscribe_)) .subscribe((d: IngressDetail) => { this.ingress = d; this.notifications_.pushErrors(d.errors); @@ -56,7 +57,8 @@ export class IngressDetailComponent implements OnInit, OnDestroy { } ngOnDestroy(): void { - this.ingressSubscription_.unsubscribe(); + this.unsubscribe_.next(); + this.unsubscribe_.complete(); this.actionbar_.onDetailsLeave.emit(); } } diff --git a/src/app/frontend/resource/discovery/service/detail/component.ts b/src/app/frontend/resource/discovery/service/detail/component.ts index 7054a33b7..1a8ef32b9 100644 --- a/src/app/frontend/resource/discovery/service/detail/component.ts +++ b/src/app/frontend/resource/discovery/service/detail/component.ts @@ -15,7 +15,8 @@ import {Component, OnDestroy, OnInit} from '@angular/core'; import {ActivatedRoute} from '@angular/router'; import {ServiceDetail} from '@api/backendapi'; -import {Subscription} from 'rxjs/Subscription'; +import {Subject} from 'rxjs'; +import {takeUntil} from 'rxjs/operators'; import {ActionbarService, ResourceMeta} from '../../../../common/services/global/actionbar'; import {NotificationsService} from '../../../../common/services/global/notifications'; @@ -27,8 +28,9 @@ import {NamespacedResourceService} from '../../../../common/services/resource/re templateUrl: './template.html', }) export class ServiceDetailComponent implements OnInit, OnDestroy { - private serviceSubscription_: Subscription; private readonly endpoint_ = EndpointManager.resource(Resource.service, true); + private readonly unsubscribe_ = new Subject(); + service: ServiceDetail; isInitialized = false; podListEndpoint: string; @@ -38,7 +40,7 @@ export class ServiceDetailComponent implements OnInit, OnDestroy { private readonly service_: NamespacedResourceService, private readonly actionbar_: ActionbarService, private readonly activatedRoute_: ActivatedRoute, - private readonly notifications_: NotificationsService, + private readonly notifications_: NotificationsService ) {} ngOnInit(): void { @@ -48,8 +50,9 @@ export class ServiceDetailComponent implements OnInit, OnDestroy { this.podListEndpoint = this.endpoint_.child(resourceName, Resource.pod, resourceNamespace); this.eventListEndpoint = this.endpoint_.child(resourceName, Resource.event, resourceNamespace); - this.serviceSubscription_ = this.service_ + this.service_ .get(this.endpoint_.detail(), resourceName, resourceNamespace) + .pipe(takeUntil(this.unsubscribe_)) .subscribe((d: ServiceDetail) => { this.service = d; this.notifications_.pushErrors(d.errors); @@ -59,7 +62,8 @@ export class ServiceDetailComponent implements OnInit, OnDestroy { } ngOnDestroy(): void { - this.serviceSubscription_.unsubscribe(); + this.unsubscribe_.next(); + this.unsubscribe_.complete(); this.actionbar_.onDetailsLeave.emit(); } } diff --git a/src/app/frontend/resource/workloads/cronjob/detail/component.ts b/src/app/frontend/resource/workloads/cronjob/detail/component.ts index 770408b7a..c1192194a 100644 --- a/src/app/frontend/resource/workloads/cronjob/detail/component.ts +++ b/src/app/frontend/resource/workloads/cronjob/detail/component.ts @@ -15,7 +15,8 @@ import {Component, OnDestroy, OnInit} from '@angular/core'; import {ActivatedRoute} from '@angular/router'; import {CronJobDetail} from '@api/backendapi'; -import {Subscription} from 'rxjs/Subscription'; +import {Subject} from 'rxjs'; +import {takeUntil} from 'rxjs/operators'; import {ActionbarService, ResourceMeta} from '../../../../common/services/global/actionbar'; import {NotificationsService} from '../../../../common/services/global/notifications'; @@ -27,8 +28,9 @@ import {NamespacedResourceService} from '../../../../common/services/resource/re templateUrl: './template.html', }) export class CronJobDetailComponent implements OnInit, OnDestroy { - private cronJobSubscription_: Subscription; private readonly endpoint_ = EndpointManager.resource(Resource.cronJob, true); + private readonly unsubscribe_ = new Subject(); + cronJob: CronJobDetail; isInitialized = false; eventListEndpoint: string; @@ -39,7 +41,7 @@ export class CronJobDetailComponent implements OnInit, OnDestroy { private readonly cronJob_: NamespacedResourceService, private readonly actionbar_: ActionbarService, private readonly activatedRoute_: ActivatedRoute, - private readonly notifications_: NotificationsService, + private readonly notifications_: NotificationsService ) {} ngOnInit(): void { @@ -50,8 +52,9 @@ export class CronJobDetailComponent implements OnInit, OnDestroy { this.activeJobsEndpoint = this.endpoint_.child(resourceName, Resource.job, resourceNamespace); this.inactiveJobsEndpoint = this.activeJobsEndpoint + '?active=false'; - this.cronJobSubscription_ = this.cronJob_ + this.cronJob_ .get(this.endpoint_.detail(), resourceName, resourceNamespace) + .pipe(takeUntil(this.unsubscribe_)) .subscribe((d: CronJobDetail) => { this.cronJob = d; this.notifications_.pushErrors(d.errors); @@ -61,7 +64,8 @@ export class CronJobDetailComponent implements OnInit, OnDestroy { } ngOnDestroy(): void { - this.cronJobSubscription_.unsubscribe(); + this.unsubscribe_.next(); + this.unsubscribe_.complete(); this.actionbar_.onDetailsLeave.emit(); } } diff --git a/src/app/frontend/resource/workloads/daemonset/detail/actionbar/component.ts b/src/app/frontend/resource/workloads/daemonset/detail/actionbar/component.ts index e92b91ff9..fe2b156f4 100644 --- a/src/app/frontend/resource/workloads/daemonset/detail/actionbar/component.ts +++ b/src/app/frontend/resource/workloads/daemonset/detail/actionbar/component.ts @@ -13,7 +13,7 @@ // limitations under the License. import {Component, OnInit} from '@angular/core'; -import {Subscription} from 'rxjs/Subscription'; +import {Subject} from 'rxjs'; import {ActionbarService, ResourceMeta} from '../../../../../common/services/global/actionbar'; @Component({ @@ -21,20 +21,22 @@ import {ActionbarService, ResourceMeta} from '../../../../../common/services/glo templateUrl: './template.html', }) export class ActionbarComponent implements OnInit { + private readonly unsubscribe_ = new Subject(); + isInitialized = false; resourceMeta: ResourceMeta; - resourceMetaSubscription_: Subscription; constructor(private readonly actionbar_: ActionbarService) {} ngOnInit(): void { - this.resourceMetaSubscription_ = this.actionbar_.onInit.subscribe((resourceMeta: ResourceMeta) => { + this.actionbar_.onInit.subscribe((resourceMeta: ResourceMeta) => { this.resourceMeta = resourceMeta; this.isInitialized = true; }); } ngOnDestroy(): void { - this.resourceMetaSubscription_.unsubscribe(); + this.unsubscribe_.next(); + this.unsubscribe_.complete(); } } diff --git a/src/app/frontend/resource/workloads/daemonset/detail/component.ts b/src/app/frontend/resource/workloads/daemonset/detail/component.ts index f563d973d..a0fff8b97 100644 --- a/src/app/frontend/resource/workloads/daemonset/detail/component.ts +++ b/src/app/frontend/resource/workloads/daemonset/detail/component.ts @@ -15,7 +15,8 @@ import {Component, OnDestroy, OnInit} from '@angular/core'; import {ActivatedRoute} from '@angular/router'; import {DaemonSetDetail} from '@api/backendapi'; -import {Subscription} from 'rxjs/Subscription'; +import {Subject} from 'rxjs'; +import {takeUntil} from 'rxjs/operators'; import {ActionbarService, ResourceMeta} from '../../../../common/services/global/actionbar'; import {NotificationsService} from '../../../../common/services/global/notifications'; @@ -27,8 +28,9 @@ import {NamespacedResourceService} from '../../../../common/services/resource/re templateUrl: './template.html', }) export class DaemonSetDetailComponent implements OnInit, OnDestroy { - private daemonSetSubscription_: Subscription; private readonly endpoint_ = EndpointManager.resource(Resource.daemonSet, true); + private readonly unsubscribe_ = new Subject(); + daemonSet: DaemonSetDetail; isInitialized = false; eventListEndpoint: string; @@ -39,7 +41,7 @@ export class DaemonSetDetailComponent implements OnInit, OnDestroy { private readonly daemonSet_: NamespacedResourceService, private readonly actionbar_: ActionbarService, private readonly activatedRoute_: ActivatedRoute, - private readonly notifications_: NotificationsService, + private readonly notifications_: NotificationsService ) {} ngOnInit(): void { @@ -50,8 +52,9 @@ export class DaemonSetDetailComponent implements OnInit, OnDestroy { this.podListEndpoint = this.endpoint_.child(resourceName, Resource.pod, resourceNamespace); this.serviceListEndpoint = this.endpoint_.child(resourceName, Resource.service, resourceNamespace); - this.daemonSetSubscription_ = this.daemonSet_ + this.daemonSet_ .get(this.endpoint_.detail(), resourceName, resourceNamespace) + .pipe(takeUntil(this.unsubscribe_)) .subscribe((d: DaemonSetDetail) => { this.daemonSet = d; this.notifications_.pushErrors(d.errors); @@ -61,7 +64,8 @@ export class DaemonSetDetailComponent implements OnInit, OnDestroy { } ngOnDestroy(): void { - this.daemonSetSubscription_.unsubscribe(); + this.unsubscribe_.next(); + this.unsubscribe_.complete(); this.actionbar_.onDetailsLeave.emit(); } } diff --git a/src/app/frontend/resource/workloads/deployment/detail/component.ts b/src/app/frontend/resource/workloads/deployment/detail/component.ts index 471ba0d74..4969ca5b8 100644 --- a/src/app/frontend/resource/workloads/deployment/detail/component.ts +++ b/src/app/frontend/resource/workloads/deployment/detail/component.ts @@ -45,7 +45,7 @@ export class DeploymentDetailComponent implements OnInit, OnDestroy { private readonly activatedRoute_: ActivatedRoute, private readonly actionbar_: ActionbarService, private readonly kdState_: KdStateService, - private readonly notifications_: NotificationsService, + private readonly notifications_: NotificationsService ) {} ngOnInit(): void { @@ -58,7 +58,7 @@ export class DeploymentDetailComponent implements OnInit, OnDestroy { this.horizontalPodAutoscalerEndpoint = this.endpoint_.child( resourceName, Resource.horizontalPodAutoscaler, - resourceNamespace, + resourceNamespace ); this.deployment_ @@ -83,7 +83,7 @@ export class DeploymentDetailComponent implements OnInit, OnDestroy { return this.kdState_.href( this.newReplicaSet.typeMeta.kind, this.newReplicaSet.objectMeta.name, - this.newReplicaSet.objectMeta.namespace, + this.newReplicaSet.objectMeta.namespace ); } diff --git a/src/app/frontend/resource/workloads/job/detail/component.ts b/src/app/frontend/resource/workloads/job/detail/component.ts index 1bc113bbb..55a0dd352 100644 --- a/src/app/frontend/resource/workloads/job/detail/component.ts +++ b/src/app/frontend/resource/workloads/job/detail/component.ts @@ -15,7 +15,8 @@ import {Component, OnDestroy, OnInit} from '@angular/core'; import {ActivatedRoute} from '@angular/router'; import {JobDetail} from '@api/backendapi'; -import {Subscription} from 'rxjs/Subscription'; +import {Subject} from 'rxjs'; +import {takeUntil} from 'rxjs/operators'; import {ActionbarService, ResourceMeta} from '../../../../common/services/global/actionbar'; import {NotificationsService} from '../../../../common/services/global/notifications'; @@ -27,8 +28,9 @@ import {NamespacedResourceService} from '../../../../common/services/resource/re templateUrl: './template.html', }) export class JobDetailComponent implements OnInit, OnDestroy { - private jobSubscription_: Subscription; private readonly endpoint_ = EndpointManager.resource(Resource.job, true); + private readonly unsubscribe_ = new Subject(); + job: JobDetail; isInitialized = false; eventListEndpoint: string; @@ -38,7 +40,7 @@ export class JobDetailComponent implements OnInit, OnDestroy { private readonly job_: NamespacedResourceService, private readonly actionbar_: ActionbarService, private readonly activatedRoute_: ActivatedRoute, - private readonly notifications_: NotificationsService, + private readonly notifications_: NotificationsService ) {} ngOnInit(): void { @@ -48,8 +50,9 @@ export class JobDetailComponent implements OnInit, OnDestroy { this.eventListEndpoint = this.endpoint_.child(resourceName, Resource.event, resourceNamespace); this.podListEndpoint = this.endpoint_.child(resourceName, Resource.pod, resourceNamespace); - this.jobSubscription_ = this.job_ + this.job_ .get(this.endpoint_.detail(), resourceName, resourceNamespace) + .pipe(takeUntil(this.unsubscribe_)) .subscribe((d: JobDetail) => { this.job = d; this.notifications_.pushErrors(d.errors); @@ -59,7 +62,8 @@ export class JobDetailComponent implements OnInit, OnDestroy { } ngOnDestroy(): void { - this.jobSubscription_.unsubscribe(); + this.unsubscribe_.next(); + this.unsubscribe_.complete(); this.actionbar_.onDetailsLeave.emit(); } } diff --git a/src/app/frontend/resource/workloads/pod/detail/component.ts b/src/app/frontend/resource/workloads/pod/detail/component.ts index 1dc2d348a..118e83fc9 100644 --- a/src/app/frontend/resource/workloads/pod/detail/component.ts +++ b/src/app/frontend/resource/workloads/pod/detail/component.ts @@ -15,7 +15,8 @@ import {Component, OnDestroy, OnInit} from '@angular/core'; import {ActivatedRoute} from '@angular/router'; import {Container, PodDetail} from '@api/backendapi'; -import {Subscription} from 'rxjs/Subscription'; +import {Subject} from 'rxjs'; +import {takeUntil} from 'rxjs/operators'; import {ActionbarService, ResourceMeta} from '../../../../common/services/global/actionbar'; import {NotificationsService} from '../../../../common/services/global/notifications'; @@ -28,8 +29,9 @@ import {NamespacedResourceService} from '../../../../common/services/resource/re templateUrl: './template.html', }) export class PodDetailComponent implements OnInit, OnDestroy { - private podSubscription_: Subscription; private readonly endpoint_ = EndpointManager.resource(Resource.pod, true); + private readonly unsubscribe_ = new Subject(); + pod: PodDetail; isInitialized = false; eventListEndpoint: string; @@ -40,7 +42,7 @@ export class PodDetailComponent implements OnInit, OnDestroy { private readonly actionbar_: ActionbarService, private readonly activatedRoute_: ActivatedRoute, private readonly kdState_: KdStateService, - private readonly notifications_: NotificationsService, + private readonly notifications_: NotificationsService ) {} ngOnInit(): void { @@ -50,8 +52,9 @@ export class PodDetailComponent implements OnInit, OnDestroy { this.eventListEndpoint = this.endpoint_.child(resourceName, Resource.event, resourceNamespace); this.pvcListEndpoint = this.endpoint_.child(resourceName, Resource.persistentVolumeClaim, resourceNamespace); - this.podSubscription_ = this.pod_ + this.pod_ .get(this.endpoint_.detail(), resourceName, resourceNamespace) + .pipe(takeUntil(this.unsubscribe_)) .subscribe((d: PodDetail) => { this.pod = d; this.notifications_.pushErrors(d.errors); @@ -61,7 +64,8 @@ export class PodDetailComponent implements OnInit, OnDestroy { } ngOnDestroy(): void { - this.podSubscription_.unsubscribe(); + this.unsubscribe_.next(); + this.unsubscribe_.complete(); this.actionbar_.onDetailsLeave.emit(); } diff --git a/src/app/frontend/resource/workloads/replicaset/detail/component.ts b/src/app/frontend/resource/workloads/replicaset/detail/component.ts index 733a8cf33..da0a412c5 100644 --- a/src/app/frontend/resource/workloads/replicaset/detail/component.ts +++ b/src/app/frontend/resource/workloads/replicaset/detail/component.ts @@ -15,7 +15,8 @@ import {Component, OnDestroy, OnInit} from '@angular/core'; import {ActivatedRoute} from '@angular/router'; import {ReplicaSetDetail} from '@api/backendapi'; -import {Subscription} from 'rxjs/Subscription'; +import {Subject} from 'rxjs'; +import {takeUntil} from 'rxjs/operators'; import {ActionbarService, ResourceMeta} from '../../../../common/services/global/actionbar'; import {NotificationsService} from '../../../../common/services/global/notifications'; @@ -27,8 +28,9 @@ import {NamespacedResourceService} from '../../../../common/services/resource/re templateUrl: './template.html', }) export class ReplicaSetDetailComponent implements OnInit, OnDestroy { - private replicaSetSubscription_: Subscription; private readonly endpoint_ = EndpointManager.resource(Resource.replicaSet, true); + private readonly unsubscribe_ = new Subject(); + replicaSet: ReplicaSetDetail; isInitialized = false; eventListEndpoint: string; @@ -39,7 +41,7 @@ export class ReplicaSetDetailComponent implements OnInit, OnDestroy { private readonly replicaSet_: NamespacedResourceService, private readonly actionbar_: ActionbarService, private readonly activatedRoute_: ActivatedRoute, - private readonly notifications_: NotificationsService, + private readonly notifications_: NotificationsService ) {} ngOnInit(): void { @@ -50,8 +52,9 @@ export class ReplicaSetDetailComponent implements OnInit, OnDestroy { this.podListEndpoint = this.endpoint_.child(resourceName, Resource.pod, resourceNamespace); this.serviceListEndpoint = this.endpoint_.child(resourceName, Resource.service, resourceNamespace); - this.replicaSetSubscription_ = this.replicaSet_ + this.replicaSet_ .get(this.endpoint_.detail(), resourceName, resourceNamespace) + .pipe(takeUntil(this.unsubscribe_)) .subscribe((d: ReplicaSetDetail) => { this.replicaSet = d; this.notifications_.pushErrors(d.errors); @@ -61,7 +64,8 @@ export class ReplicaSetDetailComponent implements OnInit, OnDestroy { } ngOnDestroy(): void { - this.replicaSetSubscription_.unsubscribe(); + this.unsubscribe_.next(); + this.unsubscribe_.complete(); this.actionbar_.onDetailsLeave.emit(); } } diff --git a/src/app/frontend/resource/workloads/replicationcontroller/detail/component.ts b/src/app/frontend/resource/workloads/replicationcontroller/detail/component.ts index a1e6c7f16..b1ceb5bcd 100644 --- a/src/app/frontend/resource/workloads/replicationcontroller/detail/component.ts +++ b/src/app/frontend/resource/workloads/replicationcontroller/detail/component.ts @@ -15,7 +15,8 @@ import {Component, OnDestroy, OnInit} from '@angular/core'; import {ActivatedRoute} from '@angular/router'; import {ReplicationControllerDetail} from '@api/backendapi'; -import {Subscription} from 'rxjs/Subscription'; +import {Subject} from 'rxjs'; +import {takeUntil} from 'rxjs/operators'; import {ActionbarService, ResourceMeta} from '../../../../common/services/global/actionbar'; import {NotificationsService} from '../../../../common/services/global/notifications'; @@ -27,8 +28,9 @@ import {NamespacedResourceService} from '../../../../common/services/resource/re templateUrl: './template.html', }) export class ReplicationControllerDetailComponent implements OnInit, OnDestroy { - private replicationControllerSubscription_: Subscription; private readonly endpoint_ = EndpointManager.resource(Resource.replicationController, true); + private readonly unsubscribe_ = new Subject(); + replicationController: ReplicationControllerDetail; isInitialized = false; eventListEndpoint: string; @@ -39,7 +41,7 @@ export class ReplicationControllerDetailComponent implements OnInit, OnDestroy { private readonly replicationController_: NamespacedResourceService, private readonly actionbar_: ActionbarService, private readonly activatedRoute_: ActivatedRoute, - private readonly notifications_: NotificationsService, + private readonly notifications_: NotificationsService ) {} ngOnInit(): void { @@ -50,8 +52,9 @@ export class ReplicationControllerDetailComponent implements OnInit, OnDestroy { this.podListEndpoint = this.endpoint_.child(resourceName, Resource.pod, resourceNamespace); this.serviceListEndpoint = this.endpoint_.child(resourceName, Resource.service, resourceNamespace); - this.replicationControllerSubscription_ = this.replicationController_ + this.replicationController_ .get(this.endpoint_.detail(), resourceName, resourceNamespace) + .pipe(takeUntil(this.unsubscribe_)) .subscribe((d: ReplicationControllerDetail) => { this.replicationController = d; this.notifications_.pushErrors(d.errors); @@ -61,7 +64,8 @@ export class ReplicationControllerDetailComponent implements OnInit, OnDestroy { } ngOnDestroy(): void { - this.replicationControllerSubscription_.unsubscribe(); + this.unsubscribe_.next(); + this.unsubscribe_.complete(); this.actionbar_.onDetailsLeave.emit(); } } diff --git a/src/app/frontend/resource/workloads/statefulset/detail/component.ts b/src/app/frontend/resource/workloads/statefulset/detail/component.ts index 4ffb2e905..a87610eb9 100644 --- a/src/app/frontend/resource/workloads/statefulset/detail/component.ts +++ b/src/app/frontend/resource/workloads/statefulset/detail/component.ts @@ -15,7 +15,8 @@ import {Component, OnDestroy, OnInit} from '@angular/core'; import {ActivatedRoute} from '@angular/router'; import {StatefulSetDetail} from '@api/backendapi'; -import {Subscription} from 'rxjs/Subscription'; +import {Subject} from 'rxjs'; +import {takeUntil} from 'rxjs/operators'; import {ActionbarService, ResourceMeta} from '../../../../common/services/global/actionbar'; import {NotificationsService} from '../../../../common/services/global/notifications'; @@ -27,8 +28,9 @@ import {NamespacedResourceService} from '../../../../common/services/resource/re templateUrl: './template.html', }) export class StatefulSetDetailComponent implements OnInit, OnDestroy { - private statefulSetSubscription_: Subscription; private readonly endpoint_ = EndpointManager.resource(Resource.statefulSet, true); + private readonly unsubscribe_ = new Subject(); + statefulSet: StatefulSetDetail; isInitialized = false; podListEndpoint: string; @@ -38,7 +40,7 @@ export class StatefulSetDetailComponent implements OnInit, OnDestroy { private readonly statefulSet_: NamespacedResourceService, private readonly actionbar_: ActionbarService, private readonly activatedRoute_: ActivatedRoute, - private readonly notifications_: NotificationsService, + private readonly notifications_: NotificationsService ) {} ngOnInit(): void { @@ -48,8 +50,9 @@ export class StatefulSetDetailComponent implements OnInit, OnDestroy { this.podListEndpoint = this.endpoint_.child(resourceName, Resource.pod, resourceNamespace); this.eventListEndpoint = this.endpoint_.child(resourceName, Resource.event, resourceNamespace); - this.statefulSetSubscription_ = this.statefulSet_ + this.statefulSet_ .get(this.endpoint_.detail(), resourceName, resourceNamespace) + .pipe(takeUntil(this.unsubscribe_)) .subscribe((d: StatefulSetDetail) => { this.statefulSet = d; this.notifications_.pushErrors(d.errors); @@ -59,7 +62,8 @@ export class StatefulSetDetailComponent implements OnInit, OnDestroy { } ngOnDestroy(): void { - this.statefulSetSubscription_.unsubscribe(); + this.unsubscribe_.next(); + this.unsubscribe_.complete(); this.actionbar_.onDetailsLeave.emit(); } } diff --git a/src/app/frontend/settings/global/component.ts b/src/app/frontend/settings/global/component.ts index cd793b4f5..b227c42ff 100644 --- a/src/app/frontend/settings/global/component.ts +++ b/src/app/frontend/settings/global/component.ts @@ -16,8 +16,8 @@ import {Component, OnDestroy, OnInit} from '@angular/core'; import {NgForm} from '@angular/forms'; import {MatDialog} from '@angular/material/dialog'; import {GlobalSettings} from '@api/backendapi'; -import {Subject} from 'rxjs'; -import {takeUntil} from 'rxjs/operators'; +import {of, Subject} from 'rxjs'; +import {catchError, takeUntil, tap} from 'rxjs/operators'; import {GlobalSettingsService} from '../../common/services/global/globalsettings'; import {TitleService} from '../../common/services/global/title'; @@ -31,15 +31,15 @@ import {SaveAnywayDialog} from './saveanywaysdialog/dialog'; export class GlobalSettingsComponent implements OnInit, OnDestroy { // Keep it in sync with ConcurrentSettingsChangeError constant from the backend. private readonly concurrentChangeErr_ = 'settings changed since last reload'; + private readonly unsubscribe_ = new Subject(); + settings: GlobalSettings = {} as GlobalSettings; hasLoadError = false; - private readonly unsubscribe_ = new Subject(); - constructor( private readonly settings_: GlobalSettingsService, private readonly dialog_: MatDialog, - private readonly title_: TitleService, + private readonly title_: TitleService ) {} ngOnInit(): void { @@ -81,29 +81,33 @@ export class GlobalSettingsComponent implements OnInit, OnDestroy { } save(form: NgForm): void { - this.settings_.save(this.settings).subscribe( - () => { - this.load(form); - this.title_.update(); - this.settings_.onSettingsUpdate.next(); - }, - err => { - if (err && err.data.indexOf(this.concurrentChangeErr_) !== -1) { - this.dialog_ - .open(SaveAnywayDialog, {width: '420px'}) - .afterClosed() - .subscribe(result => { - if (result === true) { - // Backend was refreshed with the PUT request, so the second try will be - // successful unless yet another concurrent change will happen. In that case - // "save anyways" dialog will be shown again. - this.save(form); - } else { - this.load(form); - } - }); + this.settings_ + .save(this.settings) + .pipe( + tap(_ => { + this.load(form); + this.title_.update(); + this.settings_.onSettingsUpdate.next(); + }) + ) + .pipe( + catchError(err => { + if (err && err.data.indexOf(this.concurrentChangeErr_) !== -1) { + return this.dialog_.open(SaveAnywayDialog, {width: '420px'}).afterClosed(); + } + + return of(false); + }) + ) + .subscribe(result => { + if (result === true) { + // Backend was refreshed with the PUT request, so the second try will be + // successful unless yet another concurrent change will happen. In that case + // "save anyways" dialog will be shown again. + this.save(form); + } else { + this.load(form); } - }, - ); + }); } } diff --git a/src/app/frontend/shell/component.ts b/src/app/frontend/shell/component.ts index 9d68a33ee..7d0acbb0f 100644 --- a/src/app/frontend/shell/component.ts +++ b/src/app/frontend/shell/component.ts @@ -67,7 +67,7 @@ export class ShellComponent implements AfterViewInit, OnDestroy { private readonly activatedRoute_: ActivatedRoute, private readonly matSnackBar_: MatSnackBar, private readonly cdr_: ChangeDetectorRef, - private readonly _router: Router, + private readonly _router: Router ) { this.namespace_ = this.activatedRoute_.snapshot.params.resourceNamespace; this.podName = this.activatedRoute_.snapshot.params.resourceName; @@ -259,7 +259,7 @@ export class ShellComponent implements AfterViewInit, OnDestroy { Data: str, Cols: this.term.cols, Rows: this.term.rows, - }), + }) ); } } @@ -271,7 +271,7 @@ export class ShellComponent implements AfterViewInit, OnDestroy { Op: 'resize', Cols: this.term.cols, Rows: this.term.rows, - }), + }) ); } } -- GitLab