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

Conversation

nickyfantasy
Copy link
Contributor

No description provided.

* use default prop instead of duplicate data and prop
* use function instead of shorthand declaration with data
</v-btn>
<v-select
v-if="downloadLink"
style="width:100px;"

Choose a reason for hiding this comment

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

If you have a fixed value, why not putting it in css

Copy link
Contributor Author

Choose a reason for hiding this comment

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

coz of laziness

},
data() {
return {
width: 400,

Choose a reason for hiding this comment

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

Why are these stored as component data? Unless this changes (which we don't have right now right?), this should probably not be computed

Copy link
Collaborator

Choose a reason for hiding this comment

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

Storing width and height in the data seems fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think they put it here because user can expand/shrink the chart

);
seriesOption = flatten(seriesOption);
let legendOptions = tagList.map(item => item.run);
let that = this;

Choose a reason for hiding this comment

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

let view = this; Who came up with that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

lol, I coped all these from original san files, we actually do not need a local variable at all, just use this. for the rest of context

};
return getPluginScalarsScalars(params);
});
axios.all(requestList).then(resArray => {

Choose a reason for hiding this comment

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

Requests should probably not be made from within component. Can you move this to a service / API manager outside?

},

expandArea() {
let pageBoxWidth = document.getElementsByClassName('visual-dl-chart-page-box')[0].offsetWidth;

Choose a reason for hiding this comment

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

You should be using something like refs to find elements rendered by this component, instead of DOM query selector lookups.

https://vuejs.org/v2/guide/components.html#Child-Component-Refs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

very good idea. ref is the way to go, I will replace all document.getElementsBy... with ref. However in this case it is finding the parent component element...let me see if there is a way to do it

Copy link
Collaborator

@jetfuel jetfuel left a comment

Choose a reason for hiding this comment

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

Otherwise LGTM

@@ -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

@@ -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.

const intervalTime = 15;

export default {
components: {
Copy link
Collaborator

Choose a reason for hiding this comment

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

If we don't plan to include any component, let's remove the components for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure

},
data() {
return {
width: 400,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Storing width and height in the data seems fine.

horizontal: function(val) {
this.setChartHorizon();
},
// runs: function(val) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this commented out?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They did not define setChartsRuns(line 102) in anywhere. But I expect they add this for future purpose, so I comment it for now.

</template>
<script>
// import ExpandPanel from '../../common/component/ExpandPanel';
import Chart from './Chart.vue';
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it is possible to import without adding .vue

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thats true

@@ -1,26 +1,26 @@
<template>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a particular reason for the renaming?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like Vue coding standard Component name starts with capital

<v-slider label="Smoothing" v-bind:max="100" v-bind:min="0" v-model="config.smoothing" dark></v-slider>
<v-text-field v-model="config.smoothing" type="number" dark></v-text-field>
<div>
<v-slider label="Smoothing" :max="0.999" :min="0" :step="0.001" v-model="config.smoothing" dark></v-slider>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does v-slider take step smaller than 1? I thought it only take Integer number

Copy link
Contributor Author

Choose a reason for hiding this comment

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

v-slider takes type Number which can be double or integer

@nickyfantasy nickyfantasy merged commit 937a9e0 into PaddlePaddle:migrateFromSanToVue Feb 20, 2018
jetfuel added a commit that referenced this pull request Mar 8, 2018
* Initial checking to setup Vue basic requirements. (#264)

Add App.vue
Add AppMenu.vue

* Vue with app menu (#265)

* Add vuetify framework
Update AppMenu.vue to include the basic menu item.

* use name as key.

* Add major components (#266)

* Add vuetify framework
Update AppMenu.vue to include the basic menu item.

* use name as key.

* Add Scalars, Images, Histograms, Graph.

* Switch to use the stylus language for CSS

* Port functions from Scalars.san to Scalars.vue

* Add config vue (#267)

* Add vuetify framework
Update AppMenu.vue to include the basic menu item.

* use name as key.

* Add Config Vue

* Integrate chart to scalar with Vue (#268)

* Fix warnings from Vue compiler
* use default prop instead of duplicate data and prop
* use function instead of shorthand declaration with data

* refract naming style, fix scalar options

* Fix config UI

* Add chart and chart page and integrate to scalar

* update with varun and jeff's comments

* Add images config (#270)

* Add vuetify framework
Update AppMenu.vue to include the basic menu item.

* use name as key.

* Add the Config.vue for Images

* Add the CharPage.vue and Image.vue

* Hook up the config to the image.vue so that the image height and width can update

* Show Scalar Data and add ExpandPanel (#272)

* Watch tagInfo changes to update chart and fix tooltip issue

* Add expand panel and maintain isShow state in the panel

* Add Expand Panel in Image

* Add watch group name reg (#273)

* Add vuetify framework
Update AppMenu.vue to include the basic menu item.

* use name as key.

* Add Watch on the groupNameReg

* Allow the nav bar to persist the selected item style. (#274)

* Fix the incorrect pagination issue. (#276)

* Add the Graph.vue and the Config.vue for Graph tab (#277)

* Add the Histogram related vue files. (#278)

* Fix error message on charts (#279)

* Make sure to clear the chart before each use.

* Add key for v-for loop.

* Add theme and fix UI (#280)

-Apply theme color in Vuetify
-Add main.styl to override Vuetify default stylus variables
-Add relative path in web pack config to find variables.styl

* Fix multiple scalar issues: (#283)

* Fix multiple scalar issues:
-download link / outliers should take boolean value instead of array
-download link now show proper selector of runsItem and download button
-Use tag as key to prevent chart re-rendering
-Add missing label in scalar config and fix UI

* simply use index for key because scalar has different tag info structure from image and histogram

* Fix font size and reorganize css and stylus (#287)

* Fix comments

* placeholder index.js

* Fix issue where download data link points to empty run (#294)

-Dropdown should only display non empty runs
-Select first run by default
-Remove drop down if all are empty runs
-Refract download type to runItemForDownload
-Add train run and multiple tags in mock data

* Fix error when scalar data empty (#298)

-Error comes in when trying to access elements inside empty data
-When one of the runs has empty data, the chart will display nothing even other run has non empty data
-Fix by checking length of data before accessing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants