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

Replace Foundation javascript #2972

Open
hmpf opened this issue Sep 16, 2024 · 7 comments
Open

Replace Foundation javascript #2972

hmpf opened this issue Sep 16, 2024 · 7 comments
Assignees

Comments

@hmpf
Copy link
Contributor

hmpf commented Sep 16, 2024

For #2794

@lunkwill42
Copy link
Member

We need an initial analysis of actual usage of Foundation JS calls before we can start planning what to do with it.

@podliashanyk
Copy link
Contributor

Found following usages directly in JS:

Targets
    Occurrences of 'foundation' in Project
Found occurrences in Project  (41 usages found)
    Unclassified  (41 usages found)
        nav  (41 usages found)
            python/nav/web/static/js/src  (26 usages found)
                devicehistory.js  (3 usages found)
                    41 Foundation.libs.tooltip.create(target);
                    43 Foundation.libs.tooltip.hide($(event.currentTarget));
                    46 Foundation.libs.tooltip.showTip(target);
                info_room.js  (2 usages found)
                    70 $(document).foundation('reveal');  // Apply reveal after ajax request
                    71 $(document).foundation('tooltip');  // Apply tooltip after ajax request
                info_room_rack.js  (5 usages found)
                    60 $sensorModal.foundation('reveal', 'open', {
                    98 $sensorModal.foundation('reveal', 'close');
                    114 $sensorModal.foundation('reveal', 'close');
                    137 $rackModal.foundation('reveal', 'close');
                    496 $(document).foundation();  // Make sure add rack modal opens
                main.js  (1 usage found)
                    68 $(document).foundation();   // Apply foundation javascript on load
                portadmin.js  (3 usages found)
                    25 this.modal.foundation('reveal', 'open', {
                    31 this.modal.foundation('reveal', 'close');
                    91 $(document).foundation('tooltip', 'reflow');
                radius.js  (1 usage found)
                    69 $('#details_modal').foundation('reveal', 'open', $(this).attr('data-bubble-reveal'));
                seeddb.js  (2 usages found)
                    126 $(document).foundation({
                    140 $(document).foundation('joyride', 'start');
                seeddb_add_patch.js  (4 usages found)
                    52 $modal.foundation('reveal', 'open');
                    66 $addModal.foundation('reveal', 'close');
                    86 $removeModal.foundation('reveal', 'close');
                    96 $removeModal.foundation('reveal', 'close');
                subnetmatrix.js  (3 usages found)
                    221 Foundation.libs.tooltip.create(target);
                    227 Foundation.libs.tooltip.hide(popped);
                    234 Foundation.libs.tooltip.showTip($target);
                threshold.js  (1 usage found)
                    56 $(document).foundation('dropdown', 'close', $parent);
                webfront.js  (1 usage found)
                    361 $(document).foundation('joyride', 'start');
            python/nav/web/static/js/src/ipam  (1 usage found)
                app.js  (1 usage found)
                    5 var Foundation = require("libs/foundation.min");
            python/nav/web/static/js/src/ipam/views  (2 usages found)
                subnetallocator.js  (2 usages found)
                    14 var Foundation = require("libs/foundation.min");
                    324 $(document).foundation();
            python/nav/web/static/js/src/netmap  (1 usage found)
                control_view.js  (1 usage found)
                    129 $(document).foundation('equalizer', 'reflow');
            python/nav/web/static/js/src/plugins  (8 usages found)
                delegate_tooltip.js  (4 usages found)
                    27 Foundation.libs.tooltip.showTip($target);
                    56 Foundation.libs.tooltip.create($target);
                    57 Foundation.libs.tooltip.showTip($target);
                    59 Foundation.libs.tooltip.hide($target);
                navlet_controller.js  (3 usages found)
                    196 $(modal).foundation('reveal', 'close');
                    212 $(modal).foundation('reveal', 'close');
                    216 $(modal).foundation('reveal', 'open');
                navlets_controller.js  (1 usage found)
                    93 $('#navlet-list').foundation('reveal', 'close');
            python/nav/web/static/js/src/status2  (1 usage found)
                views.js  (1 usage found)
                    171 $(document).foundation('dropdown', 'reflow');
            python/nav/web/templates  (1 usage found)
                styleguide.html  (1 usage found)
                    23 $(document).foundation('dropdown', 'close', $(this).parents('.f-dropdown:first'));
            python/nav/web/templates/useradmin  (1 usage found)
                token_edit.html  (1 usage found)
                    26 $(document).foundation('dropdown', 'close', $(this).parents('.f-dropdown:first'));

Additionally see #2794 (comment) for usages of crispy_forms_foundation

@podliashanyk
Copy link
Contributor

NB! Usages in #2972 (comment) are not tested for redundancy, except for:

            python/nav/web/static/js/src/ipam  (1 usage found)
                app.js  (1 usage found)
                    5 var Foundation = require("libs/foundation.min");
            python/nav/web/static/js/src/ipam/views  (2 usages found)
                subnetallocator.js  (2 usages found)
                    14 var Foundation = require("libs/foundation.min");

Removing the above mentioned lines from the codebase does not seem to affect any style/behaviour in IPAM.

@podliashanyk
Copy link
Contributor

To generally summarise so far, foundation is used:

  • extensively in crispy forms
  • extensively in modals
  • extensively in navlets
  • somewhat in tooltips, dropdowns
  • once in netmap "View options" toggle
  • to no effect in IPAM view or IPAM sliders

@lunkwill42
Copy link
Member

@hmpf This is tracked by #2788 and says it's for #2794: But fixing this really isn't a requirement of either, is it? We can remove crispy-forms and make NAV run just fine on Python 3.11 without replacing calls to Foundation JavaScript.

@hmpf
Copy link
Contributor Author

hmpf commented Sep 17, 2024

We can still use crispy-forms as long as we stop using crispy-forms-foundation. Foundation 5 needs to go for security reasons.

@lunkwill42
Copy link
Member

We can still use crispy-forms as long as we stop using crispy-forms-foundation. Foundation 5 needs to go for security reasons.

I don't know what those security reasons are, though I agree that Foundation needs to go, eventually. However, if we remove crispy-forms from NAV, doing something about Foundation is not a requirement to close #2788 or #2794.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants