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

Launcher save fixed attributes #3784

Merged
merged 19 commits into from
Oct 3, 2024
Merged

Launcher save fixed attributes #3784

merged 19 commits into from
Oct 3, 2024

Conversation

ashton22305
Copy link
Contributor

Fixes #3743

Prevents bc_num_slots from overwriting opts

Prevents auto_cores from being overwritten entirely in the launcher

Updates the data-fixed-toggler attribute for auto-environment-variable when the environment variable changes


if (labelString.match(/Environment( |\s)Variable/)) {
var label_field = event.target.parentElement.children[2].children[0];
label_field.innerHTML = `Environment Variable: ${aev_name}`;
}

// Update the checkbox so that environment variables can be fixed when created
let fixedBoxGroup = event.target.parentElement.children[3].children[0].children[0];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it's really flaky and prone to errors. Is there some ID or data- attribute we can apply here so we don't have this?

querySelector (or querySelectorAll) is a method on the document object, bit it's also a method on all elements. So you could do event.target.querySelector to find what we're looking for.

@johrstrom johrstrom closed this Sep 16, 2024
@johrstrom johrstrom reopened this Sep 16, 2024
Comment on lines 31 to 43
def self.default_script_value(initial_opts, script_opts)
return nil if !initial_opts[:value] || script_opts.empty?

# Replace directory if the script is present in correct directory, otherwise delete value
valid_opt = script_opts.select { |opt| opt.first == File.basename(initial_opts[:value]) }.first
if valid_opt
initial_opts[:value] = valid_opt.last
elsif script_opts&.none? { |opt| opt.include?(initial_opts[:value]) }
initial_opts.delete(:value)
end

(initial_opts[:value] || script_opts.first.last).to_s
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm struggling to understand this. I think because it does 2 things - potentially modifies initial_opts and has a return value.

Can we restructure this so it just has the return value with no modification to the things passed into it?

When I was investigating the tests, I came up with this - I also think a simple name change (and type change of the first argument) helped me figure out what it's attempting to do.

# called through  default_value(opts[:default], options)

    def self.default_value(default, scripts)
      if scripts.empty?
        nil
      elsif default.nil? || default.to_s.empty?
        scripts.first[1]
      elsif scripts.map { |s| s[1] }.include?(default)
        default
      else
        scripts.first[1]
      end
    end

@johrstrom johrstrom closed this Sep 30, 2024
@johrstrom johrstrom reopened this Sep 30, 2024
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you submit the changes to this file in another pull request? I can't just glance at this to see what it is, so I'll need more time to look it over.

@johrstrom johrstrom merged commit d95e1b2 into master Oct 3, 2024
26 checks passed
@johrstrom johrstrom deleted the save-fixed-attributes branch October 3, 2024 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Project Manager - Cannot save some fixed attributes in launcher
3 participants