Skip to content

Commit 3b2e81a

Browse files
fix: allow deleting test groups in creator (#840)
1 parent 5adad52 commit 3b2e81a

File tree

2 files changed

+68
-8
lines changed

2 files changed

+68
-8
lines changed

src/components/Panels/TestBenchPanel/TestBenchCreator.vue

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,25 @@
9393
</div>
9494
</div>
9595

96-
<div v-for="(group, groupIndex) in groups" class="group-container" :key="groupIndex">
97-
<div class="group-header">
98-
<input v-model="group.title" class="group-title-input" type="text" />
99-
<v-btn size="small" class="add-test-btn" variant="tonal" @click="addTestToGroup(groupIndex)">
96+
<div v-for="(group, groupIndex) in groups" class="group-container" :key="groupIndex">
97+
<div class="group-header">
98+
<input v-model="group.title" class="group-title-input" type="text" />
99+
<div class="group-actions">
100+
101+
<v-btn size="small" class="add-test-btn" variant="tonal"
102+
@click="addTestToGroup(groupIndex)">
100103
<v-icon left>mdi-plus</v-icon>
101104
Add Test
102105
</v-btn>
106+
107+
<v-btn icon size="small" variant="text" color="black" @click="deleteGroup(groupIndex)"
108+
title="Delete Group">
109+
<v-icon>mdi-delete</v-icon>
110+
</v-btn>
103111
</div>
112+
</div>
113+
114+
104115

105116
<div v-for="(_, testIndex) in (group.inputs[0] || [])" class="data-grid data-row" :key="testIndex" :class="{ 'with-results': testBenchStore.showResults }">
106117
<div class="grid-cell label-col action-col">
@@ -309,6 +320,12 @@ const addNewGroup = () => {
309320
});
310321
};
311322
323+
const deleteGroup = (groupIndex: number) => {
324+
if (groups.length === 1) return;
325+
groups.splice(groupIndex, 1);
326+
};
327+
328+
312329
const increInputs = () => {
313330
groups.forEach((group) => {
314331
if (group.inputs.length === 0) return;
@@ -670,14 +687,17 @@ const importFromCSV = () => {
670687
display: flex;
671688
align-items: center;
672689
margin-bottom: 8px;
690+
justify-content: space-between;
673691
gap: 16px;
674692
}
693+
675694
.group-title-input {
676695
font-size: 1.1rem;
677696
font-weight: 500;
678697
border: none;
679698
border-bottom: 1px solid transparent;
680699
padding: 4px 0;
700+
flex: 0 0 auto;
681701
}
682702
.group-title-input:focus {
683703
outline: none;
@@ -747,5 +767,17 @@ const importFromCSV = () => {
747767
.attach-btn:hover {
748768
background-color: #424242;
749769
}
770+
771+
.group-actions {
772+
display: flex;
773+
align-items: center;
774+
gap: 8px;
775+
margin-left: auto;
776+
}
777+
778+
.add-test-btn {
779+
color: var(--cv-green);
780+
}
781+
750782
</style>
751783

v1/src/components/Panels/TestBenchPanel/TestBenchCreator.vue

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,23 @@
9393
</div>
9494
</div>
9595

96-
<div v-for="(group, groupIndex) in groups" class="group-container" :key="groupIndex">
97-
<div class="group-header">
98-
<input v-model="group.title" class="group-title-input" type="text" />
99-
<v-btn size="small" class="add-test-btn" variant="tonal" @click="addTestToGroup(groupIndex)">
96+
<div v-for="(group, groupIndex) in groups" class="group-container" :key="groupIndex">
97+
<div class="group-header">
98+
<input v-model="group.title" class="group-title-input" type="text" />
99+
<div class="group-actions">
100+
101+
<v-btn size="small" class="add-test-btn" variant="tonal"
102+
@click="addTestToGroup(groupIndex)">
100103
<v-icon left>mdi-plus</v-icon>
101104
Add Test
102105
</v-btn>
106+
107+
<v-btn icon size="small" variant="text" color="black" @click="deleteGroup(groupIndex)"
108+
title="Delete Group">
109+
<v-icon>mdi-delete</v-icon>
110+
</v-btn>
103111
</div>
112+
</div>
104113

105114
<div v-for="(_, testIndex) in (group.inputs[0] || [])" class="data-grid data-row" :key="testIndex" :class="{ 'with-results': testBenchStore.showResults }">
106115
<div class="grid-cell label-col action-col">
@@ -309,6 +318,11 @@ const addNewGroup = () => {
309318
});
310319
};
311320
321+
const deleteGroup = (groupIndex: number) => {
322+
if (groups.length === 1) return;
323+
groups.splice(groupIndex, 1);
324+
};
325+
312326
const increInputs = () => {
313327
groups.forEach((group) => {
314328
if (group.inputs.length === 0) return;
@@ -671,13 +685,15 @@ const importFromCSV = () => {
671685
align-items: center;
672686
margin-bottom: 8px;
673687
gap: 16px;
688+
justify-content: space-between;
674689
}
675690
.group-title-input {
676691
font-size: 1.1rem;
677692
font-weight: 500;
678693
border: none;
679694
border-bottom: 1px solid transparent;
680695
padding: 4px 0;
696+
flex: 0 0 auto;
681697
}
682698
.group-title-input:focus {
683699
outline: none;
@@ -747,5 +763,17 @@ const importFromCSV = () => {
747763
.attach-btn:hover {
748764
background-color: #424242;
749765
}
766+
767+
.group-actions {
768+
display: flex;
769+
align-items: center;
770+
gap: 8px;
771+
margin-left: auto;
772+
}
773+
774+
.add-test-btn {
775+
color: var(--cv-green);
776+
}
777+
750778
</style>
751779

0 commit comments

Comments
 (0)