-
-
Notifications
You must be signed in to change notification settings - Fork 335
testplan-multi-clone #3985
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
base: master
Are you sure you want to change the base?
testplan-multi-clone #3985
Conversation
for more information, see https://pre-commit.ci
|
||
def get(self, request): | ||
if not self._is_request_data_valid(request, "p"): | ||
return HttpResponseRedirect(request.META.get("HTTP_REFERER", "/")) |
Check warning
Code scanning / CodeQL
URL redirection from remote source Medium test
user-provided value
|
||
def post(self, request): | ||
if not self._is_request_data_valid(request): | ||
return HttpResponseRedirect(request.META.get("HTTP_REFERER", "/")) |
Check warning
Code scanning / CodeQL
URL redirection from remote source Medium test
user-provided value
|
||
# invalid form | ||
messages.add_message(request, messages.ERROR, clone_form.errors) | ||
return HttpResponseRedirect(request.META.get("HTTP_REFERER", "/")) |
Check warning
Code scanning / CodeQL
URL redirection from remote source Medium test
user-provided value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a few initial comments.
}) | ||
|
||
// header “select all” | ||
$('#resultsTable thead').on('change', '#select-all', function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not liking this in the header that much.
Can you move the "Select All" + the "Clone Selected" buttons into the button box above the table?
See how the rest of the buttons are defined. For icon, use fa-code-fork icon to match existing UI.
The order should be
[ ] <clone-selected> <excel> <.... the rest of the buttons>
.
Note: (a follow up improvement can be made to the rest of these table buttons to operate only on the current selection if present.
$('#btn_clone_bulk').click(function () { | ||
const selectedTestPlans = getSelectedTestPlans() | ||
if (selectedTestPlans.length === 0) { | ||
alert('No test plans selected for cloning.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This string must be translatable. See how it's done for other strings on dynamic pages (.data('trans-
selectors).
$('#id_product').change(updateVersionSelectFromProduct) | ||
} | ||
|
||
function getSelectedTestPlans () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmmm, this feels like a duplicate. Need to check if we don't have something more generic which already does this.
In testplans/static/testplans/js/get.js there is getSelectedTestCases() and IIRC there was another one in utils.js but let's leave this for later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main differences between getSelectedTestPlans() and getSelectedTestCases() is that getplans has the handle selecting child nested elements where getcases does not do this.
|
||
|
||
@method_decorator(permission_required("testplans.add_testplan"), name="dispatch") | ||
class MultiClone(FormView): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not liking this one very much b/c it adds unnecessary code.
IMO all could be done with the existing cloning code but needs more attention to the details.
Let's sort the GUI part first and then will circle back to this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could remove the original single clone classes and code and change it to redirect to multiclone checking if there is only one and if so letting you change its name.
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
|
Adds the funtionality to support cloning multiple test plans at once from the testplans search page, addressing issue #3976.
Important notes and considerations before merge. The existing single clone page still exists as a seperate page. For the most part these two pages are identical however since we are handellign multiple testplans at once I removed the ability to give the clone test plan a new name instead always keeping the old name. In the future I can look at combining these two pages into one. Also this code assumes all test plans that want to be coded are going to be clone into the same product and version. If user want more cotimization I believe they should filter and do clones in smaller groups, however we could add more check bozes to the page to ask indiviualy for each test plan if they want to set the old test plan as the parent and if they want to copy test cases, rn the response is uniform.