Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Nomad
Commits
79ecf479
Commit
79ecf479
authored
7 years ago
by
Michael Lange
Browse files
Options
Download
Email Patches
Plain Diff
Make allocation pages extend the job breadcrumb trail
parent
efeb5abb
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
ui/app/controllers/allocations/allocation.js
+34
-1
ui/app/controllers/allocations/allocation.js
ui/app/controllers/allocations/allocation/index.js
+5
-1
ui/app/controllers/allocations/allocation/index.js
ui/app/routes/allocations/allocation.js
+9
-2
ui/app/routes/allocations/allocation.js
ui/app/templates/allocations/allocation/index.hbs
+9
-4
ui/app/templates/allocations/allocation/index.hbs
with
57 additions
and
8 deletions
+57
-8
ui/app/controllers/allocations/allocation.js
+
34
-
1
View file @
79ecf479
import
Controller
from
'
@ember/controller
'
;
import
{
computed
}
from
'
@ember/object
'
;
import
{
qpBuilder
}
from
'
nomad-ui/utils/classes/query-params
'
;
export
default
Controller
.
extend
({});
export
default
Controller
.
extend
({
breadcrumbs
:
computed
(
'
model.job
'
,
function
()
{
return
[
{
label
:
'
Jobs
'
,
args
:
[
'
jobs
'
]
},
{
label
:
this
.
get
(
'
model.job.name
'
),
args
:
[
'
jobs.job
'
,
this
.
get
(
'
model.job
'
),
qpBuilder
({
jobNamespace
:
this
.
get
(
'
model.namespace.name
'
)
||
'
default
'
,
}),
],
},
{
label
:
this
.
get
(
'
model.taskGroupName
'
),
args
:
[
'
jobs.job.task-group
'
,
this
.
get
(
'
model.job
'
),
this
.
get
(
'
model.taskGroupName
'
),
qpBuilder
({
jobNamespace
:
this
.
get
(
'
model.namespace.name
'
)
||
'
default
'
,
}),
],
},
{
label
:
this
.
get
(
'
model.shortId
'
),
args
:
[
'
allocations.allocation
'
,
this
.
get
(
'
model
'
)],
},
];
}),
});
This diff is collapsed.
Click to expand it.
ui/app/controllers/allocations/allocation/index.js
+
5
-
1
View file @
79ecf479
import
{
alias
}
from
'
@ember/object/computed
'
;
import
Controller
from
'
@ember/controller
'
;
import
Controller
,
{
inject
as
controller
}
from
'
@ember/controller
'
;
import
Sortable
from
'
nomad-ui/mixins/sortable
'
;
export
default
Controller
.
extend
(
Sortable
,
{
allocationController
:
controller
(
'
allocations.allocation
'
),
queryParams
:
{
sortProperty
:
'
sort
'
,
sortDescending
:
'
desc
'
,
...
...
@@ -11,6 +13,8 @@ export default Controller.extend(Sortable, {
sortProperty
:
'
name
'
,
sortDescending
:
false
,
breadcrumbs
:
alias
(
'
allocationController.breadcrumbs
'
),
listToSort
:
alias
(
'
model.states
'
),
sortedStates
:
alias
(
'
listSorted
'
),
});
This diff is collapsed.
Click to expand it.
ui/app/routes/allocations/allocation.js
+
9
-
2
View file @
79ecf479
import
Route
from
'
@ember/routing/route
'
;
import
WithModelErrorHandling
from
'
nomad-ui/mixins/with-model-error-handling
'
;
import
{
collect
}
from
'
@ember/object/computed
'
;
import
{
watchRecord
}
from
'
nomad-ui/utils/properties/watch
'
;
import
WithWatchers
from
'
nomad-ui/mixins/with-watchers
'
;
import
notifyError
from
'
nomad-ui/utils/notify-error
'
;
export
default
Route
.
extend
(
WithModelErrorHandling
,
WithWatchers
,
{
export
default
Route
.
extend
(
WithWatchers
,
{
startWatchers
(
controller
,
model
)
{
controller
.
set
(
'
watcher
'
,
this
.
get
(
'
watch
'
).
perform
(
model
));
},
model
()
{
// Preload the job for the allocation since it's required for the breadcrumb trail
return
this
.
_super
(...
arguments
)
.
then
(
allocation
=>
allocation
.
get
(
'
job
'
).
then
(()
=>
allocation
))
.
catch
(
notifyError
(
this
));
},
watch
:
watchRecord
(
'
allocation
'
),
watchers
:
collect
(
'
watch
'
),
...
...
This diff is collapsed.
Click to expand it.
ui/app/templates/allocations/allocation/index.hbs
+
9
-
4
View file @
79ecf479
{{#
global-header
class
=
"page-header"
}}
<li><a
href=
"#"
>
Allocations
</a></li>
<li
class=
"is-active"
>
{{#
link-to
"allocations.allocation"
model
}}{{
model
.
shortId
}}{{/
link-to
}}
</li>
{{#
each
breadcrumbs
as
|
breadcrumb
index
|
}}
<li
class=
"
{{
if
(
eq
(
inc
index
)
breadcrumbs
.
length
)
"is-active"
}}
"
>
{{#
link-to
data-test-breadcrumb
=
breadcrumb
.
label
params
=
breadcrumb
.
args
}}
{{
breadcrumb
.
label
}}
{{/
link-to
}}
</li>
{{/
each
}}
{{/
global-header
}}
{{#
gutter-menu
class
=
"page-body"
}}
<section
class=
"section"
>
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help