Skip to content
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

Revert "Revert "Dts 37072 api hit limit"" #1195

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ div.main {
min-width: 60px;
}

.status-container.pending {
background-color: #FFBF00;
border: 1px solid #FFBF00;
}

.status-container.inactive {
background-color: #ea6a47;
border: 1px solid #ea6a47;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,11 @@

<div class="p-d-flex p-align-center" *ngIf="(!findTraceLogForTool(processor.processorName)?.executionOngoing && processor.processorName === 'Jira') || processor.processorName !== 'Jira'">
<div *ngIf="showProcessorLastState(processor.processorName) !== 'NA'" class="status-container"
[ngClass]="showProcessorLastState(processor.processorName) === 'Success' ? 'active' : 'inactive'">
[ngClass]="{
'active': showProcessorLastState(processor.processorName) === 'Success',
'inactive': showProcessorLastState(processor.processorName) === 'Failure',
'pending': showProcessorLastState(processor.processorName) === 'Warning'
}">
{{ showProcessorLastState(processor.processorName)}}
</div>
<span *ngIf="showProcessorLastState(processor.processorName) === 'NA'">NA</span>
Expand All @@ -105,12 +109,16 @@
<i class="pi pi-info-circle" [ngClass]="{'disabled': !(findTraceLogForTool('Jira')?.progressStatusList?.length || findTraceLogForTool('Jira')?.errorMessage)}"
(click)="(findTraceLogForTool('Jira')?.errorMessage || findTraceLogForTool('Jira')?.progressStatusList?.length) ? op.toggle($event) : ''" style="font-size: 1.2rem"></i>
</div>
<div class="p-ml-2" *ngIf="processor.processorName === 'RepoTool' && showProcessorLastState(processor.processorName) === 'Warning'">
<i class="pi pi-info-circle"
(click)="rOp.toggle($event)" style="font-size: 1.2rem"></i>
</div>
</div>
</td>
<td class='custom-table-cell p-d-flex p-align-center column-width'>
<button pButton pRipple label="Run Now"
icon="{{findTraceLogForTool(processor.processorName)?.executionOngoing === true ? 'pi pi-spin pi-spinner' : 'pi pi-forward'}}"
[disabled]="(shouldDisableRunProcessor() || findTraceLogForTool(processor.processorName)?.executionOngoing === true) && processor.processorName !== 'Jira' "
[disabled]="(shouldDisableRunProcessor() || findTraceLogForTool(processor.processorName)?.executionOngoing === true) && processor.processorName !== 'Jira' || (processor.processorName === 'RepoTool' && showProcessorLastState(processor.processorName) === 'Warning')"
class="p-button-sm p-button-success p-button-raised" (click)="runProcessor(processor.processorName)"></button>
<div class="action-btns p-ml-3" [ngClass]="{'disabled':!(getToolDetailsForProcessor(processor?.processorName)?.length > 0 && findTraceLogForTool(processor?.processorName)) || findTraceLogForTool(processor?.processorName)?.isDeleteDisable}" *ngIf="!shouldDisableRunProcessor()"><i class="far fa-trash-alt" (click)="deleteProcessorData(processor)"></i></div>
</td>
Expand Down Expand Up @@ -180,3 +188,8 @@ <h3 class="p-text-center" class="error-text"><img src="../../../assets/img/icon-
</ul>
</div>
</p-overlayPanel>

<p-overlayPanel #rOp [showCloseIcon]="false">
Reached the rate limit. Repo scanning will automatically resume after {{ getRepoToolTimeDetails() }}
</p-overlayPanel>

Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,10 @@ export class AdvancedSettingsComponent implements OnInit {
const traceLog = this.findTraceLogForTool(processorName);
if (traceLog == undefined || traceLog == null || traceLog.executionEndedAt == 0) {
return 'NA';
} else {
} else if(traceLog.executionWarning){
return 'Warning';
}
else {
return traceLog.executionSuccess ? 'Success' : 'Failure';
}
}
Expand Down Expand Up @@ -367,6 +370,12 @@ export class AdvancedSettingsComponent implements OnInit {
}
}

getRepoToolTimeDetails() {
const processorName = 'RepoTool';
const traceLog = this.findTraceLogForTool(processorName);
return (traceLog == undefined || traceLog == null || traceLog.executionResumesAt == 0) ? 'NA' : new DatePipe('en-US').transform(traceLog.executionResumesAt, 'dd-MMM-yyyy (EEE) - hh:mmaaa');
}

decideWhetherLoaderOrNot(jiraLogDetails){
if(jiraLogDetails && jiraLogDetails?.executionOngoing && jiraLogDetails?.progressStatusList?.length){
const logs = jiraLogDetails.progressStatusList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public class ProcessorExecutionTraceLog {
private boolean dataMismatch;
private boolean progressStats;
private boolean executionOngoing;
private boolean executionWarning;
private long executionResumesAt;
private String errorMessage;
private String failureLog;
private List<ProgressStatus> progressStatusList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*
******************************************************************************/


package com.publicissapient.kpidashboard.apis.repotools.model;

import lombok.AllArgsConstructor;
Expand All @@ -35,6 +34,6 @@ public class RepoToolsStatusResponse implements Serializable {
private String repository;
private String source;
private String status;
private String timestamp;
private Long timestamp;

}
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ public class RepoToolsConfigServiceImpl {
public static final String BITBUCKET_CLOUD_IDENTIFIER = "bitbucket.org";
public static final String PROJECT = "/projects/";
public static final String REPOS = "/repos/";
public static final String WARNING = "WARNING";



Expand All @@ -125,7 +126,7 @@ public int configureRepoToolProject(ProjectToolConfig projectToolConfig, Connect
ToolCredential toolCredential = new ToolCredential(connection.getUsername(),
aesEncryptionService.decrypt(connection.getAccessToken(), customApiConfig.getAesEncryptionKey()),
connection.getEmail());
LocalDateTime fistScan = LocalDateTime.now().minusMonths(6);
LocalDateTime fistScan = LocalDateTime.now().minusMonths(3);
RepoToolsProvider repoToolsProvider = repoToolsProviderRepository
.findByToolName(connection.getRepoToolProvider().toLowerCase());
String[] split = projectToolConfig.getGitFullUrl().split("/");
Expand Down Expand Up @@ -344,6 +345,9 @@ public void saveRepoToolProjectTraceLog(RepoToolsStatusResponse repoToolsStatusR
existingProcessorExecutionTraceLog -> processorExecutionTraceLog.setLastEnableAssigneeToggleState(
existingProcessorExecutionTraceLog.isLastEnableAssigneeToggleState()));
processorExecutionTraceLog.setExecutionEndedAt(System.currentTimeMillis());
boolean isWarning = WARNING.equalsIgnoreCase(repoToolsStatusResponse.getStatus());
processorExecutionTraceLog.setExecutionWarning(isWarning);
processorExecutionTraceLog.setExecutionResumesAt(isWarning?repoToolsStatusResponse.getTimestamp():0L);
processorExecutionTraceLog.setExecutionSuccess(
Constant.SUCCESS.equalsIgnoreCase(repoToolsStatusResponse.getStatus()));
processorExecutionTraceLogService.save(processorExecutionTraceLog);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ public void fetchActiveSprint_HttpClientErrorException() {
public void saveRepoToolTraceLogsTest() {

processorService.saveRepoToolTraceLogs(new RepoToolsStatusResponse("project", "repo", "src",
Constant.SUCCESS, "timestamp"));
Constant.SUCCESS, 1715222363881L));
Mockito.verify(cacheService, Mockito.times(3)).clearCache(Mockito.anyString());

}
Expand Down
Loading