You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@skywalking.apache.org by ha...@apache.org on 2018/03/09 09:36:13 UTC
[incubator-skywalking-ui] branch bug/e2e updated: Refactor trace
query condition
This is an automated email from the ASF dual-hosted git repository.
hanahmily pushed a commit to branch bug/e2e
in repository https://gitbox.apache.org/repos/asf/incubator-skywalking-ui.git
The following commit(s) were added to refs/heads/bug/e2e by this push:
new 5591d86 Refactor trace query condition
5591d86 is described below
commit 5591d865731dce5e0bc308d5be677c032643cae6
Author: hanahmily <ha...@gmail.com>
AuthorDate: Fri Mar 9 17:17:14 2018 +0800
Refactor trace query condition
---
src/routes/Trace/Trace.js | 15 +++++++++------
src/utils/models.js | 13 +++++++------
2 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/src/routes/Trace/Trace.js b/src/routes/Trace/Trace.js
index 93510e2..f86737c 100644
--- a/src/routes/Trace/Trace.js
+++ b/src/routes/Trace/Trace.js
@@ -25,7 +25,11 @@ import styles from './Trace.less';
const { Option } = Select;
const FormItem = Form.Item;
-
+const initPaging = {
+ pageNum: 1,
+ pageSize: 10,
+ needTotal: true,
+};
@connect(state => ({
trace: state.trace,
@@ -65,6 +69,9 @@ export default class Trace extends PureComponent {
const filteredVariables = { ...variables };
filteredVariables.queryDuration = filteredVariables.duration;
delete filteredVariables.duration;
+ if (!filteredVariables.paging) {
+ filteredVariables.paging = initPaging;
+ }
this.props.dispatch({
type: 'trace/fetchData',
payload: { variables: { condition: filteredVariables } },
@@ -84,11 +91,7 @@ export default class Trace extends PureComponent {
values: {
...fieldsValue,
queryDuration: duration,
- paging: {
- pageNum: 1,
- pageSize: 10,
- needTotal: true,
- },
+ paging: initPaging,
},
},
});
diff --git a/src/utils/models.js b/src/utils/models.js
index e3712bf..26cd596 100644
--- a/src/utils/models.js
+++ b/src/utils/models.js
@@ -78,23 +78,24 @@ export function generateModal({ namespace, dataQuery, optionsQuery, defaultOptio
const defaultLabels = {};
Object.keys(allOptions).forEach((_) => {
const thisOptions = allOptions[_];
+ let newOptions = [...thisOptions];
+ if (defaultOption && defaultOption[_]) {
+ newOptions = [defaultOption[_], ...newOptions];
+ }
if (!values[_]) {
if (defaultOption && defaultOption[_]) {
defaultValues[_] = defaultOption[_].key;
defaultLabels[_] = defaultOption[_].label;
- amendOptions[_] = [defaultOption[_], ...thisOptions];
- return;
- }
- if (thisOptions.length > 0) {
+ } else if (thisOptions.length > 0) {
defaultValues[_] = thisOptions[0].key;
defaultLabels[_] = thisOptions[0].label;
}
- return;
}
const key = values[_];
if (!thisOptions.find(o => o.key === key)) {
- amendOptions[_] = [...thisOptions, { key, label: labels[_] }];
+ newOptions = [...newOptions, { key, label: labels[_] }];
}
+ amendOptions[_] = newOptions;
});
variables.options = {
...options,
--
To stop receiving notification emails like this one, please contact
hanahmily@apache.org.