Fixing app crash when iterating Events without 'kind' prop defined (#743)

* Checking for 'kind' to be defined
Inside 'involvedObject' of Event

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Fixing resource var definition

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Reverting to link rendering in Events

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Explicitly return emty link if no 'kind' available

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Removing lowercase of url path

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev authored and GitHub committed 2020-09-01 10:36:44 +03:00
1 parent 505a5c7d9f
commit f4d262b294
2 files changed
+4 -1

No files matched your search

+3 -1
View File
@@ -121,6 +121,8 @@ export function lookupApiLink(ref: IKubeObjectRef, parentObject: KubeObject): st
namespace = parentObject.getNs()
} = ref;
if (!kind) return "";
// search in registered apis by 'kind' & 'apiVersion'
const api = apiManager.getApi(api => api.kind === kind && api.apiVersionWithGroup == apiVersion)
if (api) {
@@ -129,7 +131,7 @@ export function lookupApiLink(ref: IKubeObjectRef, parentObject: KubeObject): st
// lookup api by generated resource link
const apiPrefixes = ["/apis", "/api"];
const resource = kind.toLowerCase() + kind.endsWith("s") ? "es" : "s";
const resource = kind.endsWith("s") ? `${kind.toLowerCase()}es` : `${kind.toLowerCase()}s`;
for (const apiPrefix of apiPrefixes) {
const apiLink = createKubeApiURL({ apiPrefix, apiVersion, name, namespace, resource });
if (apiManager.getApi(apiLink)) {
+1
View File
@@ -69,6 +69,7 @@ export function getSelectedDetails() {
}
export function getDetailsUrl(details: string) {
if (!details) return "";
return getQueryString({
details: details,
selected: getSelectedDetails(),