Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"compilerOptions": {
// "checkJs": true,
"paths": {
"@/*": ["./src/*"]
"@/*": ["./src/*"],
"$tests/*": ["./tests/*"]
}
},
"watchOptions": {
Expand Down
4 changes: 1 addition & 3 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<template>
<v-defaults-provider :defaults="vuetifyDefaults">
<v-app :class="`job_theme--${jobTheme}`">
<component :is="layout" :showSidebar="showSidebar">
<component :is="layout">
<router-view/>
</component>
</v-app>
Expand All @@ -36,8 +36,6 @@ const route = useRoute()

const layout = computed(() => `${route.meta.layout || DEFAULT_LAYOUT}-layout`)

const showSidebar = computed(() => route.meta.showSidebar ?? true)

const jobTheme = useJobTheme()

const vuetifyDefaults = useDynamicVuetifyDefaults()
Expand Down
70 changes: 35 additions & 35 deletions src/components/cylc/Toolbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
>
<!-- burger button -->
<v-btn
icon
v-if="drawerEnabled"
:icon="drawer ? icons.mdiMenuOpen : icons.mdiMenuClose"
@click.stop="toggleDrawer"
id="toggle-drawer"
>
<v-icon>{{ drawer ? icons.backBurger : icons.list }}</v-icon>
</v-btn>
/>
<!-- title -->
<v-toolbar-title
class="c-toolbar-title text-md-h6 text-subtitle-1 font-weight-medium text-primary ml-0"
class="c-toolbar-title text-md-h6 text-subtitle-1 font-weight-medium text-primary"
:class="drawerEnabled ? 'ml-0' : null"
>
{{ title }}
</v-toolbar-title>
Expand All @@ -52,7 +52,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<v-btn
id="workflow-mutate-button"
v-command-menu="currentWorkflow"
:icon="icons.menu"
:icon="icons.mdiMicrosoftXboxControllerMenu"
size="small"
density="comfortable"
/>
Expand Down Expand Up @@ -184,7 +184,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
>
<v-list>
<v-list-item
v-for="[name, view] in views"
v-for="[name, view] in workflowViews"
:id="`toolbar-add-${name}-view`"
:key="name"
@click="eventBus.emit('add-view', { name })"
Expand Down Expand Up @@ -212,6 +212,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<v-btn
icon
size="small"
data-cy="user-avatar-btn"
>
<v-avatar
color="primary"
Expand Down Expand Up @@ -250,7 +251,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</template>

<script>
import { inject } from 'vue'
import { inject, computed } from 'vue'
import { useRoute } from 'vue-router'
import { mapState } from 'vuex'
import {
mdiCog,
Expand All @@ -259,18 +261,18 @@ import {
mdiPlay,
mdiPlusBoxMultiple,
mdiStop,
mdiViewList,
mdiBackburger,
mdiAccount,
mdiChevronDown,
mdiArrowULeftTop,
mdiInformationOutline,
mdiMenuOpen,
mdiMenuClose,
} from '@mdi/js'
import { startCase } from 'lodash'
import { until } from '@/utils/reactivity'
import { useDrawer, toolbarHeight } from '@/utils/toolbar'
import WorkflowState from '@/model/WorkflowState.model'
import graphql from '@/mixins/graphql'
import { useGraphQL } from '@/mixins/graphql'
import {
mutationStatus
} from '@/utils/aotf'
Expand All @@ -280,6 +282,7 @@ import gql from 'graphql-tag'
import { eventBus } from '@/services/eventBus'
import { upperFirst } from 'lodash-es'
import WarningIcon from '@/components/cylc/WarningIcon.vue'
import { workflowViews } from '@/views/views'

const QUERY = gql(`
subscription Workflow ($workflowId: ID) {
Expand Down Expand Up @@ -327,25 +330,40 @@ fragment PrunedDelta on Pruned {
export default {
name: 'Toolbar',

setup () {
const { drawer, toggleDrawer } = useDrawer()
setup (props) {
const route = useRoute()

const { variables, workflowName, workflowID } = useGraphQL()

/** Show workflow name as title if we are navigated to one, otherwise the generic route title. */
const title = computed(
() => workflowName.value || route.meta?.title || route.name
)

const { drawer, drawerEnabled, toggleDrawer } = useDrawer()

const uisVersionInfo = inject('versionInfo')
const uisFlowVersion = uisVersionInfo?.value?.['cylc-flow'] ?? ''

return {
eventBus,
drawer,
drawerEnabled,
toggleDrawer,
toolbarHeight,
variables,
title,
workflowName,
workflowID,
uisFlowVersion,
workflowViews,
icons: {
add: mdiPlusBoxMultiple,
hold: mdiPause,
info: mdiInformationOutline,
list: mdiViewList,
backBurger: mdiBackburger,
menu: mdiMicrosoftXboxControllerMenu,
mdiMenuOpen,
mdiMenuClose,
mdiMicrosoftXboxControllerMenu,
run: mdiPlay,
stop: mdiStop,
mdiCog,
Expand All @@ -361,26 +379,9 @@ export default {
},

mixins: [
graphql,
subscriptionComponentMixin
],

props: {
/**
* All possible view component classes that can be rendered
*
* @type {Map<string, import('@/views/views.js').CylcView>}
*/
views: {
type: Map,
default: () => new Map()
},
workflowName: {
type: String,
default: null
}
},

data: () => ({
expecting: {
// store state from mutations in order to compute the "enabled" attrs
Expand All @@ -392,7 +393,6 @@ export default {
}),

computed: {
...mapState('app', ['title']),
...mapState('user', ['user']),
...mapState('workflows', ['cylcTree']),
query () {
Expand All @@ -408,7 +408,7 @@ export default {
},
currentWorkflow () {
if (!this.workflowName) return null
return this.cylcTree.$index[this.workflowId]
return this.cylcTree.$index[this.workflowID]
},
isRunning () {
return (
Expand Down
13 changes: 2 additions & 11 deletions src/components/cylc/workspace/Lumino.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
:id="id"
>
<component
:is="props.allViews.get(name).component"
:is="allViews.get(name).component"
:workflow-name="workflowName"
v-model:initial-options="views.get(id).initialOptions"
:widgetID="id"
Expand All @@ -63,7 +63,7 @@ import { LuminoWidget } from '@/components/cylc/workspace/luminoWidget'
import { BoxPanel, DockPanel, Widget } from '@lumino/widgets'
import { watchWithControl } from '@/utils/reactivity'
import { replacer, reviver } from '@/utils/json'
import { useDefaultView } from '@/views/views'
import { allViews, useDefaultView } from '@/views/views'
import { eventBus } from '@/services/eventBus'
import { useWorkspaceLayoutsCache } from '@/composables/cacheStorage'

Expand Down Expand Up @@ -91,15 +91,6 @@ const props = defineProps({
type: String,
required: true
},
/**
* All possible view component classes that can be rendered
*
* @type {Map<string, import('@/views/views.js').CylcView>}
*/
allViews: {
type: Map,
required: true
},
})

const emit = defineEmits([
Expand Down
81 changes: 16 additions & 65 deletions src/layouts/Default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<template>
<div>
<ConnectionStatus :is-offline="offline" />
<Drawer v-if="showSidebar" />
<Drawer v-if="drawerEnabled" />
<CommandMenu/>

<v-main>
<Toolbar v-if="showToolbar" />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sooo, this change is unexpected, I'm guessing it just made more sense to you include the toolbar here?

The toolbar was very purposefully omitted from the standalone views, but admittedly, the standalone views never got much attention and their purpose is unclear / lost in the midst of time.

The ideas behind the standalone views were:

  • Embeddable (i.e, <iframe />able) components for incorporation in other tools/apps/dashboards.
    • The idea to assimilate the Cylc GUI into other apps.
    • Jupyter Lab (Investigate a Cylc UI within JupyterLab #374) was one idea.
    • But operators also expressed a desire for "display panels" they could put on wall monitors or whatever.
    • Potential for other high-level integrations - site dashboards or whatever.
    • Situations where you probably don't want the toolbar on the view, but might want it available as a standalone component so it can be embedded in the appropriate location.
  • Bare-bones testing:
    • To allow the views to be tested standalone with only their subscription and none other active.
    • We didn't have Cypress component testing as an option back then so the ability to test the bare minimum of the view was somewhat important.
    • Helps avoid the views developing dependencies on the toolbar, etc.

<Toolbar />
<alert />
<div
id="core-view"
Expand All @@ -35,79 +35,30 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</div>
</template>

<script>
import { computed } from 'vue'
import { useRoute } from 'vue-router'
import { mapState } from 'vuex'
<script setup>
import { computed, onErrorCaptured } from 'vue'
import { store } from '@/store/index'
import { allViews } from '@/views/views'
import { Alert as AlertModel } from '@/model/Alert.model'
import Alert from '@/components/core/Alert.vue'
import Drawer from '@/components/cylc/Drawer.vue'
import Toolbar from '@/components/cylc/Toolbar.vue'
import { toolbarHeight } from '@/utils/toolbar'
import { toolbarHeight, useDrawer } from '@/utils/toolbar'
import ConnectionStatus from '@/components/cylc/ConnectionStatus.vue'
import CommandMenu from '@/components/cylc/commandMenu/Menu.vue'

export default {
name: 'Default',
const { drawerEnabled } = useDrawer()

setup () {
const route = useRoute()
/**
* Views that display workflows. For these views, we do not
* want to display the default Toolbar—the Workspace view
* has its own Toolbar that communicates with the Workflow
* component (e.g. the Workflow Toolbar owns a button that
* triggers the action to add a new Tree or Table View, so the events
* are passed down from the parent Workflow View).
*/
const workflowViews = [
...allViews.keys(),
'Workspace',
]

/** Whether to show app toolbar (not the workspace view toolbar). */
const showToolbar = computed(
() => !workflowViews.includes(route.name)
)
const coreViewStyle = computed(() => ({
marginTop: '0px',
height: showToolbar.value ? `calc(100vh - ${toolbarHeight}px)` : '100vh'
}))

return {
showToolbar,
coreViewStyle,
}
},

components: {
ConnectionStatus,
CommandMenu,
Alert,
Drawer,
Toolbar
},

props: {
showSidebar: {
type: Boolean,
required: false,
default: true
}
},
const coreViewStyle = {
height: `calc(100vh - ${toolbarHeight}px)`
}

computed: {
...mapState(['offline'])
},
const offline = computed(() => store.state.offline)

errorCaptured (error, vm, info) {
if (import.meta.env.MODE !== 'production') {
store.dispatch('setAlert', new AlertModel(error, 'error'))
}
// Stop error propagating further:
return false
onErrorCaptured((error, vm, info) => {
if (import.meta.env.MODE !== 'production') {
store.dispatch('setAlert', new AlertModel(error, 'error'))
}
}
// Stop error propagating further:
return false
})
</script>
10 changes: 0 additions & 10 deletions src/layouts/Empty.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<slot />
</v-main>
</template>

<script>
export default {
name: 'Empty'
}
</script>

<style scoped>

</style>
Loading