Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
philrenaud committed Mar 6, 2023
1 parent 49d73ec commit 9d2f67b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 39 deletions.
3 changes: 3 additions & 0 deletions .changelog/16274.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
ui: fixed an issue where system/sysbatch jobs with wildcard datacenters (like ["dc*"]) were not showing client status charts
```
38 changes: 1 addition & 37 deletions ui/app/abilities/variable.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { computed, get } from '@ember/object';
import { or } from '@ember/object/computed';
import AbstractAbility from './abstract';
import { default as doesMatchPattern } from 'nomad-ui/utils/match-glob';
import doesMatchPattern from 'nomad-ui/utils/match-glob';

const WILDCARD_GLOB = '*';
const WILDCARD_PATTERN = '/';
Expand Down Expand Up @@ -208,42 +208,6 @@ export default class Variable extends AbstractAbility {
return this._smallestDifference(allMatchingPaths, path);
}

// _doesMatchPattern(pattern, path) {
// const parts = pattern?.split(WILDCARD_GLOB);
// const hasLeadingGlob = pattern?.startsWith(WILDCARD_GLOB);
// const hasTrailingGlob = pattern?.endsWith(WILDCARD_GLOB);
// const lastPartOfPattern = parts[parts.length - 1];
// const isPatternWithoutGlob = parts.length === 1 && !hasLeadingGlob;

// if (!pattern || !path || isPatternWithoutGlob) {
// return pattern === path;
// }

// if (pattern === WILDCARD_GLOB) {
// return true;
// }

// let subPathToMatchOn = path;
// for (let i = 0; i < parts.length; i++) {
// const part = parts[i];
// const idx = subPathToMatchOn?.indexOf(part);
// const doesPathIncludeSubPattern = idx > -1;
// const doesMatchOnFirstSubpattern = idx === 0;

// if (i === 0 && !hasLeadingGlob && !doesMatchOnFirstSubpattern) {
// return false;
// }

// if (!doesPathIncludeSubPattern) {
// return false;
// }

// subPathToMatchOn = subPathToMatchOn.slice(0, idx + path.length);
// }

// return hasTrailingGlob || path.endsWith(lastPartOfPattern);
// }

_computeLengthDiff(pattern, path) {
const countGlobsInPattern = pattern
?.split('')
Expand Down
4 changes: 2 additions & 2 deletions ui/app/utils/properties/job-client-status.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ export default function jobClientStatus(nodesKey, jobKey) {

// Filter nodes by the datacenters defined in the job.
const filteredNodes = nodes.filter((n) => {
return job.datacenters.filter((dc) => {
return job.datacenters.find((dc) => {
return !!matchGlob(dc, n.datacenter);
}).length;
});
});

if (job.status === 'pending') {
Expand Down

0 comments on commit 9d2f67b

Please sign in to comment.