From d922cc2827304fb3315fc9690d757e9026785342 Mon Sep 17 00:00:00 2001 From: Jeff Cantrill Date: Wed, 29 Aug 2018 10:39:04 -0400 Subject: [PATCH] bug 1614255. Remove posting token for use with oauth-proxy --- app/scripts/directives/logViewer.js | 18 +- app/scripts/services/logLinks.js | 7 +- app/views/directives/logs/_log-viewer.html | 10 +- dist/scripts/scripts.js | 234 ++++++++++----------- dist/scripts/templates.js | 8 +- 5 files changed, 127 insertions(+), 150 deletions(-) diff --git a/app/scripts/directives/logViewer.js b/app/scripts/directives/logViewer.js index 7e7470b5b8..bd5e31f6b1 100644 --- a/app/scripts/directives/logViewer.js +++ b/app/scripts/directives/logViewer.js @@ -434,23 +434,10 @@ angular.module('openshiftConsole') if(!(projectName && containerName && name && url)) { return; } - - // 3 things needed: - // - kibanaAuthUrl to authorize user - // - access_token - // - kibanaArchiveUrl for the final destination once auth'd - angular.extend($scope, { - kibanaAuthUrl: $sce.trustAsResourceUrl(URI(url) - .segment('auth').segment('token') - .normalizePathname().toString()), - access_token: AuthService.UserStore().getToken() - }); - $scope.$watchGroup(['context.project.metadata.name', 'options.container', 'name'], function() { angular.extend($scope, { - // The archive URL violates angular's built in same origin policy. - // Need to explicitly tell it to trust this location or it will throw errors. kibanaArchiveUrl: $sce.trustAsResourceUrl(logLinks.archiveUri({ + baseURL: url, namespace: $scope.context.project.metadata.name, namespaceUid: $scope.context.project.metadata.uid, podname: name, @@ -461,9 +448,6 @@ angular.module('openshiftConsole') }); }); - - - // PUBLIC API ---------------------------------------------------- this.cacheScrollableNode = function(node) { diff --git a/app/scripts/services/logLinks.js b/app/scripts/services/logLinks.js index 20cfb2a928..4ed46dba2b 100644 --- a/app/scripts/services/logLinks.js +++ b/app/scripts/services/logLinks.js @@ -46,7 +46,7 @@ angular.module('openshiftConsole') // broken up for readability: var template = _.template([ - "/#/discover?", + "<%= baseURL %>#/discover?", "_g=(", "time:(", "from:now-1w,", @@ -76,6 +76,11 @@ angular.module('openshiftConsole') var archiveUri = function(opts, prefix) { prefix = prefix || 'project.' + opts.namespace + '.' + opts.namespaceUid; opts.index = prefix + '.*'; + + if (opts.baseURL.substr(-1) !== '/') { + opts.baseURL += '/'; + } + return template(opts); }; diff --git a/app/views/directives/logs/_log-viewer.html b/app/views/directives/logs/_log-viewer.html index 29674f2e02..1b6bcefeb9 100644 --- a/app/views/directives/logs/_log-viewer.html +++ b/app/views/directives/logs/_log-viewer.html @@ -6,14 +6,8 @@ extension-name="log-links" extension-types="link dom" extension-args="[object, options]"> - -
- - - -
+ + View Archive | diff --git a/dist/scripts/scripts.js b/dist/scripts/scripts.js index 3450e3820b..4ca8743051 100644 --- a/dist/scripts/scripts.js +++ b/dist/scripts/scripts.js @@ -1,20 +1,20 @@ "use strict"; function OverviewController(e, t, n, r, a, o, i, s, c, l, u, d, m, p, f, g, v, h, y, b, S, C, w, P, j, k, I, R, E, T, N) { -function A(e) { +function D(e) { var t = e.metadata.ownerReferences; return t ? _(t).filter({ kind: "OfflineVirtualMachine" }).map("uid").first() : null; } -function D() { +function A() { if (B.offlineVirtualMachines && B.virtualMachines && B.pods) { var e = _(B.pods).values().filter(function(e) { return !!_.get(e, 'metadata.labels["kubevirt.io/vmUID"]'); }).keyBy('metadata.labels["kubevirt.io/vmUID"]').value(), t = _(B.virtualMachines).values().filter(function(e) { -return !!A(e); +return !!D(e); }).keyBy(function(e) { -return A(e); +return D(e); }).value(), n = []; _.each(B.offlineVirtualMachines, function(r) { var a = r.metadata.uid, o = t[a]; @@ -130,14 +130,14 @@ return _.isEmpty(be.pipelinesByDeploymentConfig[t]); B.deploymentConfigsNoPipeline = _.sortBy(e, "metadata.name"), B.pipelineViewHasOtherResources = !(_.isEmpty(B.deploymentConfigsNoPipeline) && _.isEmpty(B.vanillaReplicationControllers) && _.isEmpty(B.deployments) && _.isEmpty(B.vanillaReplicaSets) && _.isEmpty(B.statefulSets) && _.isEmpty(B.monopods)); }, Ne = function() { B.disableFilter = "pipeline" === B.viewBy && _.isEmpty(B.pipelineBuildConfigs); -}, Ae = function(e) { +}, De = function(e) { return b.getLabelSelector().select(e); -}, De = [ "metadata.name", "spec.clusterServiceClassExternalName" ], $e = function(e) { -return y.filterForKeywords(e, De, be.filterKeywords); +}, Ae = [ "metadata.name", "spec.clusterServiceClassExternalName" ], $e = function(e) { +return y.filterForKeywords(e, Ae, be.filterKeywords); }, Be = function(e) { switch (B.filterBy) { case "label": -return Ae(e); +return De(e); case "name": return $e(e); @@ -157,7 +157,7 @@ B.filteredDeploymentConfigs = Be(B.deploymentConfigs), B.filteredReplicationCont B.viewBy = localStorage.getItem(Oe) || "app", e.$watch(function() { return B.viewBy; }, function(e) { -localStorage.setItem(Oe, e), Ne(), De = "app" === B.viewBy ? [ "metadata.name", "metadata.labels.app" ] : [ "metadata.name" ], Le(), "pipeline" === B.viewBy ? b.setLabelSuggestions(he) : b.setLabelSuggestions(ve); +localStorage.setItem(Oe, e), Ne(), Ae = "app" === B.viewBy ? [ "metadata.name", "metadata.labels.app" ] : [ "metadata.name" ], Le(), "pipeline" === B.viewBy ? b.setLabelSuggestions(he) : b.setLabelSuggestions(ve); }), d.DISABLE_OVERVIEW_METRICS || (C.isAvailable(!0).then(function(e) { be.showMetrics = e; }), e.$on("metrics-connection-failed", function(e, t) { @@ -240,7 +240,7 @@ _.isEmpty(e) || (b.addLabelSuggestionsFromResources(e, he), "pipeline" === B.vie }, nt = function(e) { return "Succeeded" !== e.status.phase && "Failed" !== e.status.phase && (!H(e, "openshift.io/deployer-pod-for.name") && (!O(e, "openshift.io/build.name") && "slave" !== H(e, "jenkins"))); }, rt = function() { -be.podsByOwnerUID = j.groupByOwnerUID(B.pods), B.monopods = _.filter(be.podsByOwnerUID[""], nt), D(); +be.podsByOwnerUID = j.groupByOwnerUID(B.pods), B.monopods = _.filter(be.podsByOwnerUID[""], nt), A(); }, at = function(e) { return !!_.get(e, "status.replicas") || (!O(e, "deploymentConfig") || x(e)); }, ot = function(e) { @@ -495,13 +495,13 @@ poll: V, pollInterval: 6e4 })), e.KUBEVIRT_ENABLED) { Rt.push(m.watch(N.offlineVirtualMachine, r, function(e) { -B.offlineVirtualMachines = e.by("metadata.name"), D(), Le(); +B.offlineVirtualMachines = e.by("metadata.name"), A(), Le(); }, { poll: V, pollInterval: 6e4 })); Rt.push(m.watch(N.virtualMachine, r, function(e) { -B.virtualMachines = e.by("metadata.name"), D(), Le(); +B.virtualMachines = e.by("metadata.name"), A(), Le(); }, { poll: V, pollInterval: 6e4 @@ -4971,7 +4971,7 @@ name: e.containerName }), n = I(t); e.containerState = n; }); -}, N = e("annotation"), A = function(e, t) { +}, N = e("annotation"), D = function(e, t) { if (r.loaded = !0, r.pod = e, r.dcName = N(e, "deploymentConfig"), r.rcName = N(e, "deployment"), r.deploymentVersion = N(e, "deploymentVersion"), r.logCanRun = !_.includes([ "New", "Pending", "Unknown" ], e.status.phase), S(), delete r.controllerRef, !r.dcName) { var n = m.getControllerReferences(e); r.controllerRef = _.find(n, function(e) { @@ -4987,10 +4987,10 @@ f.get(n.project).then(_.spread(function(t, a) { b = a, r.project = t, r.projectContext = a, s.get(r.podsVersion, n.pod, a, { errorNotification: !1 }).then(function(e) { -A(e); +D(e); var t = {}; t[e.metadata.name] = e, r.logOptions.container = n.container || e.spec.containers[0].name, r.containerTerminals = R(), E(e), l.fetchReferencedImageStreamImages(t, r.imagesByDockerReference, r.imageStreamImageRefByDockerReference, b), h.push(s.watchObject(r.podsVersion, n.pod, a, function(e, t) { -A(e, t), T(r.containerTerminals), E(e); +D(e, t), T(r.containerTerminals), E(e); })); }, function(t) { r.loaded = !0, r.alerts.load = { @@ -5191,12 +5191,12 @@ n.filteredStatefulSets = c.filterForKeywords(_.values(n.statefulSets), P, j); C = _.filter(n.pods, function(e) { return !n.filters.hideOlderResources || "Succeeded" !== e.status.phase && "Failed" !== e.status.phase; }), n.filteredPods = c.filterForKeywords(C, P, j); -}, A = r("isIncompleteBuild"), D = r("buildConfigForBuild"), B = r("isRecentBuild"), V = function() { +}, D = r("isIncompleteBuild"), A = r("buildConfigForBuild"), B = r("isRecentBuild"), V = function() { moment().subtract(5, "m"); y = _.filter(n.builds, function(e) { if (!n.filters.hideOlderResources) return !0; -if (A(e)) return !0; -var t = D(e); +if (D(e)) return !0; +var t = A(e); return t ? n.latestBuildByConfig[t].metadata.name === e.metadata.name : B(e); }), n.filteredBuilds = c.filterForKeywords(y, P, j); }, L = r("deploymentStatus"), O = r("deploymentIsInProgress"), U = function() { @@ -5408,7 +5408,7 @@ return e ? r + (y(e, "description") || "") : ""; } } }); -var A = function(e, t, n, a) { +var D = function(e, t, n, a) { var o = { title: "Confirm Removal", alerts: {}, @@ -5455,7 +5455,7 @@ project: n, subjectKinds: N, canUpdateRolebindings: b("rolebindings", "update", v), confirmRemove: function(n, a, i, s) { -var l = null, u = A(n, a, i, r.user.metadata.name); +var l = null, u = D(n, a, i, r.user.metadata.name); _.isEqual(n, r.user.metadata.name) && d.isLastRole(r.user.metadata.name, r.roleBindings) && (l = !0), o.open({ templateUrl: "views/modals/confirm.html", controller: "ConfirmModalController", @@ -6194,7 +6194,7 @@ o.unwatchAll(j); }); })); } ]), angular.module("openshiftConsole").controller("ReplicaSetController", [ "$scope", "$filter", "$routeParams", "APIService", "AuthorizationService", "BreadcrumbsService", "DataService", "DeploymentsService", "HPAService", "ImageStreamResolver", "keyValueEditorUtils", "kind", "Logger", "MetricsService", "ModalsService", "Navigate", "OwnerReferencesService", "PodsService", "ProjectsService", "StorageService", function(e, t, n, r, a, o, i, s, c, l, u, d, m, p, f, g, v, h, y, b) { -var S = !1, C = t("annotation"), w = t("humanizeKind")(d), P = t("hasDeployment"), j = r.getPreferredVersion("builds"), k = r.getPreferredVersion("imagestreams"), I = r.getPreferredVersion("horizontalpodautoscalers"), R = r.getPreferredVersion("limitranges"), E = r.getPreferredVersion("pods"), T = r.getPreferredVersion("replicasets"), N = r.getPreferredVersion("replicationcontrollers"), A = r.getPreferredVersion("resourcequotas"), D = r.getPreferredVersion("appliedclusterresourcequotas"); +var S = !1, C = t("annotation"), w = t("humanizeKind")(d), P = t("hasDeployment"), j = r.getPreferredVersion("builds"), k = r.getPreferredVersion("imagestreams"), I = r.getPreferredVersion("horizontalpodautoscalers"), R = r.getPreferredVersion("limitranges"), E = r.getPreferredVersion("pods"), T = r.getPreferredVersion("replicasets"), N = r.getPreferredVersion("replicationcontrollers"), D = r.getPreferredVersion("resourcequotas"), A = r.getPreferredVersion("appliedclusterresourcequotas"); switch (d) { case "ReplicaSet": e.resource = T, e.healthCheckURL = g.healthCheckURL(n.project, "ReplicaSet", n.replicaSet, "extensions"); @@ -6342,12 +6342,12 @@ pollInterval: 6e4 })), i.list(R, u).then(function(t) { e.limitRanges = t.by("metadata.name"), U(); }); -B.push(i.watch(A, u, function(t) { +B.push(i.watch(D, u, function(t) { e.quotas = t.by("metadata.name"); }, { poll: !0, pollInterval: 6e4 -})), B.push(i.watch(D, u, function(t) { +})), B.push(i.watch(A, u, function(t) { e.clusterQuotas = t.by("metadata.name"); }, { poll: !0, @@ -7260,7 +7260,7 @@ return _.map(e, "metadata.name"); }); e.webhookSecrets = m.groupSecretsByType(t).webhook, e.webhookSecrets.unshift(""), e.secrets.secretsByType = _.each(r, function(e) { e.unshift(""); -}), A(), P = S(t.by("metadata.name")), e.valueFromObjects = w.concat(P); +}), D(), P = S(t.by("metadata.name")), e.valueFromObjects = w.concat(P); }); var n = function(e, n) { e.type = n && n.kind ? n.kind : "None"; @@ -7407,7 +7407,7 @@ var t = [].concat(e.triggers.imageChangeTriggers, e.triggers.builderImageChangeT return t = _.filter(t, function(e) { return _.has(e, "disabled") && !e.disabled || e.present; }), t = t.concat(T(e.triggers.webhookTriggers)), t = _.map(t, "data"); -}, A = function() { +}, D = function() { switch (e.secrets.picked = { gitSecret: e.buildConfig.spec.source.sourceSecret ? [ e.buildConfig.spec.source.sourceSecret ] : [ { name: "" @@ -7437,7 +7437,7 @@ name: "" mountPath: "" } ]; } -}, D = function(e, t, n) { +}, A = function(e, t, n) { t.name ? e[n] = t : delete e[n]; }, $ = function(t, n) { var r = "Custom" === e.strategyType ? "secretSource" : "secret", a = _.filter(n, function(e) { @@ -7458,7 +7458,7 @@ break; case "JenkinsPipeline": "path" === e.jenkinsfileOptions.type ? delete e.updatedBuildConfig.spec.strategy.jenkinsPipelineStrategy.jenkinsfile : delete e.updatedBuildConfig.spec.strategy.jenkinsPipelineStrategy.jenkinsfilePath; } -switch (e.sources.images && !_.isEmpty(e.sourceImages) && (e.updatedBuildConfig.spec.source.images[0].paths = R(e.imageSourcePaths), e.updatedBuildConfig.spec.source.images[0].from = E(e.imageOptions.fromSource)), "None" === e.imageOptions.from.type ? delete b(e.updatedBuildConfig).from : b(e.updatedBuildConfig).from = E(e.imageOptions.from), "None" === e.imageOptions.to.type ? delete e.updatedBuildConfig.spec.output.to : e.updatedBuildConfig.spec.output.to = E(e.imageOptions.to), b(e.updatedBuildConfig).env = p.compactEntries(e.envVars), D(e.updatedBuildConfig.spec.source, _.head(e.secrets.picked.gitSecret), "sourceSecret"), D(b(e.updatedBuildConfig), _.head(e.secrets.picked.pullSecret), "pullSecret"), D(e.updatedBuildConfig.spec.output, _.head(e.secrets.picked.pushSecret), "pushSecret"), e.strategyType) { +switch (e.sources.images && !_.isEmpty(e.sourceImages) && (e.updatedBuildConfig.spec.source.images[0].paths = R(e.imageSourcePaths), e.updatedBuildConfig.spec.source.images[0].from = E(e.imageOptions.fromSource)), "None" === e.imageOptions.from.type ? delete b(e.updatedBuildConfig).from : b(e.updatedBuildConfig).from = E(e.imageOptions.from), "None" === e.imageOptions.to.type ? delete e.updatedBuildConfig.spec.output.to : e.updatedBuildConfig.spec.output.to = E(e.imageOptions.to), b(e.updatedBuildConfig).env = p.compactEntries(e.envVars), A(e.updatedBuildConfig.spec.source, _.head(e.secrets.picked.gitSecret), "sourceSecret"), A(b(e.updatedBuildConfig), _.head(e.secrets.picked.pullSecret), "pullSecret"), A(e.updatedBuildConfig.spec.output, _.head(e.secrets.picked.pushSecret), "pushSecret"), e.strategyType) { case "Source": case "Docker": $(e.updatedBuildConfig.spec.source, e.secrets.picked.sourceSecrets); @@ -8124,13 +8124,13 @@ g.hideNotification("create-builder-list-config-maps-error"), g.hideNotification( }); }; e.$on("$destroy", N); -var A = i.getPreferredVersion("configmaps"), D = i.getPreferredVersion("limitranges"), $ = i.getPreferredVersion("imagestreams"), B = i.getPreferredVersion("imagestreamtags"), V = i.getPreferredVersion("secrets"), L = i.getPreferredVersion("resourcequotas"), O = i.getPreferredVersion("appliedclusterresourcequotas"); +var D = i.getPreferredVersion("configmaps"), A = i.getPreferredVersion("limitranges"), $ = i.getPreferredVersion("imagestreams"), B = i.getPreferredVersion("imagestreamtags"), V = i.getPreferredVersion("secrets"), L = i.getPreferredVersion("resourcequotas"), O = i.getPreferredVersion("appliedclusterresourcequotas"); v.get(a.project).then(_.spread(function(t, n) { e.project = t, a.sourceURI && (e.sourceURIinParams = !0), e.hasClusterResourceOverrides = d.hasClusterResourceOverrides(t); var i = function() { e.cpuProblems = d.validatePodLimits(e.limitRanges, "cpu", [ e.container ], t), e.memoryProblems = d.validatePodLimits(e.limitRanges, "memory", [ e.container ], t); }; -c.list(D, n).then(function(t) { +c.list(A, n).then(function(t) { e.limitRanges = t.by("metadata.name"), _.isEmpty(e.limitRanges) || e.$watch("container", i, !0); }); var v, y, C = function() { @@ -8182,7 +8182,7 @@ return r.buildConfig.sourceUrl === _.get(r, "image.metadata.annotations.sampleRe e.metricsWarning = !t; }); var o = [], i = []; -e.valueFromObjects = [], c.list(A, n, null, { +e.valueFromObjects = [], c.list(D, n, null, { errorNotification: !1 }).then(function(t) { o = R(t.by("metadata.name")), e.valueFromObjects = o.concat(i); @@ -9992,9 +9992,9 @@ details: e("getErrorDetails")(n) } function w() { var e = { -started: "Creating resources in project " + D(p.input.selectedProject), -success: "Creating resources in project " + D(p.input.selectedProject), -failure: "Failed to create some resources in project " + D(p.input.selectedProject) +started: "Creating resources in project " + A(p.input.selectedProject), +success: "Creating resources in project " + A(p.input.selectedProject), +failure: "Failed to create some resources in project " + A(p.input.selectedProject) }, t = {}; d.add(e, t, p.input.selectedProject.metadata.name, function() { var e = n.defer(); @@ -10029,9 +10029,9 @@ hasErrors: r } function P() { var e = { -started: "Updating resources in project " + D(p.input.selectedProject), -success: "Updated resources in project " + D(p.input.selectedProject), -failure: "Failed to update some resources in project " + D(p.input.selectedProject) +started: "Updating resources in project " + A(p.input.selectedProject), +success: "Updated resources in project " + A(p.input.selectedProject), +failure: "Failed to update some resources in project " + A(p.input.selectedProject) }, t = {}; d.add(e, t, p.input.selectedProject.metadata.name, function() { var e = n.defer(); @@ -10114,7 +10114,7 @@ type: "error" }).length ? (_.each(E, function(e) { e.id = _.uniqueId("from-file-alert-"), c.addNotification(e); }), p.disableInputs = !1) : E.length ? (R(E), p.disableInputs = !1) : y(); -}, A = function() { +}, D = function() { if (_.has(p.input.selectedProject, "metadata.uid")) return n.when(p.input.selectedProject); var t = p.input.selectedProject.metadata.name, r = p.input.selectedProject.metadata.annotations["new-display-name"], a = e("description")(p.input.selectedProject); return m.create(t, r, a); @@ -10129,7 +10129,7 @@ var e = []; p.errorOccurred = !1, _.forEach(p.resourceList, function(t) { if (!g(t)) return p.errorOccurred = !0, !1; e.push(S(t)); -}), A().then(function(t) { +}), D().then(function(t) { p.input.selectedProject = t, n.all(e).then(function() { p.errorOccurred || (1 === p.createResources.length && "Template" === p.resourceList[0].kind ? v() : _.isEmpty(p.updateResources) ? l.getLatestQuotaAlerts(p.createResources, { namespace: p.input.selectedProject.metadata.name @@ -10147,7 +10147,7 @@ details: I(e) }, p.cancel = function() { T(), s.toProjectOverview(p.input.selectedProject.metadata.name); }; -var D = e("displayName"); +var A = e("displayName"); p.$on("importFileFromYAMLOrJSON", p.create), p.$on("$destroy", T); } ] }; @@ -11026,11 +11026,11 @@ _.size(h) <= 100 ? (y = e("orderByDisplayName")(h), T = _.map(y, function(e) { return n(e, !1); })) : T = [ n(h[t], !0) ], E.empty(), E.append(T), E.append($('')), E.append($('')), E.selectpicker("refresh"); } -}, A = function() { +}, D = function() { return f.list().then(function(e) { h = e.by("metadata.name"); }); -}, D = function() { +}, A = function() { k(R); var e = a.project; if (i.currentProjectName !== e) { @@ -11047,7 +11047,7 @@ n.all([ r, a ]).then(function() { i.catalogItems = c.sortCatalogItems(_.concat(t, o)); }); } -}), A().then(function() { +}), D().then(function() { i.currentProjectName && h && (h[i.currentProjectName] || (h[i.currentProjectName] = { metadata: { name: i.currentProjectName @@ -11087,7 +11087,7 @@ m.toProjectCatalog(i.currentProjectName, n); }); i.closeOrderingPanel = function() { v.addItem(_.get(i.selectedItem, "resource.metadata.uid")), i.orderingPanelVisible = !1; -}, D(), i.$on("$routeChangeSuccess", D), E.change(function() { +}, A(), i.$on("$routeChangeSuccess", A), E.change(function() { var e = $(this).val(), t = "" === e ? "projects" : g(e); I(t); }), i.$on("$destroy", function() { @@ -12083,7 +12083,7 @@ Available: "#d1d1d1" } }; R[t.id] ? R[t.id].load(a) : ((n = B(e)).data = a, r(function() { -D || (R[t.id] = c3.generate(n)); +A || (R[t.id] = c3.generate(n)); })); } } @@ -12099,7 +12099,7 @@ var n, a = c.getSparklineData(t), o = e.chartPrefix + "sparkline"; E[o] ? E[o].load(a) : ((n = V(e)).data = a, e.chartDataColors && (n.color = { pattern: e.chartDataColors }), r(function() { -D || (E[o] = c3.generate(n)); +A || (E[o] = c3.generate(n)); })); } } @@ -12110,7 +12110,7 @@ function h() { return 60 * m.options.timeRange.value * 1e3; } function y() { -return Math.floor(h() / A) + "ms"; +return Math.floor(h() / D) + "ms"; } function b(e, t, n) { var r, a = { @@ -12125,12 +12125,12 @@ containerName: e.containerMetric ? m.options.selectedContainer.name : "pod" }) : null; } function S() { -D || (L = 0, _.each(m.metrics, function(e) { +A || (L = 0, _.each(m.metrics, function(e) { g(e), f(e); })); } function C(e) { -if (!D) if (L++, m.noData) m.metricsError = { +if (!A) if (L++, m.noData) m.metricsError = { status: _.get(e, "status", 0), details: _.get(e, "data.errorMsg") || _.get(e, "statusText") || "Status code " + _.get(e, "status", 0) }; else if (!(L < 2)) { @@ -12159,7 +12159,7 @@ isNaN(r) && (r = 0), e.convert && (r = e.convert(r)), t.used = d3.round(r, e.usa function j(e, t) { m.noData = !1; var n = _.initial(t.data); -e.data ? e.data = _.chain(e.data).takeRight(A).concat(n).value() : e.data = n; +e.data ? e.data = _.chain(e.data).takeRight(D).concat(n).value() : e.data = n; } function k() { if (w()) { @@ -12175,7 +12175,7 @@ P(n, a, e); })); } }), t = t.concat(r), a.all(r).then(function(e) { -D || angular.forEach(e, function(e) { +A || angular.forEach(e, function(e) { e && j(_.find(n.datasets, { id: e.metricID }), e); @@ -12187,7 +12187,7 @@ m.loaded = !0; } } m.includedMetrics = m.includedMetrics || [ "cpu", "memory", "network" ]; -var I, R = {}, E = {}, T = n("resources.limits.memory"), N = n("resources.limits.cpu"), A = 30, D = !1; +var I, R = {}, E = {}, T = n("resources.limits.memory"), N = n("resources.limits.cpu"), D = 30, A = !1; m.uniqueID = c.uniqueID(), m.metrics = [], _.includes(m.includedMetrics, "memory") && m.metrics.push({ label: "Memory", units: "MiB", @@ -12291,7 +12291,7 @@ I && (t.cancel(I), I = null), O && (O(), O = null), angular.forEach(R, function( e.destroy(); }), R = null, angular.forEach(E, function(e) { e.destroy(); -}), E = null, D = !0; +}), E = null, A = !0; }); } }; @@ -12353,7 +12353,7 @@ return e[0]; function u(e) { P || (N = 0, t.showAverage = _.size(t.pods) > 5 || w, _.each(t.metrics, function(n) { var r, a = o(e, n), i = n.descriptor; -w && n.compactCombineWith && (i = n.compactCombineWith, n.lastValue && (T[i].lastValue = (T[i].lastValue || 0) + n.lastValue)), S[i] ? (S[i].load(a), t.showAverage ? S[i].legend.hide() : S[i].legend.show()) : ((r = A(n)).data = a, S[i] = c3.generate(r)); +w && n.compactCombineWith && (i = n.compactCombineWith, n.lastValue && (T[i].lastValue = (T[i].lastValue || 0) + n.lastValue)), S[i] ? (S[i].load(a), t.showAverage ? S[i].legend.hide() : S[i].legend.show()) : ((r = D(n)).data = a, S[i] = c3.generate(r)); })); } function d() { @@ -12483,7 +12483,7 @@ t.metricsURL = e; }), t.options = { rangeOptions: s.getTimeRangeOptions() }, t.options.timeRange = _.head(t.options.rangeOptions), t.options.selectedContainer = _.head(t.containers); -var A = function(e) { +var D = function(e) { var n = s.getDefaultSparklineConfig(e.chartID, e.units, w); return _.set(n, "legend.show", !w && !t.showAverage), n; }; @@ -12492,11 +12492,11 @@ I = {}, j = null, delete t.metricsError, y(); }, !0), b = e(y, s.getDefaultUpdateInterval(), !1), t.updateInView = function(e) { R = !e, e && (!k || Date.now() > k + s.getDefaultUpdateInterval()) && y(); }; -var D = a.$on("metrics.charts.resize", function() { +var A = a.$on("metrics.charts.resize", function() { s.redraw(S); }); t.$on("$destroy", function() { -b && (e.cancel(b), b = null), D && (D(), D = null), angular.forEach(S, function(e) { +b && (e.cancel(b), b = null), A && (A(), A = null), angular.forEach(S, function(e) { e.destroy(); }), S = null, P = !0; }); @@ -12526,65 +12526,65 @@ empty: "=?", run: "=?" }, controller: [ "$scope", function(t) { -var l, u, p, g = document.documentElement; +var o, l, u, p = document.documentElement; t.logViewerID = _.uniqueId("log-viewer"), t.empty = !0; -var v, h; -"ReplicationController" === t.object.kind ? (v = "deploymentconfigs/log", h = r("annotation")(t.object, "deploymentConfig")) : (v = i.kindToResource(t.object.kind) + "/log", h = t.object.metadata.name); -var y, b = function() { +var g, v; +"ReplicationController" === t.object.kind ? (g = "deploymentconfigs/log", v = r("annotation")(t.object, "deploymentConfig")) : (g = i.kindToResource(t.object.kind) + "/log", v = t.object.metadata.name); +var h, y = function() { t.$apply(function() { -var e = l.getBoundingClientRect(); -t.fixedHeight ? t.showScrollLinks = e && e.height > t.fixedHeight : t.showScrollLinks = e && (e.top < 0 || e.bottom > g.clientHeight); +var e = o.getBoundingClientRect(); +t.fixedHeight ? t.showScrollLinks = e && e.height > t.fixedHeight : t.showScrollLinks = e && (e.top < 0 || e.bottom > p.clientHeight); }); -}, S = !1, C = function() { -S ? S = !1 : t.$evalAsync(function() { +}, b = !1, S = function() { +b ? b = !1 : t.$evalAsync(function() { t.autoScrollActive = !1; }); +}, C = function() { +l ? $(l).on("scroll", S) : m.on("scroll", S); }, w = function() { -u ? $(u).on("scroll", C) : m.on("scroll", C); -}, P = function() { -t.fixedHeight || p.affix({ +t.fixedHeight || u.affix({ target: window, offset: { top: t.followAffixTop || 0 } }); -}, j = function() { +}, P = function() { return $("#" + t.logViewerID + " .log-view-output"); -}, k = function(e) { -var n = j(), r = n.offset().top; +}, j = function(e) { +var n = P(), r = n.offset().top; if (!(r < 0)) { var a = $(".ellipsis-pulser").outerHeight(!0), o = t.fixedHeight ? t.fixedHeight : Math.floor($(window).height() - r - a); t.chromeless || t.fixedHeight || (o -= 40), e ? n.animate({ "min-height": o + "px" }, "fast") : n.css("min-height", o + "px"), t.fixedHeight && n.css("max-height", o); } -}, I = function() { -if (!y) { +}, k = function() { +if (!h) { var e = function() { -clearInterval(y), y = null, t.$evalAsync(function() { +clearInterval(h), h = null, t.$evalAsync(function() { t.sized = !0; }); }, n = 0; -y = setInterval(function() { -n > 10 ? e() : (n++, j().is(":visible") && (k(), e())); +h = setInterval(function() { +n > 10 ? e() : (n++, P().is(":visible") && (j(), e())); }, 100); } -}, R = _.debounce(function() { -k(!0), b(), C(); +}, I = _.debounce(function() { +j(!0), y(), S(); }, 100); -m.on("resize", R); -var E, T = function() { -S = !0, d.scrollBottom(u); -}, N = document.createDocumentFragment(), A = _.debounce(function() { -l.appendChild(N), N = document.createDocumentFragment(), t.autoScrollActive && T(), t.showScrollLinks || b(); +m.on("resize", I); +var R, E = function() { +b = !0, d.scrollBottom(l); +}, T = document.createDocumentFragment(), N = _.debounce(function() { +o.appendChild(T), T = document.createDocumentFragment(), t.autoScrollActive && E(), t.showScrollLinks || y(); }, 100, { maxWait: 300 }), D = function(e) { var t = a.defer(); -return E ? (E.onClose(function() { +return R ? (R.onClose(function() { t.resolve(); -}), E.stop()) : t.resolve(), e || (A.cancel(), l && (l.innerHTML = ""), N = document.createDocumentFragment()), t.promise; -}, B = function() { +}), R.stop()) : t.resolve(), e || (N.cancel(), o && (o.innerHTML = ""), T = document.createDocumentFragment()), t.promise; +}, A = function() { D().then(function() { t.$evalAsync(function() { if (t.run) { @@ -12606,79 +12606,77 @@ return /\n$/.test(e); return e.match(/^.*(\n|$)/gm); }, i = function(e) { var t = r + e; -a(e) ? (r = "", n++, N.appendChild(f(n, t)), A()) : r = t; +a(e) ? (r = "", n++, T.appendChild(f(n, t)), N()) : r = t; }, s = function(e) { var t = o(e); _.each(t, i); }; -(E = c.createStream(v, h, t.context, e)).onMessage(function(r, a, o) { +(R = c.createStream(g, v, t.context, e)).onMessage(function(r, a, o) { t.$evalAsync(function() { -t.empty = !1, "logs" !== t.state && (t.state = "logs", I()); +t.empty = !1, "logs" !== t.state && (t.state = "logs", k()); }), r && (e.limitBytes && o >= e.limitBytes && (t.$evalAsync(function() { t.limitReached = !0, t.loading = !1; }), D(!0)), s(r), !t.largeLog && n >= e.tailLines && t.$evalAsync(function() { t.largeLog = !0; })); -}), E.onClose(function() { -E = null, t.$evalAsync(function() { +}), R.onClose(function() { +R = null, t.$evalAsync(function() { t.loading = !1, t.autoScrollActive = !1, 0 !== n || t.emptyStateMessage || (t.state = "empty", t.emptyStateMessage = "The logs are no longer available or could not be loaded."); }); -}), E.onError(function() { -E = null, t.$evalAsync(function() { +}), R.onError(function() { +R = null, t.$evalAsync(function() { angular.extend(t, { loading: !1, autoScrollActive: !1 }), 0 === n ? (t.state = "empty", t.emptyStateMessage = "The logs are no longer available or could not be loaded.") : t.errorWhileRunning = !0; }); -}), E.start(); +}), R.start(); } }); }); }; if (s.getLoggingURL(t.context.project).then(function(a) { -var i = _.get(t.context, "project.metadata.name"), s = _.get(t.options, "container"); -i && s && h && a && (angular.extend(t, { -kibanaAuthUrl: e.trustAsResourceUrl(URI(a).segment("auth").segment("token").normalizePathname().toString()), -access_token: o.UserStore().getToken() -}), t.$watchGroup([ "context.project.metadata.name", "options.container", "name" ], function() { +var o = _.get(t.context, "project.metadata.name"), i = _.get(t.options, "container"); +o && i && v && a && t.$watchGroup([ "context.project.metadata.name", "options.container", "name" ], function() { angular.extend(t, { kibanaArchiveUrl: e.trustAsResourceUrl(d.archiveUri({ +baseURL: a, namespace: t.context.project.metadata.name, namespaceUid: t.context.project.metadata.uid, -podname: h, +podname: v, containername: t.options.container, backlink: URI.encode(n.location.href) }, r("annotation")(t.context.project, "loggingDataPrefix"))) }); -})); +}); }), this.cacheScrollableNode = function(e) { -u = e; -}, this.cacheLogNode = function(e) { l = e; +}, this.cacheLogNode = function(e) { +o = e; }, this.cacheAffixable = function(e) { -p = $(e); +u = $(e); }, this.start = function() { -w(), P(); +C(), w(); }, angular.extend(t, { ready: !0, loading: !0, autoScrollActive: !0, state: !1, onScrollBottom: function() { -d.scrollBottom(u); +d.scrollBottom(l); }, onScrollTop: function() { -t.autoScrollActive = !1, d.scrollTop(u), $("#" + t.logViewerID + "-affixedFollow").affix("checkPosition"); +t.autoScrollActive = !1, d.scrollTop(l), $("#" + t.logViewerID + "-affixedFollow").affix("checkPosition"); }, toggleAutoScroll: function() { -t.autoScrollActive = !t.autoScrollActive, t.autoScrollActive && T(); +t.autoScrollActive = !t.autoScrollActive, t.autoScrollActive && E(); }, goChromeless: d.chromelessLink, -restartLogs: B +restartLogs: A }), t.$on("$destroy", function() { -D(), m.off("resize", R), m.off("scroll", C), u && $(u).off("scroll", C); -}), "deploymentconfigs/logs" === v && !h) return t.state = "empty", void (t.emptyStateMessage = "Logs are not available for this replication controller because it was not generated from a deployment configuration."); -t.$watchGroup([ "name", "options.container", "run" ], B); +D(), m.off("resize", I), m.off("scroll", S), l && $(l).off("scroll", S); +}), "deploymentconfigs/logs" === g && !v) return t.state = "empty", void (t.emptyStateMessage = "Logs are not available for this replication controller because it was not generated from a deployment configuration."); +t.$watchGroup([ "name", "options.container", "run" ], A); } ], require: "logViewer", link: function(e, n, r, a) { @@ -14876,7 +14874,7 @@ cancelButtonText: "Cancel" } } }).result.then(T); -}, A = function(e) { +}, D = function(e) { b = e.quotaAlerts || []; var t = _.filter(b, { type: "error" @@ -14893,7 +14891,7 @@ namespace: n.input.selectedProject.metadata.name }), i = function(e) { return n.nameTaken = e.nameTaken, r; }; -t.then(i, i).then(A, A); +t.then(i, i).then(D, D); }, function(e) { n.disableInputs = !1, "AlreadyExists" === e.data.reason ? n.projectNameTaken = !0 : l.addNotification({ id: "deploy-image-create-project-error", @@ -15365,7 +15363,7 @@ namespace: e.namespace S[a.project] && delete S[a.project][e.uid], b[a.project] && delete b[a.project][e.uid], E(e); }, N = function() { b[a.project] = {}, S[a.project] = {}; -}, A = function(e) { +}, D = function(e) { return _.reduce(e, function(e, t) { return e[t.metadata.uid] = { actions: null, @@ -15378,7 +15376,7 @@ firstTimestamp: t.firstTimestamp, event: t }, e; }, {}); -}, D = function(e) { +}, A = function(e) { return _.reduce(e, function(e, t) { return u.isImportantAPIEvent(t) && !u.isCleared(t.metadata.uid) && (e[t.metadata.uid] = t), e; }, {}); @@ -15400,7 +15398,7 @@ m && (l.unwatch(m), m = null); }, U = function() { d && d(), d = null; }, F = function(e) { -b[a.project] = A(D(e.by("metadata.name"))), V(); +b[a.project] = D(A(e.by("metadata.name"))), V(); }, x = function(e, t) { var n = t.namespace || a.project, r = t.id ? n + "/" + t.id : _.uniqueId("notification_") + Date.now(); t.showInDrawer && !u.isCleared(r) && (S[n] = S[n] || {}, S[n][r] = { @@ -16665,7 +16663,7 @@ return function(e) { return !!e && /[\x00-\x09\x0E-\x1F]/.test(e); }; }), angular.module("openshiftConsole").factory("logLinks", [ "$anchorScroll", "$document", "$location", "$window", function(e, t, n, r) { -var a = _.template([ "/#/discover?", "_g=(", "time:(", "from:now-1w,", "mode:relative,", "to:now", ")", ")", "&_a=(", "columns:!(kubernetes.container_name,message),", "index:'<%= index %>',", "query:(", "query_string:(", "analyze_wildcard:!t,", 'query:\'kubernetes.pod_name:"<%= podname %>" AND kubernetes.namespace_name:"<%= namespace %>"\'', ")", "),", "sort:!('@timestamp',desc)", ")", "#console_container_name=<%= containername %>", "&console_back_url=<%= backlink %>" ].join("")); +var a = _.template([ "<%= baseURL %>#/discover?", "_g=(", "time:(", "from:now-1w,", "mode:relative,", "to:now", ")", ")", "&_a=(", "columns:!(kubernetes.container_name,message),", "index:'<%= index %>',", "query:(", "query_string:(", "analyze_wildcard:!t,", 'query:\'kubernetes.pod_name:"<%= podname %>" AND kubernetes.namespace_name:"<%= namespace %>"\'', ")", "),", "sort:!('@timestamp',desc)", ")", "#console_container_name=<%= containername %>", "&console_back_url=<%= backlink %>" ].join("")); return { scrollTop: function(e) { e ? e.scrollTop = 0 : window.scrollTo(null, 0); @@ -16686,7 +16684,7 @@ a.addSearch(e); } }, archiveUri: function(e, t) { -return t = t || "project." + e.namespace + "." + e.namespaceUid, e.index = t + ".*", a(e); +return t = t || "project." + e.namespace + "." + e.namespaceUid, e.index = t + ".*", "/" !== e.baseURL.substr(-1) && (e.baseURL += "/"), a(e); } }; } ]), angular.module("javaLinkExtension", [ "openshiftConsole" ]).run([ "AuthService", "BaseHref", "DataService", "extensionRegistry", function(e, t, n, r) { diff --git a/dist/scripts/templates.js b/dist/scripts/templates.js index a88ae177b3..61e1a25f36 100644 --- a/dist/scripts/templates.js +++ b/dist/scripts/templates.js @@ -7722,12 +7722,8 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function( "
\n" + "
\n" + "\n" + - "\n" + - "
\n" + - "\n" + - "\n" + - "\n" + - "
\n" + + "\n" + + "View Archive\n" + "|\n" + "\n" + "\n" +