Skip to content

Commit

Permalink
feat: sync from RAP2@alibaba-internal to RAP2@CE
Browse files Browse the repository at this point in the history
  • Loading branch information
Bosn committed Jul 20, 2020
1 parent aa77224 commit 9ad7cff
Show file tree
Hide file tree
Showing 85 changed files with 1,930 additions and 749 deletions.
59 changes: 32 additions & 27 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"description": "",
"main": "app.js",
"scripts": {
"dev": "npm run start",
"build-css": "node ./node_modules/sass/sass src/:src/ --quiet",
"watch-css": "npm run build-css && node ./node_modules/sass/sass src/:src/ --watch",
"start-js": "react-scripts start",
Expand All @@ -13,41 +12,45 @@
"test-backup": "npm run lint && react-scripts test --env=jsdom",
"test": "npm run lint",
"eject": "react-scripts eject",
"lint": "tslint --project ./ -c tslint.json --fix",
"build-docker": "docker build --rm -f \"Dockerfile\" -t rapteam/rap2-dolores:latest ."
"dev": "npm run start",
"lint": "tslint --project ./ -c tslint.json --fix"
},
"repository": {
"type": "git",
"url": "[email protected]:thx/rap2-dolores.git"
},
"engines": {
"install-alinode": "v5.15.0"
},
"author": "[email protected]",
"license": "ISC",
"dependencies": {
"@material-ui/core": "^4.4.3",
"@material-ui/icons": "^4.4.3",
"@material-ui/pickers": "^3.2.6",
"@material-ui/styles": "^4.4.3",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
"@material-ui/pickers": "^3.2.10",
"@material-ui/styles": "^4.10.0",
"@types/json5": "^0.0.30",
"@welldone-software/why-did-you-render": "^4.0.3",
"@welldone-software/why-did-you-render": "^4.2.5",
"animate.css": "3.7.2",
"awesome-debounce-promise": "^2.1.0",
"chart.js": "^2.8.0",
"chart.js": "^2.9.3",
"classnames": "^2.2.6",
"clipboard-copy": "^3.1.0",
"codemirror": "5.49.0",
"connected-react-router": "^6.5.2",
"debounce-promise": "^3.1.2",
"formik": "^1.5.8",
"formik-material-ui": "^0.0.22",
"formik": "^2.1.4",
"formik-material-ui": "^2.0.1",
"graceful": "1.0.2",
"history": "^4.10.1",
"jquery": "^3.4.1",
"json5": "^2.1.0",
"json5": "^2.1.3",
"koa": "2.8.1",
"koa-router": "7.4.0",
"koa-session": "5.12.3",
"koa-static": "5.0.0",
"lodash": "4.17.15",
"markdown-to-jsx": "^6.11.4",
"mockjs": "1.1.0",
"moment": "2.24.0",
"node-fetch": "2.6.0",
Expand All @@ -58,19 +61,21 @@
"popper.js": "^1.15.0",
"prop-types": "15.7.2",
"rc-tooltip": "^3.7.3",
"react": "^16.9.0",
"react-custom-scroll": "^4.2.0",
"react-dom": "^16.9.0",
"react": "^16.13.1",
"react-custom-scroll": "^4.2.1",
"react-dom": "^16.13.1",
"react-hotkeys": "^2.0.0",
"react-icons": "3.7.0",
"react-joyride": "^2.2.0",
"react-modal": "3.10.1",
"react-redux": "^7.1.1",
"react-router": "5.1.0",
"react-router-config": "5.1.0",
"react-router-dom": "5.1.0",
"react-select": "^3.0.5",
"redux": "4.0.4",
"redux-saga": "1.1.1",
"react-redux": "^7.2.0",
"react-router": "5.2.0",
"react-router-config": "5.1.1",
"react-router-dom": "5.2.0",
"react-select": "^3.1.0",
"redux": "4.0.5",
"redux-api-middleware": "^3.2.1",
"redux-saga": "1.1.3",
"reselect": "^4.0.0",
"sortablejs": "1.10.0",
"urijs": "1.19.1",
Expand All @@ -86,7 +91,7 @@
]
},
"devDependencies": {
"@types/chart.js": "^2.8.5",
"@types/chart.js": "^2.9.22",
"@types/classnames": "^2.2.9",
"@types/codemirror": "^0.0.77",
"@types/history": "^4.7.3",
Expand All @@ -112,10 +117,10 @@
"pre-commit": "^1.2.2",
"react-scripts": "^3.1.2",
"standard": "14.3.1",
"tslint": "^5.20.0",
"tslint-react": "^4.1.0",
"tslint-react-hooks": "^2.2.1",
"typescript": "^3.8.3"
"tslint": "^6.1.2",
"tslint-react": "^5.0.0",
"tslint-react-hooks": "^2.2.2",
"typescript": "^3.9.6"
},
"pre-commit": [
"lint"
Expand Down
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>RAP2</title>
<title>RAP接口管理平台</title>
</head>
<body>
<div id="root"></div>
Expand Down
92 changes: 92 additions & 0 deletions src/actions/account.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
import { THEME_TEMPLATE_KEY } from 'components/account/ThemeChangeOverlay'
import { CACHE_KEY } from 'utils/consts'
import { mergeRSAABase } from './rootAction'
import { RSAA } from 'redux-api-middleware'
import { serve } from 'relatives/services/constant'

// 登陆
export const login = (user: any, onResolved: any) => ({ type: 'USER_LOGIN', user, onResolved })
export const loginSucceeded = (user: any) => ({ type: 'USER_LOGIN_SUCCEEDED', user })
Expand Down Expand Up @@ -67,3 +73,89 @@ export const findpwdFailed = (message: any) => ({ type: 'USER_FINDPWD_FAILED', m
export const resetpwd = (user: any, onResolved: any) => ({ type: 'USER_RESETPWD', user, onResolved })
export const resetpwdSucceeded = () => ({ type: 'USER_RESETPWD_SUCCEEDED' })
export const resetpwdFailed = (message: any) => ({ type: 'USER_RESETPWD_FAILED', message })
export type CHANGE_THEME = 'CHANGE_THEME'
export const CHANGE_THEME: CHANGE_THEME = 'CHANGE_THEME'

export const changeTheme = (themeId: THEME_TEMPLATE_KEY) => ({
type: CHANGE_THEME,
payload: themeId,
})

export type UPDATE_USER_SETTING_REQUEST = 'UPDATE_USER_SETTING_REQUEST'
export const UPDATE_USER_SETTING_REQUEST: UPDATE_USER_SETTING_REQUEST = 'UPDATE_USER_SETTING_REQUEST'

export type UPDATE_USER_SETTING_SUCCESS = 'UPDATE_USER_SETTING_SUCCESS'
export const UPDATE_USER_SETTING_SUCCESS: UPDATE_USER_SETTING_SUCCESS = 'UPDATE_USER_SETTING_SUCCESS'

export type UPDATE_USER_SETTING_FAILURE = 'UPDATE_USER_SETTING_FAILURE'
export const UPDATE_USER_SETTING_FAILURE: UPDATE_USER_SETTING_FAILURE = 'UPDATE_USER_SETTING_FAILURE'

export function updateUserSetting(key: CACHE_KEY, value: string) {
return {
[RSAA]: mergeRSAABase({
endpoint: `${serve}/account/updateUserSetting/${key}`,
method: 'POST',
body: JSON.stringify(value ? { value } : {}),
types: [UPDATE_USER_SETTING_REQUEST, UPDATE_USER_SETTING_SUCCESS, UPDATE_USER_SETTING_SUCCESS],
}),
}
}

export type DO_UPDATE_USER_SETTING = 'DO_UPDATE_USER_SETTING'
export const DO_UPDATE_USER_SETTING = 'DO_UPDATE_USER_SETTING'

export const doUpdateUserSetting = (key: CACHE_KEY, value: string, cb: TCB) => ({
type: DO_UPDATE_USER_SETTING,
payload: {
cb,
key,
value,
},
})

export interface DoUpdateUserSettingAction {
type: DO_UPDATE_USER_SETTING
payload: {
cb: TCB
key: CACHE_KEY
value: string
}
}

export type FETCH_USER_SETTINGS_REQUEST = 'FETCH_USER_SETTINGS_REQUEST'
export const FETCH_USER_SETTINGS_REQUEST: FETCH_USER_SETTINGS_REQUEST = 'FETCH_USER_SETTINGS_REQUEST'

export type FETCH_USER_SETTINGS_SUCCESS = 'FETCH_USER_SETTINGS_SUCCESS'
export const FETCH_USER_SETTINGS_SUCCESS: FETCH_USER_SETTINGS_SUCCESS = 'FETCH_USER_SETTINGS_SUCCESS'

export type FETCH_USER_SETTINGS_FAILURE = 'FETCH_USER_SETTINGS_FAILURE'
export const FETCH_USER_SETTINGS_FAILURE: FETCH_USER_SETTINGS_FAILURE = 'FETCH_USER_SETTINGS_FAILURE'

export function fetchUserSettings(keys: CACHE_KEY[]) {
return {
[RSAA]: mergeRSAABase({
endpoint: `${serve}/account/fetchUserSettings`,
method: 'POST',
body: JSON.stringify({ keys }),
types: [FETCH_USER_SETTINGS_REQUEST, FETCH_USER_SETTINGS_SUCCESS, FETCH_USER_SETTINGS_SUCCESS],
}),
}
}

export type DO_FETCH_USER_SETTINGS = 'DO_FETCH_USER_SETTINGS'
export const DO_FETCH_USER_SETTINGS: DO_FETCH_USER_SETTINGS = 'DO_FETCH_USER_SETTINGS'

export function doFetchUserSettings(keys: CACHE_KEY[], cb?: (isOk: boolean, payload?: any) => void): DoFetchUserSettingsAction {
return {
type: DO_FETCH_USER_SETTINGS,
payload: { keys, cb },
}
}

export interface DoFetchUserSettingsAction {
type: DO_FETCH_USER_SETTINGS
payload: {
keys: CACHE_KEY[]
cb?: (isOk: boolean, payload?: any) => void
}
}
19 changes: 19 additions & 0 deletions src/actions/rootAction.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { ApiError, IRSAA } from 'redux-api-middleware'

export interface CommonFetchFailureAction {
payload: ApiError
error: true
}

const RSAA_BASE: Partial<IRSAA> = {
credentials: 'include',
method: 'GET',
headers: { 'Content-Type': 'application/json' },
}

export const mergeRSAABase = (options: Partial<IRSAA>) => {
return {
...RSAA_BASE,
...options,
} as IRSAA
}
10 changes: 10 additions & 0 deletions src/actions/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { RouterState } from 'connected-react-router'
import { THEME_TEMPLATE_KEY } from 'components/account/ThemeChangeOverlay'

export interface RootState {
auth: any
Expand All @@ -17,6 +18,11 @@ export interface RootState {
logs: any
loading: boolean
message: IMessage

userSettings: { [key: string]: string }
userSettingsIsUpdating: boolean

themeId: THEME_TEMPLATE_KEY
}

export interface Organization {
Expand Down Expand Up @@ -103,7 +109,11 @@ export interface RepositoryFormData {

collaboratorIdstring?: string

canUserEdit?: boolean

token?: string

modules?: Module[]
}

export interface Repository {
Expand Down
20 changes: 10 additions & 10 deletions src/assets/components.sass
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ input[type="checkbox"]
.btn
line-height: 1.5
.rapfont
line-height: 1rem
line-height: 0.65rem
margin-right: .5rem
a.btn.btn-success
color: white
Expand All @@ -82,10 +82,10 @@ a.btn.btn-success
// &:hover
// background-color: $brand-hover
// &.btn-rapfont
// padding-right: 2rem
// padding-right: 1.3rem
// .rapfont
// font-size: 1rem
// margin-right: 0.5rem
// font-size: 0.65rem
// margin-right: 0.325rem
// ----------------------------------------
// 表格 Table
Expand Down Expand Up @@ -114,7 +114,7 @@ table.table
// ----------------------------------------
// .panel
// margin-bottom: 1rem
// margin-bottom: 0.65rem
// border: 1px solid $border
// border-radius: 0.3rem
// > .panel-header,
Expand All @@ -137,7 +137,7 @@ table.table
left: 50%
top: 50%
width: 20rem
height: 4rem
height: 2.6rem
margin-left: -10rem
margin-top: -2rem
.Spin
Expand Down Expand Up @@ -179,7 +179,7 @@ button:focus
display: none
float: left
min-width: 10rem
padding: 0.5rem 0
padding: 0.325rem 0
margin: 0.125rem 0 0
font-size: 1rem
color: #212529
Expand Down Expand Up @@ -305,7 +305,7 @@ button:focus

.dropdown-divider
height: 0
margin: 0.5rem 0
margin: 0.325rem 0
overflow: hidden
border-top: 1px solid #e9ecef

Expand Down Expand Up @@ -338,9 +338,9 @@ button:focus

.dropdown-header
display: block
padding: 0.5rem 1.5rem
padding: 0.325rem 1.5rem
margin-bottom: 0
font-size: 0.875rem
font-size: 1rem
color: #6c757d
white-space: nowrap

Expand Down
Loading

0 comments on commit 9ad7cff

Please sign in to comment.