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

Commit d66784e

Browse files
committed
fix for screenshot not capturing full height
Fixes #712 better solution for #77 fix for sticky grid header Fixes #722
1 parent f0adc6b commit d66784e

File tree

12 files changed

+150
-107
lines changed

12 files changed

+150
-107
lines changed

app/content/css/ui.css

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ body.sidecar-is-minimized .header {
6767
.header-left-bits {
6868
flex: 1;
6969
}
70+
.header-top-bits {
71+
display: flex;
72+
flex: 1;
73+
}
7074
.header .clickable, .header .clickable:hover {
7175
text-decoration: none;
7276
transition: none;
@@ -523,6 +527,7 @@ sidecar.visible {
523527
.sidecar-bottom-stripe {
524528
padding: 0 1em;
525529
flex-basis: 3em;
530+
min-height: 3rem; /* see shell issue #712 */
526531
display: flex;
527532
align-items: center;
528533
font-size: 0.875em;
@@ -642,8 +647,10 @@ sidecar .custom-content {
642647
}
643648
sidecar .sidecar-header {
644649
display: flex;
650+
flex-direction: column;
645651
border-bottom: 1px solid;
646652
flex-basis: 9rem;
653+
min-height: 9rem; /* see shell issue #712 */
647654
}
648655
sidecar .header-right-bits {
649656
flex-direction: column;
@@ -777,7 +784,7 @@ sidecar.entity-is-activations .sidecar-header-name .sidecar-header-name-content
777784
sidecar .sidecar-header-secondary-content {
778785
font-size: 0.875rem;
779786
opacity: 0.75;
780-
margin: 1ex 0;
787+
margin: 1ex 2em;
781788
}
782789
sidecar .sidecar-header-secondary-content .kind-content {
783790
overflow: hidden;

app/content/js/ui.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -912,6 +912,24 @@ const ui = (function() {
912912

913913
const sidecar = document.querySelector('#sidecar')
914914

915+
if (custom.controlHeaders === true) {
916+
// plugin will control all headers
917+
} else if (!custom.controlHeaders) {
918+
// plugin will control no headers
919+
const customHeaders = sidecar.querySelectorAll('.custom-header-content')
920+
for (let idx = 0; idx < customHeaders.length; idx++) {
921+
ui.removeAllDomChildren(customHeaders[idx])
922+
}
923+
} else {
924+
// plugin will control some headers; it tell us which it wants us to control
925+
custom.controlHeaders.forEach(_ => {
926+
const customHeaders = sidecar.querySelectorAll(`${_} .custom-header-content`)
927+
for (let idx = 0; idx < customHeaders.length; idx++) {
928+
ui.removeAllDomChildren(customHeaders[idx])
929+
}
930+
})
931+
}
932+
915933
// which viewer is currently active?
916934
sidecar.setAttribute('data-active-view', '.custom-content > div')
917935

app/content/js/usage-error.js

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -279,17 +279,26 @@ const format = (message, options={}) => {
279279

280280
// detailed example command
281281
if (detailedExample) {
282-
const examplePart = bodyPart(),
283-
prePart = prefix('Example'),
284-
textPart = div(detailedExample.command),
285-
docPart = sans(div(detailedExample.docs))
282+
const examples = !Array.isArray(detailedExample) ? [detailedExample] : detailedExample
286283

284+
const examplePart = bodyPart(),
285+
prePart = prefix(examples.length === 1 ? 'Example' : 'Examples')
287286
left.appendChild(examplePart)
288287
examplePart.appendChild(prePart)
289-
examplePart.appendChild(textPart)
290-
examplePart.appendChild(smaller(docPart))
291288

292-
textPart.style.color = 'var(--color-support-02)'
289+
examples.forEach(({command, docs}, idx) => {
290+
const textPart = div(command),
291+
docPart = sans(div(docs))
292+
293+
examplePart.appendChild(textPart)
294+
examplePart.appendChild(smaller(docPart))
295+
296+
textPart.style.color = 'var(--color-support-02)'
297+
298+
if (idx > 0) {
299+
textPart.style.marginTop = '1em'
300+
}
301+
})
293302
}
294303

295304
/**

app/plugins/modules/activation-visualizations/lib/grid.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ const drawGrid = (options, header) => activations => {
159159
return {
160160
type: 'custom',
161161
content,
162+
controlHeaders: true,
162163
modes: modes('grid', options)
163164
}
164165
}

app/plugins/modules/activation-visualizations/lib/table.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ const _drawTable = (options, header, content, groupData, eventBus, sorter=defaul
521521
medianDot.style.left = percent(medianLeft)
522522
medianDot.setAttribute('data-balloon', prettyPrintDuration(thisMedian))
523523
medianDot.setAttribute('data-balloon-length', 'small')
524-
medianDot.setAttribute('data-balloon-pos', balloonPos)
524+
medianDot.setAttribute('data-balloon-pos', 'right')
525525
focus(medianDot)
526526

527527
// outlier activations

app/plugins/modules/activation-visualizations/lib/util.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ exports.displayTimeRange = ({minTime, maxTime, totalCount}, container) => {
278278
*/
279279
exports.prepareHeader = isRedraw => {
280280
const sidecar = document.querySelector('#sidecar'),
281-
leftHeader = sidecar.querySelector('.header-left-bits .sidecar-header-secondary-content .custom-header-content'),
281+
leftHeader = sidecar.querySelector('.sidecar-header-secondary-content .custom-header-content'),
282282
rightHeader = sidecar.querySelector('.header-right-bits .custom-header-content')
283283

284284
if (!isRedraw) {

app/plugins/modules/activation-visualizations/web/css/table.css

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -212,15 +212,15 @@
212212
.activation-viz-plugin .data-table td.cell-stats .stat-median-dot, .activation-viz-plugin.show-outliers .outlier-dot {
213213
position: absolute;
214214
width: 0.4em;
215-
height: 2.2em;
216-
background: #56D2BB;
215+
height: 1.75em;
216+
background: #67a9cf;
217217
outline: 2px solid rgba(255,255,255,0.5);
218218
border: 1px solid rgba(0,0,0,0.9);
219219
transition: all 150ms ease-in-out;
220220
}
221221
.activation-viz-plugin.show-outliers .outlier-dot {
222222
/* dot representing an outlier activation */
223-
background: #3C6DF0;
223+
background: #b2182b;
224224
opacity: 0.6;
225225
border-color: rgba(255,255,255,0.2);
226226
width: 0.3em;
@@ -254,17 +254,16 @@
254254
.activation-viz-plugin .data-table td.cell-stats .stat-indicator {
255255
position: absolute;
256256
color: white;
257-
/*mix-blend-mode: difference;*/
258-
font-size: 0.6875em;
257+
font-size: 0.6em;
259258
opacity: 0.8;
260259
}
261260
.activation-viz-plugin .data-table td.cell-stats .stat-bar:hover {
262261
outline: 1px solid rgba(0, 85, 127, 0.2)
263262
}
264263
.activation-viz-plugin .data-table td.cell-stats .stat-bar {
265264
position: absolute;
266-
background: hsla(171, 100%, 25%, 1); /* #00A78F with Lightness reduced from 33% to 25% */
267-
height: 1.9em; /* matches activation list height: .log-lines .log-line .log-line-bar in ui.css */
265+
background: #2166ac;
266+
height: 1.25em; /* matches activation list height: .log-lines .log-line .log-line-bar in ui.css */
268267
transition: all 150ms ease-in-out, outline 300ms ease-in-out;
269268
}
270269
/* focused bar */
@@ -747,12 +746,12 @@ body.subwindow .grid-grid:not(.activation-viz-timeline) {
747746
}
748747
.activation-summary-range-selector li {
749748
list-style: none;
750-
border: 1px solid var(--color-brand-01);
749+
border: 1px solid var(--color-text-02);
751750
padding: 0 2em;
752751
font-weight: 400;
753752
font-size: 0.75em;
754753
display: flex;
755-
color: var(--color-brand-01);
754+
color: var(--color-text-02);
756755
align-items: center;
757756
transition: all 150ms ease-in-out;
758757
-webkit-font-smoothing: antialiased; /* fonts a bit too bold otherwise */
@@ -770,15 +769,15 @@ body.subwindow .grid-grid:not(.activation-viz-timeline) {
770769
border-bottom-right-radius: 8px;
771770
}
772771
.activation-summary-range-selector li:hover {
773-
background: var(--color-brand-02);
772+
background: var(--color-text-01);
774773
color: white;
775774
cursor: pointer;
776775
}
777776
.activation-summary-range-selector li.selected {
778-
background: var(--color-brand-01);
777+
background: var(--color-text-02);
779778
color: white;
780779
}
781780
.activation-summary-range-selector li.partially-selected {
782-
background: var(--color-brand-02);
781+
background: var(--color-text-01);
783782
color: white;
784783
}

app/plugins/modules/editor/lib/edit.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -298,16 +298,11 @@ const updateText = editor => action => {
298298
let amdRequire // the monaco editor uses the AMD module loader, and smashes the global.require; we need to finagle it a bit
299299
let initDone // this is part of the finagling, to make sure we finagle only once
300300
const openEditor = wsk => {
301-
const sidecar = document.querySelector('#sidecar'),
302-
leftHeader = sidecar.querySelector('.header-left-bits .sidecar-header-secondary-content .custom-header-content'),
303-
rightHeader = sidecar.querySelector('.header-right-bits .custom-header-content')
301+
const sidecar = document.querySelector('#sidecar')
304302

305303
/** returns the current action entity */
306304
const getAction = () => sidecar.entity
307305

308-
ui.removeAllDomChildren(leftHeader)
309-
ui.removeAllDomChildren(rightHeader)
310-
311306
// Monaco uses a custom amd loader that over-rides node's require.
312307
// Keep a reference to node's require so we can restore it after executing the amd loader file.
313308
const nodeRequire = global.require;
@@ -435,7 +430,7 @@ const openEditor = wsk => {
435430
sidecar.entity = action
436431

437432
// isModified display
438-
const subtext = sidecar.querySelector('.custom-header-content'),
433+
const subtext = sidecar.querySelector('.sidecar-header-secondary-content .custom-header-content'),
439434
status = document.createElement('div'),
440435
isNew = document.createElement('div'),
441436
upToDate = document.createElement('div'),
@@ -510,6 +505,7 @@ const openEditor = wsk => {
510505
const respondToRepl = (wsk, extraModes=[]) => ({ getAction, editor, content, eventBus }) => ({
511506
type: 'custom',
512507
content,
508+
controlHeaders: ['.header-right-bits'],
513509
displayOptions: [`entity-is-${getAction().type}`, 'edit-mode'],
514510
modes: extraModes
515511
.map(_ => _({wsk, getAction, editor, eventBus}))

app/plugins/modules/editor/lib/editor.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,12 @@
7070
transition: opacity 150ms ease-in-out;
7171
opacity: 0;
7272
width: 0;
73+
height: 0;
7374
}
7475
#sidecar.is-modified .custom-header-content .editor-status:not(.is-new) .is-modified, #sidecar:not(.is-modified) .custom-header-content .editor-status:not(.is-new) .is-up-to-date, #sidecar .custom-header-content .editor-status.is-new .is-new {
7576
opacity: 1;
7677
width: auto;
78+
height: auto;
7779
}
7880

7981
/* wskflow container while editing compositions */

app/plugins/modules/editor/lib/readonly.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ exports.readonly = ({ wsk, getAction }) => () => Promise.resolve(getAction())
2727
*
2828
*/
2929
exports.edit = ({ wsk, getAction }) => () => Promise.resolve(getAction())
30-
.then(x => { console.error("!!!!!!!!!!", getAction, x); return x})
3130
.then(({ namespace, name }) => repl.qexec(`edit "/${namespace}/${name}"`))
3231
.then(ui.showCustom)
3332

0 commit comments

Comments
 (0)