nsgm-cli 2.0.6 → 2.0.8
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/LICENSE +201 -201
- package/README.md +161 -161
- package/client/layout/index.tsx +248 -245
- package/client/redux/reducers.ts +4 -4
- package/client/redux/store.ts +50 -50
- package/client/redux/template/manage/actions.ts +190 -190
- package/client/redux/template/manage/reducers.ts +118 -118
- package/client/redux/template/manage/types.ts +24 -24
- package/client/service/template/manage.ts +96 -96
- package/client/styled/common.ts +60 -27
- package/client/styled/layout/index.ts +25 -25
- package/client/styled/template/manage.ts +51 -51
- package/client/utils/common.ts +89 -86
- package/client/utils/cookie.ts +51 -51
- package/client/utils/fetch.ts +25 -25
- package/client/utils/menu.tsx +27 -27
- package/client/utils/sso.ts +205 -0
- package/generation/README.md +19 -19
- package/generation/app.js +2 -2
- package/generation/client/redux/reducers.ts +4 -4
- package/generation/client/utils/menu.tsx +27 -27
- package/generation/gitignore +4 -4
- package/generation/mysql.config.js +12 -13
- package/generation/next.config.js +6 -6
- package/generation/package.json +21 -26
- package/generation/project.config.js +13 -12
- package/generation/server/rest.js +23 -20
- package/generation/tsconfig.json +30 -30
- package/index.js +10 -10
- package/lib/args.d.ts +6 -6
- package/lib/args.js +53 -53
- package/lib/generate.d.ts +3 -3
- package/lib/generate.js +751 -736
- package/lib/index.d.ts +2 -2
- package/lib/index.js +272 -272
- package/lib/server/db.d.ts +5 -5
- package/lib/server/db.js +110 -110
- package/lib/server/graphql.d.ts +7 -7
- package/lib/server/graphql.js +119 -119
- package/lib/server/plugins/date.d.ts +5 -5
- package/lib/server/plugins/date.js +16 -16
- package/lib/tsconfig.build.tsbuildinfo +1 -1
- package/mysql.config.js +14 -14
- package/next-env.d.ts +6 -6
- package/next.config.js +2 -2
- package/package.json +126 -126
- package/pages/_app.tsx +54 -44
- package/pages/login.tsx +79 -0
- package/pages/template/manage.tsx +278 -278
- package/project.config.js +16 -14
- package/public/slbhealthcheck.html +9 -9
- package/scripts/shutdown.sh +9 -9
- package/scripts/startup.sh +34 -34
- package/server/apis/sso.js +44 -0
- package/server/apis/template.js +17 -17
- package/server/modules/template/schema.js +33 -33
- package/server/rest.js +24 -20
- package/server/sql/template.sql +8 -8
- package/generation/.DS_Store +0 -0
package/pages/_app.tsx
CHANGED
|
@@ -1,44 +1,54 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react'
|
|
2
|
-
import { Provider } from 'react-redux'
|
|
3
|
-
import { ThemeProvider } from 'styled-components'
|
|
4
|
-
import { useStore } from '../client/redux/store'
|
|
5
|
-
import { GlobalStyle, Loading } from '../client/styled/common'
|
|
6
|
-
import LayoutComponent from '../client/layout'
|
|
7
|
-
import {
|
|
8
|
-
import 'antd
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
1
|
+
import React, { useEffect, useState } from 'react'
|
|
2
|
+
import { Provider } from 'react-redux'
|
|
3
|
+
import { ThemeProvider } from 'styled-components'
|
|
4
|
+
import { useStore } from '../client/redux/store'
|
|
5
|
+
import { GlobalStyle, Loading } from '../client/styled/common'
|
|
6
|
+
import LayoutComponent from '../client/layout'
|
|
7
|
+
import { login } from '../client/utils/sso'
|
|
8
|
+
import { Spin } from 'antd'
|
|
9
|
+
import 'antd/dist/antd.css'
|
|
10
|
+
|
|
11
|
+
const theme = {
|
|
12
|
+
colors: {
|
|
13
|
+
primary: '#0070f3'
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default function App({ Component, pageProps }) {
|
|
18
|
+
const store = useStore(pageProps.initialReduxState)
|
|
19
|
+
const [ssoUser, setSsoUser] = useState(null)
|
|
20
|
+
const [pageLoad, setPageLoad] = useState(false)
|
|
21
|
+
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
login((user: any) => {
|
|
24
|
+
if (user) {
|
|
25
|
+
// console.log('checkLogin_user', user)
|
|
26
|
+
setSsoUser(user)
|
|
27
|
+
}
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
setTimeout(() => {
|
|
31
|
+
setPageLoad(true)
|
|
32
|
+
}, 100)
|
|
33
|
+
}, [])
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<>
|
|
37
|
+
<GlobalStyle whiteColor={true} />
|
|
38
|
+
<ThemeProvider theme={theme}>
|
|
39
|
+
<Provider store={store}>
|
|
40
|
+
{
|
|
41
|
+
pageLoad ?
|
|
42
|
+
ssoUser ? <LayoutComponent user={ssoUser}>
|
|
43
|
+
<Component {...pageProps} />
|
|
44
|
+
</LayoutComponent> :
|
|
45
|
+
<Component {...pageProps} /> :
|
|
46
|
+
<Loading>
|
|
47
|
+
<Spin size="large" />
|
|
48
|
+
</Loading>
|
|
49
|
+
}
|
|
50
|
+
</Provider>
|
|
51
|
+
</ThemeProvider>
|
|
52
|
+
</>
|
|
53
|
+
)
|
|
54
|
+
}
|
package/pages/login.tsx
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import MarkdownIt from 'markdown-it'
|
|
2
|
+
import _ from 'lodash'
|
|
3
|
+
import { LoginContainer } from '../client/styled/common'
|
|
4
|
+
// import getConfig from 'next/config'
|
|
5
|
+
import React, { useState } from 'react'
|
|
6
|
+
import { handleXSS } from '../client/utils/common'
|
|
7
|
+
|
|
8
|
+
const md = new MarkdownIt({
|
|
9
|
+
html: true,
|
|
10
|
+
linkify: true,
|
|
11
|
+
typographer: true
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
// const nextConfig = getConfig()
|
|
15
|
+
// const { publicRuntimeConfig } = nextConfig
|
|
16
|
+
// const { env } = publicRuntimeConfig
|
|
17
|
+
|
|
18
|
+
const renderArr:any = []
|
|
19
|
+
|
|
20
|
+
renderArr.push('Login')
|
|
21
|
+
|
|
22
|
+
const Page = ({ html }) => {
|
|
23
|
+
const [userName, setUserName] = useState("")
|
|
24
|
+
const [userPassword, setUserPassword] = useState("")
|
|
25
|
+
|
|
26
|
+
const createMarkup = () => {
|
|
27
|
+
return {
|
|
28
|
+
__html: html
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const doLogin = ()=>{
|
|
33
|
+
if(typeof window !== "undefined"){
|
|
34
|
+
let locationHref = window.location.origin + "?ticket=XXX"
|
|
35
|
+
if(userName !== ''){
|
|
36
|
+
locationHref += "&name=" + btoa(handleXSS(userName + "," + userPassword))
|
|
37
|
+
window.location.href = locationHref
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const doChangeName = (e)=>{
|
|
43
|
+
setUserName(_.trim(e.target.value))
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const doChangePassword = (e)=>{
|
|
47
|
+
setUserPassword(_.trim(e.target.value))
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<LoginContainer>
|
|
52
|
+
<div dangerouslySetInnerHTML={createMarkup()} />
|
|
53
|
+
<input type="text" style={{ opacity:0, position:"absolute", width:0, height:0 }}></input>
|
|
54
|
+
<input type="password" style={{ opacity:0, position:"absolute", width:0, height:0 }}></input>
|
|
55
|
+
<div className='row'>
|
|
56
|
+
<input type="text" name="user-name" className='user-input' autoComplete='off' onChange={doChangeName} value={userName}></input>
|
|
57
|
+
</div>
|
|
58
|
+
<div className='row'>
|
|
59
|
+
<input type="password" name="user-password" className='user-input' autoComplete='off' onChange={doChangePassword} value={userPassword}></input>
|
|
60
|
+
</div>
|
|
61
|
+
<div className='row right'>
|
|
62
|
+
<button onClick={doLogin}>login</button>
|
|
63
|
+
</div>
|
|
64
|
+
</LoginContainer>
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
Page.getInitialProps = () => {
|
|
69
|
+
let html = ''
|
|
70
|
+
_.each(renderArr, (item, index) => {
|
|
71
|
+
html += md.render(item)
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
return {
|
|
75
|
+
html
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export default Page
|