Skip to content

Commit 2f871a5

Browse files
authored
Merge pull request #906 from lowcoder-org/feature-swagger-display
Feature swagger display
2 parents 05d0743 + ae41218 commit 2f871a5

File tree

7 files changed

+2247
-64
lines changed

7 files changed

+2247
-64
lines changed

client/packages/lowcoder/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"@rjsf/core": "^5.15.1",
3030
"@rjsf/utils": "^5.15.1",
3131
"@rjsf/validator-ajv8": "^5.15.1",
32+
"@stoplight/elements": "^8.1.3",
3233
"@types/lodash": "^4.14.194",
3334
"@types/node": "^16.7.13",
3435
"@types/react": "^18.2.45",
@@ -128,6 +129,7 @@
128129
"vite-plugin-checker": "^0.5.1",
129130
"vite-plugin-dynamic-import": "^1.5.0",
130131
"vite-plugin-html": "^3.2.0",
132+
"vite-plugin-node-polyfills": "^0.22.0",
131133
"vite-plugin-svgr": "^2.2.2",
132134
"vite-tsconfig-paths": "^3.6.0"
133135
}

client/packages/lowcoder/src/app.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import {
2828
ORG_AUTH_FORGOT_PASSWORD_URL,
2929
ORG_AUTH_RESET_PASSWORD_URL,
3030
} from "constants/routesURL";
31-
3231
import React from "react";
3332
import { createRoot } from "react-dom/client";
3433
import { Helmet } from "react-helmet";
@@ -222,7 +221,6 @@ class AppIndex extends React.Component<AppIndexProps, any> {
222221
<LazyRoute path={`${COMPONENT_DOC_URL}/:name`} component={LazyComponentDoc} />
223222
<LazyRoute path={`/playground/:name/:dsl`} component={LazyComponentPlayground} />
224223
<Redirect to={`${COMPONENT_DOC_URL}/input`} path="/components" />
225-
226224
{developEnv() && (
227225
<>
228226
<LazyRoute path="/debug_comp/:name" component={LazyDebugComp} />

client/packages/lowcoder/src/i18n/locales/en.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2199,6 +2199,7 @@ export const en = {
21992199
"theme": "Themes",
22002200
"plugin": "Plugins",
22012201
"advanced": "Advanced",
2202+
"apiDocs": "API Docs",
22022203
"lab": "Lab",
22032204
"branding": "Branding",
22042205
"oauthProviders": "User Authentication",
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import '@stoplight/elements/styles.min.css';
2+
3+
import { API } from '@stoplight/elements';
4+
import React from 'react';
5+
6+
const ApiDocs: React.FC = () => {
7+
return (
8+
<API
9+
basePath="lowcoder-api"
10+
apiDescriptionUrl="https://api-service.lowcoder.cloud/api/docs/api-docs"
11+
/>
12+
);
13+
};
14+
15+
export default ApiDocs;

client/packages/lowcoder/src/pages/setting/settingHome.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import { selectSystemConfig } from "redux/selectors/configSelectors";
2626
import { enableCustomBrand } from "util/featureFlagUtils";
2727
import FreeLimitTag from "pages/common/freeLimitTag";
2828
import { Helmet } from "react-helmet";
29+
import ApiDocs from "./apiDocs";
2930

3031
enum SettingPageEnum {
3132
UserGroups = "permission",
@@ -34,6 +35,7 @@ enum SettingPageEnum {
3435
Theme = "theme",
3536
Branding = "branding",
3637
Advanced = "advanced",
38+
ApiDocs = "apiDocs",
3739
OAuthProvider = "oauth-provider",
3840
AppUsage = "app-usage",
3941
Environments = "environments",
@@ -71,6 +73,11 @@ export function SettingHome() {
7173
label: trans("settings.advanced"),
7274
icon: <LeftSettingIcon width={"20px"}/>,
7375
},
76+
{
77+
key: SettingPageEnum.ApiDocs,
78+
label: trans("settings.apiDocs"),
79+
icon: <LeftSettingIcon width={"20px"}/>,
80+
},
7481

7582
// Premium features
7683

@@ -148,6 +155,7 @@ export function SettingHome() {
148155
{selectKey === SettingPageEnum.Audit && <AuditSetting />}
149156
{selectKey === SettingPageEnum.Branding && <BrandingSetting />}
150157
{selectKey === SettingPageEnum.Advanced && <AdvancedSetting />}
158+
{selectKey === SettingPageEnum.ApiDocs && <ApiDocs />}
151159
</TwoColumnSettingPageContent>
152160
</>
153161
);

client/packages/lowcoder/vite.config.mts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import dynamicImport from 'vite-plugin-dynamic-import';
1212
import { ensureLastSlash } from "./src/dev-utils/util";
1313
import { buildVars } from "./src/dev-utils/buildVars";
1414
import { globalDepPlugin } from "./src/dev-utils/globalDepPlguin";
15+
import { nodePolyfills } from 'vite-plugin-node-polyfills'
1516

1617
dotenv.config();
1718

@@ -157,6 +158,7 @@ export const viteConfig: UserConfig = {
157158
}),
158159
isVisualizerEnabled && visualizer(),
159160
dynamicImport(),
161+
nodePolyfills({ include: ['process'] }),
160162
].filter(Boolean),
161163
};
162164

0 commit comments

Comments
 (0)