open-nomad/ui/app/helpers/format-volume-name.js
Phil Renaud a5bef3ce72
[ui, bugfix] Link fix for volumes where per_alloc=true (#12713)
* Allocation page linkfix

* fix added to task page and computed prop moved to allocation model

* Fallback query added to task group when specific volume isnt knowable

* Delog

* link text reflects alloc suffix

* Helper instead of in-template conditionals

* formatVolumeName unit test

* Removing unused helper import
2022-04-21 13:57:18 -04:00

19 lines
518 B
JavaScript

import { helper } from '@ember/component/helper';
/**
* Volume Name Formatter
*
* Usage: {{format-volume-name source=string isPerAlloc=boolean volumeExtension=string}}
*
* Outputs a title/link for volumes that are per_alloc-aware.
* (when a volume is per_alloc, its route location requires an additional extension)
*/
export function formatVolumeName(
_,
{ source = '', isPerAlloc, volumeExtension }
) {
return `${source}${isPerAlloc ? volumeExtension : ''}`;
}
export default helper(formatVolumeName);