Skip to content

Commit 5ac0bb9

Browse files
committed
[TOS-136],[TOS-121],[TOS-130] and code cleanUp
1 parent ccaaef1 commit 5ac0bb9

File tree

10 files changed

+32
-13
lines changed

10 files changed

+32
-13
lines changed

server/src/main/java/com/testsigma/repository/ElementRepository.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,5 @@ public interface ElementRepository extends BaseRepository<Element, Long> {
2020

2121
List<Element> findByNameInAndWorkspaceVersionId(List<String> names, Long workspaceVersionId);
2222

23-
List<Element> findAllByWorkspaceVersionId(Long workspaceVersionId);
2423
}
2524

server/src/main/java/com/testsigma/service/ElementService.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,6 @@ public Page<Element> findAll(Specification<Element> specification, Pageable page
7272
return elementRepository.findAll(specification, pageable);
7373
}
7474

75-
public List<Element> findAllByWorkspaceVersionId(Long workspaceVersionId) {
76-
return this.elementRepository.findAllByWorkspaceVersionId(workspaceVersionId);
77-
}
7875

7976
public Element create(Element element) {
8077
element = elementRepository.save(element);

server/src/main/java/com/testsigma/specification/AgentSpecification.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import java.sql.Timestamp;
77

88
public class AgentSpecification extends BaseSpecification<Agent> {
9-
private static final long dayInMillis = 86400000L;
109
private static final long TEN_MIN_IN_MILLISECONDS = 600000L;
1110

1211
public AgentSpecification(final SearchCriteria criteria) {

ui/src/app/agents/components/webcomponents/agents-auto-complete.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ export class AgentsAutoCompleteComponent implements OnInit {
149149
if (term) {
150150
searchName = ",title:*" + term + "*";
151151
}
152-
this.agentService.findAll(searchName).subscribe(res => {
152+
this.agentService.findAll(searchName,"updatedDate,desc").subscribe(res => {
153153
if(searchName?.length == 0)
154154
this.agentsEmpty = res.empty;
155155
this.agents = res;

ui/src/app/components/webcomponents/dry-run-form.component.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,13 @@
8383
<span class="p-10 text-left" [innerHTML]="'ad_hoc.invalid_url'| translate:{ fieldNames:invalidUrls.join(', ') }"></span>
8484
</div>
8585
</div>
86+
<div class="theme-warning text-danger border-rds-4 px-10 py-5 fz-12 mt-2 mb-40 text-center"
87+
*ngIf="isHybrid && zeroActiveAgents">
88+
<div class="mx-auto w-fit-content d-flex align-items-center">
89+
<i class="fa-warning fz-20 pl-15 pr-8"></i>
90+
<span class="p-10 text-left" [innerHTML]="'ad_hoc.inactive_agents' | translate"></span>
91+
</div>
92+
</div>
8693
<app-dry-run-rest-form
8794
(closeDialog)="closeDialogTab()"
8895
*ngIf="dryExecutionForm && isRest && version"

ui/src/app/components/webcomponents/dry-run-form.component.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export class DryRunFormComponent extends BaseComponent implements OnInit {
5454
public searchAutoComplete = new FormControl();
5555
public filteredDryRunConfigs: AdhocRunConfiguration[] =[];
5656
public refresh: boolean=true;
57-
public agentEmpty:boolean;
57+
public zeroActiveAgents:boolean = false;
5858

5959
constructor(
6060
public authGuard: AuthenticationGuard,
@@ -113,8 +113,15 @@ export class DryRunFormComponent extends BaseComponent implements OnInit {
113113
this.fetchVersion();
114114
});
115115
this.agentService.findAll().subscribe(res => {
116-
this.agentEmpty = res.empty;
116+
res.content.forEach(agent => {
117+
if (!agent.isOnline()) {
118+
this.zeroActiveAgents = true;
119+
}else{
120+
this.zeroActiveAgents = false;
121+
}
122+
})
117123
});
124+
118125
this.searchAutoComplete.valueChanges.subscribe((term) => {
119126
this.searchDryRunConfigs(term);
120127
})
@@ -387,7 +394,7 @@ export class DryRunFormComponent extends BaseComponent implements OnInit {
387394

388395
disableRunButton() {
389396
return this.saving || this.savingConfig || this.dryExecutionForm?.invalid || this.emptyElements.length>0
390-
|| (!this.isHybrid && this.invalidUrls.length>0) || (this.isHybrid && this.agentEmpty) ;
397+
|| (!this.isHybrid && this.invalidUrls.length>0) || (this.isHybrid && this.zeroActiveAgents) ;
391398
}
392399

393400
private searchDryRunConfigs(term: any) {

ui/src/app/components/webcomponents/element-form.component.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,12 +385,21 @@ export class ElementFormComponent extends BaseComponent implements OnInit {
385385
}
386386

387387
saveOrUpdate() {
388+
let screenName : ElementScreenName;
388389
if (!this.isInProgress) {
389390
this.formSubmitted = true;
390391
if (this.elementForm.invalid)
391392
return;
392393
if (this.element.screenNameId) {
393-
(this.elementId) ? this.updateElement() : this.saveElement()
394+
let updatedScreenName =this.elementForm.get("screen_name").value;
395+
this.element.screenNameObj.name = updatedScreenName;
396+
screenName = new ElementScreenName();
397+
screenName.name = updatedScreenName;
398+
screenName.workspaceVersionId =this.element.workspaceVersionId;
399+
this.elementScreenNameService.create(screenName).subscribe(screeNameObj => {
400+
this.element.screenNameId = screeNameObj.id;
401+
(this.elementId) ? this.updateElement() : this.saveElement()
402+
});
394403
} else {
395404
let screenNameBean: ElementScreenName = new ElementScreenName();
396405
screenNameBean.name = this.elementForm.get('screen_name').value;

ui/src/app/components/webcomponents/jira-issue-details.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
*ngFor="let formField of formFields"
113113
class="form-row" [ngSwitch]="true">
114114
<div class="pb-20"
115-
*ngSwitchCase="formField.type != 'textarea'">
115+
*ngSwitchCase="formField?.type != 'textarea'">
116116
<div
117117
class="rb-medium pb-4 pl-7"
118118
[textContent]="formField.name"></div>

ui/src/app/components/webcomponents/schedule-plan-form.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,8 @@ export class SchedulePlanFormComponent extends BaseComponent implements OnInit {
197197

198198
setScheduleEntityValues() {
199199
this.scheduledPlan.scheduleTime = this.toUTCTime(this.getTimeDate());
200-
this.scheduledPlan.testPlanId = this.testPlan.id;
201-
this.scheduledPlan.scheduleType = this.scheduleForm.get('scheduleType').value;
200+
this.scheduledPlan.testPlanId = this.testPlan?.id;
201+
this.scheduledPlan.scheduleType = this.scheduleForm?.get('scheduleType')?.value;
202202
this.scheduledPlan.status = ScheduleStatus.ACTIVE;
203203
}
204204

ui/src/assets/i18n/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -966,6 +966,7 @@
966966
"ad_hoc.saved_config.save_as": "Save As Favorite",
967967
"ad_hoc.empty_elements": "Unable to run the test. The test case contains steps with empty Elements - <span class='rb-semi-bold'>{{fieldNames}}</span>. Please update those and try running again.",
968968
"ad_hoc.invalid_url": "Unable to run the Test. The Test Case contains Navigate Step with Local URLs - <span class='f-semi-bold text-break'>{{fieldNames}}</span> which cannot be accessed using Test Lab Type 'Testsigma Lab'. Please select the 'Hybrid' option in Test Lab Type to run the tests locally. Learn more - <a href=\"https://testsigma.com/docs/faqs/web-apps/why-cloud-devices-cannot-access-local-apps/\" target=\"_blank\" class='text-link'>Why Cloud Test Environments can't access Locally hosted Applications?</a>",
969+
"ad_hoc.inactive_agents": "Provided agent is Not Active Please choose another Test Machine to run the Test Case or Restart your agent.",
969970
"hint.message.ad_hoc.saved_config.list": "Manage Favorite Ad-hoc Run Configs",
970971
"ad_hoc.btn.create_run": "Run Now",
971972
"test_plan.enable_visual_testing": "Enable Visual Testing",

0 commit comments

Comments
 (0)