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/08 08:47:54 UTC

[incubator-skywalking-ui] 02/02: Fix #142 the default value of applicationId should be 'All application'

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

commit ac0f455ffdd694314455f0f62c950f42201894d0
Author: hanahmily <ha...@gmail.com>
AuthorDate: Thu Mar 8 16:45:00 2018 +0800

    Fix #142 the default value of applicationId should be 'All application'
---
 src/models/trace.js       |  5 +++++
 src/routes/Trace/Trace.js | 19 +++++++++++--------
 src/utils/models.js       |  8 +++++++-
 3 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/src/models/trace.js b/src/models/trace.js
index df350ce..4c2ade1 100644
--- a/src/models/trace.js
+++ b/src/models/trace.js
@@ -94,6 +94,11 @@ export default generateModal({
     },
   },
   optionsQuery,
+  defaultOption: {
+    applicationId: {
+      label: 'All Application',
+    },
+  },
   dataQuery,
   effects: {
     *fetchSpans({ payload }, { call, put }) {
diff --git a/src/routes/Trace/Trace.js b/src/routes/Trace/Trace.js
index 8dec0a7..93510e2 100644
--- a/src/routes/Trace/Trace.js
+++ b/src/routes/Trace/Trace.js
@@ -124,33 +124,36 @@ export default class Trace extends PureComponent {
     const { trace: { variables: { options } } } = this.props;
     return (
       <Form onSubmit={this.handleSearch} layout="inline">
-        <Row gutter={{ md: 8, lg: 8, xl: 8 }}>
-          <Col xl={4} sm={24}>
+        <Row gutter={{ md: 8, lg: 12, xl: 8 }}>
+          <Col xl={4} lg={12} sm={24}>
             <FormItem label="Application">
               {getFieldDecorator('applicationId')(
-                <Select placeholder="No application" style={{ width: '100%' }}>
+                <Select placeholder="All application" style={{ width: '100%' }}>
                   {options.applicationId && options.applicationId.map((app) => {
-                      return (<Option key={app.key} value={app.key}>{app.label}</Option>);
+                      return (
+                        <Option key={app.key ? app.key : -1} value={app.key}>
+                          {app.label}
+                        </Option>);
                     })}
                 </Select>
               )}
             </FormItem>
           </Col>
-          <Col xl={4} sm={24}>
+          <Col xl={4} lg={12} sm={24}>
             <FormItem label="TraceId">
               {getFieldDecorator('traceId')(
                 <Input placeholder="Input trace id" />
               )}
             </FormItem>
           </Col>
-          <Col xl={6} sm={24}>
+          <Col xl={6} lg={12} sm={24}>
             <FormItem label="OperationName">
               {getFieldDecorator('operationName')(
                 <Input placeholder="Input operation name" />
               )}
             </FormItem>
           </Col>
-          <Col xl={6} sm={24}>
+          <Col xl={6} lg={12} sm={24}>
             <FormItem label="DurationRange">
               {getFieldDecorator('minTraceDuration')(
                 <InputNumber style={{ width: '40%' }} />
@@ -160,7 +163,7 @@ export default class Trace extends PureComponent {
               )}
             </FormItem>
           </Col>
-          <Col xl={4} sm={24}>
+          <Col xl={4} lg={12} sm={24}>
             <span className={styles.submitButtons}>
               <Button type="primary" htmlType="submit">Search</Button>
             </span>
diff --git a/src/utils/models.js b/src/utils/models.js
index a3e47d7..82a67bd 100644
--- a/src/utils/models.js
+++ b/src/utils/models.js
@@ -18,7 +18,7 @@
 
 import { query as queryService } from '../services/graphql';
 
-export function generateModal({ namespace, dataQuery, optionsQuery, state = {},
+export function generateModal({ namespace, dataQuery, optionsQuery, defaultOption, state = {},
   effects = {}, reducers = {}, subscriptions = {} }) {
   return {
     namespace,
@@ -76,6 +76,12 @@ export function generateModal({ namespace, dataQuery, optionsQuery, state = {},
         Object.keys(allOptions).forEach((_) => {
           const thisOptions = allOptions[_];
           if (!values[_]) {
+            if (defaultOption[_]) {
+              defaultValues[_] = defaultOption[_].key;
+              defaultLabels[_] = defaultOption[_].label;
+              amendOptions[_] = [defaultOption[_], ...thisOptions];
+              return;
+            }
             if (thisOptions.length > 0) {
               defaultValues[_] = thisOptions[0].key;
               defaultLabels[_] = thisOptions[0].label;

-- 
To stop receiving notification emails like this one, please contact
hanahmily@apache.org.