Commit cdb22744 authored by WuFeiyang's avatar WuFeiyang

版本1.2 修复了cache的问题

parent 98b74648
...@@ -5382,6 +5382,11 @@ ...@@ -5382,6 +5382,11 @@
"websocket-driver": ">=0.5.1" "websocket-driver": ">=0.5.1"
} }
}, },
"fetch-jsonp": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/fetch-jsonp/-/fetch-jsonp-1.1.3.tgz",
"integrity": "sha1-nrnlhboIqvcAVjU40Xu+u81aPbI="
},
"figgy-pudding": { "figgy-pudding": {
"version": "3.5.1", "version": "3.5.1",
"resolved": "https://registry.npm.taobao.org/figgy-pudding/download/figgy-pudding-3.5.1.tgz", "resolved": "https://registry.npm.taobao.org/figgy-pudding/download/figgy-pudding-3.5.1.tgz",
......
...@@ -2,22 +2,33 @@ ...@@ -2,22 +2,33 @@
<div id="app"> <div id="app">
<b-navbar class="Widget"> <b-navbar class="Widget">
<b-dropdown id="dropdown-1" text="Add Widget" class="m-md-2" variant="primary" size="lg"> <b-dropdown id="dropdown-1" text="Add Widget" class="m-md-2" variant="primary" size="lg">
<b-dropdown-item v-for="(availableWidget,index) in availableWidgets" :key="index" class="smallFont"> <b-dropdown-item
v-for="(availableWidget,index) in availableWidgets"
:key="index"
class="smallFont"
>
<div v-on:click="addWidget(availableWidget)">{{availableWidget}}</div> <div v-on:click="addWidget(availableWidget)">{{availableWidget}}</div>
</b-dropdown-item> </b-dropdown-item>
</b-dropdown> </b-dropdown>
<b-button class="smallFont" @click="saveWidgetList" style="margin-left:2%" variant="primary">Save</b-button> <b-button
class="smallFont"
@click="saveWidgetList"
style="margin-left:2%"
variant="primary"
>Save</b-button>
<b-form-file <b-form-file
id="file" id="file"
type="file" type="file"
@change="loadTextFromFile" @change="loadTextFromFile"
placeholder="Choose a widgetTemplate file to laod" placeholder="Choose a widgetTemplate file to load"
accept=".json" accept=".json"
style="width:30%;margin-left:2%" style="width:30%;margin-left:2%"
class="smallFont" class="smallFont"
/> />
</b-navbar> </b-navbar>
<!-- <b-button @click="test">test</b-button> -->
<grid-layout <grid-layout
:layout.sync="widgetList" :layout.sync="widgetList"
:col-num="12" :col-num="12"
...@@ -55,14 +66,14 @@ ...@@ -55,14 +66,14 @@
import { Component, Vue } from "vue-property-decorator"; import { Component, Vue } from "vue-property-decorator";
import axios from "axios"; import axios from "axios";
import { GridItemData, GridLayout, GridItem } from "vue-grid-layout"; import { GridItemData, GridLayout, GridItem } from "vue-grid-layout";
import VueRouter from 'vue-router'; import VueRouter from "vue-router";
import { WidgetRef } from "./models/WidgetRef"; import { WidgetRef } from "./models/WidgetRef";
import { WidgetConfig, AllWidgetConfig } from "./models/WidgetConfig"; import { WidgetConfig, AllWidgetConfig } from "./models/WidgetConfig";
import { Action, UpdatePayload } from "./models/UpdatePayload"; import { Action, UpdatePayload } from "./models/UpdatePayload";
import { Widget } from "./models/wiget"; import { Widget } from "./models/wiget";
import { ResourceInfo } from "./models/Customview"; import { ResourceInfo } from "./models/Customview";
import { indexOf } from 'typescript-collections/dist/lib/arrays'; import { indexOf } from "typescript-collections/dist/lib/arrays";
//when add more available widgets add ref to the widgets //when add more available widgets add ref to the widgets
import Status from "./components/Status/Status.vue"; import Status from "./components/Status/Status.vue";
...@@ -95,7 +106,14 @@ export default class App extends Vue { ...@@ -95,7 +106,14 @@ export default class App extends Vue {
text: string = ""; text: string = "";
//when add more available widgets add its name here //when add more available widgets add its name here
availableWidgets = ["Status", "Config", "WaveView", "Method", "Thing","State"]; availableWidgets = [
"Status",
"Config",
"WaveView",
"Method",
"Thing",
"State"
];
toggleShowAddWidget(): void { toggleShowAddWidget(): void {
this.isShowAddWidget = !this.isShowAddWidget; this.isShowAddWidget = !this.isShowAddWidget;
...@@ -103,73 +121,101 @@ export default class App extends Vue { ...@@ -103,73 +121,101 @@ export default class App extends Vue {
pokeAndUpdateUI(ref: string, sample: any) { pokeAndUpdateUI(ref: string, sample: any) {
Vue.nextTick(() => { Vue.nextTick(() => {
console.log(this.$refs[ref]); ((this.$refs[ref] as Array<Widget>)[0] as Widget).samplePoke(sample);
((this.$refs[ref] as Array<Widget>)[0] as Widget).samplePoke(
sample
);
((this.$refs[ref] as Array<Widget>)[0] as Widget).updateUI(); ((this.$refs[ref] as Array<Widget>)[0] as Widget).updateUI();
}); });
} }
mounted() { dataAccess(URL: string) {
var dataURL = "a";
dataURL = URL;
axios
.get(dataURL, {
headers: {
Pragma: "no-cache",
"Cache-Control": "no-cache"
}
})
.then(dataresponse => {
var resourcetype = dataresponse.data.ResourceType;
var samplePath = dataresponse.data.CFET2CORE_SAMPLE_PATH;
this.addWidget(resourcetype);
var tempRef = (this.lastWidgetIndex - 1).toString();
this.pokeAndUpdateUI(tempRef, dataresponse.data);
});
}
async mounted() {
// var f1 = window.location.hash; // var f1 = window.location.hash;
// console.log(typeof(f1)); var f = window.location.hash;
var f = window.location.hash;
var fragment = "a"; var fragment = "a";
fragment = f; fragment = f;
console.log(fragment);
if (fragment != "#/" && fragment != "#") { if (fragment != "#/" && fragment != "#") {
fragment = fragment.substring(1, fragment.length); fragment = fragment.substring(1, fragment.length);
var customViewURL = "/customView/template" + fragment; var customViewURL = "/customView/template" + fragment;
console.log(customViewURL); var isCustomview: boolean = false;
axios.get(customViewURL).then(response => { await axios
if ( .get(customViewURL, {
response.data.CFET2CORE_SAMPLE_ISVALID == false || headers: {
response.data.CFET2CORE_SAMPLE_VAL == null Pragma: "no-cache",
) { "Cache-Control": "no-cache"
//直接访问对应的值 }
var dataURL = fragment; })
console.log(dataURL); .then(response => {
axios.get(dataURL,{headers: { if (
"Content-Type":"application/json" response.data.CFET2CORE_SAMPLE_ISVALID == true &&
}}).then(dataresponse => { response.data.CFET2CORE_SAMPLE_VAL != null
console.log(dataresponse.data); ) {
var resourcetype = dataresponse.data.ResourceType; isCustomview = true;
this.addWidget(resourcetype); //返回有值的customview template,进行load处理
console.log(resourcetype); var customviewTemplate: string;
var tempRef = (this.lastWidgetIndex - 1).toString(); customviewTemplate = response.data.CFET2CORE_SAMPLE_VAL;
this.pokeAndUpdateUI(tempRef, dataresponse.data); var widgets = Object.assign(
}); new AllWidgetConfig(),
} else { JSON.parse(customviewTemplate)
//返回有值的customview template,进行load处理 );
var customviewTemplate: string; this.widgetList = widgets.widgetList;
customviewTemplate = response.data.CFET2CORE_SAMPLE_VAL; this.lastWidgetIndex = Number(widgets.currentRef);
console.log(customviewTemplate); this.$forceUpdate();
var widgets = Object.assign( //替换startpath
new AllWidgetConfig(), Vue.nextTick(() => {
JSON.parse(customviewTemplate) // fragment = fragment.substring(1,fragment.length);
); // for (var wid of this.widgetList) {
console.log(widgets); // ((this.$refs[wid.ref] as Array<Widget>)[0] as Widget).replaceStartPath( fragment as string);
this.widgetList = widgets.widgetList; // }
this.lastWidgetIndex = Number(widgets.currentRef); //刷新值
this.$forceUpdate(); this.importActiveWidgetList();
//替换startpath // for (var wid of this.widgetList) {
Vue.nextTick(() => { // ((this.$refs[wid.ref] as Array<Widget>)[0] as Widget).refresh();
// fragment = fragment.substring(1,fragment.length); // }
// for (var wid of this.widgetList) { });
// ((this.$refs[wid.ref] as Array<Widget>)[0] as Widget).replaceStartPath( fragment as string); }
// } });
//刷新值
this.importActiveWidgetList(); if (isCustomview == false) {
// for (var wid of this.widgetList) { //直接访问对应的值
// ((this.$refs[wid.ref] as Array<Widget>)[0] as Widget).refresh(); var dataURL = fragment;
// } this.dataAccess(dataURL);
}); }
}
});
} }
} }
// mounted() {
// var f = window.location.hash;
// var fragment = "a";
// fragment = f;
// fragment = fragment.substring(1, fragment.length);
// axios.get(fragment)
// .then(dataresponse => {
// var resourcetype = dataresponse.data.ResourceType;
// var samplePath = dataresponse.data.CFET2CORE_SAMPLE_PATH;
// this.addWidget(resourcetype);
// var tempRef = (this.lastWidgetIndex - 1).toString();
// this.pokeAndUpdateUI(tempRef, dataresponse.data);
// });
// }
exportActiveWidgetList(): AllWidgetConfig { exportActiveWidgetList(): AllWidgetConfig {
for (var widget of this.widgetList) { for (var widget of this.widgetList) {
widget.widgetConfig = ((this.$refs[widget.ref] as Array< widget.widgetConfig = ((this.$refs[widget.ref] as Array<
...@@ -179,13 +225,11 @@ export default class App extends Vue { ...@@ -179,13 +225,11 @@ export default class App extends Vue {
var widgetConfigList = new AllWidgetConfig(); var widgetConfigList = new AllWidgetConfig();
widgetConfigList.widgetList = this.widgetList; widgetConfigList.widgetList = this.widgetList;
widgetConfigList.currentRef = this.lastWidgetIndex.toString(); widgetConfigList.currentRef = this.lastWidgetIndex.toString();
console.log(widgetConfigList);
return widgetConfigList; return widgetConfigList;
} }
importActiveWidgetList() { importActiveWidgetList() {
for (var wid of this.widgetList) { for (var wid of this.widgetList) {
console.log(wid.widgetConfig);
((this.$refs[wid.ref] as Array<Widget>)[0] as Widget).setConfig( ((this.$refs[wid.ref] as Array<Widget>)[0] as Widget).setConfig(
wid.widgetConfig as WidgetConfig wid.widgetConfig as WidgetConfig
); );
...@@ -197,13 +241,11 @@ export default class App extends Vue { ...@@ -197,13 +241,11 @@ export default class App extends Vue {
const reader = new FileReader(); const reader = new FileReader();
reader.readAsText(file); reader.readAsText(file);
var widgets; var widgets;
// console.log(this.$refs);
reader.onload = e => { reader.onload = e => {
widgets = Object.assign( widgets = Object.assign(
new AllWidgetConfig(), new AllWidgetConfig(),
JSON.parse((e.target as any).result) JSON.parse((e.target as any).result)
); );
// console.log(widgets);
this.widgetList = widgets.widgetList; this.widgetList = widgets.widgetList;
this.lastWidgetIndex = Number(widgets.currentRef); this.lastWidgetIndex = Number(widgets.currentRef);
this.$forceUpdate(); this.$forceUpdate();
...@@ -211,13 +253,11 @@ export default class App extends Vue { ...@@ -211,13 +253,11 @@ export default class App extends Vue {
// changed here // changed here
this.importActiveWidgetList(); this.importActiveWidgetList();
}); });
// console.log(this.$refs);
}; };
} }
saveWidgetList(): void { saveWidgetList(): void {
var data = JSON.stringify(this.exportActiveWidgetList()); var data = JSON.stringify(this.exportActiveWidgetList());
console.log(data);
const blob = new Blob([data]); const blob = new Blob([data]);
if (window.navigator.msSaveOrOpenBlob) { if (window.navigator.msSaveOrOpenBlob) {
......
...@@ -34,13 +34,11 @@ export default class WidgetParams extends Vue{ ...@@ -34,13 +34,11 @@ export default class WidgetParams extends Vue{
path.forEach(element => { path.forEach(element => {
this.userInputData.set(element, ''); this.userInputData.set(element, '');
}); });
console.log(this.userInputData);
this.$forceUpdate(); this.$forceUpdate();
} }
setVariableInput(parentUserInputData:Map<string, string>) setVariableInput(parentUserInputData:Map<string, string>)
{ {
console.log(parentUserInputData);
for (var key of parentUserInputData.keys()) { for (var key of parentUserInputData.keys()) {
this.tempUserInputData[key] = parentUserInputData.get(key) as string; this.tempUserInputData[key] = parentUserInputData.get(key) as string;
} }
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
<b-row> <b-row>
<b-col> <b-col>
<div <div
v-if="getConfigValue!=''&&getConfigValue!=undefined"
style="width:100%;overflow:auto;border-style: solid; border-width: 1px;" style="width:100%;overflow:auto;border-style: solid; border-width: 1px;"
> >
<p style="float:left;margin:0px" class="largeFont">{{ getConfigValue }}</p> <p style="float:left;margin:0px" class="largeFont">{{ getConfigValue }}</p>
...@@ -110,7 +109,7 @@ export default class Config extends Widget { ...@@ -110,7 +109,7 @@ export default class Config extends Widget {
pathProcessor = new PathProcessor(); pathProcessor = new PathProcessor();
strMapObjChange = new StrMapObjChange(); strMapObjChange = new StrMapObjChange();
WidgetComponentName: string = "Config"; WidgetComponentName: string = "Config";
getConfigValue: string = ""; getConfigValue: string = " ";
setConfigValue: string = ""; setConfigValue: string = "";
pathId: string = ""; pathId: string = "";
userGetInputData = new Map<string, string>(); userGetInputData = new Map<string, string>();
...@@ -196,22 +195,16 @@ export default class Config extends Widget { ...@@ -196,22 +195,16 @@ export default class Config extends Widget {
//布置get输入参数 //布置get输入参数
var temp = this.config.data.get.userInputData; var temp = this.config.data.get.userInputData;
temp = JSON.parse(JSON.stringify(temp)); temp = JSON.parse(JSON.stringify(temp));
console.log(temp);
temp = this.strMapObjChange.objToStrMap(temp); temp = this.strMapObjChange.objToStrMap(temp);
console.log(temp);
this.userGetInputData = temp; this.userGetInputData = temp;
console.log(this.userGetInputData); /* */
(this.$refs.WidgetGetParams as WidgetParams).setVariableInput( (this.$refs.WidgetGetParams as WidgetParams).setVariableInput(
this.userGetInputData this.userGetInputData
); );
//布置set输入参数 //布置set输入参数
temp = this.config.data.set.userInputData; temp = this.config.data.set.userInputData;
temp = JSON.parse(JSON.stringify(temp)); temp = JSON.parse(JSON.stringify(temp));
console.log(temp);
temp = this.strMapObjChange.objToStrMap(temp); temp = this.strMapObjChange.objToStrMap(temp);
console.log(temp);
this.userSetInputData = temp; this.userSetInputData = temp;
console.log(this.userSetInputData); /* */
(this.$refs.WidgetSetParams as WidgetParams).setVariableInput( (this.$refs.WidgetSetParams as WidgetParams).setVariableInput(
this.userSetInputData this.userSetInputData
); );
...@@ -229,7 +222,6 @@ export default class Config extends Widget { ...@@ -229,7 +222,6 @@ export default class Config extends Widget {
temp = this.strMapObjChange.objToStrMap(temp); temp = this.strMapObjChange.objToStrMap(temp);
var Parameters: Map<string, string>; var Parameters: Map<string, string>;
Parameters = temp; Parameters = temp;
console.log(Parameters);
Parameters.forEach((value, key) => { Parameters.forEach((value, key) => {
count++; count++;
...@@ -250,12 +242,10 @@ export default class Config extends Widget { ...@@ -250,12 +242,10 @@ export default class Config extends Widget {
count = 0; count = 0;
var settemp = sample.Actions.set.Parameters; var settemp = sample.Actions.set.Parameters;
console.log(settemp);
settemp = JSON.parse(JSON.stringify(settemp)); settemp = JSON.parse(JSON.stringify(settemp));
settemp = this.strMapObjChange.objToStrMap(settemp); settemp = this.strMapObjChange.objToStrMap(settemp);
var SetParameters: Map<string, string>; var SetParameters: Map<string, string>;
SetParameters = settemp; SetParameters = settemp;
console.log(SetParameters);
SetParameters.forEach((value, key) => { SetParameters.forEach((value, key) => {
count++; count++;
...@@ -328,19 +318,30 @@ export default class Config extends Widget { ...@@ -328,19 +318,30 @@ export default class Config extends Widget {
async getData(url: string) { async getData(url: string) {
var apiLoad = url; var apiLoad = url;
await axios.get(apiLoad).then(response => { await axios.get(apiLoad, {
console.log(response); headers: {
'Pragma': 'no-cache',
'Cache-Control': 'no-cache'
}
}).then(response => {
this.getConfigValue = response.data.CFET2CORE_SAMPLE_VAL; this.getConfigValue = response.data.CFET2CORE_SAMPLE_VAL;
if(this.getConfigValue == undefined)
{
this.getConfigValue = "undefined";
}
console.log(this.getConfigValue); console.log(this.getConfigValue);
}); });
} }
async setData(url: string) { async setData(url: string) {
var apiLoad = url; var apiLoad = url;
await axios.post(apiLoad).then(response => { await axios.post(apiLoad, {
console.log(response); headers: {
'Pragma': 'no-cache',
'Cache-Control': 'no-cache'
}
}).then(response => {
this.setConfigValue = response.data.CFET2CORE_SAMPLE_VAL; this.setConfigValue = response.data.CFET2CORE_SAMPLE_VAL;
console.log(this.setConfigValue);
}); });
} }
...@@ -353,8 +354,6 @@ export default class Config extends Widget { ...@@ -353,8 +354,6 @@ export default class Config extends Widget {
this.userGetInputData, this.userGetInputData,
this.config.data.get.url this.config.data.get.url
); );
console.log(this.getConfigValue);
console.log(this.getPathwithVar);
await this.getData(this.getPathwithVar); await this.getData(this.getPathwithVar);
} }
...@@ -366,11 +365,20 @@ export default class Config extends Widget { ...@@ -366,11 +365,20 @@ export default class Config extends Widget {
this.userSetInputData, this.userSetInputData,
this.config.data.set.url this.config.data.set.url
); );
console.log(this.setConfigValue);
console.log(this.setPathwithVar);
await this.setData(this.setPathwithVar); await this.setData(this.setPathwithVar);
this.refresh(); this.getrefresh();
} }
getrefresh() {
var GetArgs: UpdatePayload = {
action: "get",
variables: (this.$refs
.WidgetGetParams as WidgetParams).getVariableValues(),
target: ["self"]
};
this.viewGetLoad(GetArgs);
}
} }
</script> </script>
......
...@@ -13,16 +13,15 @@ ...@@ -13,16 +13,15 @@
<br /> <br />
<b-row> <!-- <b-row>
<b-col> <b-col>
<div <div
v-if="StatusValue!=''&&StatusValue!=undefined"
style="width:100%;overflow:auto;border-style: solid; border-width: 1px;" style="width:100%;overflow:auto;border-style: solid; border-width: 1px;"
> >
<p style="float:left;margin:0px" class="largeFont">{{ StatusValue }}</p> <p style="float:left;margin:0px" class="largeFont">{{ StatusValue }}</p>
</div> </div>
</b-col> </b-col>
</b-row> </b-row> -->
<br /> <br />
...@@ -135,11 +134,8 @@ export default class Method extends Widget { ...@@ -135,11 +134,8 @@ export default class Method extends Widget {
//map不能序列化,必须要单独处理,这里的处理方法仅限map<string,string>类型 //map不能序列化,必须要单独处理,这里的处理方法仅限map<string,string>类型
var temp = this.config.data.userInputData; var temp = this.config.data.userInputData;
temp = JSON.parse(JSON.stringify(temp)); temp = JSON.parse(JSON.stringify(temp));
console.log(temp);
temp = this.strMapObjChange.objToStrMap(temp); temp = this.strMapObjChange.objToStrMap(temp);
console.log(temp);
this.userInputData = temp; this.userInputData = temp;
console.log(this.userInputData); /* */
(this.$refs.WidgetParams as WidgetParams).setVariableInput( (this.$refs.WidgetParams as WidgetParams).setVariableInput(
this.userInputData this.userInputData
); );
...@@ -175,9 +171,13 @@ export default class Method extends Widget { ...@@ -175,9 +171,13 @@ export default class Method extends Widget {
var f = this.config.data.url; var f = this.config.data.url;
var pokepath = "a"; var pokepath = "a";
pokepath = f; pokepath = f;
axios.get(pokepath).then(response => { axios.get(pokepath, {
headers: {
'Pragma': 'no-cache',
'Cache-Control': 'no-cache'
}
}).then(response => {
var resourcetype = response.data.ResourceType; var resourcetype = response.data.ResourceType;
console.log(resourcetype);
this.samplePoke(response.data); this.samplePoke(response.data);
this.updateUI(); this.updateUI();
}); });
...@@ -200,10 +200,17 @@ export default class Method extends Widget { ...@@ -200,10 +200,17 @@ export default class Method extends Widget {
async getData(url: string) { async getData(url: string) {
var apiLoad = url; var apiLoad = url;
await axios.put(apiLoad).then(response => { await axios.put(apiLoad, {
console.log(response); headers: {
'Pragma': 'no-cache',
'Cache-Control': 'no-cache'
}
}).then(response => {
this.StatusValue = response.data.CFET2CORE_SAMPLE_VAL; this.StatusValue = response.data.CFET2CORE_SAMPLE_VAL;
console.log(this.StatusValue); if(this.StatusValue == undefined)
{
this.StatusValue = "undefined";
}
}); });
} }
...@@ -216,8 +223,6 @@ export default class Method extends Widget { ...@@ -216,8 +223,6 @@ export default class Method extends Widget {
this.userInputData, this.userInputData,
this.config.data.url this.config.data.url
); );
console.log(this.StatusValue);
console.log(this.pathwithVar);
await this.getData(this.pathwithVar); await this.getData(this.pathwithVar);
} }
} }
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
<b-row> <b-row>
<b-col> <b-col>
<div <div
v-if="StatusValue!=''&&StatusValue!=undefined"
style="width:100%;overflow:auto;border-style: solid; border-width: 1px;" style="width:100%;overflow:auto;border-style: solid; border-width: 1px;"
> >
<p style="float:left;margin:0px" class="largeFont">{{ StatusValue }}</p> <p style="float:left;margin:0px" class="largeFont">{{ StatusValue }}</p>
...@@ -145,11 +144,8 @@ export default class State extends Widget { ...@@ -145,11 +144,8 @@ export default class State extends Widget {
//map不能序列化,必须要单独处理,这里的处理方法仅限map<string,string>类型 //map不能序列化,必须要单独处理,这里的处理方法仅限map<string,string>类型
var temp = this.config.data.userInputData; var temp = this.config.data.userInputData;
temp = JSON.parse(JSON.stringify(temp)); temp = JSON.parse(JSON.stringify(temp));
console.log(temp);
temp = this.strMapObjChange.objToStrMap(temp); temp = this.strMapObjChange.objToStrMap(temp);
console.log(temp);
this.userInputData = temp; this.userInputData = temp;
console.log(this.userInputData); /* */
(this.$refs.WidgetParams as WidgetParams).setVariableInput( (this.$refs.WidgetParams as WidgetParams).setVariableInput(
this.userInputData this.userInputData
); );
...@@ -185,7 +181,12 @@ export default class State extends Widget { ...@@ -185,7 +181,12 @@ export default class State extends Widget {
var f = this.config.data.url; var f = this.config.data.url;
var pokepath = "a"; var pokepath = "a";
pokepath = f; pokepath = f;
axios.get(pokepath).then(response => { axios.get(pokepath, {
headers: {
'Pragma': 'no-cache',
'Cache-Control': 'no-cache'
}
}).then(response => {
this.samplePoke(response.data); this.samplePoke(response.data);
this.updateUI(); this.updateUI();
}); });
...@@ -208,9 +209,17 @@ export default class State extends Widget { ...@@ -208,9 +209,17 @@ export default class State extends Widget {
async getData(url: string) { async getData(url: string) {
var apiLoad = url; var apiLoad = url;
await axios.get(apiLoad).then(response => { await axios.get(apiLoad, {
console.log(response); headers: {
'Pragma': 'no-cache',
'Cache-Control': 'no-cache'
}
}).then(response => {
this.StatusValue = response.data.CFET2CORE_SAMPLE_VAL; this.StatusValue = response.data.CFET2CORE_SAMPLE_VAL;
if(this.StatusValue == undefined)
{
this.StatusValue = "undefined";
}
switch (this.StatusValue.toString()) { switch (this.StatusValue.toString()) {
case "0": { case "0": {
this.StatusValue = "Idle"; this.StatusValue = "Idle";
...@@ -229,7 +238,6 @@ export default class State extends Widget { ...@@ -229,7 +238,6 @@ export default class State extends Widget {
break; break;
} }
} }
console.log(this.StatusValue);
}); });
} }
...@@ -242,8 +250,6 @@ export default class State extends Widget { ...@@ -242,8 +250,6 @@ export default class State extends Widget {
this.userInputData, this.userInputData,
this.config.data.url this.config.data.url
); );
console.log(this.StatusValue);
console.log(this.pathwithVar);
await this.getData(this.pathwithVar); await this.getData(this.pathwithVar);
} }
} }
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
<b-row> <b-row>
<b-col> <b-col>
<div <div
v-if="StatusValue!=''&&StatusValue!=undefined"
style="width:100%;overflow:auto;border-style: solid; border-width: 1px;" style="width:100%;overflow:auto;border-style: solid; border-width: 1px;"
> >
<p style="float:left;margin:0px" class="largeFont">{{ StatusValue }}</p> <p style="float:left;margin:0px" class="largeFont">{{ StatusValue }}</p>
...@@ -144,11 +143,8 @@ export default class Status extends Widget { ...@@ -144,11 +143,8 @@ export default class Status extends Widget {
//map不能序列化,必须要单独处理,这里的处理方法仅限map<string,string>类型 //map不能序列化,必须要单独处理,这里的处理方法仅限map<string,string>类型
var temp = this.config.data.userInputData; var temp = this.config.data.userInputData;
temp = JSON.parse(JSON.stringify(temp)); temp = JSON.parse(JSON.stringify(temp));
console.log(temp);
temp = this.strMapObjChange.objToStrMap(temp); temp = this.strMapObjChange.objToStrMap(temp);
console.log(temp);
this.userInputData = temp; this.userInputData = temp;
console.log(this.userInputData); /* */
(this.$refs.WidgetParams as WidgetParams).setVariableInput( (this.$refs.WidgetParams as WidgetParams).setVariableInput(
this.userInputData this.userInputData
); );
...@@ -184,7 +180,12 @@ export default class Status extends Widget { ...@@ -184,7 +180,12 @@ export default class Status extends Widget {
var f = this.config.data.url; var f = this.config.data.url;
var pokepath = "a"; var pokepath = "a";
pokepath = f; pokepath = f;
axios.get(pokepath).then(response => { axios.get(pokepath, {
headers: {
'Pragma': 'no-cache',
'Cache-Control': 'no-cache'
}
}).then(response => {
this.samplePoke(response.data); this.samplePoke(response.data);
this.updateUI(); this.updateUI();
}); });
...@@ -207,11 +208,20 @@ export default class Status extends Widget { ...@@ -207,11 +208,20 @@ export default class Status extends Widget {
async getData(url: string) { async getData(url: string) {
var apiLoad = url; var apiLoad = url;
await axios.get(apiLoad).then(response => { await axios
console.log(response); .get(apiLoad, {
this.StatusValue = response.data.CFET2CORE_SAMPLE_VAL; headers: {
console.log(this.StatusValue); Pragma: "no-cache",
}); "Cache-Control": "no-cache"
}
})
.then(response => {
this.StatusValue = response.data.CFET2CORE_SAMPLE_VAL;
if(this.StatusValue == undefined)
{
this.StatusValue = "undefined";
}
});
} }
//called when widgetParams action clicked //called when widgetParams action clicked
...@@ -223,8 +233,6 @@ export default class Status extends Widget { ...@@ -223,8 +233,6 @@ export default class Status extends Widget {
this.userInputData, this.userInputData,
this.config.data.url this.config.data.url
); );
console.log(this.StatusValue);
console.log(this.pathwithVar);
await this.getData(this.pathwithVar); await this.getData(this.pathwithVar);
} }
} }
......
...@@ -11,13 +11,17 @@ ...@@ -11,13 +11,17 @@
</b-col> </b-col>
</b-row> </b-row>
<b-row> <br />
<!-- <b-row>
<b-col> <b-col>
<div v-if="StatusValue!=''&&StatusValue!=undefined" style="width:100%;overflow:auto"> <div
<button style="float:left;" class="largeFont">{{ StatusValue }}</button> style="width:100%;overflow:auto;border-style: solid; border-width: 1px;"
>
<p style="float:left;margin:0px" class="largeFont">{{ StatusValue }}</p>
</div> </div>
</b-col> </b-col>
</b-row> </b-row> -->
<br /> <br />
...@@ -139,11 +143,8 @@ export default class Thing extends Widget { ...@@ -139,11 +143,8 @@ export default class Thing extends Widget {
//map不能序列化,必须要单独处理,这里的处理方法仅限map<string,string>类型 //map不能序列化,必须要单独处理,这里的处理方法仅限map<string,string>类型
var temp = this.config.data.userInputData; var temp = this.config.data.userInputData;
temp = JSON.parse(JSON.stringify(temp)); temp = JSON.parse(JSON.stringify(temp));
console.log(temp);
temp = this.strMapObjChange.objToStrMap(temp); temp = this.strMapObjChange.objToStrMap(temp);
console.log(temp);
this.userInputData = temp; this.userInputData = temp;
console.log(this.userInputData); /* */
(this.$refs.WidgetParams as WidgetParams).setVariableInput( (this.$refs.WidgetParams as WidgetParams).setVariableInput(
this.userInputData this.userInputData
); );
...@@ -151,7 +152,6 @@ export default class Thing extends Widget { ...@@ -151,7 +152,6 @@ export default class Thing extends Widget {
samplePoke(sample: any) { samplePoke(sample: any) {
var samplePath = sample.CFET2CORE_SAMPLE_PATH; var samplePath = sample.CFET2CORE_SAMPLE_PATH;
console.log(samplePath);
var pokedPath: string; var pokedPath: string;
pokedPath = samplePath; pokedPath = samplePath;
this.config.data.url = pokedPath; this.config.data.url = pokedPath;
...@@ -185,9 +185,7 @@ export default class Thing extends Widget { ...@@ -185,9 +185,7 @@ export default class Thing extends Widget {
async getData(url: string) { async getData(url: string) {
var apiLoad = url; var apiLoad = url;
await axios.get(apiLoad).then(response => { await axios.get(apiLoad).then(response => {
console.log(response);
this.StatusValue = response.data.CFET2CORE_SAMPLE_VAL; this.StatusValue = response.data.CFET2CORE_SAMPLE_VAL;
console.log(this.StatusValue);
}); });
} }
...@@ -200,8 +198,6 @@ export default class Thing extends Widget { ...@@ -200,8 +198,6 @@ export default class Thing extends Widget {
this.userInputData, this.userInputData,
this.config.data.url this.config.data.url
); );
console.log(this.StatusValue);
console.log(this.pathwithVar);
await this.getData(this.pathwithVar); await this.getData(this.pathwithVar);
} }
} }
......
...@@ -40,7 +40,10 @@ export default class waveView extends Widget { ...@@ -40,7 +40,10 @@ export default class waveView extends Widget {
config: WidgetConfig = { config: WidgetConfig = {
WidgetComponentName: 'WaveView', WidgetComponentName: 'WaveView',
data: { data: {
url:'', url:{
path:'',
timePath:''
},
userInputData:'', userInputData:'',
position:{ position:{
x1:'', x1:'',
...@@ -62,11 +65,13 @@ export default class waveView extends Widget { ...@@ -62,11 +65,13 @@ export default class waveView extends Widget {
} }
setConfig(widgetConfig:WidgetConfig): void { setConfig(widgetConfig:WidgetConfig): void {
this.config = widgetConfig; this.config = widgetConfig;
console.log(widgetConfig);
var temp = this.config.data.userInputData; var temp = this.config.data.userInputData;
this.updateUI(); this.updateUI();
var temp = JSON.parse(JSON.stringify(temp)); var temp = JSON.parse(JSON.stringify(temp));
temp = this.strMapObjChange.objToStrMap(temp); temp = this.strMapObjChange.objToStrMap(temp);
widgetConfig.data.userInputData = temp; widgetConfig.data.userInputData = temp;
console.log(widgetConfig);
(this.$refs.setBasicParams as setBasicParams).setConfig(widgetConfig); (this.$refs.setBasicParams as setBasicParams).setConfig(widgetConfig);
} }
parentUpdate(payload: UpdatePayload): void { parentUpdate(payload: UpdatePayload): void {
......
...@@ -2,7 +2,10 @@ ...@@ -2,7 +2,10 @@
<div> <div>
<div v-show="isShowCog" style="width:100%"> <div v-show="isShowCog" style="width:100%">
<b-input-group size="lg" prepend="Channel Path"> <b-input-group size="lg" prepend="Channel Path">
<b-input v-model="config.data.url" ></b-input> <b-input v-model="config.data.url.path" ></b-input>
</b-input-group><br>
<b-input-group size="lg" prepend="Channel TimePath">
<b-input v-model="config.data.url.timePath" ></b-input>
<b-input-group-addon> <b-input-group-addon>
<b-button variant="primary" @click="getPathIdParams">OK<span class="glyphicon glyphicon-save"></span></b-button> <b-button variant="primary" @click="getPathIdParams">OK<span class="glyphicon glyphicon-save"></span></b-button>
<b-button variant="info" @click="pathPoke">poke</b-button> <b-button variant="info" @click="pathPoke">poke</b-button>
...@@ -38,11 +41,15 @@ export default class setBasicParams extends Vue { ...@@ -38,11 +41,15 @@ export default class setBasicParams extends Vue {
isShowCog: boolean = false; isShowCog: boolean = false;
pathId!: string; pathId!: string;
userInputData = new Map<string, string>(); userInputData = new Map<string, string>();
tempUserInputData = new Map<string, string>();
strMapObjChange = new StrMapObjChange(); strMapObjChange = new StrMapObjChange();
config: WidgetConfig = { config: WidgetConfig = {
WidgetComponentName: "WaveView", WidgetComponentName: "WaveView",
data: { data: {
url: "10086.data.0/$startTime$/$endTime$/$dotNum$", url: {
path:'',
timePath:''
},
userInputData: "", userInputData: "",
position: { position: {
x1: "", x1: "",
...@@ -58,8 +65,8 @@ export default class setBasicParams extends Vue { ...@@ -58,8 +65,8 @@ export default class setBasicParams extends Vue {
created() { created() {
this.config.data.userInputData = this.userInputData; this.config.data.userInputData = this.userInputData;
this.getConfig = this.config; // this.getConfig = this.config;
this.updateConfig(); // this.updateConfig();
} }
refresh(){ refresh(){
var Args: UpdatePayload = { var Args: UpdatePayload = {
...@@ -73,6 +80,9 @@ export default class setBasicParams extends Vue { ...@@ -73,6 +80,9 @@ export default class setBasicParams extends Vue {
this.$emit("pathPoke"); this.$emit("pathPoke");
} }
setConfig(config: WidgetConfig) { setConfig(config: WidgetConfig) {
(this.$refs.WidgetParams as WidgetParams).setVariableList(
this.pathProcessor.extractVarFromPath(config.data.url.path)
);
(this.$refs.WidgetParams as WidgetParams).setVariableInput(config.data.userInputData); (this.$refs.WidgetParams as WidgetParams).setVariableInput(config.data.userInputData);
this.config = config; this.config = config;
console.log(this.config); console.log(this.config);
...@@ -87,12 +97,12 @@ export default class setBasicParams extends Vue { ...@@ -87,12 +97,12 @@ export default class setBasicParams extends Vue {
this.$emit("updateConfig", this.getConfig); this.$emit("updateConfig", this.getConfig);
} }
getPathIdParams() { getPathIdParams() {
if (this.tempUrl != this.config.data.url) { if (this.tempUrl != this.config.data.url.path) {
this.config.data.userInputData.clear(); this.config.data.userInputData.clear();
this.tempUrl = this.config.data.url; this.tempUrl = this.config.data.url.path;
} }
this.updateConfig(); this.updateConfig();
var url = this.config.data.url; var url = this.config.data.url.path;
(this.$refs.WidgetParams as WidgetParams).setVariableList( (this.$refs.WidgetParams as WidgetParams).setVariableList(
this.pathProcessor.extractVarFromPath(url) this.pathProcessor.extractVarFromPath(url)
); );
...@@ -113,27 +123,29 @@ export default class setBasicParams extends Vue { ...@@ -113,27 +123,29 @@ export default class setBasicParams extends Vue {
this.getConfig.data.position.y1 = ""; this.getConfig.data.position.y1 = "";
this.getConfig.data.position.y2 = ""; this.getConfig.data.position.y2 = "";
this.config.data.userInputData = Args.variables; this.config.data.userInputData = Args.variables;
this.tempUserInputData = this.config.data.userInputData;
var url = this.pathProcessor.FillPathWithVar( var url = this.pathProcessor.FillPathWithVar(
this.config.data.userInputData, this.config.data.userInputData,
this.config.data.url this.config.data.url.path
);
var timeUrl = this.pathProcessor.FillPathWithVar(
this.config.data.userInputData,
this.config.data.url.timePath
); );
var first = url.indexOf("/"); var first = url.indexOf("/");
var second = url.indexOf("/", first+1); var second = url.indexOf("/", first+1);
var third = url.indexOf("/", second+1) var third = url.indexOf("/", second+1)
this.pathId = url.slice(second+1, third); var fouth = url.indexOf("/", third+1)
this.pathId = url.slice(third+1, fouth);
var thingPath = url.slice(0, url.indexOf('/', 2)) var thingPath = url.slice(0, url.indexOf('/', 2))
var path = this.pathId; var path = this.pathId;
var dealPath = { var dealPath = {
thingPath:thingPath, thingPath:thingPath,
path:path path:path
} }
var dealFillPath = {
url:url.slice(url.indexOf('/', 1)+1),
thingPath:thingPath
}
this.$emit("getPathId", dealPath); this.$emit("getPathId", dealPath);
await this.getData(dealFillPath); await this.getData(url);
await this.getDataTimeAxis(dealFillPath); await this.getDataTimeAxis(timeUrl);
var myPlot = this.wave; var myPlot = this.wave;
var data_initial = [ var data_initial = [
{ {
...@@ -164,6 +176,9 @@ export default class setBasicParams extends Vue { ...@@ -164,6 +176,9 @@ export default class setBasicParams extends Vue {
var temp = this.temp; var temp = this.temp;
var getConfig = this.getConfig; var getConfig = this.getConfig;
var updateConfig = this.updateConfig; var updateConfig = this.updateConfig;
var pathProcessor = this.pathProcessor
var config = this.config;
var tempUserInputData = this.tempUserInputData;
zoom(); zoom();
function zoom() { function zoom() {
...@@ -184,21 +199,29 @@ export default class setBasicParams extends Vue { ...@@ -184,21 +199,29 @@ export default class setBasicParams extends Vue {
zoom_xmin = nowZoom_xmin; zoom_xmin = nowZoom_xmin;
var zoom_ymin = data["yaxis.range[0]"]; var zoom_ymin = data["yaxis.range[0]"];
var zoom_ymax = data["yaxis.range[1]"]; var zoom_ymax = data["yaxis.range[1]"];
var url = var params = [zoom_xmin * reAskDataScale, zoom_xmax / reAskDataScale, requiredDotNum]
path + var index = 0;
"/" + for(var key of tempUserInputData.keys()){
(zoom_xmin * reAskDataScale).toString() + tempUserInputData.set(key, params[index]);
"/" + index++;
(zoom_xmax / reAskDataScale).toString() + }
"/" + var url = pathProcessor.FillPathWithVar(
requiredDotNum; tempUserInputData,
config.data.url.path
);
var timeUrl = pathProcessor.FillPathWithVar(
tempUserInputData,
config.data.url.timePath
);
console.log(url);
console.log(timeUrl);
getConfig.data.position.x1 = zoom_xmin; getConfig.data.position.x1 = zoom_xmin;
getConfig.data.position.x2 = zoom_xmax; getConfig.data.position.x2 = zoom_xmax;
getConfig.data.position.y1 = zoom_ymin; getConfig.data.position.y1 = zoom_ymin;
getConfig.data.position.y2 = zoom_ymax; getConfig.data.position.y2 = zoom_ymax;
updateConfig(); updateConfig();
getData(url); // getData(url);
getDataTimeAxis(url); // getDataTimeAxis(timeUrl);
var data_update = [ var data_update = [
{ {
x: temp.dataTimeAxis, x: temp.dataTimeAxis,
...@@ -237,14 +260,14 @@ export default class setBasicParams extends Vue { ...@@ -237,14 +260,14 @@ export default class setBasicParams extends Vue {
Plotly.newPlot(myPlot, data_update, data_layout, config); Plotly.newPlot(myPlot, data_update, data_layout, config);
} }
async getData(url: any) { async getData(url: any) {
var apiLoad = url.thingPath + "/DataByTimeFuzzy/" + url.url; var apiLoad = url;
console.log(apiLoad);//改 console.log(apiLoad);//改
await axios.get(apiLoad).then(response => { await axios.get(apiLoad).then(response => {
this.temp.data = response.data.CFET2CORE_SAMPLE_VAL; this.temp.data = response.data.CFET2CORE_SAMPLE_VAL;
}); });
} }
async getDataTimeAxis(url: any) { async getDataTimeAxis(url: any) {
var apiLoad = url.thingPath + "/DataByTimeFuzzyTimeAxis/" + url.url; var apiLoad = url;
await axios.get(apiLoad).then(response => { await axios.get(apiLoad).then(response => {
this.temp.dataTimeAxis = response.data.CFET2CORE_SAMPLE_VAL; this.temp.dataTimeAxis = response.data.CFET2CORE_SAMPLE_VAL;
}); });
......
<template> <template>
<div class="smallFont" style="float:left width:100%"> <div class="largeFont" style="float:left width:100%">
<span>Basic Path :&nbsp;{{ basePathId }}</span><br> <span>Basic Path :&nbsp;{{ basePathId }}</span><br>
<span> Rate: {{ sampleId }}</span><br> <span> Rate: {{ sampleId }}</span><br>
<span>length: {{ lengthId }}</span> <span>length: {{ lengthId }}</span>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment