Migrate navigator.clipboard in ML model version page to copyToClipboard

What does this MR do and why?

Replaces the direct navigator.clipboard.writeText call in the ML model version page with copyToClipboard from ~/lib/utils/copy_to_clipboard. This helper also works on non-secure (http) pages, and it lets us remove the no-restricted-properties eslint-disable comment. The spec had no test for the copy button click, so one was added.

Closes #579488.

References

Part of epic &19827.

Screenshots or screen recordings

Not applicable — no visual change.

How to set up and validate locally

  1. Run yarn jest spec/frontend/ml/model_registry/apps/show_ml_model_version_spec.js.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist.

This contribution was prepared with the help of an AI assistant. I reviewed the changes and take responsibility for them.

Merge request reports

Loading
Loading