Skip to content

Commit

Permalink
Merge pull request #117 from thalesgroup-cert/v2
Browse files Browse the repository at this point in the history
Back - Fix Ticked ID Bug
  • Loading branch information
ygalnezri authored Jun 7, 2024
2 parents 898c351 + ddfd046 commit f7dfe03
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -311,11 +311,12 @@ export class SuspiciousSites extends Component {
e.preventDefault();
const domain_name = this.inputDomainRef.current.value;
const ticket_id = this.inputTicketRef.current.value;
const rtir = this.inputRtirRef.current.value ? this.inputRtirRef.current.value : getMax(this.props.sites, "rtir")+1;
const expiry = this.state.day;
const ip_monitoring = this.ipMonitoringRef.current.checked;
const content_monitoring = this.webContentMonitoringRef.current.checked;
const mail_monitoring = this.emailMonitoringRef.current.checked;
const site = expiry ? {domain_name, ticket_id, expiry, ip_monitoring, content_monitoring, mail_monitoring} : {domain_name, ticket_id, rtir, ip_monitoring, content_monitoring, mail_monitoring};
const site = expiry ? {domain_name, ticket_id, rtir, expiry, ip_monitoring, content_monitoring, mail_monitoring} : {domain_name, ticket_id, rtir, ip_monitoring, content_monitoring, mail_monitoring};

this.props.addSite(site);
this.setState({
Expand Down Expand Up @@ -355,6 +356,13 @@ export class SuspiciousSites extends Component {
placeholder="230509-200a2"
defaultValue={this.state.ticketId}/>
</Col>
<Form.Label column sm="4">ID</Form.Label>
<Col sm="8">
<Form.Control ref={this.inputRtirRef} size="md"
type="number" placeholder="number"
defaultValue={this.state.rtir}
readOnly/>
</Col>
<Form.Label column sm="4">Expiry Date</Form.Label>
<Col sm="8">
<DayPickerInput
Expand Down
6 changes: 0 additions & 6 deletions Watcher/Watcher/site_monitoring/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,6 @@ class Meta:
def __str__(self):
return self.domain_name

@receiver(pre_save, sender=Site)
def set_rtir(sender, instance, **kwargs):
if instance.rtir is None:
last_site = Site.objects.order_by('-rtir').first()
instance.rtir = 1 if not last_site else last_site.rtir + 1


class Alert(models.Model):
"""
Expand Down

0 comments on commit f7dfe03

Please sign in to comment.