Skip to content
This repository was archived by the owner on Dec 17, 2024. It is now read-only.

Commit 9e98398

Browse files
committed
fix for buggy drilldown form activations
Fixes #694
1 parent 546b0fb commit 9e98398

File tree

2 files changed

+61
-2
lines changed

2 files changed

+61
-2
lines changed

app/content/js/ui.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ const ui = (function() {
686686
// click handler
687687
if (actionNamespace) {
688688
const nsForClick = actionNamespace.indexOf('/') >= 0? actionNamespace : `/${actionNamespace}`
689-
action.onclick = () => repl.pexec(`wsk ${options && options.type || 'action'} get "${nsForClick}/${actionName}"`).then(ui.showEntity)
689+
action.onclick = () => repl.pexec(`wsk ${options && options.type || 'action'} get "${nsForClick}/${actionName}"`)
690690
}
691691
}
692692
}
@@ -1153,6 +1153,7 @@ const ui = (function() {
11531153
*/
11541154
self.showEntity = (entity, options={}, block, nextBlock) => {
11551155
debug('showEntity', entity, options)
1156+
console.trace()
11561157

11571158
const sidecar = document.querySelector('#sidecar'),
11581159
header = sidecar.querySelector('.sidecar-header')
@@ -1506,7 +1507,7 @@ const ui = (function() {
15061507
const entityName = nameDom.querySelector('.entity-name')
15071508
entityName.innerText = entity.name
15081509
entityName.className = `${entityName.className} clickable`
1509-
entityName.onclick = entity.onclick || (() => repl.pexec(`wsk action get "/${entityNameWithPackageAndNamespace}"`).then(ui.showEntity))
1510+
entityName.onclick = entity.onclick || (() => repl.pexec(`wsk action get "/${entityNameWithPackageAndNamespace}"`))
15101511

15111512
// add the activation id to the header
15121513
const activationDom = sidecar.querySelector('.sidecar-header-name .activation-id')
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
* Copyright 2018 IBM Corporation
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
const common = require('../../../lib/common'),
18+
openwhisk = require('../../../lib/openwhisk'),
19+
ui = require('../../../lib/ui'),
20+
assert = require('assert'),
21+
keys = ui.keys,
22+
cli = ui.cli,
23+
sidecar = ui.sidecar,
24+
actionName = `foo-${new Date().getTime()}`,
25+
actionName2 = 'foo2',
26+
fs = require('fs')
27+
28+
describe('activation list, activation get, click on header', function() {
29+
before(common.before(this))
30+
after(common.after(this))
31+
32+
it('should have an active repl', () => cli.waitForRepl(this.app))
33+
34+
it('should create an action', () => cli.do(`let ${actionName} = x=>x -p x 3`, this.app)
35+
.then(cli.expectOK)
36+
.then(sidecar.expectOpen)
37+
.then(sidecar.expectShowing(actionName))
38+
.catch(common.oops(this)))
39+
40+
const expectedSrc = 'let main = x => x'
41+
42+
it('should async that action and click on the activation id', () => cli.do(`async ${actionName}`, this.app)
43+
.then(cli.expectOKWithCustom(cli.makeCustom('.activationId', '')))
44+
.then(selector => this.app.client.getText(selector)
45+
.then(activationId => this.app.client.click(selector)
46+
.then(() => sidecar.expectOpen(this.app))
47+
.then(sidecar.expectShowing(actionName, activationId))))
48+
.catch(common.oops(this)))
49+
50+
it(`click on action name in sidecar header and show action source`, () => this.app.client.click(ui.selectors.SIDECAR_TITLE)
51+
.then(() => this.app)
52+
.then(sidecar.expectOpen)
53+
.then(sidecar.expectShowing(actionName))
54+
.then(() => this.app.client.waitUntil(() => this.app.client.getText(ui.selectors.SIDECAR_ACTION_SOURCE))
55+
.then(x => x.trim())
56+
.then(actualSrc => actualSrc === expectedSrc))
57+
.catch(common.oops(this)))
58+
})

0 commit comments

Comments
 (0)