github.com/hernad/nomad@v1.6.112/ui/app/components/job-status/allocation-status-block.js (about) 1 /** 2 * Copyright (c) HashiCorp, Inc. 3 * SPDX-License-Identifier: MPL-2.0 4 */ 5 6 import Component from '@glimmer/component'; 7 8 export default class JobStatusAllocationStatusBlockComponent extends Component { 9 get countToShow() { 10 const restWidth = 50; 11 const restGap = 10; 12 let cts = Math.floor((this.args.width - (restWidth + restGap)) / 42); 13 // Either show 3+ or show only a single/remaining box 14 return cts > 3 ? cts : 0; 15 } 16 17 get remaining() { 18 return this.args.count - this.countToShow; 19 } 20 }