Skip to content

Commit 59d04f1

Browse files
committed
Show log view type in Lumino tab title and selected file in caption
1 parent ca5c69b commit 59d04f1

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
@@ -201,6 +201,7 @@ import CopyBtn from '@/components/core/CopyBtn.vue'
201201
import { Alert } from '@/model/Alert.model'
202202
import { getJobLogFileFromState } from '@/model/JobState.model'
203203
import { useLogWordWrapDefault } from '@/composables/localStorage'
204+
import { eventBus } from '@/services/eventBus'
204205
205206
/**
206207
* Query used to retrieve data for the Log view.
@@ -314,6 +315,12 @@ export default {
314315
315316
props: {
316317
initialOptions,
318+
/** ID of widget if the log view is in a Lumino tab. */
319+
widgetID: {
320+
type: String,
321+
required: false,
322+
default: null,
323+
},
317324
},
318325
319326
setup (props, { emit }) {
@@ -429,7 +436,18 @@ export default {
429436
id: this.id ?? undefined, // (do not trigger the callback on null ⇄ undefined)
430437
file: this.file ?? undefined
431438
}),
432-
async ({ id }, old) => {
439+
async ({ id, file }, old) => {
440+
// update the widget tab caption when the id or file change
441+
if (this.widgetID) {
442+
const prefix = this.relativeID ? `${this.relativeID}` : ''
443+
eventBus.emit(
444+
`lumino:update-tab:${this.widgetID}`,
445+
{
446+
title: this.jobLog ? 'Log – Job' : 'Log – Workflow',
447+
caption: `${prefix}${file ?? 'No file selected'}`,
448+
}
449+
)
450+
}
433451
// update the query when the id or file change
434452
this.updateQuery()
435453
// refresh the file & file list when the id changes

0 commit comments

Comments
 (0)