-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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
- Loading branch information
1 parent
f1fcd50
commit a977577
Showing
11 changed files
with
105 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:bug | ||
ui: Fixed a bug where volumes were being incorrectly linked when per_alloc=true | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"compilerOptions":{"target":"es6","experimentalDecorators":true},"exclude":["node_modules","bower_components","tmp","vendor",".git","dist"]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { module, test } from 'qunit'; | ||
import { formatVolumeName } from 'nomad-ui/helpers/format-volume-name'; | ||
|
||
module('Unit | Helper | formatVolumeName', function () { | ||
test('Returns source as string when isPerAlloc is false', function (assert) { | ||
const expectation = 'my-volume-source'; | ||
assert.equal( | ||
formatVolumeName(null, { | ||
source: 'my-volume-source', | ||
isPerAlloc: false, | ||
volumeExtension: '[arbitrary]', | ||
}), | ||
expectation, | ||
'false perAlloc' | ||
); | ||
assert.equal( | ||
formatVolumeName(null, { | ||
source: 'my-volume-source', | ||
isPerAlloc: null, | ||
volumeExtension: '[arbitrary]', | ||
}), | ||
expectation, | ||
'null perAlloc' | ||
); | ||
}); | ||
|
||
test('Returns concatonated name when isPerAlloc is true', function (assert) { | ||
const expectation = 'my-volume-source[1]'; | ||
assert.equal( | ||
formatVolumeName(null, { | ||
source: 'my-volume-source', | ||
isPerAlloc: true, | ||
volumeExtension: '[1]', | ||
}), | ||
expectation, | ||
expectation | ||
); | ||
}); | ||
}); |