netbox v2.10 (#52)
* small changes * removed print * fix coords * fix saving coords * update readme * fixed icons * bump version Co-authored-by: mattieserver <[email protected]>
This commit is contained in:
1 parent
0340522f59
commit
a314d2b307
11 files changed
+327
-110
No files matched your search
@@ -1 +1 @@
|
||||
var graph=null,container=null;function iniPlotboxFull(){document.addEventListener("DOMContentLoaded",function(){container=document.getElementById("fullvisgraph"),startRender()},!1)}function startRender(){var e=location.search;$.ajax({type:"GET",url:"../../api/plugins/topology-views/search/search/"+e,contentType:"application/json; charset=utf-8",success:function(e,t,n){graph=null,nodes=new vis.DataSet,edges=new vis.DataSet,graph=new vis.Network(container,{nodes:nodes,edges:edges},options),$.each(e.nodes,function(e,t){nodes.add(t)}),$.each(e.edges,function(e,t){edges.add(t)}),graph.fit(),canvas=document.getElementById("fullvisgraph").getElementsByTagName("canvas")[0]}})}var graph=null,container=null,downloadButton=null,MIME_TYPE="image/png",canvas=null,csrftoken=null,nodes=new vis.DataSet,edges=new vis.DataSet,options={interaction:{hover:!0,hoverConnectedEdges:!0,multiselect:!1},nodes:{shape:"image",brokenImage:"../../static/netbox_topology_views/img/role-unknown.png",size:35,font:{multi:"md",face:"helvetica"}},edges:{length:100,width:2,font:{face:"helvetica"}},physics:{solver:"forceAtlas2Based"}},selected_regions=[];function iniPlotboxIndex(){document.addEventListener("DOMContentLoaded",function(){container=document.getElementById("visgraph"),csrftoken=jQuery("[name=csrfmiddlewaretoken]").val(),startLoadSearchBar(),handleButtonPress(),downloadButton=document.getElementById("btnDownloadImage"),btnFullView=document.getElementById("btnFullView")},!1)}function startLoadSearchBar(){$("#device-roles").select2({allowClear:!0,placeholder:"---------",theme:"bootstrap",multiple:!0,ajax:{url:"../../api/dcim/device-roles/?brief=true",dataType:"json",type:"GET",data:function(e){return{q:e.term}},processResults:function(e){return{results:$.map(e.results,function(e){return{text:e.name,id:e.id}})}}}}),$("#sites").select2({allowClear:!0,placeholder:"---------",theme:"bootstrap",multiple:!0,ajax:{url:function(e){var t="../../api/dcim/sites/?brief=true";if(0==selected_regions.length)return t;for(var n=0;n<selected_regions.length;n++){t+="®ion_id="+selected_regions[n]}return t},dataType:"json",type:"GET",data:function(e){return{q:e.term}},processResults:function(e){return{results:$.map(e.results,function(e){return{text:e.name,id:e.id}})}}}}),$("#tags").select2({allowClear:!0,placeholder:"---------",theme:"bootstrap",multiple:!0,ajax:{url:"../../api/extras/tags/?brief=true",dataType:"json",type:"GET",data:function(e){return{q:e.term}},processResults:function(e){return{results:$.map(e.results,function(e){return{text:e.name,id:e.id}})}}}}),$("#regions").select2({allowClear:!0,placeholder:"---------",theme:"bootstrap",multiple:!0,ajax:{url:"../../api/dcim/regions/?brief=true",dataType:"json",type:"GET",data:function(e){return{q:e.term}},processResults:function(e){return{results:$.map(e.results,function(e){return{text:e.name,id:e.id}})}}}}),$("#regions").on("select2:select",function(e){var t=e.params.data;-1==selected_regions.indexOf(t.id.toString())&&selected_regions.push(t.id.toString())}),$("#regions").on("select2:unselect",function(e){var t=e.params.data,n=selected_regions.indexOf(t.id.toString());console.log(n),-1<n&&selected_regions.splice(n,1)}),$("#regions").on("select2:clear",function(e){selected_regions=[]});var a=$("#device-roles");$.ajax({type:"GET",url:"../../api/plugins/topology-views/preselectdeviceroles/"}).then(function(e){$.each(e.results,function(e,t){var n=new Option(t.name,t.id,!0,!0);a.append(n).trigger("change"),a.trigger({type:"select2:select",params:{data:t}})})});var s=$("#tags");$.ajax({type:"GET",url:"../../api/plugins/topology-views/preselecttags/"}).then(function(e){$.each(e.results,function(e,t){var n=new Option(t.name,t.id,!0,!0);s.append(n).trigger("change"),s.trigger({type:"select2:select",params:{data:t}})})})}function handleButtonPress(){$("#search-form").submit(function(e){$("#status").html('<span class="label label-info">Loading data</span>'),e.preventDefault();var t=$("#name").val(),n=$("#device-roles").val(),a=$("#sites").val(),s=$("#tags").val(),o=$("#regions").val();$.ajax({type:"GET",url:"../../api/plugins/topology-views/search/search/",data:{name:t,"devicerole[]":n,"sites[]":a,"tags[]":s,"regions[]":o},headers:{"X-CSRFToken":csrftoken},contentType:"application/json; charset=utf-8",dataType:"json",beforeSend:function(){new_url=this.url.split("../../api/plugins/topology-views/search/search/?"),new_url=new_url[1],new_url="../../plugins/topology-views/full?"+new_url,btnFullView.classList.remove("disabled"),btnFullView.href=new_url},success:function(e,t,n){$("#status").html('<span class="label label-info">Drawing network</span>'),graph=null,nodes=new vis.DataSet,edges=new vis.DataSet,graph=new vis.Network(container,{nodes:nodes,edges:edges},options),$.each(e.nodes,function(e,t){nodes.add(t)}),$.each(e.edges,function(e,t){edges.add(t)}),graph.fit(),canvas=document.getElementById("visgraph").getElementsByTagName("canvas")[0],graph.on("afterDrawing",function(){$("#status").html('<span class=Line truncated
|
||||
var graph=null,container=null;function iniPlotboxFull(){document.addEventListener("DOMContentLoaded",function(){container=document.getElementById("fullvisgraph"),startRender()},!1)}function startRender(){var e=location.search;$.ajax({type:"GET",url:"../../api/plugins/topology-views/search/search/"+e,contentType:"application/json; charset=utf-8",success:function(e,t,n){graph=null,nodes=new vis.DataSet,edges=new vis.DataSet,graph=new vis.Network(container,{nodes:nodes,edges:edges},options),$.each(e.nodes,function(e,t){nodes.add(t)}),$.each(e.edges,function(e,t){edges.add(t)}),graph.fit(),canvas=document.getElementById("fullvisgraph").getElementsByTagName("canvas")[0]}})}graph=null,container=null;var downloadButton=null,MIME_TYPE="image/png",canvas=null,csrftoken=null,nodes=new vis.DataSet,edges=new vis.DataSet,options={interaction:{hover:!0,hoverConnectedEdges:!0,multiselect:!1},nodes:{shape:"image",brokenImage:"../../static/netbox_topology_views/img/role-unknown.png",size:35,font:{multi:"md",face:"helvetica"}},edges:{length:100,width:2,font:{face:"helvetica"}},physics:{solver:"forceAtlas2Based"}},selected_regions=[];function iniPlotboxIndex(){document.addEventListener("DOMContentLoaded",function(){container=document.getElementById("visgraph"),csrftoken=jQuery("[name=csrfmiddlewaretoken]").val(),startLoadSearchBar(),handleButtonPress(),downloadButton=document.getElementById("btnDownloadImage"),btnFullView=document.getElementById("btnFullView")},!1)}function startLoadSearchBar(){$("#device-roles").select2({allowClear:!0,placeholder:"---------",theme:"bootstrap",multiple:!0,ajax:{url:"../../api/dcim/device-roles/?brief=true",dataType:"json",type:"GET",data:function(e){return{q:e.term}},processResults:function(e){return{results:$.map(e.results,function(e){return{text:e.name,id:e.id}})}}}}),$("#sites").select2({allowClear:!0,placeholder:"---------",theme:"bootstrap",multiple:!0,ajax:{url:function(e){var t="../../api/dcim/sites/?brief=true";if(0==selected_regions.length)return t;for(var n=0;n<selected_regions.length;n++){t+="®ion_id="+selected_regions[n]}return t},dataType:"json",type:"GET",data:function(e){return{q:e.term}},processResults:function(e){return{results:$.map(e.results,function(e){return{text:e.name,id:e.id}})}}}}),$("#tags").select2({allowClear:!0,placeholder:"---------",theme:"bootstrap",multiple:!0,ajax:{url:"../../api/extras/tags/?brief=true",dataType:"json",type:"GET",data:function(e){return{q:e.term}},processResults:function(e){return{results:$.map(e.results,function(e){return{text:e.name,id:e.id}})}}}}),$("#regions").select2({allowClear:!0,placeholder:"---------",theme:"bootstrap",multiple:!0,ajax:{url:"../../api/dcim/regions/?brief=true",dataType:"json",type:"GET",data:function(e){return{q:e.term}},processResults:function(e){return{results:$.map(e.results,function(e){return{text:e.name,id:e.id}})}}}}),$("#regions").on("select2:select",function(e){var t=e.params.data;-1==selected_regions.indexOf(t.id.toString())&&selected_regions.push(t.id.toString())}),$("#regions").on("select2:unselect",function(e){var t=e.params.data,n=selected_regions.indexOf(t.id.toString());console.log(n),-1<n&&selected_regions.splice(n,1)}),$("#regions").on("select2:clear",function(e){selected_regions=[]});var a=$("#device-roles");$.ajax({type:"GET",url:"../../api/plugins/topology-views/preselectdeviceroles/"}).then(function(e){$.each(e.results,function(e,t){var n=new Option(t.name,t.id,!0,!0);a.append(n).trigger("change"),a.trigger({type:"select2:select",params:{data:t}})})});var s=$("#tags");$.ajax({type:"GET",url:"../../api/plugins/topology-views/preselecttags/"}).then(function(e){$.each(e.results,function(e,t){var n=new Option(t.name,t.id,!0,!0);s.append(n).trigger("change"),s.trigger({type:"select2:select",params:{data:t}})})})}function handleButtonPress(){$("#search-form").submit(function(e){$("#status").html('<span class="label label-info">Loading data</span>'),e.preventDefault();var t=$("#name").val(),n=$("#device-roles").val(),a=$("#sites").val(),s=$("#tags").val(),o=$("#regions").val();$.ajax({type:"GET",url:"../../api/plugins/topology-views/search/search/",data:{name:t,"devicerole[]":n,"sites[]":a,"tags[]":s,"regions[]":o},headers:{"X-CSRFToken":csrftoken},contentType:"application/json; charset=utf-8",dataType:"json",beforeSend:function(){new_url=this.url.split("../../api/plugins/topology-views/search/search/?"),new_url=new_url[1],new_url="../../plugins/topology-views/full?"+new_url,btnFullView.classList.remove("disabled"),btnFullView.href=new_url},success:function(e,t,n){$("#status").html('<span class="label label-info">Drawing network</span>'),graph=null,nodes=new vis.DataSet,edges=new vis.DataSet,graph=new vis.Network(container,{nodes:nodes,edges:edges},options),$.each(e.nodes,function(e,t){nodes.add(t)}),$.each(e.edges,function(e,t){edges.add(t)}),graph.fit(),canvas=document.getElementById("visgraph").getElementsByTagName("canvas")[0],graph.on("afterDrawing",function(){$("#status").html('<span class=Line truncated
|
||||
@@ -1 +1 @@
|
||||
!function(g,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((g=g||self).vis=g.vis||{})}(this,function(g){var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function e(g,t,e){return g(e={path:t,exports:{},require:function(g,t){return Le(null==t&&e.path)}},e.exports),e.exports}function A(g){return g&&g.default||g}function Le(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}function C(g){return g&&g.Math==Math&&g}function a(g){try{return!!g()}catch(g){return!0}}function v(g,t){return{enumerable:!(1&g),configurable:!(2&g),writable:!(4&g),value:t}}function I(g){return x.call(g).slice(8,-1)}function n(g){if(null==g)throw TypeError("Can't call method on "+g);return g}function r(g){return O(n(g))}function h(g){return"object"==typeof g?null!==g:"function"==typeof g}function i(g,t){if(!h(g))return g;var e,A;if(t&&"function"==typeof(e=g.toString)&&!h(A=e.call(g)))return A;if("function"==typeof(e=g.valueOf)&&!h(A=e.call(g)))return A;if(!t&&"function"==typeof(e=g.toString)&&!h(A=e.call(g)))return A;throw TypeError("Can't convert object to primitive value")}function p(g,t){return T.call(g,t)}function o(g){return N?E.createElement(g):{}}function s(g,t){var e=_[z(g)];return e==B||e!=Z&&("function"==typeof t?a(t):!!t)}function d(g){if("function"!=typeof g)throw TypeError(String(g)+" is not a function");return g}function y(A,C,g){if(d(A),void 0===C)return A;switch(g){case 0:return function(){return A.call(C)};case 1:return function(g){return A.call(C,g)};case 2:return function(g,t){return A.call(C,g,t)};case 3:return function(g,t,e){return A.call(C,g,t,e)}}return function(){return A.apply(C,arguments)}}function l(g){if(!h(g))throw TypeError(String(g)+" is not an object");return g}function f(A){function g(g,t,e){if(this instanceof A){switch(arguments.length){case 0:return new A;case 1:return new A(g);case 2:return new A(g,t)}return new A(g,t,e)}return A.apply(this,arguments)}return g.prototype=A.prototype,g}function m(g,t){var e,A,C,I,i,o,n,r,s=g.target,a=g.global,h=g.stat,d=g.proto,l=a?b:h?b[s]:(b[s]||{}).prototype,c=a?Y:Y[s]||(Y[s]={}),u=c.prototype;for(C in t)e=!F(a?C:s+(h?".":"#")+C,g.forced)&&l&&p(l,C),i=c[C],e&&(o=g.noTargetGet?(r=V(l,C))&&r.value:l[C]),I=e&&o?o:t[C],e&&typeof i==typeof I||(n=g.bind&&e?y(I,b):g.wrap&&e?f(I):d&&"function"==typeof I?y(Function.call,I):I,(g.sham||I&&I.sham||i&&i.sham)&&j(n,"sham",!0),c[C]=n,d&&(p(Y,A=s+"Prototype")||j(Y,A,{}),Y[A][C]=I,g.real&&u&&!u[C]&&j(u,C,I)))}var b=C("object"==typeof globalThis&&globalThis)||C("object"==typeof window&&window)||C("object"==typeof self&&self)||C("object"==typeof t&&t)||Function("return this")(),c=!a(function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}),u={}.propertyIsEnumerable,w=Object.getOwnPropertyDescriptor,k={f:w&&!u.call({1:2},1)?function(g){var t=w(this,g);return!!t&&t.enumerable}:u},x={}.toString,D="".split,O=a(function(){return!Object("z").propertyIsEnumerable(0)})?function(g){return"String"==I(g)?D.call(g,""):Object(g)}:Object,T={}.hasOwnProperty,E=b.document,N=h(E)&&h(E.createElement),R=!c&&!a(function(){return 7!=Object.defineProperty(o("div"),"a",{get:function(){return 7}}).a}),M=Object.getOwnPropertyDescriptor,P={f:c?M:function(g,t){if(g=r(g),t=i(t,!0),R)try{return M(g,t)}catch(g){}if(p(g,t))return v(!k.f.call(g,t),g[t])}},S=/#|\.prototype\./,z=s.normalize=function(g){return String(g).replace(S,".").toLowerCase()},_=s.data={},Z=s.NATIVE="N",B=s.POLYFILL="P",F=s,Y={},G=Object.defineProperty,L={f:c?G:function(g,t,e){if(l(g),t=i(t,!0),l(e),R)try{return G(g,t,e)}catch(g){}if("get"in e||"set"in e)throw TypeError("Accessors not supported");return"value"in e&&(g[t]=e.value),g}},j=c?function(g,t,e){return L.f(g,t,v(1,e))}:function(g,t,e){return g[t]=e,g},V=P.f,W=[].slice,H={},U=Function.bind||function(t){var e=d(this),A=W.call(arguments,1),C=function(){var g=A.concat(W.call(arguments));return this instanceof C?function(g,t,e){if(!(t in H)){for(var A=[],C=0;C<t;C++)A[C]="a["+C+"]";H[t]=Function("C,a","return new C("+A.join(",")+")")}return H[t](g,e)}(e,g.length,g):e.apply(t,g)};return h(e.prototype)&&(C.prototype=e.prototype),C};m({target:"Function",proto:!0},{bind:U});function Q(g){return Y[g+"Prototype"]}function K(g){return isNaN(g=+g)?0:(0<g?Ig:Cg)(g)}function X(g){return 0<g?ig(K(g),9007199254740991):0}function J(g,t){var e=K(g);return e<0?og(e+t,0):ng(e,t)}function q(o){return function(g,t,e){var A,C=r(g),I=X(C.length),i=J(e,I);if(o&&t!=t){for(;i<I;)if((A=C[i++])!=A)return!0}else for(;i<I;i++)if((o||i in C)&&C[i]===t)return o||i||0;return!o&&-1}}function $(g,t){var e,A=r(g),C=0,I=[];for(e in A)!p(sg,e)&&p(A,e)&&I.push(e);for(;t.length>C;)p(A,e=t[C++])&&(~ag(I,e)||I.push(e));return I}function gg(g){return Object(n(g))}var tg=Q("Function").bind,eg=Function.prototype,Ag=function(g){var t=g.bind;retuLine truncated
|
||||
!function(g,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((g="undefined"!=typeof globalThis?globalThis:g||self).vis=g.vis||{})}(this,function(g){var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function e(g,t,e){return g(e={path:t,exports:{},require:function(g,t){return Le(null==t&&e.path)}},e.exports),e.exports}function A(g){return g&&g.default||g}function Le(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}function C(g){return g&&g.Math==Math&&g}function a(g){try{return!!g()}catch(g){return!0}}function y(g,t){return{enumerable:!(1&g),configurable:!(2&g),writable:!(4&g),value:t}}function I(g){return x.call(g).slice(8,-1)}function n(g){if(null==g)throw TypeError("Can't call method on "+g);return g}function r(g){return D(n(g))}function h(g){return"object"==typeof g?null!==g:"function"==typeof g}function i(g,t){if(!h(g))return g;var e,A;if(t&&"function"==typeof(e=g.toString)&&!h(A=e.call(g)))return A;if("function"==typeof(e=g.valueOf)&&!h(A=e.call(g)))return A;if(!t&&"function"==typeof(e=g.toString)&&!h(A=e.call(g)))return A;throw TypeError("Can't convert object to primitive value")}function f(g,t){return T.call(g,t)}function o(g){return N?E.createElement(g):{}}function s(g,t){var e=_[z(g)];return e==B||e!=Z&&("function"==typeof t?a(t):!!t)}function d(g){if("function"!=typeof g)throw TypeError(String(g)+" is not a function");return g}function m(A,C,g){if(d(A),void 0===C)return A;switch(g){case 0:return function(){return A.call(C)};case 1:return function(g){return A.call(C,g)};case 2:return function(g,t){return A.call(C,g,t)};case 3:return function(g,t,e){return A.call(C,g,t,e)}}return function(){return A.apply(C,arguments)}}function l(g){if(!h(g))throw TypeError(String(g)+" is not an object");return g}function p(A){function g(g,t,e){if(this instanceof A){switch(arguments.length){case 0:return new A;case 1:return new A(g);case 2:return new A(g,t)}return new A(g,t,e)}return A.apply(this,arguments)}return g.prototype=A.prototype,g}function b(g,t){var e,A,C,I,i,o,n,r,s=g.target,a=g.global,h=g.stat,d=g.proto,l=a?v:h?v[s]:(v[s]||{}).prototype,c=a?Y:Y[s]||(Y[s]={}),u=c.prototype;for(C in t)e=!F(a?C:s+(h?".":"#")+C,g.forced)&&l&&f(l,C),i=c[C],e&&(o=g.noTargetGet?(r=V(l,C))&&r.value:l[C]),I=e&&o?o:t[C],e&&typeof i==typeof I||(n=g.bind&&e?m(I,v):g.wrap&&e?p(I):d&&"function"==typeof I?m(Function.call,I):I,(g.sham||I&&I.sham||i&&i.sham)&&L(n,"sham",!0),c[C]=n,d&&(f(Y,A=s+"Prototype")||L(Y,A,{}),Y[A][C]=I,g.real&&u&&!u[C]&&L(u,C,I)))}var v=C("object"==typeof globalThis&&globalThis)||C("object"==typeof window&&window)||C("object"==typeof self&&self)||C("object"==typeof t&&t)||Function("return this")(),c=!a(function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}),u={}.propertyIsEnumerable,w=Object.getOwnPropertyDescriptor,k={f:w&&!u.call({1:2},1)?function(g){var t=w(this,g);return!!t&&t.enumerable}:u},x={}.toString,O="".split,D=a(function(){return!Object("z").propertyIsEnumerable(0)})?function(g){return"String"==I(g)?O.call(g,""):Object(g)}:Object,T={}.hasOwnProperty,E=v.document,N=h(E)&&h(E.createElement),R=!c&&!a(function(){return 7!=Object.defineProperty(o("div"),"a",{get:function(){return 7}}).a}),M=Object.getOwnPropertyDescriptor,P={f:c?M:function(g,t){if(g=r(g),t=i(t,!0),R)try{return M(g,t)}catch(g){}if(f(g,t))return y(!k.f.call(g,t),g[t])}},S=/#|\.prototype\./,z=s.normalize=function(g){return String(g).replace(S,".").toLowerCase()},_=s.data={},Z=s.NATIVE="N",B=s.POLYFILL="P",F=s,Y={},G=Object.defineProperty,j={f:c?G:function(g,t,e){if(l(g),t=i(t,!0),l(e),R)try{return G(g,t,e)}catch(g){}if("get"in e||"set"in e)throw TypeError("Accessors not supported");return"value"in e&&(g[t]=e.value),g}},L=c?function(g,t,e){return j.f(g,t,y(1,e))}:function(g,t,e){return g[t]=e,g},V=P.f,W=[].slice,H={},U=Function.bind||function(t){var e=d(this),A=W.call(arguments,1),C=function(){var g=A.concat(W.call(arguments));return this instanceof C?function(g,t,e){if(!(t in H)){for(var A=[],C=0;C<t;C++)A[C]="a["+C+"]";H[t]=Function("C,a","return new C("+A.join(",")+")")}return H[t](g,e)}(e,g.length,g):e.apply(t,g)};return h(e.prototype)&&(C.prototype=e.prototype),C};b({target:"Function",proto:!0},{bind:U});function Q(g){return Y[g+"Prototype"]}function K(g){return isNaN(g=+g)?0:(0<g?Ig:Cg)(g)}function X(g){return 0<g?ig(K(g),9007199254740991):0}function J(g,t){var e=K(g);return e<0?og(e+t,0):ng(e,t)}function q(o){return function(g,t,e){var A,C=r(g),I=X(C.length),i=J(e,I);if(o&&t!=t){for(;i<I;)if((A=C[i++])!=A)return!0}else for(;i<I;i++)if((o||i in C)&&C[i]===t)return o||i||0;return!o&&-1}}function $(g,t){var e,A=r(g),C=0,I=[];for(e in A)!f(sg,e)&&f(A,e)&&I.push(e);for(;t.length>C;)f(A,e=t[C++])&&(~ag(I,e)||I.push(e));return I}function gg(g){return Object(n(g))}var tg=Q("Function").bind,eg=Function.Line truncated
|
||||
Reference in new issue
Block a user