Skip to content

Commit 8f84e45

Browse files
committed
Show log view type in Lumino tab title and selected file in caption
1 parent d3f1146 commit 8f84e45

File tree

4 files changed

+27
-3
lines changed

4 files changed

+27
-3
lines changed

src/components/cylc/workspace/Lumino.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
2727
:is="props.allViews.get(name).component"
2828
:workflow-name="workflowName"
2929
v-model:initial-options="views.get(id).initialOptions"
30+
:widgetID="id"
3031
class="h-100"
3132
/>
3233
</WidgetComponent>

src/components/cylc/workspace/luminoWidget.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ export class LuminoWidget extends Widget {
6666
// which cause the tab panel to be updated.
6767
this.title.label = this.name
6868
this.title.closable = this.closable
69+
eventBus.on(`lumino:update-tab:${this.id}`, ({ title, caption }) => {
70+
this.title.label = title
71+
this.title.caption = caption
72+
})
6973
super.onBeforeAttach(msg)
7074
}
7175

@@ -79,6 +83,7 @@ export class LuminoWidget extends Widget {
7983
onCloseRequest (msg) {
8084
// Emit an event so that the Vue component knows that it needs to be removed too
8185
eventBus.emit('lumino:deleted', this.id)
86+
eventBus.off(`lumino:update-tab:${this.id}`)
8287
super.onCloseRequest(msg)
8388
}
8489

src/styles/cylc/_workspace.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@
4242
.lm-TabBar-tab {
4343
display: flex;
4444
align-items: center;
45-
border-bottom: 1px solid #C0C0C0;
45+
flex-basis: 10rem !important; // Min width of tab
4646
}
4747
.lm-TabBar-tabLabel {
4848
font-family: settings.$body-font-family;
49-
font-size: 1rem;
49+
font-size: 0.9rem;
5050
}
5151
.lm-TabBar-tabCloseIcon {
5252
color: inherit;

src/views/Log.vue

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ import { debounce } from 'lodash-es'
200200
import CopyBtn from '@/components/core/CopyBtn.vue'
201201
import { Alert } from '@/model/Alert.model'
202202
import { getJobLogFileFromState } from '@/model/JobState.model'
203+
import { eventBus } from '@/services/eventBus'
203204
204205
/**
205206
* Query used to retrieve data for the Log view.
@@ -313,6 +314,12 @@ export default {
313314
314315
props: {
315316
initialOptions,
317+
/** ID of widget if the log view is in a Lumino tab. */
318+
widgetID: {
319+
type: String,
320+
required: false,
321+
default: null,
322+
},
316323
},
317324
318325
setup (props, { emit }) {
@@ -424,7 +431,18 @@ export default {
424431
id: this.id ?? undefined, // (do not trigger the callback on null ⇄ undefined)
425432
file: this.file ?? undefined
426433
}),
427-
async ({ id }, old) => {
434+
async ({ id, file }, old) => {
435+
// update the widget tab caption when the id or file change
436+
if (this.widgetID) {
437+
const prefix = this.relativeID ? `${this.relativeID}` : ''
438+
eventBus.emit(
439+
`lumino:update-tab:${this.widgetID}`,
440+
{
441+
title: this.jobLog ? 'Log – Job' : 'Log – Workflow',
442+
caption: `${prefix}${file ?? 'No file selected'}`,
443+
}
444+
)
445+
}
428446
// update the query when the id or file change
429447
this.updateQuery()
430448
// refresh the file & file list when the id changes

0 commit comments

Comments
 (0)