Skip to content

Commit e3e2f3a

Browse files
Refactor: removed computed logic, used latestJob in template, updated class as requested
1 parent 6b1883f commit e3e2f3a

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

src/components/cylc/tree/TreeItem.vue

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
9292
</div>
9393
<span class="mx-1">{{ node.name }}</span>
9494
<span
95-
v-if="!isExpanded && latestPlatform"
96-
class="platform-badge mx-1 text-caption text-grey"
95+
v-if="!isExpanded && latestJob(node)?.platform"
96+
class="mx-1 text-grey"
9797
>
98-
[{{ latestPlatform }}]
98+
[{{ latestJob(node)?.platform }}]
9999
</span>
100100
<FlowNumsChip :flowNums="node.node.flowNums"/>
101101
</div>
@@ -185,7 +185,6 @@ import { getIndent, getNodeChildren } from '@/components/cylc/tree/util'
185185
import { once } from '@/utils'
186186
import { useToggle } from '@vueuse/core'
187187
import FlowNumsChip from '@/components/cylc/common/FlowNumsChip.vue'
188-
import { computed } from 'vue' //
189188
190189
export default {
191190
name: 'TreeItem',
@@ -250,21 +249,12 @@ export default {
250249
// Toggles to true when this.isExpanded first becomes true and doesn't get recomputed afterwards
251250
const renderChildren = once(isExpanded)
252251
253-
const latestPlatform = computed(() => {
254-
const jobs = props.node.children
255-
if (props.node.type === 'task' && jobs?.length) {
256-
return jobs[0]?.node?.platform || null
257-
}
258-
return null
259-
})
260-
261252
return {
262253
isExpanded,
263254
isFlowNone,
264255
latestJob,
265256
renderChildren,
266257
toggleExpandCollapse,
267-
latestPlatform,
268258
}
269259
},
270260

0 commit comments

Comments
 (0)