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

Commit 08df82c

Browse files
committed
add files missing from PR #820
Fixes #821
1 parent f930962 commit 08df82c

File tree

6 files changed

+79
-54
lines changed

6 files changed

+79
-54
lines changed

app/content/css/themes/ibm.css

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,6 @@ body a:hover:not(.plain-anchor) {
5050
.header {
5151
background: var(--color-stripe-01);
5252
color: var(--color-ui-01);
53-
border-bottom-color: var(--color-ui-05);
54-
outline-color: var(--color-ui-05); /* outline, rather than border-bottom-color, to allow minimized sidecar to stay on top */
55-
box-shadow: 0 1px 2px rgba(0,0,0,0.1);;
5653
}
5754
.header .application-icon {
5855
background-image: url('../../icons/svg/blue-dolphin.svg');

app/content/css/ui.css

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,8 @@ body .page > .header {
4545
padding-right: 3em;
4646
font-weight: 300;
4747
font-size: 1rem;
48-
border-bottom: 1px solid; /* outline rather than border-bottom, to allow minimized sidecar to stay on top */
4948
-webkit-font-smoothing: antialiased; /* chrome, you suck */
5049
}
51-
body.sidecar-is-minimized .header {
52-
outline: 1px solid; /* outline rather than border-bottom, to allow minimized sidecar to stay on top */
53-
border-bottom: none;
54-
}
5550
.header .deemphasize {
5651
font-size: 55%;
5752
letter-spacing: 1px;
@@ -108,10 +103,10 @@ header .header-nav-list {
108103
padding: 0;
109104
}
110105
.header .header-nav-list li {
111-
font-weight: 400;
112-
font-size: 0.75rem;
106+
font-weight: 700;
107+
font-size: 0.875rem;
113108
text-transform: uppercase;
114-
margin-left: 1em;
109+
margin: 0 1em;
115110
}
116111
.header-nav-list li input {
117112
border: none;
@@ -1364,7 +1359,7 @@ body.subwindow.sidecar-full-screen #sidecar .sidecar-bottom-stripe .sidecar-bott
13641359
.fill-container.flush-right {
13651360
justify-content: flex-end;
13661361
}
1367-
.sidecar-bottom-stripe .graphical-icon {
1362+
.graphical-icon {
13681363
/* font awesome icons in the bottom stripe */
13691364
font-size: 1.25rem;
13701365
width: 1em;
@@ -1503,16 +1498,17 @@ break {
15031498
.list-paginator {
15041499
display: flex;
15051500
justify-content: flex-end;
1506-
align-items: center;
15071501
font-family: var(--font-sans-serif);
1508-
font-weight: 100;
1509-
font-size: 0.875em;
1510-
margin-top: 0.75ex;
1502+
color: var(--color-text-02);
1503+
border: 1px solid var(--color-ui-04);
1504+
border-top: none;
1505+
height: 3em;
15111506
}
15121507
.list-paginator .list-paginator-left-buttons {
1508+
display: flex;
1509+
align-items: center;
1510+
padding: .5rem 1rem;
15131511
flex: 1;
1514-
font-size: 1rem;
1515-
font-variant: small-caps;
15161512
letter-spacing: 1px;
15171513
}
15181514
.list-paginator .list-paginator-left-buttons > span {
@@ -1526,27 +1522,31 @@ break {
15261522
/* a list paginator left button, except for the first one */
15271523
margin-left: 1em;
15281524
}
1525+
.list-paginator .list-paginator-right-buttons {
1526+
display: flex;
1527+
font-weight: 400;
1528+
font-size: 0.875em;
1529+
}
15291530
.list-paginator .list-paginator-description {
1530-
margin-right: 1em;
1531+
display: flex;
1532+
align-items: center;
1533+
padding: .5rem 1rem;
15311534
}
15321535
.list-paginator .list-paginator-button {
1533-
background: var(--color-ui-03);
1534-
color: var(--color-text-01);
1535-
border: 1px solid var(--color-ui-05);
1536-
transition: all 150ms ease-in-out;
1537-
padding: 0.5ex 1.5ex;
1538-
opacity: 0.7;
1539-
}
1540-
.list-paginator .list-paginator-button:first-child {
1541-
/* avoid a double border in the middle */
1542-
border-right: none
1536+
border-left: 1px solid var(--color-ui-04);
1537+
transition: all 250ms;
1538+
width: 2.625rem;
1539+
display: flex;
1540+
align-items: center;
1541+
justify-content: center;
1542+
font-size: 1.25em;
1543+
color: var(--color-ui-05);
15431544
}
15441545
.list-paginator .list-paginator-button.list-paginator-button-disabled {
1545-
opacity: 0.33;
1546+
color: var(--color-ui-04);
15461547
}
15471548
.list-paginator .list-paginator-button:not(.list-paginator-button-disabled):hover {
1548-
font-weight: bold;
1549-
opacity: 1;
1549+
color: var(--color-brand-01);
15501550
cursor: pointer;
15511551
}
15521552

app/content/js/repl.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,15 @@ const printResults = (block, nextBlock, resultDom, echo=true, execOptions, parse
231231
ui.ok(resultDom.parentNode).className = 'ok-for-list'
232232
}
233233

234-
} else if (typeof response === 'string' || (!response.type && response.message && typeof response.message === 'string')) {
234+
} else if (response.verb === 'list' && response[response.type] && typeof response[response.type] === 'number') {
235+
// maybe a list API returned a count?
236+
const span = document.createElement('span')
237+
span.innerText = response[response.type]
238+
resultDom.appendChild(span)
239+
resultDom.parentNode.classList.add('result-vertical')
240+
ui.ok(resultDom.parentNode).className = 'ok-for-list'
241+
242+
} else if (typeof response === 'number' || typeof response === 'string' || (!response.type && response.message && typeof response.message === 'string')) {
235243
// if either the response is a string, or it's a non-entity (no response.type) and has a message field
236244
// then treat the response as a simple string response
237245
if (echo) {

app/content/js/views/list/activations.js

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,10 @@ const _render = ({entity, activationIds, container, noCrop=false, noPip=false, s
133133
return (value - start - gaps[idx]) / (dur - tgap)
134134
}
135135

136-
return fetch(activationIds)
137-
.then(activations => entity ? [entity, ...activations] : activations) // add entity to the top of the list
138-
.then(activations => {
136+
return Promise.all([fetch(activationIds)
137+
.then(activations => entity ? [entity, ...activations] : activations), // add entity to the top of the list
138+
repl.qexec(`wsk activation count ${mapToOptions(parsedOptions)}`)])
139+
.then(([activations, count]) => {
139140
gaps = new Array(activations.length).fill(0)
140141
if (!entity) {
141142
let residualDur = dur // after subtracing out gaps
@@ -384,6 +385,7 @@ const _render = ({entity, activationIds, container, noCrop=false, noPip=false, s
384385
if (!entity) {
385386
const paginator = document.createElement('div'),
386387
leftButtons = document.createElement('div'),
388+
rightButtons = document.createElement('div'),
387389
description = document.createElement('span'),
388390
prev = document.createElement('span'),
389391
next = document.createElement('span')
@@ -396,27 +398,38 @@ const _render = ({entity, activationIds, container, noCrop=false, noPip=false, s
396398
leftButtons.classList.add('list-paginator-left-buttons')
397399

398400
// show summary buttons
399-
const buttons = [ 'summary',
401+
paginator.appendChild(rightButtons)
402+
rightButtons.classList.add('list-paginator-right-buttons')
403+
const buttons = [ { command: 'summary', icon: 'fas fa-chart-bar', balloon: 'Open a statistical summary view' },
400404
// 'timeline', // disabled for now shell issue #794
401-
'grid' ]
402-
buttons.forEach(buttonText => {
403-
const command = buttonText, // it so happens...
404-
button = document.createElement('span')
405-
leftButtons.appendChild(button)
405+
{ command: 'grid', icon: 'fas fa-th', balloon: 'Open a grid view' } ]
406+
buttons.forEach(({ command, icon, balloon, balloonPos='up-left' }) => {
407+
const buttonContainer = document.createElement('span'),
408+
button = document.createElement('i')
409+
410+
leftButtons.appendChild(buttonContainer)
411+
412+
buttonContainer.className = 'graphical-icon'
413+
buttonContainer.appendChild(button)
414+
buttonContainer.setAttribute('data-balloon', balloon)
415+
buttonContainer.setAttribute('data-balloon-pos', balloonPos)
416+
417+
button.className = icon
406418
button.classList.add('clickable')
407-
button.setAttribute('data-button-command', command)
408-
button.innerText = buttonText
409-
button.onclick = () => repl.pexec(command)
419+
420+
buttonContainer.setAttribute('data-button-command', command)
421+
buttonContainer.onclick = () => repl.pexec(command)
410422
})
411423

412424
// description of current page
413425
description.className = 'list-paginator-description'
414-
paginator.appendChild(description)
415-
description.innerText = `Showing ${skip + 1}\u2013${skip+activationIds.length}`
426+
rightButtons.appendChild(description)
427+
428+
description.innerText = `${skip + 1}\u2013${skip+activationIds.length} of ${count.toLocaleString()} items`
416429

417430
// forward and back buttons
418-
paginator.appendChild(prev)
419-
paginator.appendChild(next)
431+
rightButtons.appendChild(prev)
432+
rightButtons.appendChild(next)
420433
prev.innerText = '\uff1c'
421434
next.innerText = '\uff1e'
422435
prev.className = 'list-paginator-button list-paginator-button-prev'

app/plugins/ui/commands/openwhisk-core.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,8 +1304,15 @@ module.exports = (commandTree, prequire) => {
13041304
// count APIs
13051305
for (let entityType in synonyms.entities) {
13061306
synonyms.entities[entityType].forEach(syn => {
1307-
commandTree.listen(`/wsk/${syn}/count`, () => ow[entityType].list({ count: true })
1308-
.then(res => res[entityType]))
1307+
commandTree.listen(`/wsk/${syn}/count`, (_1, _2, _3, _4, _5, _6, argv, options) => {
1308+
const name = argv[argv.indexOf('count') + 1],
1309+
overrides = { count: true }
1310+
if (name) {
1311+
overrides.name = name
1312+
}
1313+
return ow[entityType].list(Object.assign({}, options, overrides))
1314+
.then(res => res[entityType])
1315+
})
13091316
})
13101317
}
13111318

tests/tests/passes/04/pagination.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ const testPagination = (ctx, actionName) => {
6969
.then(() => app.client.waitUntil(() => {
7070
return Promise.all([app.client.getText(description), app.client.elements(tableRowsFiltered)])
7171
.then(([paginatorText, rows]) => {
72-
return paginatorText === `Showing 1\u2013${limit}`
72+
return paginatorText.indexOf(`1\u2013${limit} of`) === 0 // starts with "1-limit of" ...
7373
&& rows.value.length === limit
7474
})
7575
}))
@@ -79,7 +79,7 @@ const testPagination = (ctx, actionName) => {
7979
.then(() => app.client.waitUntil(() => {
8080
return Promise.all([app.client.getText(description), app.client.elements(tableRowsFiltered)])
8181
.then(([paginatorText, rows]) => {
82-
return paginatorText === `Showing ${limit + 1}\u2013${limit + limit}`
82+
return paginatorText.indexOf(`${limit + 1}\u2013${limit + limit} of`) === 0 // starts with 'N+1-N+limit+1 of'
8383
&& rows.value.length === limit
8484
})
8585
}))
@@ -89,7 +89,7 @@ const testPagination = (ctx, actionName) => {
8989
.then(() => app.client.waitUntil(() => {
9090
return Promise.all([app.client.getText(description), app.client.elements(tableRowsFiltered)])
9191
.then(([paginatorText, rows]) => {
92-
return paginatorText === `Showing 1\u2013${limit}`
92+
return paginatorText.indexOf(`1\u2013${limit} of`) === 0 // starts with "1-limit of" ...
9393
&& rows.value.length === limit
9494
})
9595
}))

0 commit comments

Comments
 (0)