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
727ca282
Commit
727ca282
authored
3 years ago
by
Jai Bhagat
Browse files
Options
Download
Email Patches
Plain Diff
feat: add filter client allocations table
parent
873b0969
Branches unavailable
v1.4.3
v1.4.2
v1.4.1
v1.4.0
v1.4.0-rc.1
v1.4.0-beta.1
v1.3.8
v1.3.7
v1.3.6
v1.3.5
v1.3.4
v1.3.3
v1.3.2
v1.3.1
v1.3.0
v1.3.0-rc.1
v1.3.0-beta.1
v1.2.15
v1.2.14
v1.2.13
v1.2.12
v1.2.11
v1.2.10
v1.2.9
v1.2.8
v1.2.7
v1.2.6
v1.2.5
v1.2.4
nightly
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ui/app/controllers/clients/client/index.js
+33
-2
ui/app/controllers/clients/client/index.js
ui/app/templates/clients/client/index.hbs
+9
-1
ui/app/templates/clients/client/index.hbs
with
42 additions
and
3 deletions
+42
-3
ui/app/controllers/clients/client/index.js
+
33
-
2
View file @
727ca282
...
...
@@ -7,6 +7,7 @@ import { task } from 'ember-concurrency';
import
Sortable
from
'
nomad-ui/mixins/sortable
'
;
import
Searchable
from
'
nomad-ui/mixins/searchable
'
;
import
messageFromAdapterError
from
'
nomad-ui/utils/message-from-adapter-error
'
;
import
{
serialize
,
deserializedQueryParam
as
selection
}
from
'
nomad-ui/utils/qp-serialize
'
;
import
classic
from
'
ember-classic-decorator
'
;
@
classic
...
...
@@ -27,11 +28,15 @@ export default class ClientController extends Controller.extend(Sortable, Search
{
onlyPreemptions
:
'
preemptions
'
,
},
{
qpStatus
:
'
status
'
,
},
];
// Set in the route
flagAsDraining
=
false
;
qpStatus
=
''
;
currentPage
=
1
;
pageSize
=
8
;
...
...
@@ -45,15 +50,25 @@ export default class ClientController extends Controller.extend(Sortable, Search
onlyPreemptions
=
false
;
@
computed
(
'
model.allocations.[]
'
,
'
preemptions.[]
'
,
'
onlyPreemptions
'
)
@
computed
(
'
model.allocations.[]
'
,
'
preemptions.[]
'
,
'
onlyPreemptions
'
,
'
selectionStatus
'
)
get
visibleAllocations
()
{
return
this
.
onlyPreemptions
?
this
.
preemptions
:
this
.
model
.
allocations
;
const
allocations
=
this
.
onlyPreemptions
?
this
.
preemptions
:
this
.
model
.
allocations
;
const
{
selectionStatus
}
=
this
;
return
allocations
.
filter
(
alloc
=>
{
if
(
selectionStatus
.
length
&&
!
selectionStatus
.
includes
(
alloc
.
clientStatus
))
{
return
false
;
}
return
true
;
});
}
@
alias
(
'
visibleAllocations
'
)
listToSort
;
@
alias
(
'
listSorted
'
)
listToSearch
;
@
alias
(
'
listSearched
'
)
sortedAllocations
;
@
selection
(
'
qpStatus
'
)
selectionStatus
;
eligibilityError
=
null
;
stopDrainError
=
null
;
drainError
=
null
;
...
...
@@ -147,4 +162,20 @@ export default class ClientController extends Controller.extend(Sortable, Search
const
error
=
messageFromAdapterError
(
err
)
||
'
Could not run drain
'
;
this
.
set
(
'
drainError
'
,
error
);
}
get
optionsAllocationStatus
()
{
return
[
{
key
:
'
queued
'
,
label
:
'
Queued
'
},
{
key
:
'
starting
'
,
label
:
'
Starting
'
},
{
key
:
'
running
'
,
label
:
'
Running
'
},
{
key
:
'
complete
'
,
label
:
'
Complete
'
},
{
key
:
'
failed
'
,
label
:
'
Failed
'
},
{
key
:
'
lost
'
,
label
:
'
Lost
'
},
];
}
@
action
setFacetQueryParam
(
queryParam
,
selection
)
{
this
.
set
(
queryParam
,
serialize
(
selection
));
}
}
This diff is collapsed.
Click to expand it.
ui/app/templates/clients/client/index.hbs
+
9
-
1
View file @
727ca282
...
...
@@ -299,7 +299,15 @@
@
onChange=
{{
action
this
.
resetPagination
}}
@
placeholder=
"Search allocations..."
@
class=
"is-inline pull-right"
@
inputClass=
"is-compact"
/>
@
inputClass=
"is-compact"
/>
<MultiSelectDropdown
data-test-allocation-status-facet
@
label=
"Status"
@
options=
{{
this
.
optionsAllocationStatus
}}
@
selection=
{{
this
.
selectionStatus
}}
@
onSelect=
{{
action
"setFacetQueryParam"
"qpStatus"
}}
/>
</div>
<div
class=
"boxed-section-body is-full-bleed"
>
<ListPagination
...
...
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