Skip to content

Commit 41b79ab

Browse files
GraphNode: make jobs click-able
* Allow job nodes to be clicked on in the Graph view.
1 parent a00c728 commit 41b79ab

File tree

3 files changed

+29
-9
lines changed

3 files changed

+29
-9
lines changed

src/components/cylc/GraphNode.vue

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,24 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
7777
scale(${ (index === 0) ? mostRecentJobScale : '1' })
7878
`"
7979
>
80-
<job
81-
:svg="true"
82-
:status="job.node.state"
80+
<symbol
81+
:id="`${nodeID}-${index}`"
82+
viewBox="0 0 100 100"
83+
:class="`job_theme--${jobTheme}`"
84+
>
85+
<!--
86+
Use a "symbol" for job nodes in order to make them clickable.
87+
The job theme must be set on the "symbol" for styling to work.
88+
-->
89+
<job
90+
:svg="true"
91+
:status="job.node.state"
92+
/>
93+
</symbol>
94+
<use
95+
:href="`#${nodeID}-${index}`"
96+
width="100" height="100"
97+
v-cylc-object="job"
8398
/>
8499
</g>
85100
<!-- overflow indicator if there are surplus jobs -->
@@ -130,6 +145,9 @@ export default {
130145
// the size of the most recent job icon relative to any previos jobs
131146
default: 1.2,
132147
required: false
148+
},
149+
jobTheme: {
150+
required: true
133151
}
134152
},
135153
computed: {

src/styles/cylc/_job.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,14 @@ $cjob: ".c-job .job rect";
150150

151151
// if overridden elsewhere the new value should take priority
152152
// (this allows us to override the theme in the user-profile
153-
#app .job_theme--default {
153+
.job_theme--default {
154154
@include job_theme_default
155155
}
156156

157-
#app .job_theme--greyscale {
157+
.job_theme--greyscale {
158158
@include job_theme_greyscale
159159
}
160160

161-
#app .job_theme--colour_blind {
161+
.job_theme--colour_blind {
162162
@include job_theme_colour_blind
163163
}

src/views/Graph.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
2828
width="100%"
2929
height="100%"
3030
ref="graph"
31-
class="graph"
31+
class="graph job_theme--default"
3232
>
3333
<defs>
3434
<marker
@@ -44,7 +44,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
4444
</marker>
4545
</defs>
4646
<g
47-
class="svg-pan-zoom_viewport"
47+
class="svg-pan-zoom_viewport job_theme--default"
4848
>
4949
<!-- the nodes -->
5050
<g
@@ -58,6 +58,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
5858
<GraphNode
5959
:task="node"
6060
:jobs="node.children"
61+
:jobTheme="jobTheme"
6162
/>
6263
</g>
6364
<!-- the edges
@@ -93,7 +94,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
9394
<script>
9495
import Vue from 'vue'
9596
import gql from 'graphql-tag'
96-
import { mapGetters } from 'vuex'
97+
import { mapGetters, mapState } from 'vuex'
9798
import pageMixin from '@/mixins/index'
9899
import graphqlMixin from '@/mixins/graphql'
99100
import subscriptionComponentMixin from '@/mixins/subscriptionComponent'
@@ -303,6 +304,7 @@ export default {
303304
clearInterval(this.refreshTimer)
304305
},
305306
computed: {
307+
...mapState('app', ['jobTheme']),
306308
...mapGetters('workflows', ['getNodes']),
307309
query () {
308310
return new SubscriptionQuery(

0 commit comments

Comments
 (0)