mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
clean up ui src files
This commit is contained in:
@ -36,6 +36,7 @@
|
|||||||
"@babel/preset-env": "^7.13.9",
|
"@babel/preset-env": "^7.13.9",
|
||||||
"@babel/preset-typescript": "^7.13.0",
|
"@babel/preset-typescript": "^7.13.0",
|
||||||
"@types/bootstrap": "^5.0.8",
|
"@types/bootstrap": "^5.0.8",
|
||||||
|
"@types/clipboard": "^2.0.1",
|
||||||
"@types/cookie": "^0.4.0",
|
"@types/cookie": "^0.4.0",
|
||||||
"@types/masonry-layout": "^4.2.2",
|
"@types/masonry-layout": "^4.2.2",
|
||||||
"@typescript-eslint/eslint-plugin": "^4.17.0",
|
"@typescript-eslint/eslint-plugin": "^4.17.0",
|
||||||
|
@ -1,13 +1,5 @@
|
|||||||
// const jquery = require("jquery");
|
import 'babel-polyfill';
|
||||||
/* // @ts-expect-error */
|
import '@popperjs/core';
|
||||||
// window.$ = window.jQuery = jquery;
|
import 'bootstrap';
|
||||||
// require("jquery-ui");
|
import 'clipboard';
|
||||||
// require("select2");
|
import './netbox';
|
||||||
// require("./js/forms");
|
|
||||||
|
|
||||||
require('babel-polyfill');
|
|
||||||
require('@popperjs/core');
|
|
||||||
require('bootstrap');
|
|
||||||
require('clipboard');
|
|
||||||
require('flatpickr');
|
|
||||||
require('./netbox');
|
|
||||||
|
@ -5,6 +5,7 @@ import { initDateSelector } from './dateSelector';
|
|||||||
import { initMessageToasts } from './toast';
|
import { initMessageToasts } from './toast';
|
||||||
import { initSpeedSelector, initForms } from './forms';
|
import { initSpeedSelector, initForms } from './forms';
|
||||||
import { initSearchBar } from './search';
|
import { initSearchBar } from './search';
|
||||||
|
import { getElements } from './util';
|
||||||
|
|
||||||
const INITIALIZERS = [
|
const INITIALIZERS = [
|
||||||
initSearchBar,
|
initSearchBar,
|
||||||
@ -18,13 +19,13 @@ const INITIALIZERS = [
|
|||||||
] as (() => void)[];
|
] as (() => void)[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable Tooltips everywhere
|
* Enable any defined Bootstrap Tooltips.
|
||||||
* @see https://getbootstrap.com/docs/5.0/components/tooltips/
|
*
|
||||||
|
* @see https://getbootstrap.com/docs/5.0/components/tooltips
|
||||||
*/
|
*/
|
||||||
function initBootstrap(): void {
|
function initBootstrap(): void {
|
||||||
if (document !== null) {
|
if (document !== null) {
|
||||||
const tooltips = Array.from(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
|
for (const tooltip of getElements('[data-bs-toggle="tooltip"]')) {
|
||||||
for (const tooltip of tooltips) {
|
|
||||||
new Tooltip(tooltip, { container: 'body', boundary: 'window' });
|
new Tooltip(tooltip, { container: 'body', boundary: 'window' });
|
||||||
}
|
}
|
||||||
initMessageToasts();
|
initMessageToasts();
|
||||||
@ -32,10 +33,12 @@ function initBootstrap(): void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function initMasonry() {
|
/**
|
||||||
|
* Initialize masonry-layout for homepage (or any other masonry layout cards).
|
||||||
|
*/
|
||||||
|
function initMasonry(): void {
|
||||||
if (document !== null) {
|
if (document !== null) {
|
||||||
const grids = document.querySelectorAll('.masonry');
|
for (const grid of getElements('.masonry')) {
|
||||||
for (const grid of grids) {
|
|
||||||
new Masonry(grid, {
|
new Masonry(grid, {
|
||||||
itemSelector: '.masonry-item',
|
itemSelector: '.masonry-item',
|
||||||
percentPosition: true,
|
percentPosition: true,
|
||||||
@ -46,6 +49,7 @@ function initMasonry() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a slug from any input string.
|
* Create a slug from any input string.
|
||||||
|
*
|
||||||
* @param slug Original string.
|
* @param slug Original string.
|
||||||
* @param chars Maximum number of characters.
|
* @param chars Maximum number of characters.
|
||||||
* @returns Slugified string.
|
* @returns Slugified string.
|
||||||
|
@ -1158,6 +1158,11 @@
|
|||||||
"@popperjs/core" "^2.6.0"
|
"@popperjs/core" "^2.6.0"
|
||||||
"@types/jquery" "*"
|
"@types/jquery" "*"
|
||||||
|
|
||||||
|
"@types/clipboard@^2.0.1":
|
||||||
|
version "2.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/clipboard/-/clipboard-2.0.1.tgz#75a74086c293d75b12bc93ff13bc7797fef05a40"
|
||||||
|
integrity sha512-gJJX9Jjdt3bIAePQRRjYWG20dIhAgEqonguyHxXuqALxsoDsDLimihqrSg8fXgVTJ4KZCzkfglKtwsh/8dLfbA==
|
||||||
|
|
||||||
"@types/cookie@^0.4.0":
|
"@types/cookie@^0.4.0":
|
||||||
version "0.4.0"
|
version "0.4.0"
|
||||||
resolved "https://registry.yarnpkg.com/@types/cookie/-/cookie-0.4.0.tgz#14f854c0f93d326e39da6e3b6f34f7d37513d108"
|
resolved "https://registry.yarnpkg.com/@types/cookie/-/cookie-0.4.0.tgz#14f854c0f93d326e39da6e3b6f34f7d37513d108"
|
||||||
|
Reference in New Issue
Block a user