Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] Nomad UI breaks when a job name includes a period #4866

Closed
nickwales opened this issue Nov 12, 2018 · 6 comments
Closed

[bug] Nomad UI breaks when a job name includes a period #4866

nickwales opened this issue Nov 12, 2018 · 6 comments

Comments

@nickwales
Copy link
Contributor

nickwales commented Nov 12, 2018

Nomad version

Nomad v0.8.6

Operating system and Environment details

Ubuntu 16.04

Issue

The UI breaks whenever a job name has a period

Reproduction steps

Run a job with periods in the name e.g. 'my.new.job' , browse the jobs view and click on a job with a period. Get a page with "Error Something went wrong"

@DingoEatingFuzz
Copy link
Contributor

Hi @nickwales, I just tried replicating this locally with v0.8.6 and couldn't.

image

Can you reproduce this while the chrome/firefox/safari dev tools are open monitoring network traffic? I'm wondering if the API request is erroring and causing the UI to error. Or maybe the dots are a red herring and the issue is something else?

I'm looking for a screenshot like this:

image

Thank you!

@nickwales
Copy link
Contributor Author

@DingoEatingFuzz interesting that you're not seeing it, could be a red herring but I can't yet see any differences between jobs with and without the dots! The network diagram or syslog doesn't show me anything but the console has an unrecoverable error:

Console:
screen shot 2018-12-03 at 8 04 24 am

Network:
screen shot 2018-12-03 at 8 10 52 am

@DingoEatingFuzz
Copy link
Contributor

Thank you for the screenshots @nickwales. @angrycub managed to reproduce this and together we diagnosed the issue.

Turns out it isn't the dot in the job name, but a dot in the task name. This is a perfectly valid Nomad thing to do, but it breaks this line of code.

const state = get(hash, `TaskStates.${key}`);

key here is the task name, so it expands to something like

const state = get(hash, `TaskStates.my.task`);

Which uses Ember's getter function to avoid having to check for undefined objects. Unfortunately, this expands to vanilla js that looks something like

const state = hash.TaskStates.my.task;

Which doesn't work since the actual object looks something like

{
  "TaskStates": {
    "my.task": { ... }
  }
}

The correct js is more like

const state = hash.TaskStates ? hash.TaskStates['my.task'] : {}

Now that the root issue is known, I can fix it. I'll also make sure to check any other place where this might be a problem.

@nickwales
Copy link
Contributor Author

Awesome, thank you!

@DingoEatingFuzz
Copy link
Contributor

Fixed in #4994

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants