-
Notifications
You must be signed in to change notification settings - Fork 28
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
Mass merge from listing #70
Labels
Comments
I use a tampermonkey snippet to fix the issue 😄 // ==UserScript==
// @name pma reports
// @namespace http://tampermonkey.net/
// @version 0.1
// @description hack report server
// @author William Desportes
// @match https://reports.phpmyadmin.net/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
const sameAs = localStorage.getItem('sameAsRememeber');
const urlBase = 'https://reports.phpmyadmin.net/reports/mark_related_to/';
var done = 0;
var max = 0;
var concurrent = async (xs, f, n=Infinity) => {
const finished = Symbol();
let promises = xs.slice(0, n).map(f), others = xs.slice(n);
while (promises.length) {
await Promise.race(promises.map(promise => promise.then(() => {promise[finished] = true;})));
promises = promises.filter(promise => !promise[finished]);
promises.push(...others.splice(0, n - promises.length).map(f));
}
};
const markReport = (done, total, reportId) => {
$('input[type="checkbox"][value="'+reportId+'"]').prop('checked' , false);
$("#mark_same_as").val('In progress ... (' +done+'/'+total+')');
if (done === total) {
$("#mark_same_as").val('All done');
$('#resultsForm_checkall').prop('checked' , false);
}
};
const processMarkReports = (ticketId, reports) => {
done = 0;
max = reports.length;
concurrent(reports, (reportId) => {
console.log("Mark same "+reportId+" as "+ticketId);
return $.post(urlBase + reportId, {
related_to: ticketId
}, (result) => {
done++;
markReport(done, max, reportId)
});
}, 10);
}
$('#reports_table_length > label > select').append('<option value="300">300</option>');
$('#reports_table_length > label > select').append('<option value="500">500</option>');
$('#reports_table_length > label > select').append('<option value="1000">1000</option>');
$('#reports_table_length > label > select').append('<option value="1500">1500</option>');
$('#state-form > div:nth-child(2)').append(`
<input type="number" id="same_as"/>
<input type="button" value="Mark same as" id="mark_same_as" class="btn btn-primary"/>
<input type="button" value="Clear value" id="clear_sameAsRememeber" class="btn btn-primary"/>
`);
$('#same_as').val(sameAs);
$("#clear_sameAsRememeber").on('click', function () {
localStorage.setItem('sameAsRememeber', '');
$("#same_as").val('');
});
$("#mark_same_as").on('click', function () {
const ticketId = $('#same_as').val();
localStorage.setItem('sameAsRememeber', ticketId);
var sameReports = [];
$.each($("input[name='reports[]']:checked"), function (){
let reportId = $(this).val();
if(reportId !== ticketId) {
sameReports.push(reportId);
}
});
console.log(ticketId, sameReports);
processMarkReports(ticketId, sameReports);
});
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sometimes it's clear from the listing of issues that these are same, so there should be a mass merge option.
The text was updated successfully, but these errors were encountered: