Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a "Create a Copy" function for cloning checks Fixes #288
- Loading branch information
Showing
8 changed files
with
122 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from hc.api.models import Channel, Check | ||
from hc.test import BaseTestCase | ||
|
||
|
||
class CopyCheckTestCase(BaseTestCase): | ||
def setUp(self): | ||
super(CopyCheckTestCase, self).setUp() | ||
self.check = Check(project=self.project) | ||
self.check.name = "Foo" | ||
self.check.save() | ||
|
||
self.copy_url = "/checks/%s/copy/" % self.check.code | ||
|
||
def test_it_works(self): | ||
self.client.login(username="alice@example.org", password="password") | ||
r = self.client.post(self.copy_url, follow=True) | ||
self.assertContains(r, "This is a brand new check") | ||
self.assertContains(r, "Foo (copy)") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<div id="copy-modal" class="modal"> | ||
<div class="modal-dialog"> | ||
<form action="{% url 'hc-copy' check.code %}" method="post"> | ||
{% csrf_token %} | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<button type="button" class="close" data-dismiss="modal">×</button> | ||
<h4>Create a Copy of This Check</h4> | ||
</div> | ||
<div class="modal-body"> | ||
<p>You are about to <strong>create a new check based on this | ||
check's configuration</strong>. The following items will | ||
get copied:</p> | ||
<ul class="checkmarks"> | ||
<li>Name, tags and description</li> | ||
<li>Schedule</li> | ||
<li>Assigned notification methods</li> | ||
</ul> | ||
<p>The following items <em>will not</em> be copied:</p> | ||
<ul class="crosses"> | ||
<li>Its URL (a new URL will be generated)</li> | ||
<li>The log of already received pings</li> | ||
</ul> | ||
</div> | ||
<div class="modal-footer"> | ||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button> | ||
<button type="submit" class="btn btn-primary">Create a Copy</button> | ||
</div> | ||
</div> | ||
</form> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters