Skip to content

Commit

Permalink
[Prod bug] fix bugs with activate later (#1092)
Browse files Browse the repository at this point in the history
* Found a bug w/ activate later. Fixed.

* Found another nuanced 'error' around activate later.

* Small hack to make the sync start date UI disable after activating

* make the hack less of a hack
  • Loading branch information
jmather-c authored Apr 20, 2023
1 parent 04ba550 commit 887c0c0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ <h4 class="slds-text-heading_small slds-m-bottom_xx-small">
</p>
</div>
<div class="slds-col slds-p-left_xx-large slds-size_1-of-3">
<lightning-input label="Sync Start Date" type="date" date-style="short" variant="label-hidden" value={syncStartDate} onchange={updateSyncStartDate} placeholder="Select Sync Start Date..." disabled={hasSynced}></lightning-input>
<lightning-input data-id="syncStartDate" label="Sync Start Date" type="date" date-style="short" variant="label-hidden" required={pollingEnabled} value={syncStartDate} onchange={updateSyncStartDate} placeholder="Select Sync Start Date..." disabled={hasSynced}></lightning-input>
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,15 @@ export default class SyncPreferencesStep extends LightningElement {
return;
}
this.stripeAccountId = responseData.results.stripe_account_id;
this.lastSynced = new Date(responseData.results.last_synced * 1000).toLocaleString(undefined, {year:'numeric', month:'numeric', day: '2-digit', hour: 'numeric', minute:'2-digit', timeZoneName:'short'});
if (responseData.results.last_synced) {
this.lastSynced = new Date(responseData.results.last_synced * 1000).toLocaleString(undefined, {year:'numeric', month:'numeric', day: '2-digit', hour: 'numeric', minute:'2-digit', timeZoneName:'short'});
}
this.isM = responseData.results.default_currency;
this.defaultCurrency = responseData.results.default_currency;
this.syncRecordRetention = responseData.results.sync_record_retention;
this.syncStartDate = new Date(responseData.results.sync_start_date * 1000).toISOString();
if (responseData.results.sync_start_date && responseData.results.sync_start_date !== "0") {
this.syncStartDate = new Date(responseData.results.sync_start_date * 1000).toISOString();
}
this.apiPercentageLimit = responseData.results.api_percentage_limit;
this.cpqTermUnit = responseData.results.cpq_term_unit;
this.isCpqInstalled = responseData.results.isCpqInstalled;
Expand Down Expand Up @@ -357,6 +361,12 @@ export default class SyncPreferencesStep extends LightningElement {

// confirm they wish to initialize polling
if (this.pollingEnabledChanged && this.hasSynced === false && this.pollingEnabled) {
const startDateEle = this.template.querySelector('[data-id="syncStartDate"]');
if (startDateEle.checkValidity() === false) {
startDateEle.reportValidity();
this.showToast("A Sync Start Date must be set.", 'error', 'sticky');
return;
}
const formattedDate = new Date(this.syncStartDate).toLocaleDateString();
const alertMsg = POLLING_FIRST_ENABLE_ALERT_TEMPLATE.replace('SYNC_START_DATE', formattedDate);

Expand All @@ -375,6 +385,9 @@ export default class SyncPreferencesStep extends LightningElement {
}));
return;
}

// hack to make the sync start date input disable
this.lastSynced = 'Scheduled';
}

if((this.apiPercentageLimit < 100 && this.apiPercentageLimit > 0) && (this.syncRecordRetention < 1000000 && this.syncRecordRetention > 100)) {
Expand Down

0 comments on commit 887c0c0

Please sign in to comment.