mirror of
https://github.com/kemko/nomad.git
synced 2026-01-08 11:25:41 +03:00
Show the nomad agent version of the agent the UI is served from
This commit is contained in:
@@ -28,6 +28,20 @@ export default class SystemService extends Service {
|
||||
});
|
||||
}
|
||||
|
||||
@computed
|
||||
get agent() {
|
||||
const token = this.token;
|
||||
return PromiseObject.create({
|
||||
promise: token
|
||||
.authorizedRawRequest(`/${namespace}/agent/self`)
|
||||
.then(jsonWithDefault({}))
|
||||
.then(agent => {
|
||||
agent.version = agent.member?.Tags?.build || 'Unknown';
|
||||
return agent;
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
@computed
|
||||
get defaultRegion() {
|
||||
const token = this.token;
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
.gutter {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
border-right: 1px solid $grey-blue;
|
||||
overflow: hidden;
|
||||
@@ -56,6 +58,13 @@
|
||||
.menu {
|
||||
z-index: $z-gutter;
|
||||
}
|
||||
|
||||
.gutter-footer {
|
||||
text-align: center;
|
||||
border-top: 1px solid lighten($grey-blue, 10%);
|
||||
padding: 0.5em 0;
|
||||
margin-top: auto;
|
||||
}
|
||||
}
|
||||
|
||||
// Treated as an element of the gutter component despite not being nested within
|
||||
|
||||
@@ -84,6 +84,9 @@
|
||||
<li><LinkTo @route="topology" @activeClass="is-active" data-test-gutter-link="topology">Topology</LinkTo></li>
|
||||
</ul>
|
||||
</aside>
|
||||
<footer class="gutter-footer">
|
||||
<span class="is-faded">v{{this.system.agent.version}}</span>
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
<div data-test-page-content class="page-column is-right">
|
||||
|
||||
@@ -323,6 +323,12 @@ export default function() {
|
||||
};
|
||||
});
|
||||
|
||||
this.get('/agent/self', function({ agents }) {
|
||||
return {
|
||||
member: this.serialize(agents.first()),
|
||||
};
|
||||
});
|
||||
|
||||
this.get('/agent/monitor', function({ agents, nodes }, { queryParams }) {
|
||||
const serverId = queryParams.server_id;
|
||||
const clientId = queryParams.client_id;
|
||||
|
||||
@@ -152,7 +152,7 @@ module('Acceptance | regions (many)', function(hooks) {
|
||||
);
|
||||
});
|
||||
|
||||
test('when the region is not the default region, all api requests include the region query param', async function(assert) {
|
||||
test('when the region is not the default region, all api requests other than the agent/self request include the region query param', async function(assert) {
|
||||
window.localStorage.removeItem('nomadTokenSecret');
|
||||
const region = server.db.regions[1].id;
|
||||
|
||||
@@ -178,7 +178,11 @@ module('Acceptance | regions (many)', function(hooks) {
|
||||
);
|
||||
|
||||
appRequests.forEach(req => {
|
||||
assert.ok(req.url.includes(`region=${region}`), req.url);
|
||||
if (req.url === '/v1/agent/self') {
|
||||
assert.notOk(req.url.includes('region='), `(no region) ${req.url}`);
|
||||
} else {
|
||||
assert.ok(req.url.includes(`region=${region}`), req.url);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user