Skip to content

Commit 37808b1

Browse files
Alexander MatyushentsevAlexander Matyushentsev
Alexander Matyushentsev
authored and
Alexander Matyushentsev
committed
Fix loading logs when ui and workflow are in different namespace
1 parent 94910ef commit 37808b1

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

VERSION

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v2.2.1

scripts/build_docker.sh

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
#!/bin/bash
22

3+
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
4+
GIT_COMMIT=`git rev-parse --short HEAD`
5+
VERSION=`cat ${CURRENT_DIR}/../VERSION`
6+
37
set -e
48

5-
TAG=${IMAGE_TAG:-'latest'}
9+
TAG=${IMAGE_TAG:-"$VERSION-$GIT_COMMIT"}
610

711
docker build --build-arg ARGO_VERSION=${TAG} -t ${IMAGE_NAMESPACE:-`whoami`}/argoui:${TAG} .
812

src/api/app.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -101,18 +101,20 @@ export function create(
101101
async (req, res) => serve(res, () => (forceNamespaceIsolation ? crd.ns(namespace) : crd.ns(req.params.namespace)).workflows.get(req.params.name)));
102102

103103
app.get('/api/workflows/live', async (req, res) => {
104+
const ns = getNamespace(req);
105+
104106
let updatesSource = new Observable((observer: Observer<any>) => {
105107
const labelSelector = getWorkflowLabelSelector(req);
106-
let stream = crd.ns(req.params.namespace).workflows.getStream({ qs: { watch: true, labelSelector: labelSelector.join(',') } });
108+
let stream = (ns ? crd.ns(ns) : crd).workflows.getStream({ qs: { watch: true, labelSelector: labelSelector.join(',') } });
107109
stream.on('end', () => observer.complete());
108110
stream.on('error', (e) => observer.error(e));
109111
stream.on('close', () => observer.complete());
110112
stream = stream.pipe(new JSONStream());
111113
stream.on('data', (data) => data && observer.next(data));
112114
});
113-
if (forceNamespaceIsolation || req.query.namespace) {
115+
if (ns) {
114116
updatesSource = updatesSource.filter((change) => {
115-
return change.object.metadata.namespace === forceNamespaceIsolation ? namespace : req.query.namespace;
117+
return change.object.metadata.namespace === ns;
116118
});
117119
}
118120
if (req.query.name) {

0 commit comments

Comments
 (0)