gomtm 0.0.272 → 0.0.274
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/components/MtUnaryCallErrorView.js +1 -1
- package/dist/esm/components/MtmErrorView.d.ts +7 -0
- package/dist/esm/components/MtmErrorView.js +16 -0
- package/dist/esm/curd/ListViewProvider.js +5 -5
- package/dist/esm/mtmFetcher.js +4 -5
- package/dist/tsconfig.type.tsbuildinfo +1 -1
- package/package.json +3 -3
|
@@ -5,7 +5,7 @@ const MtUnaryCallErrorView = (props) => {
|
|
|
5
5
|
return /* @__PURE__ */ jsxs("div", { className: "bg-red-400 p-4", children: [
|
|
6
6
|
"code: ",
|
|
7
7
|
unaryError.errCode,
|
|
8
|
-
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("pre", { className: "prose dark:prose-invert break-words", children: unaryError.errMessage }) }),
|
|
8
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("pre", { className: "prose dark:prose-invert flex-wrap text-wrap break-words", children: unaryError.errMessage }) }),
|
|
9
9
|
retry && /* @__PURE__ */ jsx("button", { onClick: () => {
|
|
10
10
|
retry();
|
|
11
11
|
}, children: "retry" })
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { PlainMessage } from "@bufbuild/protobuf";
|
|
3
|
+
import { MtmError } from "../gomtmpb/mtm/sppb/mtm_pb";
|
|
4
|
+
export declare const MtmErrorView: (props: {
|
|
5
|
+
unaryError: PlainMessage<MtmError>;
|
|
6
|
+
retry?: () => void;
|
|
7
|
+
}) => import("react").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
const MtmErrorView = (props) => {
|
|
4
|
+
const { unaryError, retry } = props;
|
|
5
|
+
return /* @__PURE__ */ jsxs("div", { className: "bg-red-400 p-4", children: [
|
|
6
|
+
"code: ",
|
|
7
|
+
unaryError.errCode,
|
|
8
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("pre", { className: "prose dark:prose-invert max-w-96 flex-wrap text-wrap break-words", children: unaryError.errMessage }) }),
|
|
9
|
+
retry && /* @__PURE__ */ jsx("button", { onClick: () => {
|
|
10
|
+
retry();
|
|
11
|
+
}, children: "retry" })
|
|
12
|
+
] });
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
MtmErrorView
|
|
16
|
+
};
|
|
@@ -47,7 +47,7 @@ import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel
|
|
|
47
47
|
import { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious } from "mtxuilib/ui/pagination";
|
|
48
48
|
import { MtButton } from "mtxuilib/ui/ui-mt/Button";
|
|
49
49
|
import { Suspense, createContext, useCallback, useContext, useMemo, useState } from "react";
|
|
50
|
-
import {
|
|
50
|
+
import { MtmErrorView } from "../components/MtmErrorView";
|
|
51
51
|
import { useMutation, useSuspenseInfiniteQuery } from "../connectquery";
|
|
52
52
|
import { useMtmApp } from "../providers/GomtmProvider";
|
|
53
53
|
import { DlgCurdDebugInfo, DlgCurdDebugInfoTriggerButton } from "./CurdDetailProvider";
|
|
@@ -91,7 +91,7 @@ function ListViewProvider(props) {
|
|
|
91
91
|
setOpenDebug,
|
|
92
92
|
params,
|
|
93
93
|
setParams
|
|
94
|
-
}, children
|
|
94
|
+
}, children });
|
|
95
95
|
}
|
|
96
96
|
function useListView() {
|
|
97
97
|
const ctx = useContext(commonListViewContext);
|
|
@@ -103,7 +103,7 @@ function CommonListView() {
|
|
|
103
103
|
const listQuery = useSuspenseInfiniteQuery(listView.methodList, {
|
|
104
104
|
params: {
|
|
105
105
|
params: {
|
|
106
|
-
q: listView.params.q
|
|
106
|
+
q: listView.params.q || ""
|
|
107
107
|
}
|
|
108
108
|
},
|
|
109
109
|
pagination: {
|
|
@@ -131,8 +131,8 @@ function CommonListView() {
|
|
|
131
131
|
),
|
|
132
132
|
children: listQuery.data.pages.map((page, i) => {
|
|
133
133
|
var _a;
|
|
134
|
-
if (page.
|
|
135
|
-
return /* @__PURE__ */ jsx(
|
|
134
|
+
if (page.errCode) {
|
|
135
|
+
return /* @__PURE__ */ jsx(MtmErrorView, { unaryError: page }, i);
|
|
136
136
|
} else {
|
|
137
137
|
return /* @__PURE__ */ jsx(ListLayout, { layout: page.listLayout, children: (_a = page == null ? void 0 : page.items) == null ? void 0 : _a.map((item, j) => /* @__PURE__ */ jsx(ListItemView, { item }, `${i}-${j}`)) }, i);
|
|
138
138
|
}
|
package/dist/esm/mtmFetcher.js
CHANGED
|
@@ -61,16 +61,14 @@ const gomtmApiUrl = () => {
|
|
|
61
61
|
function createMtmServiceClient(service, url) {
|
|
62
62
|
return createPromiseClient(
|
|
63
63
|
service,
|
|
64
|
-
|
|
65
|
-
baseUrl: gomtmApiUrl(),
|
|
66
|
-
fetch: gomtmFetcher()
|
|
67
|
-
})
|
|
64
|
+
createTransport()
|
|
68
65
|
);
|
|
69
66
|
}
|
|
70
67
|
function createTransport() {
|
|
71
68
|
return createConnectTransport({
|
|
72
69
|
baseUrl: gomtmApiUrl(),
|
|
73
|
-
fetch: gomtmFetcher()
|
|
70
|
+
fetch: gomtmFetcher(),
|
|
71
|
+
useHttpGet: true
|
|
74
72
|
});
|
|
75
73
|
}
|
|
76
74
|
function createMtmServiceClientByName(svcName, url) {
|
|
@@ -121,6 +119,7 @@ const gomtmFetcher = (initGlobal) => {
|
|
|
121
119
|
init
|
|
122
120
|
});
|
|
123
121
|
const responseData = yield fetcher(input, init);
|
|
122
|
+
console.log("[mtmfetch response]", responseData);
|
|
124
123
|
return responseData;
|
|
125
124
|
} catch (e) {
|
|
126
125
|
console.error("[mtmfetch error]", {
|