File tree Expand file tree Collapse file tree 3 files changed +9
-13
lines changed
Expand file tree Collapse file tree 3 files changed +9
-13
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ const props = defineProps({
2828 type: Number ,
2929 default: 10
3030 },
31- key : {
31+ group : {
3232 type: String ,
3333 default: ' history'
3434 },
@@ -74,7 +74,7 @@ const handleEnter = async () => {
7474 return ;
7575 }
7676
77- const history = JSON .parse (getStorage ().getItem (props .key ) || ' []' )
77+ const history = JSON .parse (getStorage ().getItem (props .group ) || ' []' )
7878 const existingItem = history .find ((item : HistoryItem ) => item .value === input .value )
7979
8080 if (existingItem ) {
@@ -89,18 +89,18 @@ const handleEnter = async () => {
8989 history .shift ()
9090 }
9191
92- getStorage ().setItem (props .key , JSON .stringify (history ))
92+ getStorage ().setItem (props .group , JSON .stringify (history ))
9393 suggestions .value = history
9494}
9595
9696const loadHistory = () => {
97- suggestions .value = JSON .parse (getStorage ().getItem (' history ' ) || ' []' )
97+ suggestions .value = JSON .parse (getStorage ().getItem (props . group ) || ' []' )
9898}
9999
100100const deleteHistoryItem = (item : HistoryItem ) => {
101- const history = JSON .parse (getStorage ().getItem (props .key ) || ' []' )
101+ const history = JSON .parse (getStorage ().getItem (props .group ) || ' []' )
102102 const updatedHistory = history .filter ((historyItem : HistoryItem ) => historyItem .value !== item .value )
103- getStorage ().setItem (props .key , JSON .stringify (updatedHistory ))
103+ getStorage ().setItem (props .group , JSON .stringify (updatedHistory ))
104104 suggestions .value = updatedHistory
105105}
106106
Original file line number Diff line number Diff line change @@ -139,7 +139,7 @@ const keyValueDataHandler = (data: QueryData) => {
139139}
140140
141141const executeQuery = async () => {
142- executeWithQuery (sqlQuery .value )
142+ return executeWithQuery (sqlQuery .value )
143143}
144144const executeWithQuery = async (sql : string ) => {
145145 switch (kind .value ) {
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import type { FormInstance, FormRules } from 'element-plus'
66import type { Suite , TestCase , Pair } from ' ./types'
77import { NewSuggestedAPIsQuery , GetHTTPMethods , SwaggerSuggestion } from ' ./types'
88import EditButton from ' ../components/EditButton.vue'
9+ import HistoryInput from ' ../components/HistoryInput.vue'
910import { Cache } from ' ./cache'
1011import { useI18n } from ' vue-i18n'
1112import { API } from ' ./net'
@@ -301,12 +302,7 @@ const renameTestSuite = (name: string) => {
301302 {{ t('tip.testsuite') }}<EditButton :value =" suite.name" @changed =" renameTestSuite" />
302303
303304 <el-form-item :label =" t('tip.apiAddress')" prop =" api" >
304- <el-input
305- class =" w-50 m-2"
306- v-model =" suite.api"
307- placeholder =" API"
308- test-id =" suite-editor-api"
309- ></el-input >
305+ <HistoryInput placeholder =" API" v-model =" suite.api" group =" apiAddress" />
310306 </el-form-item >
311307 <table style =" width : 100% " >
312308 <tr >
You can’t perform that action at this time.
0 commit comments