Skip to content

Commit

Permalink
feat: delete testcase all history
Browse files Browse the repository at this point in the history
  • Loading branch information
SamYSF committed Sep 4, 2024
1 parent bd16bc9 commit 33c7629
Show file tree
Hide file tree
Showing 17 changed files with 1,921 additions and 581 deletions.
3 changes: 2 additions & 1 deletion console/atest-ui/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"cancelFullScreen": "Cancel Full Screen",
"viewHistory": "View History Test Case Result",
"revert": "Revert",
"goToHistory": "Go to History"
"goToHistory": "Go to History",
"deleteAllHistory": "Delete All History"
},
"title": {
"createTestSuite": "Create Test Suite",
Expand Down
3 changes: 2 additions & 1 deletion console/atest-ui/src/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"cancelFullScreen": "取消全屏",
"viewHistory": "查看历史记录",
"revert": "回退",
"goToHistory": "跳转历史记录"
"goToHistory": "跳转历史记录",
"deleteAllHistory": "删除所有历史记录"
},
"title": {
"createTestSuite": "创建测试用例集",
Expand Down
17 changes: 17 additions & 0 deletions console/atest-ui/src/views/TestCase.vue
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,17 @@ const goToHistory = async (formEl) => {
})
}
const deleteAllHistory = async (formEl) => {
if (!formEl) return
caseRevertLoading.value = true
API.DeleteAllHistoryTestCase(props.suite, props.name, handleDeleteResponse);
caseRevertLoading.value = false
historyDialogOpened.value = false
historyForm.value.selectedID = ''
const target = document.getElementById('compareView');
target.innerHTML = '';
}
const options = GetHTTPMethods()
const requestActiveTab = ref(Cache.GetPreference().requestActiveTab)
watch(requestActiveTab, Cache.WatchRequestActiveTab)
Expand Down Expand Up @@ -1105,6 +1116,12 @@ Magic.Keys(() => {
:loading="caseRevertLoading"
>{{ t('button.goToHistory') }}
</el-button>
<el-button
type="primary"
@click="deleteAllHistory(viewHistoryRef)"
:loading="caseRevertLoading"
>{{ t('button.deleteAllHistory') }}
</el-button>
</div>
</el-col>
</el-row>
Expand Down
19 changes: 18 additions & 1 deletion console/atest-ui/src/views/net.ts
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,23 @@ function DeleteHistoryTestCase(req: HistoryTestCase,
.then(callback).catch(errHandle)
}

function DeleteAllHistoryTestCase(suiteName: string, caseName: string,
callback: (d: any) => void, errHandle?: (e: any) => void | null) {
const requestOptions = {
method: 'POST',
headers: {
'X-Store-Name': Cache.GetCurrentStore().name,
'X-Auth': getToken()
},
body: JSON.stringify({
suiteName : suiteName,
caseName: caseName,
})
}
fetch('/server.Runner/DeleteAllHistoryTestCase', requestOptions)
.then(callback).catch(errHandle)
}

function RunHistoryTestCase(req: HistoryTestCase,
callback: (d: any) => void, errHandle?: (e: any) => void | null) {
const requestOptions = {
Expand Down Expand Up @@ -652,7 +669,7 @@ export const API = {
GetVersion,
CreateTestSuite, UpdateTestSuite, ImportTestSuite, GetTestSuite, DeleteTestSuite, ConvertTestSuite,GetTestSuiteYaml,
CreateTestCase, UpdateTestCase, GetTestCase, ListTestCase, DeleteTestCase, RunTestCase,
GetHistoryTestCaseWithResult, DeleteHistoryTestCase,GetHistoryTestCase, RunHistoryTestCase, GetTestCaseAllHistory,
GetHistoryTestCaseWithResult, DeleteHistoryTestCase,GetHistoryTestCase, RunHistoryTestCase, GetTestCaseAllHistory, DeleteAllHistoryTestCase,
GenerateCode, ListCodeGenerator,
PopularHeaders,
CreateOrUpdateStore, GetStores, DeleteStore, VerifyStore,
Expand Down
8 changes: 8 additions & 0 deletions pkg/server/remote_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,14 @@ func (s *server) DeleteHistoryTestCase(ctx context.Context, in *HistoryTestCase)
return
}

func (s *server) DeleteAllHistoryTestCase(ctx context.Context, in *HistoryTestCase) (reply *HelloReply, err error) {
loader := s.getLoader(ctx)
defer loader.Close()
reply = &HelloReply{}
err = loader.DeleteAllHistoryTestCase(in.SuiteName, in.CaseName)
return
}

func (s *server) DuplicateTestCase(ctx context.Context, in *TestCaseDuplicate) (reply *HelloReply, err error) {
loader := s.getLoader(ctx)
defer loader.Close()
Expand Down
459 changes: 241 additions & 218 deletions pkg/server/server.pb.go

Large diffs are not rendered by default.

Loading

0 comments on commit 33c7629

Please sign in to comment.