@@ -64,7 +64,7 @@ const handleNodeClick = (data: Tree) => {
64
64
}
65
65
}
66
66
67
- const data = ref ([] as Tree [])
67
+ const treeData = ref ([] as Tree [])
68
68
const treeRef = ref <InstanceType <typeof ElTree >>()
69
69
const currentNodekey = ref (' ' )
70
70
@@ -83,7 +83,8 @@ function loadHistoryTestSuites(storeName: string) {
83
83
if (! d .data ) {
84
84
return
85
85
}
86
- Object .keys (d .data ).map ((k ) => {
86
+ const sortedKeys = Object .keys (d .data ).sort ((a , b ) => new Date (a ) - new Date (b ));
87
+ sortedKeys .map ((k ) => {
87
88
let suite = {
88
89
id: k ,
89
90
label: k ,
@@ -102,12 +103,16 @@ function loadHistoryTestSuites(storeName: string) {
102
103
parentID: suite .id
103
104
} as Tree )
104
105
})
105
- data .value .push (suite )
106
+ treeData .value .push (suite )
106
107
})
107
108
})
108
109
}
109
110
}
110
111
112
+ function generateTestCaseID(suiteName : string , caseName : string ) {
113
+ return suiteName + caseName
114
+ }
115
+
111
116
interface Store {
112
117
name: string ,
113
118
description: string ,
@@ -116,19 +121,23 @@ interface Store {
116
121
const loginDialogVisible = ref (false )
117
122
const stores = ref ([] as Store [])
118
123
const storesLoading = ref (false )
119
- function loadStores() {
124
+ function loadStores(lastSuitName ? : string , lastCaseName ? : string ) {
125
+ if (lastSuitName && lastCaseName && lastSuitName !== ' ' && lastCaseName !== ' ' ) {
126
+ // get data from emit event
127
+ Cache .SetLastTestCaseLocation (lastSuitName , generateTestCaseID (lastSuitName , lastCaseName ))
128
+ }
129
+
120
130
storesLoading .value = true
121
131
const requestOptions = {
122
- method: ' POST' ,
123
132
headers: {
124
133
' X-Auth' : API .getToken ()
125
134
}
126
135
}
127
- fetch (' /server.Runner/GetStores ' , requestOptions )
136
+ fetch (' /api/v1/stores ' , requestOptions )
128
137
.then (API .DefaultResponseProcess )
129
138
.then (async (d ) => {
130
139
stores .value = d .data
131
- data .value = [] as Tree []
140
+ treeData .value = [] as Tree []
132
141
Cache .SetStores (d .data )
133
142
134
143
for (const item of d .data ) {
@@ -137,13 +146,14 @@ function loadStores() {
137
146
}
138
147
}
139
148
140
- if (data .value .length > 0 ) {
149
+ if (treeData .value .length > 0 ) {
141
150
const key = Cache .GetLastTestCaseLocation ()
151
+
142
152
let targetSuite = {} as Tree
143
153
let targetChild = {} as Tree
144
154
if (key .suite !== ' ' && key .testcase !== ' ' ) {
145
- for (var i = 0 ; i < data .value .length ; i ++ ) {
146
- const item = data .value [i ]
155
+ for (var i = 0 ; i < treeData .value .length ; i ++ ) {
156
+ const item = treeData .value [i ]
147
157
if (item .id === key .suite && item .children ) {
148
158
for (var j = 0 ; j < item .children .length ; j ++ ) {
149
159
const child = item .children [j ]
@@ -158,16 +168,18 @@ function loadStores() {
158
168
}
159
169
}
160
170
if (! targetChild .id || targetChild .id === ' ' ) {
161
- targetSuite = data .value [0 ]
171
+ targetSuite = treeData .value [0 ]
162
172
if (targetSuite .children && targetSuite .children .length > 0 ) {
163
173
targetChild = targetSuite .children [0 ]
164
174
}
165
175
}
166
176
167
177
viewName .value = ' testsuite'
168
178
currentNodekey .value = targetChild .id
179
+
169
180
treeRef .value ! .setCurrentKey (targetChild .id )
170
181
treeRef .value ! .setCheckedKeys ([targetChild .id ], false )
182
+
171
183
testSuite .value = targetSuite .label
172
184
Cache .SetCurrentStore (targetSuite .store )
173
185
testKind .value = targetChild .kind
@@ -233,7 +245,7 @@ const deviceAuthNext = () => {
233
245
234
246
<el-tree
235
247
v-loading =" storesLoading"
236
- :data =data
248
+ :data =treeData
237
249
highlight-current
238
250
:check-on-click-node =" true"
239
251
:expand-on-click-node =" false"
0 commit comments