Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
W
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
1
Merge Requests
1
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
WuFeiyang
WidgetUI
Commits
8dd644d4
Commit
8dd644d4
authored
Oct 24, 2019
by
WuFeiyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
broadcast ok
parent
ff152bde
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
107 additions
and
16 deletions
+107
-16
src/App.vue
src/App.vue
+5
-4
src/components/AutoBroadcast/AutoBroadcast.vue
src/components/AutoBroadcast/AutoBroadcast.vue
+28
-4
src/components/Config/Config.vue
src/components/Config/Config.vue
+33
-1
src/components/Method/Method.vue
src/components/Method/Method.vue
+20
-1
src/components/State/State.vue
src/components/State/State.vue
+20
-1
src/components/Status/Status.vue
src/components/Status/Status.vue
+1
-5
No files found.
src/App.vue
View file @
8dd644d4
...
@@ -83,6 +83,7 @@ import Config from "./components/Config/Config.vue";
...
@@ -83,6 +83,7 @@ import Config from "./components/Config/Config.vue";
import
Thing
from
"
./components/Thing/Thing.vue
"
;
import
Thing
from
"
./components/Thing/Thing.vue
"
;
import
State
from
"
./components/State/State.vue
"
;
import
State
from
"
./components/State/State.vue
"
;
import
VarBroadcast
from
"
./components/VarBroadcast/VarBroadcast.vue
"
;
import
VarBroadcast
from
"
./components/VarBroadcast/VarBroadcast.vue
"
;
import
AutoBroadcast
from
"
./components/AutoBroadcast/AutoBroadcast.vue
"
;
// import Gauge from "./components/Gauge/Gauge.vue";
// import Gauge from "./components/Gauge/Gauge.vue";
//this is the view selecotr class
//this is the view selecotr class
...
@@ -97,7 +98,8 @@ import VarBroadcast from "./components/VarBroadcast/VarBroadcast.vue";
...
@@ -97,7 +98,8 @@ import VarBroadcast from "./components/VarBroadcast/VarBroadcast.vue";
GridLayout
,
GridLayout
,
GridItem
,
GridItem
,
State
,
State
,
VarBroadcast
VarBroadcast
,
AutoBroadcast
}
}
})
})
export
default
class
App
extends
Vue
{
export
default
class
App
extends
Vue
{
...
@@ -115,7 +117,8 @@ export default class App extends Vue {
...
@@ -115,7 +117,8 @@ export default class App extends Vue {
"
Method
"
,
"
Method
"
,
"
Thing
"
,
"
Thing
"
,
"
State
"
,
"
State
"
,
"
VarBroadcast
"
"
VarBroadcast
"
,
"
AutoBroadcast
"
];
];
toggleShowAddWidget
():
void
{
toggleShowAddWidget
():
void
{
...
@@ -211,11 +214,9 @@ export default class App extends Vue {
...
@@ -211,11 +214,9 @@ export default class App extends Vue {
}
}
PubSub
.
subscribe
(
"
VarBroadcast
"
,(
messageName
,
Args
)
=>
{
PubSub
.
subscribe
(
"
VarBroadcast
"
,(
messageName
,
Args
)
=>
{
console
.
log
(
Args
);
//接收到消息调用全部widget的parentUpdate函数
//接收到消息调用全部widget的parentUpdate函数
for
(
var
widget
of
this
.
widgetList
)
{
for
(
var
widget
of
this
.
widgetList
)
{
((
this
.
$refs
[
widget
.
ref
]
as
Array
<
Widget
>
)[
0
]
as
Widget
).
parentUpdate
(
Args
);}
((
this
.
$refs
[
widget
.
ref
]
as
Array
<
Widget
>
)[
0
]
as
Widget
).
parentUpdate
(
Args
);}
console
.
log
(
this
.
$refs
[
widget
.
ref
]);
});
});
}
}
...
...
src/components/AutoBroadcast/AutoBroadcast.vue
View file @
8dd644d4
...
@@ -48,6 +48,16 @@
...
@@ -48,6 +48,16 @@
</b-col>
</b-col>
</b-row>
</b-row>
<br
/>
<b-row>
<b-col>
<b-input-group
size=
"lg"
prepend=
"BroadcastName"
v-show=
"isShowPath"
>
<b-form-input
v-model=
"autoUpdateName"
></b-form-input>
</b-input-group>
</b-col>
</b-row>
<br
/>
<br
/>
<b-row>
<b-row>
<b-col>
<b-col>
...
@@ -59,6 +69,7 @@
...
@@ -59,6 +69,7 @@
<
script
lang=
"ts"
>
<
script
lang=
"ts"
>
import
Vue
from
"
vue
"
;
import
Vue
from
"
vue
"
;
import
PubSub
from
'
pubsub-js
'
;
import
{
VueSvgGauge
}
from
"
vue-svg-gauge
"
;
import
{
VueSvgGauge
}
from
"
vue-svg-gauge
"
;
import
Component
from
"
vue-class-component
"
;
import
Component
from
"
vue-class-component
"
;
import
{
Prop
,
Watch
}
from
"
vue-property-decorator
"
;
import
{
Prop
,
Watch
}
from
"
vue-property-decorator
"
;
...
@@ -80,10 +91,10 @@ import Navigation from "@/components/Common/Navigation.vue";
...
@@ -80,10 +91,10 @@ import Navigation from "@/components/Common/Navigation.vue";
Navigation
Navigation
}
}
})
})
export
default
class
Status
extends
Widget
{
export
default
class
AutoBroadcast
extends
Widget
{
pathProcessor
=
new
PathProcessor
();
pathProcessor
=
new
PathProcessor
();
strMapObjChange
=
new
StrMapObjChange
();
strMapObjChange
=
new
StrMapObjChange
();
WidgetComponentName
:
string
=
"
Status
"
;
WidgetComponentName
:
string
=
"
AutoBroadcast
"
;
StatusValue
:
string
=
""
;
StatusValue
:
string
=
""
;
pathId
:
string
=
""
;
pathId
:
string
=
""
;
userInputData
=
new
Map
<
string
,
string
>
();
userInputData
=
new
Map
<
string
,
string
>
();
...
@@ -91,9 +102,10 @@ export default class Status extends Widget {
...
@@ -91,9 +102,10 @@ export default class Status extends Widget {
timer
?:
number
;
timer
?:
number
;
isShowPath
:
boolean
=
false
;
isShowPath
:
boolean
=
false
;
isShowParams
:
boolean
=
false
;
isShowParams
:
boolean
=
false
;
autoUpdateName
:
string
=
""
;
config
:
WidgetConfig
=
{
config
:
WidgetConfig
=
{
WidgetComponentName
:
"
Status
"
,
WidgetComponentName
:
"
AutoBroadcast
"
,
data
:
{
data
:
{
url
:
""
,
url
:
""
,
userInputData
:
""
userInputData
:
""
...
@@ -220,7 +232,7 @@ export default class Status extends Widget {
...
@@ -220,7 +232,7 @@ export default class Status extends Widget {
}
}
});
});
}
}
//called when widgetParams action clicked
//called when widgetParams action clicked
async
viewLoad
(
Args
:
UpdatePayload
)
{
async
viewLoad
(
Args
:
UpdatePayload
)
{
// this.config.data.userInputData = Args.variables;
// this.config.data.userInputData = Args.variables;
...
@@ -231,6 +243,18 @@ export default class Status extends Widget {
...
@@ -231,6 +243,18 @@ export default class Status extends Widget {
this
.
config
.
data
.
url
this
.
config
.
data
.
url
);
);
await
this
.
getData
(
this
.
pathwithVar
);
await
this
.
getData
(
this
.
pathwithVar
);
if
(
this
.
autoUpdateName
!=
""
)
{
var
autoUpdateData
=
new
Map
<
string
,
string
>
();
autoUpdateData
.
set
(
this
.
autoUpdateName
,
this
.
StatusValue
);
var
autoUpdate
:
UpdatePayload
=
{
action
:
"
AutoBroadcast
"
,
variables
:
autoUpdateData
,
target
:[
'
self
'
]
}
PubSub
.
publish
(
'
VarBroadcast
'
,
autoUpdate
);
}
}
}
}
}
</
script
>
</
script
>
...
...
src/components/Config/Config.vue
View file @
8dd644d4
...
@@ -292,7 +292,39 @@ export default class Config extends Widget {
...
@@ -292,7 +292,39 @@ export default class Config extends Widget {
this
.
config
.
data
.
set
.
url
.
replace
(
"
$startPath$
"
,
startPath
);
this
.
config
.
data
.
set
.
url
.
replace
(
"
$startPath$
"
,
startPath
);
}
}
parentUpdate
(
payload
:
UpdatePayload
):
void
{}
parentUpdate
(
payload
:
UpdatePayload
):
void
{
this
.
userGetInputData
=
this
.
strMapObjChange
.
strMapToObj
(
(
this
.
$refs
.
WidgetGetParams
as
WidgetParams
).
getVariableValues
());
var
temp
=
this
.
userGetInputData
;
temp
=
JSON
.
parse
(
JSON
.
stringify
(
temp
));
temp
=
this
.
strMapObjChange
.
objToStrMap
(
temp
);
this
.
userGetInputData
=
temp
;
this
.
userGetInputData
.
forEach
((
value
,
key
)
=>
{
payload
.
variables
.
forEach
((
valueofpayload
,
keyofpayload
)
=>
{
if
(
key
==
keyofpayload
)
{
this
.
userGetInputData
.
set
(
key
,
payload
.
variables
.
get
(
keyofpayload
)
as
string
);
}
});
});
(
this
.
$refs
.
WidgetGetParams
as
WidgetParams
).
setVariableInput
(
this
.
userGetInputData
);
this
.
userSetInputData
=
this
.
strMapObjChange
.
strMapToObj
(
(
this
.
$refs
.
WidgetSetParams
as
WidgetParams
).
getVariableValues
());
temp
=
this
.
userSetInputData
;
temp
=
JSON
.
parse
(
JSON
.
stringify
(
temp
));
temp
=
this
.
strMapObjChange
.
objToStrMap
(
temp
);
this
.
userSetInputData
=
temp
;
this
.
userSetInputData
.
forEach
((
value
,
key
)
=>
{
payload
.
variables
.
forEach
((
valueofpayload
,
keyofpayload
)
=>
{
if
(
key
==
keyofpayload
)
{
this
.
userSetInputData
.
set
(
key
,
payload
.
variables
.
get
(
keyofpayload
)
as
string
);
}
});
});
(
this
.
$refs
.
WidgetSetParams
as
WidgetParams
).
setVariableInput
(
this
.
userSetInputData
);
}
refresh
()
{
refresh
()
{
var
GetArgs
:
UpdatePayload
=
{
var
GetArgs
:
UpdatePayload
=
{
...
...
src/components/Method/Method.vue
View file @
8dd644d4
...
@@ -185,7 +185,26 @@ export default class Method extends Widget {
...
@@ -185,7 +185,26 @@ export default class Method extends Widget {
this
.
config
.
data
.
url
.
replace
(
"
$startPath$
"
,
startPath
);
this
.
config
.
data
.
url
.
replace
(
"
$startPath$
"
,
startPath
);
}
}
parentUpdate
(
payload
:
UpdatePayload
):
void
{}
parentUpdate
(
payload
:
UpdatePayload
):
void
{
this
.
userInputData
=
this
.
strMapObjChange
.
strMapToObj
(
(
this
.
$refs
.
WidgetParams
as
WidgetParams
).
getVariableValues
());
var
temp
=
this
.
userInputData
;
temp
=
JSON
.
parse
(
JSON
.
stringify
(
temp
));
temp
=
this
.
strMapObjChange
.
objToStrMap
(
temp
);
this
.
userInputData
=
temp
;
console
.
log
(
this
.
userInputData
);
console
.
log
(
payload
.
variables
);
this
.
userInputData
.
forEach
((
value
,
key
)
=>
{
payload
.
variables
.
forEach
((
valueofpayload
,
keyofpayload
)
=>
{
if
(
key
==
keyofpayload
)
{
this
.
userInputData
.
set
(
key
,
payload
.
variables
.
get
(
keyofpayload
)
as
string
);
}
});
});
(
this
.
$refs
.
WidgetParams
as
WidgetParams
).
setVariableInput
(
this
.
userInputData
);
// this.updateUI();
}
refresh
()
{
refresh
()
{
var
Args
:
UpdatePayload
=
{
var
Args
:
UpdatePayload
=
{
...
...
src/components/State/State.vue
View file @
8dd644d4
...
@@ -194,7 +194,26 @@ export default class State extends Widget {
...
@@ -194,7 +194,26 @@ export default class State extends Widget {
this
.
config
.
data
.
url
.
replace
(
"
$startPath$
"
,
startPath
);
this
.
config
.
data
.
url
.
replace
(
"
$startPath$
"
,
startPath
);
}
}
parentUpdate
(
payload
:
UpdatePayload
):
void
{}
parentUpdate
(
payload
:
UpdatePayload
):
void
{
this
.
userInputData
=
this
.
strMapObjChange
.
strMapToObj
(
(
this
.
$refs
.
WidgetParams
as
WidgetParams
).
getVariableValues
());
var
temp
=
this
.
userInputData
;
temp
=
JSON
.
parse
(
JSON
.
stringify
(
temp
));
temp
=
this
.
strMapObjChange
.
objToStrMap
(
temp
);
this
.
userInputData
=
temp
;
console
.
log
(
this
.
userInputData
);
console
.
log
(
payload
.
variables
);
this
.
userInputData
.
forEach
((
value
,
key
)
=>
{
payload
.
variables
.
forEach
((
valueofpayload
,
keyofpayload
)
=>
{
if
(
key
==
keyofpayload
)
{
this
.
userInputData
.
set
(
key
,
payload
.
variables
.
get
(
keyofpayload
)
as
string
);
}
});
});
(
this
.
$refs
.
WidgetParams
as
WidgetParams
).
setVariableInput
(
this
.
userInputData
);
// this.updateUI();
}
refresh
()
{
refresh
()
{
var
Args
:
UpdatePayload
=
{
var
Args
:
UpdatePayload
=
{
...
...
src/components/Status/Status.vue
View file @
8dd644d4
...
@@ -202,11 +202,7 @@ export default class Status extends Widget {
...
@@ -202,11 +202,7 @@ export default class Status extends Widget {
console
.
log
(
this
.
userInputData
);
console
.
log
(
this
.
userInputData
);
console
.
log
(
payload
.
variables
);
console
.
log
(
payload
.
variables
);
this
.
userInputData
.
forEach
((
value
,
key
)
=>
{
this
.
userInputData
.
forEach
((
value
,
key
)
=>
{
console
.
log
(
"
进来了
"
);
console
.
log
(
key
);
payload
.
variables
.
forEach
((
valueofpayload
,
keyofpayload
)
=>
{
payload
.
variables
.
forEach
((
valueofpayload
,
keyofpayload
)
=>
{
console
.
log
(
key
);
console
.
log
(
keyofpayload
);
if
(
key
==
keyofpayload
)
if
(
key
==
keyofpayload
)
{
{
this
.
userInputData
.
set
(
key
,
payload
.
variables
.
get
(
keyofpayload
)
as
string
);
this
.
userInputData
.
set
(
key
,
payload
.
variables
.
get
(
keyofpayload
)
as
string
);
...
@@ -214,7 +210,7 @@ export default class Status extends Widget {
...
@@ -214,7 +210,7 @@ export default class Status extends Widget {
});
});
});
});
(
this
.
$refs
.
WidgetParams
as
WidgetParams
).
setVariableInput
(
this
.
userInputData
);
(
this
.
$refs
.
WidgetParams
as
WidgetParams
).
setVariableInput
(
this
.
userInputData
);
this
.
updateUI
();
//
this.updateUI();
}
}
refresh
()
{
refresh
()
{
...
...
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