Backport of ui: handle node pool requests to older regions into release/1.6.x (#18024)

This pull request was automerged via backport-assistant
This commit is contained in:
hc-github-team-nomad-core 2023-07-21 08:17:08 -05:00 committed by GitHub
parent 30260f06e8
commit 63316363c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 26 additions and 4 deletions

3
.changelog/18021.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:bug
ui: Fixed a bug that could cause an error when accessing a region running versions of Nomad prior to 1.6.0
```

View File

@ -14,4 +14,21 @@ export default class NodePoolAdapter extends ApplicationAdapter {
resource = pluralize(resource);
return `/v1/${relationshipResource}/${resource}`;
}
findAll() {
return super.findAll(...arguments).catch((error) => {
// Handle the case where the node pool request is sent to a region that
// doesn't have node pools and the request is handled by the nodes
// endpoint.
const isNodeRequest = error.message.includes(
'node lookup failed: index error: UUID must be 36 characters'
);
if (isNodeRequest) {
return [];
}
// Rethrow to be handled downstream.
throw error;
});
}
}

View File

@ -247,7 +247,7 @@
<span class="term">
Node Pool
</span>
{{this.model.nodePool}}
{{#if this.model.nodePool}}{{this.model.nodePool}}{{else}}-{{/if}}
</span>
{{#if this.model.nodeClass}}
<span class="pair" data-test-node-class>

View File

@ -18,7 +18,9 @@
</span>
</td>
<td data-test-client-address class="is-200px is-truncatable">{{this.node.httpAddr}}</td>
<td data-test-client-node-pool title="{{this.node.nodePool}}">{{this.node.nodePool}}</td>
<td data-test-client-node-pool title="{{this.node.nodePool}}">
{{#if this.node.nodePool}}{{this.node.nodePool}}{{else}}-{{/if}}
</td>
<td data-test-client-datacenter>{{this.node.datacenter}}</td>
<td data-test-client-version>{{this.node.version}}</td>
<td data-test-client-volumes>{{if this.node.hostVolumes.length this.node.hostVolumes.length}}</td>

View File

@ -33,7 +33,7 @@
{{/if}}
<span class="pair" data-test-job-stat="node-pool">
<span class="term">Node Pool</span>
{{@job.nodePool}}
{{#if @job.nodePool}}{{@job.nodePool}}{{else}}-{{/if}}
</span>
{{yield to="after-namespace"}}
</div>

View File

@ -47,7 +47,7 @@
{{this.job.displayType.type}}
</td>
<td data-test-job-node-pool>
{{this.job.nodePool}}
{{#if this.job.nodePool}}{{this.job.nodePool}}{{else}}-{{/if}}
</td>
<td data-test-job-priority>
{{this.job.priority}}