Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate chart to scalar with Vue #268

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 29 additions & 35 deletions frontend/src/scalars/Scalars.vue
Original file line number Diff line number Diff line change
@@ -1,34 +1,27 @@
<template>
<div class="visual-dl-page-container">
<div>I AM SCALARS</div>

<div class="visual-dl-page-left">
<div>
<p>
I am chart page, to show all matched tags
</p>
<p>
tagList: {{ filteredConfig }}
</p>
<p>
runsItems: {{ runsItems }}
</p>
<p>
title="Tags matching {{config.groupNameReg}}"
</p>
</div>

<div>
<p>
I am also a chart page, but I should render groupedTags
</p>
</div>
<ui-chart-page
:expand="true"
:config="filteredConfig"
:runsItems="runsItems"
:tagList="filteredTagsList"
:title="'Tags matching' + config.groupNameReg"
></ui-chart-page>
<ui-chart-page
v-for="item in groupedTags"
:config="filteredConfig"
:runsItems="runsItems"
:tagList="item.tags"
:title="item.group"
></ui-chart-page>
</div>

<div class="visual-dl-page-right">
<div class="visual-dl-page-config-container">
<Config :runsItems="config.runs"
<ui-config :runsItems="runsItems"
:config="config"
></Config>
></ui-config>
</div>
</div>
</div>
Expand All @@ -39,14 +32,15 @@ import {getPluginScalarsTags, getRuns} from '../service';
import {debounce, flatten, uniq, isArray} from 'lodash';
import autoAdjustHeight from '../common/util/autoAdjustHeight';

import Config from './ui/config'
import Config from './ui/Config.vue'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can also do import ui-config from './ui/Config.vue'
and simply do components: {
ui-config
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm...compiler complains when I do import ui-config, "-" is not allowed in this case

import ChartPage from './ui/ChartPage';

export default {
components: {
Config
'ui-config': Config,
'ui-chart-page': ChartPage
},
name: 'Scalars',
data () {
data() {
return {
runsArray: [],
tags: [],
Expand All @@ -59,7 +53,8 @@ export default {
outlier: [],
runs: [],
running: true
}
},
filteredTagsList: []
}
},
computed: {
Expand Down Expand Up @@ -119,12 +114,12 @@ export default {
});
},
filteredConfig() {
let tansformArr = ['downloadLink', 'outlier'];
let transformArr = ['downloadLink', 'outlier'];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch.

let config = this.config || {};
let filteredConfig = {};
Object.keys(config).forEach(key => {
let val = config[key];
if (tansformArr.indexOf(key) > -1) {
if (transformArr.indexOf(key) > -1) {
filteredConfig[key] = isArray(val) && val[0] === 'yes';
}
else {
Expand All @@ -144,8 +139,8 @@ export default {
});

getRuns().then(({errno, data}) => {
this.runsArray = data
this.config.runs = data
this.runsArray = data;
this.config.runs = data;
});

// TODO: Migrate this line from San to Vue
Expand All @@ -162,8 +157,7 @@ export default {
}
let tagsList = this.tagsList || [];
let regExp = new RegExp(groupNameReg);
let filtedTagsList = tagsList.filter(item => regExp.test(item.tag));
this.filteredTagsList = filtedTagsList;
this.filteredTagsList = tagsList.filter(item => regExp.test(item.tag));
}
}
};
Expand Down
Loading