Skip to content

Commit

Permalink
chg: [query] query as same
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidCruciani committed Jul 8, 2024
1 parent 2423bc7 commit 5190d30
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
11 changes: 7 additions & 4 deletions website/app/static/js/mispParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@ function parseMispObject(misp_object, query_url, functionToCall){

if(v.type != 'counter' && v.type != 'datetime'){
if(query_url){
$query=$("<a>").attr("href", query_url+v.value).text("query").css("margin-left", "10px")
$query=$("<a>").attr({"href": query_url+v.value, "title": "Query this value with new attributes or modules"})
.text("query")
.css("margin-left", "10px")
}
if(functionToCall){
// `_${functionToCall.name}('${v.value}')` refer to 'window._query_as_same = query_as_same' in my vue file
$query_same = $("<button>").attr({"onclick": `_${functionToCall.name}('${v.value}')`,
"title": "Query this value with the same attribute and modules as the main query",
"class": "btn btn-link"
})
.text("query as same")
// .text("query as same")
.append($("<i>").attr("class", "fa-solid fa-recycle"))
.css({"margin-left": "10px", "padding": "0", "--bs-btn-border-width": "0"})
}
}
Expand Down Expand Up @@ -45,8 +48,8 @@ function parseMispObject(misp_object, query_url, functionToCall){
"margin-left": "0.5em",
}),
$("<div>").text("Value: "+ v.value),
$query,
$query_same
$query_same,
$query
)
)
)
Expand Down
6 changes: 3 additions & 3 deletions website/app/templates/query.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ <h2 title="{{', '.join(query)}}">{{query_str}}</h2>
</div>

<div class="btn-group" style="float: right;" role="group" aria-label="Basic mixed styles example">
<a style="float: right;" class="btn btn-primary" href="/" title="Do a new query with no relation with this one">New query</a>
<a style="float: right;" class="btn btn-primary" href="/" title="Do a new query with no relation with this one"><i class="fa-solid fa-plus"></i> New query</a>
<a style="float: right;" class="btn btn-secondary" href="/?query={{query}}" title="New query with same name">Query</a>
<div class="dropdown" style="float: right;">
<button class="btn btn-primary dropdown-toggle" title="New query with same parameters" style="border-radius: 0;" data-bs-toggle="dropdown" aria-expanded="false" data-bs-auto-close="outside">
Query as same
<i class="fa-solid fa-recycle"></i>
</button>
<div class="dropdown-menu p-4" style="min-width: 200px;">
<div class="mb-3">
<label for="query_as_params" class="form-label">To query:</label>
<input type="email" class="form-control" id="query_as_params" placeholder="{{', '.join(query)}}">
<input type="email" class="form-control" id="query_as_params" value="{{', '.join(query)}}">
<div id="query_as_params_error" style="color:brown"></div>
</div>
<button type="submit" class="btn btn-primary btn-sm" @click="query_as_params()" style="border-radius: 50px;">Query</button>
Expand Down

0 comments on commit 5190d30

Please sign in to comment.