github.com/hernad/nomad@v1.6.112/ui/app/helpers/format-template-label.js (about) 1 /** 2 * Copyright (c) HashiCorp, Inc. 3 * SPDX-License-Identifier: MPL-2.0 4 */ 5 6 import { helper } from '@ember/component/helper'; 7 import { capitalize } from '@ember/string'; 8 9 export default helper(function formatTemplateLabel([path]) { 10 // Removes the preceeding nomad/job-templates/default/ 11 let label; 12 const delimiter = path.lastIndexOf('/'); 13 if (delimiter !== -1) { 14 label = path.slice(delimiter + 1); 15 } else { 16 label = path; 17 } 18 return capitalize(label).split('-').join(' '); 19 });