Skip to content

Commit 1f11996

Browse files
committed
get extension list from API
1 parent 8b9890b commit 1f11996

File tree

7 files changed

+935
-713
lines changed

7 files changed

+935
-713
lines changed

console/atest-ui/src/views/net.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,12 @@ function PopularHeaders(callback: (d: any) => void, errHandle?: (e: any) => void
583583
.then(callback).catch(emptyOrDefault(errHandle))
584584
}
585585

586+
const GetStoreKinds = (callback: (d: any) => void | null, errHandle?: (e: any) => void | null) => {
587+
return fetch(`/api/v1/stores/kinds`, {})
588+
.then(DefaultResponseProcess)
589+
.then(callback).catch(emptyOrDefault(errHandle))
590+
}
591+
586592
function CreateOrUpdateStore(payload: any, create: boolean,
587593
callback: (d: any) => void, errHandle?: (e: any) => void | null,
588594
toggle?: (e: boolean) => void) {
@@ -997,7 +1003,7 @@ export const API = {
9971003
CreateTestCase, UpdateTestCase, GetTestCase, ListTestCase, DeleteTestCase, DuplicateTestCase, RenameTestCase, RunTestCase, BatchRunTestCase,
9981004
GetHistoryTestCaseWithResult, DeleteHistoryTestCase, GetHistoryTestCase, GetTestCaseAllHistory, DeleteAllHistoryTestCase, DownloadResponseFile,
9991005
GenerateCode, ListCodeGenerator, HistoryGenerateCode,
1000-
PopularHeaders,
1006+
PopularHeaders, GetStoreKinds,
10011007
CreateOrUpdateStore, GetStores, DeleteStore, VerifyStore,
10021008
FunctionsQuery,
10031009
GetSecrets, DeleteSecret, CreateOrUpdateSecret,

console/atest-ui/src/views/store.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616
import type { Pair } from './types'
17+
import { API } from './net'
1718

1819
export interface Store {
1920
name: string;
@@ -173,7 +174,8 @@ const storeExtensions = [
173174
}
174175
] as Store[]
175176

176-
export function SupportedExtensions() {
177+
export async function SupportedExtensions() {
178+
API.GetStoreKinds()
177179
return storeExtensions
178180
}
179181

pkg/server/remote_server.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,12 +1171,26 @@ func (s *server) GetStoreKinds(context.Context, *Empty) (kinds *StoreKinds, err
11711171
Name: store.Name,
11721172
Enabled: store.Enabled,
11731173
Url: store.URL,
1174+
Link: store.Link,
1175+
Params: convertStoreKindParams(store.Params),
11741176
})
11751177
}
11761178
}
11771179
return
11781180
}
11791181

1182+
func convertStoreKindParams(params []testing.StoreKindParam) (result []*StoreKindParam) {
1183+
for _, param := range params {
1184+
result = append(result, &StoreKindParam{
1185+
Key: param.Key,
1186+
DefaultValue: param.DefaultValue,
1187+
Description: param.Description,
1188+
Enum: param.Enum,
1189+
})
1190+
}
1191+
return
1192+
}
1193+
11801194
func (s *server) GetStores(ctx context.Context, in *Empty) (reply *Stores, err error) {
11811195
user := oauth.GetUserFromContext(ctx)
11821196
storeFactory := testing.NewStoreFactory(s.configDir)

0 commit comments

Comments
 (0)