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

added pipeline parameter to the url sharing feature #21

Merged
merged 1 commit into from
Nov 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion static/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@ window.onload = function () {

// only show pipelines available for selected backend
filterPipelineOptions();

let pipelineSelect = document.getElementById("select-pipeline");
if(urlParameter.has('pipeline')) {
const pipelineValues = urlParameter.get('pipeline').split(';');
pipelineValues.forEach(function(value) {
pipelineSelect.tomselect.addItem(value);
});
}

// load cli command
generateCli();
// inital conversion of example rule
Expand Down Expand Up @@ -104,10 +113,11 @@ document.getElementById("rule-share-btn").onclick = function () {
function generateShareLink() {
let backend = getSelectValue("select-backend");
let format = getSelectValue("select-format");
let pipelines = getSelectValue("select-pipeline");
let rule = encodeURIComponent(btoa(sigmaJar.toString()));

// generate link with parameters
let shareParams = "#backend=" + backend + "&format=" + format + "&rule=" + rule;
let shareParams = "#backend=" + backend + "&format=" + format + "&pipeline=" + pipelines.join(";") + "&rule=" + rule;
let shareUrl = location.protocol + "//" + location.host + "/" + shareParams;
window.history.pushState({}, null, shareParams);

Expand Down