Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
C
CFET_WidgetUI
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
XieXiaohan
CFET_WidgetUI
Commits
358a38b6
Commit
358a38b6
authored
Dec 15, 2020
by
XieXiaohan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add broadcast
parent
2684739d
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
296 additions
and
206 deletions
+296
-206
src/Windows/WindowsApp.vue
src/Windows/WindowsApp.vue
+28
-0
src/components/Config/BoolConfig.vue
src/components/Config/BoolConfig.vue
+10
-12
src/components/Config/Config.vue
src/components/Config/Config.vue
+16
-12
src/components/Method/Method.vue
src/components/Method/Method.vue
+25
-20
src/components/State/BoolState.vue
src/components/State/BoolState.vue
+16
-14
src/components/State/State.vue
src/components/State/State.vue
+23
-21
src/components/Status/LabelStatus.vue
src/components/Status/LabelStatus.vue
+25
-12
src/components/Status/Status.vue
src/components/Status/Status.vue
+21
-21
src/components/VarBroadcast/VarBroadcast.vue
src/components/VarBroadcast/VarBroadcast.vue
+131
-93
vue.config.js
vue.config.js
+1
-1
No files found.
src/Windows/WindowsApp.vue
View file @
358a38b6
...
...
@@ -134,6 +134,7 @@ import { GridItemData, GridLayout, GridItem } from "vue-grid-layout";
import
{
WidgetRef
}
from
"
./models/WidgetRef
"
;
import
{
WidgetConfig
,
AllWidgetConfig
}
from
"
./models/WidgetConfig
"
;
import
{
Action
,
UpdatePayload
}
from
"
./models/UpdatePayload
"
;
import
StrMapObjChange
from
"
@/models/StrMapObjChange
"
;
import
{
Widget
}
from
"
./models/widget
"
;
...
...
@@ -146,6 +147,7 @@ import { Widget } from "./models/widget";
export
default
class
WindowsApp
extends
Vue
{
pathProcessor
=
new
PathProcessor
();
strMapObjChange
=
new
StrMapObjChange
();
//EditPathPoke : string = '';
isShowParams
:
boolean
=
true
;
userInputData
=
new
Map
<
string
,
string
>
();
...
...
@@ -191,8 +193,10 @@ export default class WindowsApp extends Vue {
if (localURL.indexOf("?") != -1) {
var url = localURL.substr(1);
var httpData = unescape(url);
console.log(httpData);
//var jsondata = decodeURI(url);
var data = JSON.parse(httpData);
console.log(data);
this.EditData = data;
}*/
...
...
@@ -208,6 +212,17 @@ export default class WindowsApp extends Vue {
this
.
setVariableList
(
this
.
pathProcessor
.
extractVarFromPath
(
this
.
EditData
.
params
.
PokedPath
)
);
console
.
log
(
this
.
EditData
.
params
.
shouldUpdate
);
if
(
this
.
EditData
.
params
.
shouldUpdate
==
true
){
console
.
log
(
"
wind in
"
);
console
.
log
(
this
.
EditData
.
params
.
userInputData
);
//this.EditData.params.userInputData = this.strMapObjChange.objToStrMap(this.EditData.params.userInputData);
//console.log(this.EditData.params.userInputData);
this
.
setVariableInput
(
this
.
strMapObjChange
.
objToStrMap
(
this
.
EditData
.
params
.
userInputData
));
this
.
EditData
.
params
.
shouldUpdate
=
false
;
//this.apply();
}
}
...
...
@@ -252,6 +267,9 @@ export default class WindowsApp extends Vue {
target
:
[
"
self
"
]
};
this
.
EditData
.
params
.
Args
=
Args
;
this
.
getVariableValues
();
this
.
EditData
.
params
.
userInputData
=
this
.
userInputData
;
console
.
log
(
this
.
EditData
.
params
.
userInputData
);
//this.EditData.params.tempUserInputData = this.tempUserInputData;
window
.
opener
.
UpdateWidget
(
this
.
EditData
);
...
...
@@ -267,6 +285,15 @@ export default class WindowsApp extends Vue {
}
setVariableInput
(
parentUserInputData
:
Map
<
string
,
string
>
)
{
for
(
var
key
of
parentUserInputData
.
keys
())
{
this
.
tempUserInputData
[
key
]
=
parentUserInputData
.
get
(
key
)
as
string
;
}
this
.
EditData
.
params
.
tempUserInputData
=
this
.
tempUserInputData
;
}
setVariableList
(
path
:
string
[])
{
...
...
@@ -274,6 +301,7 @@ export default class WindowsApp extends Vue {
path
.
forEach
(
element
=>
{
this
.
userInputData
.
set
(
element
,
''
);
});
//this.EditData.params.userInputData = this.userInputData;
this
.
$forceUpdate
();
}
...
...
src/components/Config/BoolConfig.vue
View file @
358a38b6
...
...
@@ -90,6 +90,7 @@
pathId
:
string
=
""
;
userGetInputData
=
new
Map
<
string
,
string
>
();
userSetInputData
=
new
Map
<
string
,
string
>
();
userInputData
=
new
Map
<
string
,
string
>
();
getPathwithVar
:
string
=
""
;
setPathwithVar
:
string
=
""
;
isShowGetPath
:
boolean
=
false
;
...
...
@@ -134,6 +135,8 @@
Args
:
{},
tempUserInputData
:{},
setLabel
:
''
,
shouldUpdate
:
false
,
userInputData
:
this
.
userInputData
,
},
};
...
...
@@ -385,9 +388,8 @@
}
parentUpdate
(
payload
:
UpdatePayload
):
void
{
var
shouldUpdate
:
boolean
=
false
;
this
.
userGetInputData
=
this
.
strMapObjChange
.
strMapToObj
(
(
this
.
$refs
.
WidgetGetParams
as
WidgetParams
).
getVariableValues
()
);
this
.
userGetInputData
);
var
temp
=
this
.
userGetInputData
;
temp
=
this
.
strMapObjChange
.
objToStrMap
(
temp
);
this
.
userGetInputData
=
temp
;
...
...
@@ -396,13 +398,15 @@
if
(
key
==
keyofpayload
&&
((
this
.
userGetInputData
.
get
(
key
)
as
string
)
!=
(
payload
.
variables
.
get
(
keyofpayload
)
as
string
)))
{
this
.
userGetInputData
.
set
(
key
,
payload
.
variables
.
get
(
keyofpayload
)
as
string
);
shouldUpdate
=
true
;
this
.
EditData
.
params
.
shouldUpdate
=
true
;
this
.
EditData
.
params
.
Args
.
variables
=
this
.
userGetInputData
;
this
.
viewGetLoad
(
this
.
EditData
.
params
.
Args
);
}
});
});
});
this
.
EditData
.
params
.
userInputData
=
this
.
strMapObjChange
.
strMapToObj
(
this
.
userGetInputData
);
this
.
userSetInputData
=
this
.
strMapObjChange
.
strMapToObj
(
(
this
.
$refs
.
WidgetSetParams
as
WidgetParams
).
getVariableValues
()
);
this
.
userSetInputData
);
temp
=
this
.
userSetInputData
;
temp
=
this
.
strMapObjChange
.
objToStrMap
(
temp
);
this
.
userSetInputData
=
temp
;
...
...
@@ -411,16 +415,10 @@
if
(
key
==
keyofpayload
&&
((
this
.
userSetInputData
.
get
(
key
)
as
string
)
!=
(
payload
.
variables
.
get
(
keyofpayload
)
as
string
)))
{
this
.
userSetInputData
.
set
(
key
,
payload
.
variables
.
get
(
keyofpayload
)
as
string
);
this
.
viewSetLoad
(
this
.
EditData
.
params
.
Args
);
}
});
});
if
(
shouldUpdate
)
{
(
this
.
$refs
.
WidgetGetParams
as
WidgetParams
).
setVariableInput
(
this
.
userGetInputData
);
(
this
.
$refs
.
WidgetSetParams
as
WidgetParams
).
setVariableInput
(
this
.
userSetInputData
);
this
.
updateUI
();
}
}
...
...
src/components/Config/Config.vue
View file @
358a38b6
...
...
@@ -102,6 +102,7 @@ export default class Config extends Widget {
pathId
:
string
=
""
;
userGetInputData
=
new
Map
<
string
,
string
>
();
userSetInputData
=
new
Map
<
string
,
string
>
();
userInputData
=
new
Map
<
string
,
string
>
();
getPathwithVar
:
string
=
""
;
setPathwithVar
:
string
=
""
;
isShowGetPath
:
boolean
=
false
;
...
...
@@ -146,6 +147,8 @@ export default class Config extends Widget {
Args
:
{},
tempUserInputData
:{},
setLabel
:
''
,
shouldUpdate
:
false
,
userInputData
:
this
.
userInputData
,
},
};
...
...
@@ -359,6 +362,7 @@ export default class Config extends Widget {
this
.
samplePoke
(
response
.
data
);
this
.
updateUI
();
}).
catch
(
err
=>
{
this
.
EditData
.
params
.
PokedPath
=
this
.
config
.
data
.
url
;
this
.
openWindows
();
});
}
...
...
@@ -371,9 +375,8 @@ export default class Config extends Widget {
}
parentUpdate
(
payload
:
UpdatePayload
):
void
{
var
shouldUpdate
:
boolean
=
false
;
this
.
userGetInputData
=
this
.
strMapObjChange
.
strMapToObj
(
(
this
.
$refs
.
WidgetGetParams
as
WidgetParams
).
getVariableValues
()
);
this
.
userGetInputData
);
var
temp
=
this
.
userGetInputData
;
temp
=
this
.
strMapObjChange
.
objToStrMap
(
temp
);
this
.
userGetInputData
=
temp
;
...
...
@@ -382,13 +385,15 @@ export default class Config extends Widget {
if
(
key
==
keyofpayload
&&
((
this
.
userGetInputData
.
get
(
key
)
as
string
)
!=
(
payload
.
variables
.
get
(
keyofpayload
)
as
string
)))
{
this
.
userGetInputData
.
set
(
key
,
payload
.
variables
.
get
(
keyofpayload
)
as
string
);
shouldUpdate
=
true
;
this
.
EditData
.
params
.
shouldUpdate
=
true
;
this
.
EditData
.
params
.
Args
.
variables
=
this
.
userGetInputData
;
this
.
viewGetLoad
(
this
.
EditData
.
params
.
Args
);
}
});
});
});
this
.
EditData
.
params
.
userInputData
=
this
.
strMapObjChange
.
strMapToObj
(
this
.
userGetInputData
);
this
.
userSetInputData
=
this
.
strMapObjChange
.
strMapToObj
(
(
this
.
$refs
.
WidgetSetParams
as
WidgetParams
).
getVariableValues
()
);
this
.
userSetInputData
);
temp
=
this
.
userSetInputData
;
temp
=
this
.
strMapObjChange
.
objToStrMap
(
temp
);
this
.
userSetInputData
=
temp
;
...
...
@@ -397,20 +402,15 @@ export default class Config extends Widget {
if
(
key
==
keyofpayload
&&
((
this
.
userSetInputData
.
get
(
key
)
as
string
)
!=
(
payload
.
variables
.
get
(
keyofpayload
)
as
string
)))
{
this
.
userSetInputData
.
set
(
key
,
payload
.
variables
.
get
(
keyofpayload
)
as
string
);
this
.
viewSetLoad
(
this
.
EditData
.
params
.
Args
);
}
});
});
if
(
shouldUpdate
)
{
(
this
.
$refs
.
WidgetGetParams
as
WidgetParams
).
setVariableInput
(
this
.
userGetInputData
);
(
this
.
$refs
.
WidgetSetParams
as
WidgetParams
).
setVariableInput
(
this
.
userSetInputData
);
this
.
updateUI
();
}
}
async
getData
(
url
:
string
)
{
console
.
log
(
"
in
"
);
var
apiLoad
=
url
;
await
axios
.
get
(
apiLoad
,
{
headers
:
{
...
...
@@ -419,14 +419,18 @@ export default class Config extends Widget {
}
}).
then
(
response
=>
{
this
.
setUserData
=
response
.
data
.
CFET2CORE_SAMPLE_VAL
;
console
.
log
(
this
.
setUserData
);
if
(
this
.
setUserData
==
undefined
)
{
this
.
setUserData
=
"
undefined
"
;
}
}).
catch
(
err
=>
{
this
.
setUserData
=
"
undefined
"
;
});
}
async
setData
(
url
:
string
)
{
console
.
log
(
"
in
"
);
var
apiLoad
=
url
;
console
.
log
(
url
);
await
axios
.
post
(
apiLoad
,
{
...
...
src/components/Method/Method.vue
View file @
358a38b6
...
...
@@ -92,6 +92,8 @@ export default class Method extends Widget {
action
:
'
invoke
'
,
Args
:
{},
tempUserInputData
:{},
shouldUpdate
:
false
,
userInputData
:
this
.
userInputData
,
},
};
...
...
@@ -258,30 +260,32 @@ export default class Method extends Widget {
}
parentUpdate
(
payload
:
UpdatePayload
):
void
{
var
shouldUpdate
:
boolean
=
false
this
.
userInputData
=
this
.
strMapObjChange
.
strMapToObj
(
(
this
.
$refs
.
WidgetParams
as
WidgetParams
).
getVariableValues
());
console
.
log
(
this
.
EditData
.
params
.
userInputData
);
console
.
log
(
payload
);
this
.
userInputData
=
this
.
strMapObjChange
.
strMapToObj
(
this
.
EditData
.
params
.
userInputData
);
//this.userInputData = this.EditData.params.userInputData;
var
temp
=
this
.
userInputData
;
temp
=
this
.
strMapObjChange
.
objToStrMap
(
temp
);
this
.
userInputData
=
temp
;
console
.
log
(
this
.
userInputData
);
this
.
userInputData
.
forEach
((
value
,
key
)
=>
{
payload
.
variables
.
forEach
((
valueofpayload
,
keyofpayload
)
=>
{
if
(
key
==
keyofpayload
&&
((
this
.
userInputData
.
get
(
key
)
as
string
)
!=
(
payload
.
variables
.
get
(
keyofpayload
)
as
string
)))
{
this
.
userInputData
.
set
(
key
,
payload
.
variables
.
get
(
keyofpayload
)
as
string
);
shouldUpdate
=
true
;
}
});
});
if
(
shouldUpdate
)
{
(
this
.
$refs
.
WidgetParams
as
WidgetParams
).
setVariableInput
(
this
.
userInputData
);
//this.updateUI();
(
this
.
$refs
.
WidgetParams
as
WidgetParams
).
setVariableList
(
this
.
pathProcessor
.
extractVarFromPath
(
this
.
config
.
data
.
url
)
);
}
payload
.
variables
.
forEach
((
valueofpayload
,
keyofpayload
)
=>
{
if
(
key
==
keyofpayload
&&
((
this
.
userInputData
.
get
(
key
)
as
string
)
!=
(
payload
.
variables
.
get
(
keyofpayload
)
as
string
)))
{
this
.
userInputData
.
set
(
key
,
payload
.
variables
.
get
(
keyofpayload
)
as
string
);
console
.
log
(
this
.
userInputData
);
this
.
EditData
.
params
.
shouldUpdate
=
true
;
this
.
EditData
.
params
.
Args
.
variables
=
this
.
userInputData
;
this
.
pathwithVar
=
this
.
pathProcessor
.
FillPathWithVar
(
// this.config.data.userInputData,
this
.
userInputData
,
this
.
config
.
data
.
url
);
this
.
getData
(
this
.
pathwithVar
);
}
});
});
this
.
EditData
.
params
.
userInputData
=
this
.
strMapObjChange
.
strMapToObj
(
this
.
userInputData
);
}
refresh
()
{
...
...
@@ -289,6 +293,7 @@ export default class Method extends Widget {
}
async
getData
(
url
:
string
)
{
console
.
log
(
url
);
var
apiLoad
=
url
;
await
axios
.
put
(
apiLoad
,
{
headers
:
{
...
...
src/components/State/BoolState.vue
View file @
358a38b6
...
...
@@ -104,6 +104,8 @@
action
:
'
get
'
,
Args
:
{},
tempUserInputData
:{},
shouldUpdate
:
false
,
userInputData
:
this
.
userInputData
,
//userInputData:this.userInputData,
},
};
...
...
@@ -244,7 +246,7 @@
//test
this
.
colourViewLoad
();
this
.
EditData
.
params
.
PokedPath
=
this
.
config
.
data
.
url
;
//
this.openWindows();
this
.
openWindows
();
});
//var url = this.config.data.url;
...
...
@@ -284,30 +286,30 @@
}
parentUpdate
(
payload
:
UpdatePayload
):
void
{
var
shouldUpdate
:
boolean
=
false
;
this
.
userInputData
=
this
.
strMapObjChange
.
strMapToObj
(
(
this
.
$refs
.
WidgetParams
as
WidgetParams
).
getVariableValues
());
this
.
EditData
.
params
.
userInputData
);
//this.userInputData = this.EditData.params.userInputData;
var
temp
=
this
.
userInputData
;
temp
=
this
.
strMapObjChange
.
objToStrMap
(
temp
);
this
.
userInputData
=
temp
;
console
.
log
(
this
.
userInputData
);
this
.
userInputData
.
forEach
((
value
,
key
)
=>
{
payload
.
variables
.
forEach
((
valueofpayload
,
keyofpayload
)
=>
{
if
(
key
==
keyofpayload
&&
((
this
.
userInputData
.
get
(
key
)
as
string
)
!=
(
payload
.
variables
.
get
(
keyofpayload
)
as
string
)))
{
this
.
userInputData
.
set
(
key
,
payload
.
variables
.
get
(
keyofpayload
)
as
string
);
shouldUpdate
=
true
;
console
.
log
(
this
.
userInputData
);
this
.
EditData
.
params
.
shouldUpdate
=
true
;
this
.
EditData
.
params
.
Args
.
variables
=
this
.
userInputData
;
this
.
pathwithVar
=
this
.
pathProcessor
.
FillPathWithVar
(
// this.config.data.userInputData,
this
.
userInputData
,
this
.
config
.
data
.
url
);
this
.
getData
(
this
.
pathwithVar
);
}
});
});
if
(
shouldUpdate
)
{
(
this
.
$refs
.
WidgetParams
as
WidgetParams
).
setVariableInput
(
this
.
userInputData
);
//this.updateUI();
(
this
.
$refs
.
WidgetParams
as
WidgetParams
).
setVariableList
(
this
.
pathProcessor
.
extractVarFromPath
(
this
.
config
.
data
.
url
)
);
}
});
this
.
EditData
.
params
.
userInputData
=
this
.
strMapObjChange
.
strMapToObj
(
this
.
userInputData
);
}
refresh
()
{
...
...
src/components/State/State.vue
View file @
358a38b6
...
...
@@ -102,6 +102,8 @@ export default class State extends Widget {
action
:
'
get
'
,
Args
:
{},
tempUserInputData
:{},
shouldUpdate
:
false
,
userInputData
:
this
.
userInputData
,
//userInputData:this.userInputData,
},
};
...
...
@@ -243,7 +245,7 @@ export default class State extends Widget {
}).
catch
(
err
=>
{
this
.
colourViewLoad
();
this
.
EditData
.
params
.
PokedPath
=
this
.
config
.
data
.
url
;
//
this.openWindows();
this
.
openWindows
();
});
//var url = this.config.data.url;
...
...
@@ -283,30 +285,30 @@ export default class State extends Widget {
}
parentUpdate
(
payload
:
UpdatePayload
):
void
{
var
shouldUpdate
:
boolean
=
false
;
this
.
userInputData
=
this
.
strMapObjChange
.
strMapToObj
(
(
this
.
$refs
.
WidgetParams
as
WidgetParams
).
getVariableValues
())
;
this
.
userInputData
=
this
.
strMapObjChange
.
strMapToObj
(
this
.
EditData
.
params
.
userInputData
);
//this.userInputData = this.EditData.params.userInputData
;
var
temp
=
this
.
userInputData
;
temp
=
this
.
strMapObjChange
.
objToStrMap
(
temp
);
this
.
userInputData
=
temp
;
console
.
log
(
this
.
userInputData
);
this
.
userInputData
.
forEach
((
value
,
key
)
=>
{
payload
.
variables
.
forEach
((
valueofpayload
,
keyofpayload
)
=>
{
if
(
key
==
keyofpayload
&&
((
this
.
userInputData
.
get
(
key
)
as
string
)
!=
(
payload
.
variables
.
get
(
keyofpayload
)
as
string
)))
{
this
.
userInputData
.
set
(
key
,
payload
.
variables
.
get
(
keyofpayload
)
as
string
);
shouldUpdate
=
true
;
}
});
});
if
(
shouldUpdate
)
{
(
this
.
$refs
.
WidgetParams
as
WidgetParams
).
setVariableInput
(
this
.
userInputData
);
//this.updateUI();
(
this
.
$refs
.
WidgetParams
as
WidgetParams
).
setVariableList
(
this
.
pathProcessor
.
extractVarFromPath
(
this
.
config
.
data
.
url
)
);
}
payload
.
variables
.
forEach
((
valueofpayload
,
keyofpayload
)
=>
{
if
(
key
==
keyofpayload
&&
((
this
.
userInputData
.
get
(
key
)
as
string
)
!=
(
payload
.
variables
.
get
(
keyofpayload
)
as
string
)))
{
this
.
userInputData
.
set
(
key
,
payload
.
variables
.
get
(
keyofpayload
)
as
string
);
console
.
log
(
this
.
userInputData
);
this
.
EditData
.
params
.
shouldUpdate
=
true
;
this
.
EditData
.
params
.
Args
.
variables
=
this
.
userInputData
;
this
.
pathwithVar
=
this
.
pathProcessor
.
FillPathWithVar
(
// this.config.data.userInputData,
this
.
userInputData
,
this
.
config
.
data
.
url
);
this
.
getData
(
this
.
pathwithVar
);
}
});
});
this
.
EditData
.
params
.
userInputData
=
this
.
strMapObjChange
.
strMapToObj
(
this
.
userInputData
);
}
refresh
()
{
...
...
src/components/Status/LabelStatus.vue
View file @
358a38b6
...
...
@@ -134,6 +134,9 @@
action
:
'
get
'
,
Args
:
{},
tempUserInputData
:{},
shouldUpdate
:
false
,
userInputData
:
this
.
userInputData
,
},
};
...
...
@@ -281,10 +284,7 @@
//app
getConfig
():
[
WidgetConfig
,
object
]
{
// this.config.data.userInputData =(this.$refs.WidgetParams as WidgetParams).getVariableValues();
/*this.config.data.userInputData = this.strMapObjChange.strMapToObj(
(this.$refs.WidgetParams as WidgetParams).getVariableValues()
);*/
return
[
this
.
config
,
this
.
EditData
];
}
...
...
@@ -322,17 +322,20 @@
console
.
log
(
this
.
EditPathPoke
);
console
.
log
(
this
.
EditData
.
params
);
const
urlRegExp
=
/
(?
<=
\/)\w
*
(?=\/)
/g
;
/*
const urlRegExp = /(?<=\/)\w*(?=\/)/g;
const result = this.config.data.url.match(urlRegExp);
this.message = this.message.replace(".*", "/"+result[0]+"/.*");
console
.
log
(
this
.
message
);
console.log(this.message);
*/
var
pokepath
=
this
.
EditData
.
edit
.
url
;
console
.
log
(
pokepath
);
window
.
$axios
.
get
(
pokepath
).
then
(
response
=>
{
console
.
log
(
"
in
"
);
this
.
samplePoke
(
response
.
data
);
this
.
updateUI
();
}).
catch
(
err
=>
{
console
.
log
(
"
catch
"
);
this
.
EditData
.
params
.
PokedPath
=
this
.
config
.
data
.
url
;
this
.
openWindows
();
});
...
...
@@ -370,30 +373,40 @@
//app
parentUpdate
(
payload
:
UpdatePayload
):
void
{
var
shouldUpdate
:
boolean
=
false
//
var shouldUpdate:boolean = false
this
.
userInputData
=
this
.
strMapObjChange
.
strMapToObj
(
(
this
.
$refs
.
WidgetParams
as
WidgetParams
).
getVariableValues
());
this
.
EditData
.
params
.
userInputData
);
//this.userInputData = this.EditData.params.userInputData;
var
temp
=
this
.
userInputData
;
temp
=
this
.
strMapObjChange
.
objToStrMap
(
temp
);
this
.
userInputData
=
temp
;
console
.
log
(
this
.
userInputData
);
this
.
userInputData
.
forEach
((
value
,
key
)
=>
{
payload
.
variables
.
forEach
((
valueofpayload
,
keyofpayload
)
=>
{
if
(
key
==
keyofpayload
&&
((
this
.
userInputData
.
get
(
key
)
as
string
)
!=
(
payload
.
variables
.
get
(
keyofpayload
)
as
string
)))
{
this
.
userInputData
.
set
(
key
,
payload
.
variables
.
get
(
keyofpayload
)
as
string
);
shouldUpdate
=
true
;
console
.
log
(
this
.
userInputData
);
this
.
EditData
.
params
.
shouldUpdate
=
true
;
this
.
EditData
.
params
.
Args
.
variables
=
this
.
userInputData
;
this
.
pathwithVar
=
this
.
pathProcessor
.
FillPathWithVar
(
// this.config.data.userInputData,
this
.
userInputData
,
this
.
config
.
data
.
url
);
this
.
getData
(
this
.
pathwithVar
);
}
});
});
});
this
.
EditData
.
params
.
userInputData
=
this
.
strMapObjChange
.
strMapToObj
(
this
.
userInputData
);
if
(
shouldUpdate
)
/*
if(shouldUpdate)
{
(this.$refs.WidgetParams as WidgetParams).setVariableInput(this.userInputData);
//this.updateUI();
(this.$refs.WidgetParams as WidgetParams).setVariableList(
this.pathProcessor.extractVarFromPath(this.config.data.url)
);
}
}
*/
}
//app
...
...
src/components/Status/Status.vue
View file @
358a38b6
...
...
@@ -133,6 +133,8 @@ export default class Status extends Widget {
action
:
'
get
'
,
Args
:
{},
tempUserInputData
:{},
shouldUpdate
:
false
,
userInputData
:
this
.
userInputData
,
},
};
...
...
@@ -372,8 +374,6 @@ export default class Status extends Widget {
this.EditData.params.PokedPath = this.config.data.url;
this.openWindows();
});*/
console
.
log
(
'
defaults.timeout
'
);
console
.
log
(
window
);
window
.
$axios
.
get
(
pokepath
).
then
(
response
=>
{
this
.
samplePoke
(
response
.
data
);
this
.
updateUI
();
...
...
@@ -419,30 +419,30 @@ export default class Status extends Widget {
//app
parentUpdate
(
payload
:
UpdatePayload
):
void
{
var
shouldUpdate
:
boolean
=
false
this
.
userInputData
=
this
.
strMapObjChange
.
strMapToObj
(
(
this
.
$refs
.
WidgetParams
as
WidgetParams
).
getVariableValues
());
this
.
userInputData
=
this
.
strMapObjChange
.
strMapToObj
(
this
.
EditData
.
params
.
userInputData
);
var
temp
=
this
.
userInputData
;
temp
=
this
.
strMapObjChange
.
objToStrMap
(
temp
);
this
.
userInputData
=
temp
;
console
.
log
(
this
.
userInputData
);
this
.
userInputData
.
forEach
((
value
,
key
)
=>
{
payload
.
variables
.
forEach
((
valueofpayload
,
keyofpayload
)
=>
{
if
(
key
==
keyofpayload
&&
((
this
.
userInputData
.
get
(
key
)
as
string
)
!=
(
payload
.
variables
.
get
(
keyofpayload
)
as
string
)))
{
this
.
userInputData
.
set
(
key
,
payload
.
variables
.
get
(
keyofpayload
)
as
string
);
shouldUpdate
=
true
;
}
});
});
payload
.
variables
.
forEach
((
valueofpayload
,
keyofpayload
)
=>
{
if
(
key
==
keyofpayload
&&
((
this
.
userInputData
.
get
(
key
)
as
string
)
!=
(
payload
.
variables
.
get
(
keyofpayload
)
as
string
)))
{
this
.
userInputData
.
set
(
key
,
payload
.
variables
.
get
(
keyofpayload
)
as
string
);
console
.
log
(
this
.
userInputData
);
this
.
EditData
.
params
.
shouldUpdate
=
true
;
this
.
EditData
.
params
.
Args
.
variables
=
this
.
userInputData
;
this
.
pathwithVar
=
this
.
pathProcessor
.
FillPathWithVar
(
// this.config.data.userInputData,
this
.
userInputData
,
this
.
config
.
data
.
url
);
this
.
getData
(
this
.
pathwithVar
);
}
});
});
this
.
EditData
.
params
.
userInputData
=
this
.
strMapObjChange
.
strMapToObj
(
this
.
userInputData
);
if
(
shouldUpdate
)
{
(
this
.
$refs
.
WidgetParams
as
WidgetParams
).
setVariableInput
(
this
.
userInputData
);
//this.updateUI();
(
this
.
$refs
.
WidgetParams
as
WidgetParams
).
setVariableList
(
this
.
pathProcessor
.
extractVarFromPath
(
this
.
config
.
data
.
url
)
);
}
}
//app
...
...
src/components/VarBroadcast/VarBroadcast.vue
View file @
358a38b6
...
...
@@ -49,35 +49,18 @@
<div
class=
"hflex"
>
<div
class=
"container"
>
<div
class=
"columns"
style=
"margin-top:0px"
>
<button
class=
"button column"
@
click=
"viewLoad(EditData.params.Args)"
style=
"background-color: #216dec;padding-top: 6px; "
>
broadcast
</button
>
<div
class=
"column is-4"
>
<span
v-show =
"!isShowPath"
class=
"largeFont"
v-if =
"config.data.displayname != ''"
>
{{
config
.
data
.
displayname
}}
</span>
<span
v-show =
"!isShowPath"
class=
"largeFont"
v-if =
"config.data.displayname == ''"
>
{{
config
.
data
.
url
}}
</span>
<!--
<input
class=
"input colmumn is-8"
type=
"text"
v-show=
"isShowPath"
v-model=
"config.data.displayname"
>
-->
</div>
<div
class=
"column is-1 is-offset-7"
>
<a
class=
"delete is-medium"
@
click=
"del"
></a>
</div>
</div>
<div
class=
"columns"
>
<div
class=
"columns"
>
<WidgetParams
ref=
"WidgetParams"
v-show=
"isShowParams"
action=
"broadcast"
@
updataVariables=
"view
L
oad"
@
updataVariables=
"view
l
oad"
></WidgetParams>
</div>
<p
class=
"column buttons is-1"
style=
"margin-left: 3%;padding: 0px;margin-right: 10%;margin-top: 5%"
>
<button
@
click=
"openWindows"
class=
"button"
style=
"background-color: #64a6e1"
>
<span
class=
"icon is-small has-text"
style=
"margin-right: 1px;"
>
<i
class=
"fa fa-cog"
aria-hidden=
"true"
></i>
</span>
EDIT
</button>
</p>
<!--
<hsc-window-style-metal
>
...
...
@@ -163,6 +146,7 @@ import Navigation from "@/components/Common/Navigation.vue";
})
export
default
class
VarBroadcast
extends
Widget
{
@
Prop
()
index
!
:
number
;
@
Prop
()
refIndex
!
:
number
;
@
Prop
()
widgetList
:
WidgetRef
[]
=
[];
pathProcessor
=
new
PathProcessor
();
strMapObjChange
=
new
StrMapObjChange
();
...
...
@@ -174,7 +158,7 @@ export default class VarBroadcast extends Widget {
timer
?:
number
;
isShowPath
:
boolean
=
false
;
isShowParams
:
boolean
=
false
;
isOpen
:
boolean
=
true
;
EditPathPoke
:
string
=
""
;
config
:
WidgetConfig
=
{
WidgetComponentName
:
"
VarBroadcast
"
,
...
...
@@ -185,13 +169,25 @@ export default class VarBroadcast extends Widget {
}
};
schemas
:
any
[]
=
[{
label
:
'
varbroadcast
'
,
key
:
'
varbroadcast-config
'
,
type
:
'
varbroadcast
'
,
index
:
this
.
index
,
},
];
EditData
=
{
edit
:{
type
:
'
VarBroadcast
'
,
url
:
this
.
config
.
data
.
url
,
index
:
this
.
refIndex
,
isShowStateVlaue
:
false
,
},
props
:{
fontSize
:
22
,
title
:
''
,
titleSize
:
''
,
},
params
:{
PokedPath
:
this
.
EditPathPoke
,
action
:
'
get
'
,
Args
:
{},
tempUserInputData
:{},
},
};
created
()
{
this
.
config
.
data
.
userInputData
=
this
.
strMapObjChange
.
strMapToObj
(
...
...
@@ -199,58 +195,98 @@ export default class VarBroadcast extends Widget {
);
}
mounted
(){
let
containerlist
=
document
.
getElementsByClassName
(
'
container
'
);
//CreateContainerId
var
self
=
this
;
let
RightClickField
=
containerlist
[
this
.
index
];
RightClickField
.
oncontextmenu
=
function
(
e
)
{
e
.
preventDefault
();
let
menu
=
document
.
querySelector
(
'
.menu
'
);
//获取盒子menu。
if
(
menu
)
menu
.
remove
();
//判断清除初始盒子
menu
=
document
.
createElement
(
'
div
'
);
//创建盒子。
menu
.
classList
.
add
(
'
menu
'
);
//添加类
let
menu1
=
document
.
createElement
(
'
BUTTON
'
);
//创建盒子menu1。
menu1
.
innerHTML
=
'
del
'
;
//盒子menu1添加文本XXXX
menu1
.
onclick
=
self
.
del
;
menu
.
appendChild
(
menu1
);
//menu末尾添加新的节点menu1
let
menu2
=
document
.
createElement
(
'
BUTTON
'
);
//创建盒子menu1。
menu2
.
innerHTML
=
'
edit
'
;
//盒子menu1添加文本XXXX
menu2
.
onclick
=
self
.
openWindows
;
menu
.
appendChild
(
menu2
);
//menu末尾添加新的节点menu1
RightClickField
.
appendChild
(
menu
);
//body末尾添加新的节点menu
menu
.
style
.
left
=
e
.
offsetX
+
"
px
"
;
menu
.
style
.
top
=
e
.
offsetY
+
"
px
"
;
menu
.
style
.
position
=
'
absolute
'
;
};
RightClickField
.
onclick
=
e
=>
{
let
menu
=
document
.
querySelector
(
'
.menu
'
)
if
(
menu
&&
!
menu
.
contains
(
e
.
target
))
menu
.
remove
()
}
}
openWindows
(){
//windows.open -> another single page application
var
fragment
=
window
.
location
.
origin
;
var
JsonData
=
JSON
.
stringify
(
this
.
EditData
);
var
httpData
=
encodeURIComponent
(
JsonData
);
var
url
=
fragment
+
"
/WindowsAppIndex.html/?
"
;
window
.
open
(
url
+
httpData
,
"
WidgetWindow
"
,
'
height=100, width=100, top=10, left=10, toolbar=no
'
);
}
del
()
{
this
.
$emit
(
'
del
'
,
this
.
index
);
console
.
log
(
"
del
"
+
this
.
index
);
}
openWindows
()
{
this
.
is
Open
=
!
this
.
isOpen
;
this
.
$parent
.
$parent
.
$root
.
$children
[
0
].
OpenWindows
(
this
.
isOpen
)
;
this
.
$emit
(
'
schemas
'
,
this
.
schemas
);
updateUI
()
{
this
.
is
ShowPath
=
false
;
this
.
EditData
.
params
.
PokedPath
=
this
.
config
.
data
.
url
;
this
.
EditData
.
edit
.
url
=
this
.
config
.
data
.
url
;
this
.
openWindows
(
);
}
updateUI
(
isShowPath
:
boolean
,
isShowParams
:
boolean
,
url
:
string
)
{
showPathConfig
()
{
this
.
isShowPath
=
!
this
.
isShowPath
;
}
this
.
isShowPath
=
isShowPath
;
this
.
isShowParams
=
isShowParams
;
this
.
config
.
data
.
url
=
url
;
console
.
log
(
"
111
"
);
console
.
log
(
this
.
config
.
data
.
url
);
getConfig
():
[
WidgetConfig
,
object
]
{
return
[
this
.
config
,
this
.
EditData
];
}
showPathConfig
()
{
this
.
isShowPath
=
!
this
.
isShowPath
;
}
//app
setConfig
(
setConfigData
:
[
WidgetConfig
,
object
],
fragment
:
string
):
void
{
this
.
config
=
setConfigData
[
0
];
this
.
EditData
=
setConfigData
[
1
];
getConfig
():
WidgetConfig
{
// this.config.data.userInputData =(this.$refs.WidgetParams as WidgetParams).getVariableValues();
this
.
config
.
data
.
userInputData
=
this
.
strMapObjChange
.
strMapToObj
(
(
this
.
$refs
.
WidgetParams
as
WidgetParams
).
getVariableValues
()
);
return
this
.
config
;
}
if
(
this
.
EditData
.
edit
.
url
.
search
(
"
startpath
"
)
!=
-
1
){
this
.
replaceStartPath
(
fragment
)}
var
temp
=
this
.
EditData
.
params
.
tempUserInputData
;
temp
=
JSON
.
parse
(
JSON
.
stringify
(
temp
)
);
temp
=
this
.
strMapObjChange
.
objToStrMap
(
temp
)
;
//this.EditData.params.tempUserInputData = temp;
setConfig
(
widgetConfig
:
WidgetConfig
):
void
{
this
.
config
=
widgetConfig
;
//this.updateUI();
(
this
.
$refs
.
WidgetParams
as
WidgetParams
).
setVariableList
(
this
.
pathProcessor
.
extractVarFromPath
(
this
.
config
.
data
.
url
)
);
//map不能序列化,必须要单独处理,这里的处理方法仅限map
<
string
,
string
>
类型
var
temp
=
this
.
config
.
data
.
userInputData
;
temp
=
JSON
.
parse
(
JSON
.
stringify
(
temp
));
temp
=
this
.
strMapObjChange
.
objToStrMap
(
temp
);
this
.
userInputData
=
temp
;
(
this
.
$refs
.
WidgetParams
as
WidgetParams
).
setVariableInput
(
this
.
userInputData
);
}
var
Args
:
UpdatePayload
=
{
action
:
this
.
EditData
.
params
.
action
,
variables
:
temp
,
target
:
[
"
self
"
]
};
this
.
viewLoad
(
Args
);
}
samplePoke
(
sample
:
any
)
{
var
samplePath
=
sample
.
CFET2CORE_SAMPLE_PATH
;
...
...
@@ -279,45 +315,47 @@ export default class VarBroadcast extends Widget {
this
.
$parent
.
$root
.
$children
[
0
].
$children
[
0
].
$children
[
0
].
config
.
data
.
url
=
pokedPath
;
}
pathPoke
()
{
this
.
config
.
data
.
url
=
this
.
EditData
.
edit
.
url
;
this
.
EditPathPoke
=
this
.
EditData
.
edit
.
url
;
var
pokepath
=
this
.
config
.
data
.
url
;
window
.
$axios
.
get
(
pokepath
).
then
(
response
=>
{
this
.
samplePoke
(
response
.
data
);
this
.
updateUI
();
}).
catch
(
err
=>
{
this
.
EditData
.
params
.
PokedPath
=
this
.
config
.
data
.
url
;
this
.
openWindows
();
});
}
replaceStartPath
(
startPath
:
string
):
void
{
this
.
config
.
data
.
url
.
replace
(
"
$startPath$
"
,
startPath
);
}
replaceStartPath
(
startPath
:
string
):
void
{
this
.
config
.
data
.
url
=
this
.
config
.
data
.
url
.
replace
(
"
$startpath$
"
,
startPath
);
this
.
EditData
.
edit
.
url
=
this
.
EditData
.
edit
.
url
.
replace
(
"
$startpath$
"
,
startPath
);
}
parentUpdate
(
payload
:
UpdatePayload
):
void
{}
refresh
()
{
var
Args
:
UpdatePayload
=
{
action
:
"
get
"
,
variables
:
(
this
.
$refs
.
WidgetParams
as
WidgetParams
).
getVariableValues
(),
target
:
[
"
self
"
]
};
this
.
viewLoad
(
Args
);
this
.
viewLoad
(
this
.
EditData
.
params
.
Args
);
}
async
getData
(
url
:
string
)
{
var
apiLoad
=
url
;
await
axios
.
get
(
apiLoad
,
{
headers
:
{
Pragma
:
"
no-cache
"
,
"
Cache-Control
"
:
"
no-cache
"
}
})
.
then
(
response
=>
{
this
.
StatusValue
=
response
.
data
.
CFET2CORE_SAMPLE_VAL
;
if
(
this
.
StatusValue
==
undefined
)
{
this
.
StatusValue
=
"
undefined
"
;
}
});
var
apiLoad
=
url
;
await
window
.
$axios
.
get
(
apiLoad
)
.
then
(
response
=>
{
this
.
StatusValue
=
response
.
data
.
CFET2CORE_SAMPLE_VAL
;
if
(
this
.
StatusValue
==
undefined
)
{
this
.
StatusValue
=
"
undefined
"
;
}
})
}
//called when widgetParams action clicked
viewLoad
(
Args
:
UpdatePayload
)
{
// this.config.data.userInputData = Args.variables;
console
.
log
(
"
viewLoad
"
);
console
.
log
(
Args
.
variables
);
async
viewLoad
(
Args
:
UpdatePayload
)
{
console
.
log
(
"
view
"
);
PubSub
.
publish
(
'
VarBroadcast
'
,
Args
);
}
}
...
...
@@ -335,4 +373,4 @@ export default class VarBroadcast extends Widget {
}
</
style
>
\ No newline at end of file
</
style
>
vue.config.js
View file @
358a38b6
...
...
@@ -16,7 +16,7 @@ module.exports = {
devServer
:
{
proxy
:
{
"
/
"
:
{
target
:
"
http://192.168.0.3:800
2
"
,
target
:
"
http://192.168.0.3:800
1
"
,
secure
:
false
,
changeOrigin
:
true
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment