2 lines
6.2 KiB
JavaScript
2 lines
6.2 KiB
JavaScript
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d0c9378"],{"57cc":function(t,s,i){"use strict";i.r(s);var e=function(){var t=this,s=t._self._c;return s("div",{staticClass:"backend-content",attrs:{id:"content"}},[s("div",{staticClass:"column col-8 col-xs-12"},[s("h3",{staticClass:"s-title"},[t._v("Manage MISP instances")]),s("ul",{staticClass:"tab tab-block"},[s("li",{staticClass:"tab-item"},[s("a",{class:{active:t.tabs.addmisp},attrs:{href:"#"},on:{click:function(s){return t.switch_tab("addmisp")}}},[t._v("Add instance")])]),s("li",{staticClass:"tab-item"},[s("a",{class:{active:t.tabs.instances},attrs:{href:"#"},on:{click:function(s){return t.switch_tab("instances")}}},[t._v("Existing instances")])])]),t.tabs.addmisp?s("div",[s("div",{staticClass:"misp-form"},[s("label",{staticClass:"misp-label"},[t._v("Instance name")]),s("span"),s("input",{directives:[{name:"model",rawName:"v-model",value:t.mispinst.name,expression:"mispinst.name"}],ref:"misp_name",staticClass:"form-input",attrs:{type:"text",placeholder:"CYBERACME MISP",required:""},domProps:{value:t.mispinst.name},on:{input:function(s){s.target.composing||t.$set(t.mispinst,"name",s.target.value)}}}),s("label",{staticClass:"misp-label"},[t._v("Instance URL")]),s("span"),s("input",{directives:[{name:"model",rawName:"v-model",value:t.mispinst.url,expression:"mispinst.url"}],ref:"misp_url",staticClass:"form-input",attrs:{type:"text",placeholder:"https://misp.cyberacme.com",required:""},domProps:{value:t.mispinst.url},on:{input:function(s){s.target.composing||t.$set(t.mispinst,"url",s.target.value)}}}),s("label",{staticClass:"misp-label"},[t._v("Authentication key")]),s("span"),s("input",{directives:[{name:"model",rawName:"v-model",value:t.mispinst.key,expression:"mispinst.key"}],ref:"misp_key",staticClass:"form-input",attrs:{type:"text",placeholder:"OqHSMyAuth3ntic4t10nK3y0MyAuth3ntic4t10nK3y3iiH",required:""},domProps:{value:t.mispinst.key},on:{input:function(s){s.target.composing||t.$set(t.mispinst,"key",s.target.value)}}}),t.mispinst.url.startsWith("https://")?s("label",{staticClass:"misp-label"},[t._v("Verify certificate? ")]):t._e(),t.mispinst.url.startsWith("https://")?s("span"):t._e(),t.mispinst.url.startsWith("https://")?s("div",{staticStyle:{flex:"50%"}},[s("label",{staticClass:"form-switch"},[s("input",{directives:[{name:"model",rawName:"v-model",value:t.mispinst.ssl,expression:"mispinst.ssl"}],attrs:{type:"checkbox"},domProps:{checked:Array.isArray(t.mispinst.ssl)?t._i(t.mispinst.ssl,null)>-1:t.mispinst.ssl},on:{change:function(s){var i=t.mispinst.ssl,e=s.target,a=!!e.checked;if(Array.isArray(i)){var n=null,c=t._i(i,n);e.checked?c<0&&t.$set(t.mispinst,"ssl",i.concat([n])):c>-1&&t.$set(t.mispinst,"ssl",i.slice(0,c).concat(i.slice(c+1)))}else t.$set(t.mispinst,"ssl",a)}}}),s("i",{staticClass:"form-icon"})])]):t._e()]),s("button",{staticClass:"btn-primary btn col-12",on:{click:function(s){return t.add_instance()}}},[t._v("Add MISP instance")]),t.added?s("div",{staticClass:"form-group"},[s("div",{staticClass:"toast toast-success"},[t._v(" ✓ MISP instance added successfully. Redirecting to instances in 2 seconds. ")])]):t._e(),t.error?s("div",{staticClass:"form-group"},[s("div",{staticClass:"toast toast-error"},[t._v(" ✗ MISP instance not added. "+t._s(t.error)+" ")])]):t._e()]):t._e(),t.tabs.instances?s("div",{staticClass:"form-group"},[t.instances.length?s("div",[s("table",{staticClass:"table table-striped table-hover"},[t._m(0),s("tbody",t._l(t.instances,(function(i){return s("tr",{key:i.id},[s("td",[t._v(t._s(i.name))]),s("td",[t._v(t._s(i.url.replace("https://","").replace("http://","")))]),s("td",[t._v(t._s(i.apikey.slice(0,5))+" [...] "+t._s(i.apikey.slice(35,40)))]),s("td",[i.connected?s("span",{staticClass:"instance-online tooltip",attrs:{"data-tooltip":i.lastsync}},[t._v("✓ ONLINE")]):s("span",{staticClass:"instance-offline tooltip",attrs:{"data-tooltip":i.lastsync}},[t._v("⚠ OFFLINE")])]),s("td",[s("button",{staticClass:"btn btn-sm",on:{click:function(s){return t.delete_instance(i)}}},[t._v("Delete")])])])})),0)])]):s("div",[s("div",{staticClass:"empty"},[t.loading?s("div",[t._m(1),s("p",{staticClass:"empty-subtitle"},[t._v("Testing and loading your MISP instances.")])]):s("div",[s("p",{staticClass:"empty-title h5"},[t._v("No MISP instance found.")]),s("p",{staticClass:"empty-subtitle"},[t._v("Do not hesitate to add a MISP instance.")])])])])]):t._e()])])},a=[function(){var t=this,s=t._self._c;return s("thead",[s("tr",[s("th",[t._v("Name")]),s("th",[t._v("Server")]),s("th",[t._v("Authkey")]),s("th",[t._v("Status")]),s("th",[t._v("Action")])])])},function(){var t=this,s=t._self._c;return s("p",{staticClass:"empty-title h5"},[s("span",{staticClass:"loading loading-lg"})])}],n=i("bc3a"),c=i.n(n),l={name:"managemisp",data(){return{error:!1,loading:!1,added:!1,mispinst:{name:"",url:"",key:"",ssl:!1},instances:[],tabs:{addmisp:!0,instances:!1},jwt:""}},props:{},methods:{add_instance:function(){this.added=!1,this.error=!1,this.mispinst.name&&this.mispinst.url&&this.mispinst.key&&c.a.post("/api/misp/add",{data:{instance:this.mispinst}},{headers:{"X-Token":this.jwt}}).then(t=>{t.data.status?(this.added=!0,setTimeout(function(){this.switch_tab("instances"),this.mispinst={name:"",url:"",key:"",ssl:!1},this.added=!1}.bind(this),2e3)):this.error=t.data.message}).catch(t=>console.log(t))},delete_instance(t){c.a.get("/api/misp/delete/"+t.id,{timeout:1e4,headers:{"X-Token":this.jwt}}).then(s=>{s.data.status&&(this.instances=this.instances.filter((function(s){return s!=t})))}).catch(t=>console.log(t))},get_misp_instances(){this.loading=!0,this.instances=[],c.a.get("/api/misp/get_all",{timeout:1e4,headers:{"X-Token":this.jwt}}).then(t=>{t.data.results&&(this.instances=t.data.results,this.instances.forEach(t=>{var s=parseInt((Date.now()/1e3-t.lastsync)/86400);t.lastsync=s?`Synchronized ${s} day(s) ago`:"Synchronized today"})),this.loading=!1}).catch(t=>console.log(t))},switch_tab:function(t){Object.keys(this.tabs).forEach(s=>{s==t?(this.tabs[s]=!0,"instances"==s&&this.get_misp_instances()):this.tabs[s]=!1})},get_jwt(){c.a.get("/api/get-token",{timeout:1e4}).then(t=>{t.data.token&&(this.jwt=t.data.token)}).catch(t=>console.log(t))}},created:function(){this.get_jwt()}},o=l,r=i("2877"),d=Object(r["a"])(o,e,a,!1,null,null,null);s["default"]=d.exports}}]);
|
|
//# sourceMappingURL=chunk-2d0c9378.fb16a6a2.js.map
|