@dobot-plus/template 1.2.8 → 1.2.9
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/.dobot/protocol/postMessageHandler.ts +3 -3
- package/.dobot/protocol/websocketHandler.ts +3 -3
- package/.dobot/store/actions/userManagementActions.ts +25 -0
- package/.dobot/store/reducers/index.ts +2 -2
- package/.dobot/store/reducers/userManagementReducer.ts +35 -0
- package/.dobot/store/types.ts +8 -11
- package/package.json +1 -1
- package/.dobot/store/actions/userMagamentActions.ts +0 -25
- package/.dobot/store/reducers/userMagamentReducer.ts +0 -38
|
@@ -4,7 +4,7 @@ import store from '../store'
|
|
|
4
4
|
import { toolActions } from '../store/actions/toolActions'
|
|
5
5
|
import { communicator } from './postMessageCenter'
|
|
6
6
|
import PubSub from 'pubsub-js'
|
|
7
|
-
import {
|
|
7
|
+
import { userManagementActions } from '../store/actions/userManagementActions'
|
|
8
8
|
import { jsonSafeParse } from '@dobot/utils/tool'
|
|
9
9
|
|
|
10
10
|
export class PostMessageHandler {
|
|
@@ -143,12 +143,12 @@ export class PostMessageHandler {
|
|
|
143
143
|
syncUserPermissionHandler = (event: MessageEvent) => {
|
|
144
144
|
communicator.registerSource(JSON.parse(event.data).from || event.data.iframeName, event.source, event.origin)
|
|
145
145
|
const level = JSON.parse(event.data).data
|
|
146
|
-
store.dispatch(
|
|
146
|
+
store.dispatch(userManagementActions.setCurrentLevel(level))
|
|
147
147
|
}
|
|
148
148
|
syncCreditCardInfoHandler = (event: MessageEvent) => {
|
|
149
149
|
communicator.registerSource(JSON.parse(event.data).from || event.data.iframeName, event.source, event.origin)
|
|
150
150
|
const userInfo = JSON.parse(event.data).data
|
|
151
|
-
store.dispatch(
|
|
151
|
+
store.dispatch(userManagementActions.setCurrentUserInfo(userInfo))
|
|
152
152
|
}
|
|
153
153
|
dobotPlusLogout = () => {
|
|
154
154
|
communicator.send({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import i18n from '../utils/i18n'
|
|
2
2
|
import store from '../store'
|
|
3
3
|
import { toolActions } from '../store/actions/toolActions'
|
|
4
|
-
import {
|
|
4
|
+
import { userManagementActions } from '../store/actions/userManagementActions'
|
|
5
5
|
import { communicator } from './postMessageCenter'
|
|
6
6
|
|
|
7
7
|
const url = `ws://localhost:8099`
|
|
@@ -166,12 +166,12 @@ export class WebSocketHandler {
|
|
|
166
166
|
console.log('websocket syncUserPermissionHandler', event)
|
|
167
167
|
communicator.registerSource(event.data.from || event.data.iframeName, event.source, event.origin)
|
|
168
168
|
const level = JSON.parse(event.data)
|
|
169
|
-
store.dispatch(
|
|
169
|
+
store.dispatch(userManagementActions.setCurrentLevel(level))
|
|
170
170
|
}
|
|
171
171
|
syncCreditCardInfoHandler = (event: MessageEvent) => {
|
|
172
172
|
console.log('websocket syncCreditCardInfoHandler', event)
|
|
173
173
|
communicator.registerSource(event.data.from || event.data.iframeName, event.source, event.origin)
|
|
174
|
-
store.dispatch(
|
|
174
|
+
store.dispatch(userManagementActions.setCurrentUserInfo(String(event.data)))
|
|
175
175
|
}
|
|
176
176
|
dobotPlusLogout = () => {
|
|
177
177
|
this.send({
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export const userManagementActionsType = {
|
|
2
|
+
SETUSERMODALDATA: 'setUserModalData',
|
|
3
|
+
SET_PERMISSIONLIST: 'setPermissionList',
|
|
4
|
+
SET_CURRENT_LEVEL: 'setCurrentLevel',
|
|
5
|
+
SET_CURRENT_USER_INFO: 'setCurrentUserInfo'
|
|
6
|
+
}
|
|
7
|
+
class UserManagementActions {
|
|
8
|
+
setUserModalData = (params: any) => ({
|
|
9
|
+
type: userManagementActionsType.SETUSERMODALDATA,
|
|
10
|
+
params
|
|
11
|
+
})
|
|
12
|
+
setPermissionList = (params: any) => ({
|
|
13
|
+
type: userManagementActionsType.SET_PERMISSIONLIST,
|
|
14
|
+
params
|
|
15
|
+
})
|
|
16
|
+
setCurrentLevel = (params: any) => ({
|
|
17
|
+
type: userManagementActionsType.SET_CURRENT_LEVEL,
|
|
18
|
+
params
|
|
19
|
+
})
|
|
20
|
+
setCurrentUserInfo = (params: any) => ({
|
|
21
|
+
type: userManagementActionsType.SET_CURRENT_USER_INFO,
|
|
22
|
+
params
|
|
23
|
+
})
|
|
24
|
+
}
|
|
25
|
+
export const userManagementActions = new UserManagementActions()
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { combineReducers } from 'redux'
|
|
2
2
|
import toolReducer from './toolReducer'
|
|
3
|
-
import
|
|
3
|
+
import userManagementReducer from './userManagementReducer'
|
|
4
4
|
|
|
5
5
|
export default combineReducers({
|
|
6
6
|
toolReducer,
|
|
7
|
-
|
|
7
|
+
userManagementReducer
|
|
8
8
|
})
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { userManagementActionsType } from '../actions/userManagementActions'
|
|
2
|
+
import { UserManagementState } from '@dobot/store/types'
|
|
3
|
+
|
|
4
|
+
const initialStore: UserManagementState = {
|
|
5
|
+
userModalData: {
|
|
6
|
+
show: false
|
|
7
|
+
},
|
|
8
|
+
permissionList: [
|
|
9
|
+
[1, 'TR_LEVEL_1'],
|
|
10
|
+
[2, 'TR_LEVEL_2'],
|
|
11
|
+
[3, 'TR_LEVEL_3']
|
|
12
|
+
],
|
|
13
|
+
currentLevel: 0,
|
|
14
|
+
currentUserInfo: ''
|
|
15
|
+
}
|
|
16
|
+
const userManagementReducer = (state = initialStore, action: { type: string; params: any }) => {
|
|
17
|
+
switch (action.type) {
|
|
18
|
+
case userManagementActionsType.SETUSERMODALDATA: {
|
|
19
|
+
return Object.assign({}, state, { userModalData: action.params })
|
|
20
|
+
}
|
|
21
|
+
case userManagementActionsType.SET_PERMISSIONLIST: {
|
|
22
|
+
return Object.assign({}, state, { permissionList: action.params })
|
|
23
|
+
}
|
|
24
|
+
case userManagementActionsType.SET_CURRENT_LEVEL: {
|
|
25
|
+
return Object.assign({}, state, { currentLevel: action.params })
|
|
26
|
+
}
|
|
27
|
+
case userManagementActionsType.SET_CURRENT_USER_INFO: {
|
|
28
|
+
return Object.assign({}, state, { currentUserInfo: action.params })
|
|
29
|
+
}
|
|
30
|
+
default:
|
|
31
|
+
return state
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default userManagementReducer
|
package/.dobot/store/types.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
1
|
export interface IStoreState {
|
|
4
2
|
toolReducer: ToolState
|
|
5
|
-
|
|
3
|
+
userManagementReducer: UserManagementState
|
|
6
4
|
}
|
|
7
5
|
|
|
8
6
|
export interface ICapacityData {
|
|
@@ -117,7 +115,7 @@ export interface ToolState {
|
|
|
117
115
|
}[]
|
|
118
116
|
}
|
|
119
117
|
pointData: any[]
|
|
120
|
-
jogInPaused:boolean
|
|
118
|
+
jogInPaused: boolean
|
|
121
119
|
}
|
|
122
120
|
|
|
123
121
|
export type DeviceState = {
|
|
@@ -201,7 +199,7 @@ export type DeviceState = {
|
|
|
201
199
|
|
|
202
200
|
export enum RemoteModeType {
|
|
203
201
|
Online = 'tp',
|
|
204
|
-
TCP = 'tcp'
|
|
202
|
+
TCP = 'tcp'
|
|
205
203
|
}
|
|
206
204
|
export type remoteControlType = {
|
|
207
205
|
mode: RemoteModeType
|
|
@@ -210,18 +208,18 @@ export type remoteControlType = {
|
|
|
210
208
|
export enum PrjStateType {
|
|
211
209
|
stopped = 'stopped',
|
|
212
210
|
suspended = 'suspended',
|
|
213
|
-
running = 'running'
|
|
211
|
+
running = 'running'
|
|
214
212
|
}
|
|
215
213
|
export enum JogMode {
|
|
216
214
|
Jog = 'jog',
|
|
217
|
-
Step = 'step'
|
|
215
|
+
Step = 'step'
|
|
218
216
|
}
|
|
219
217
|
export enum CoordinateType {
|
|
220
218
|
Cartesian = 'cartesian',
|
|
221
219
|
Joint = 'joint',
|
|
222
|
-
Tool = 'tool'
|
|
220
|
+
Tool = 'tool'
|
|
223
221
|
}
|
|
224
|
-
export interface
|
|
222
|
+
export interface UserManagementState {
|
|
225
223
|
userModalData: {
|
|
226
224
|
show: boolean
|
|
227
225
|
edit?: boolean
|
|
@@ -235,6 +233,5 @@ export interface userMagamentState {
|
|
|
235
233
|
|
|
236
234
|
export enum ModuleType {
|
|
237
235
|
Module = 'Module',
|
|
238
|
-
Template = 'Template'
|
|
236
|
+
Template = 'Template'
|
|
239
237
|
}
|
|
240
|
-
|
package/package.json
CHANGED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export const userMagamentActionsType = {
|
|
2
|
-
SETUSERMODALDATA: 'setUserModalData',
|
|
3
|
-
SET_PERMISSIONLIST: 'setPermissionList',
|
|
4
|
-
SET_CURRENT_LEVEL: 'setCurrentLevel',
|
|
5
|
-
SET_CURRENT_USER_INFO: 'setCurrentUserInfo'
|
|
6
|
-
}
|
|
7
|
-
class UserMagamentActions {
|
|
8
|
-
setUserModalData = (params: any) => ({
|
|
9
|
-
type: userMagamentActionsType.SETUSERMODALDATA,
|
|
10
|
-
params,
|
|
11
|
-
})
|
|
12
|
-
setPermissionList = (params: any) => ({
|
|
13
|
-
type: userMagamentActionsType.SET_PERMISSIONLIST,
|
|
14
|
-
params,
|
|
15
|
-
})
|
|
16
|
-
setCurrentLevel = (params: any) => ({
|
|
17
|
-
type: userMagamentActionsType.SET_CURRENT_LEVEL,
|
|
18
|
-
params,
|
|
19
|
-
})
|
|
20
|
-
setCurrentUserInfo = (params: any) => ({
|
|
21
|
-
type: userMagamentActionsType.SET_CURRENT_USER_INFO,
|
|
22
|
-
params,
|
|
23
|
-
})
|
|
24
|
-
}
|
|
25
|
-
export const userMagamentActions = new UserMagamentActions()
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { userMagamentActionsType } from '../actions/userMagamentActions'
|
|
2
|
-
import { userMagamentState } from '@dobot/store/types'
|
|
3
|
-
|
|
4
|
-
const initialStore: userMagamentState = {
|
|
5
|
-
userModalData: {
|
|
6
|
-
show: false,
|
|
7
|
-
},
|
|
8
|
-
permissionList: [
|
|
9
|
-
[1, 'TR_LEVEL_1'],
|
|
10
|
-
[2, 'TR_LEVEL_2'],
|
|
11
|
-
[3, 'TR_LEVEL_3'],
|
|
12
|
-
],
|
|
13
|
-
currentLevel: 0,
|
|
14
|
-
currentUserInfo: ''
|
|
15
|
-
}
|
|
16
|
-
const userMagamentReducer = (
|
|
17
|
-
state = initialStore,
|
|
18
|
-
action: { type: string; params: any }
|
|
19
|
-
) => {
|
|
20
|
-
switch (action.type) {
|
|
21
|
-
case userMagamentActionsType.SETUSERMODALDATA: {
|
|
22
|
-
return Object.assign({}, state, { userModalData: action.params })
|
|
23
|
-
}
|
|
24
|
-
case userMagamentActionsType.SET_PERMISSIONLIST: {
|
|
25
|
-
return Object.assign({}, state, { permissionList: action.params })
|
|
26
|
-
}
|
|
27
|
-
case userMagamentActionsType.SET_CURRENT_LEVEL: {
|
|
28
|
-
return Object.assign({}, state, { currentLevel: action.params })
|
|
29
|
-
}
|
|
30
|
-
case userMagamentActionsType.SET_CURRENT_USER_INFO: {
|
|
31
|
-
return Object.assign({}, state, { currentUserInfo: action.params })
|
|
32
|
-
}
|
|
33
|
-
default:
|
|
34
|
-
return state
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export default userMagamentReducer
|