Commit cdb22744 authored by WuFeiyang's avatar WuFeiyang

版本1.2 修复了cache的问题

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