Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mmt-errorView
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Christian Maeder
mmt-errorView
Commits
83d19f57
Commit
83d19f57
authored
Jan 29, 2015
by
cmaeder
Browse files
Options
Downloads
Patches
Plain Diff
added limit and record count
parent
4ada818b
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/main/resource/search.html
+3
-2
3 additions, 2 deletions
src/main/resource/search.html
src/main/resource/static/search.js
+11
-1
11 additions, 1 deletion
src/main/resource/static/search.js
src/test/scala/CamelTest.scala
+14
-2
14 additions, 2 deletions
src/test/scala/CamelTest.scala
with
28 additions
and
5 deletions
src/main/resource/search.html
+
3
−
2
View file @
83d19f57
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
<link
rel=
"stylesheet"
href=
"static/search.css"
/>
<link
rel=
"stylesheet"
href=
"static/search.css"
/>
</head>
</head>
<body>
<body>
<h
2
>
Search
</h
2
>
<h
3
>
Search
</h
3
>
<div
ng-controller=
"SearchController"
>
<div
ng-controller=
"SearchController"
>
<li><input
type=
"checkbox"
ng-model=
"columns.id"
/>
row id
</li>
<li><input
type=
"checkbox"
ng-model=
"columns.id"
/>
row id
</li>
...
@@ -16,8 +16,9 @@
...
@@ -16,8 +16,9 @@
<li><input
type=
"checkbox"
ng-model=
"columns.errType"
/>
error type
</li>
<li><input
type=
"checkbox"
ng-model=
"columns.errType"
/>
error type
</li>
<li><input
type=
"checkbox"
ng-model=
"columns.shortMsg"
/>
short message
</li>
<li><input
type=
"checkbox"
ng-model=
"columns.shortMsg"
/>
short message
</li>
<li><input
type=
"checkbox"
ng-model=
"columns.longMsg"
/>
long message
</li>
<li><input
type=
"checkbox"
ng-model=
"columns.longMsg"
/>
long message
</li>
<p
/
>
<p
>
number of records: {{number}}
</p
>
<form
ng-submit=
"search()"
>
<form
ng-submit=
"search()"
>
<p>
maximal entries:
<input
type=
"integer"
ng-model=
"maxNumber"
size=
"5"
/></p>
<input
type=
"text"
ng-model=
"searchText"
size=
"20"
<input
type=
"text"
ng-model=
"searchText"
size=
"20"
placeholder=
"add new search string"
/>
placeholder=
"add new search string"
/>
<input
class=
"btn-primary"
type=
"submit"
value=
"search"
/>
<input
class=
"btn-primary"
type=
"submit"
value=
"search"
/>
...
...
This diff is collapsed.
Click to expand it.
src/main/resource/static/search.js
+
11
−
1
View file @
83d19f57
...
@@ -8,11 +8,21 @@ angular.module('searchApp', []).controller('SearchController',
...
@@ -8,11 +8,21 @@ angular.module('searchApp', []).controller('SearchController',
,
shortMsg
:
true
,
shortMsg
:
true
,
longMsg
:
false
};
,
longMsg
:
false
};
$scope
.
results
=
[];
$scope
.
results
=
[];
$scope
.
number
=
0
;
$scope
.
maxNumber
=
100
;
$scope
.
searchText
=
''
;
$scope
.
search
=
function
()
{
$scope
.
search
=
function
()
{
if
(
$scope
.
searchText
)
{
if
(
$scope
.
searchText
)
{
$http
.
get
(
'
search?text=
'
+
$scope
.
searchText
).
success
(
function
(
data
)
{
$http
.
get
(
'
search?limit=
'
+
$scope
.
maxNumber
+
'
&text=
'
+
$scope
.
searchText
).
success
(
function
(
data
)
{
$scope
.
results
=
data
;
$scope
.
results
=
data
;
});
});
};
};
$scope
.
count
();
};
$scope
.
count
=
function
()
{
$http
.
get
(
'
count?text=
'
+
$scope
.
searchText
).
success
(
function
(
data
)
{
$scope
.
number
=
data
[
0
].
count
;
});
};
};
}
]);
}
]);
This diff is collapsed.
Click to expand it.
src/test/scala/CamelTest.scala
+
14
−
2
View file @
83d19f57
import
java.util
import
org.apache.camel.Exchange
import
org.apache.camel.component.jackson.JacksonDataFormat
import
org.apache.camel.component.jackson.JacksonDataFormat
import
org.apache.camel.model.DataFormatDefinition
import
org.apache.camel.model.DataFormatDefinition
import
org.apache.camel.scala.dsl.builder.RouteBuilder
import
org.apache.camel.scala.dsl.builder.RouteBuilder
...
@@ -6,9 +9,18 @@ import org.eclipse.jetty.server.handler.ResourceHandler
...
@@ -6,9 +9,18 @@ import org.eclipse.jetty.server.handler.ResourceHandler
object
CamelTest
{
object
CamelTest
{
def
query2HashMap
(
ex
:
Exchange
)
:
util.HashMap
[
String
,
String
]
=
{
val
hm
=
new
util
.
HashMap
[
String
,
String
]()
hm
.
put
(
"shortMsg"
,
"%"
+
ex
.
getIn
.
getHeader
(
"text"
)
+
"%"
)
hm
.
put
(
"limit"
,
ex
.
getIn
.
getHeader
(
"limit"
).
toString
)
hm
}
class
MyRouteBuilder
extends
RouteBuilder
{
class
MyRouteBuilder
extends
RouteBuilder
{
(
"jetty:http://localhost:8383/search"
transform
(
ex
=>
"%"
+
ex
.
getIn
.
getHeader
(
"text"
)
+
"%"
))
-->
(
"jetty:http://localhost:8383/count"
transform
(
ex
=>
"%"
+
ex
.
getIn
.
getHeader
(
"text"
)
+
"%"
))
-->
"db:SELECT * FROM errors WHERE shortMsg LIKE #"
marshal
(
new
DataFormatDefinition
(
new
JacksonDataFormat
()))
"db:SELECT COUNT(*) as count FROM errors WHERE shortMsg LIKE #"
marshal
new
DataFormatDefinition
(
new
JacksonDataFormat
())
(
"jetty:http://localhost:8383/search"
transform
query2HashMap
)
-->
"db:SELECT * FROM errors WHERE shortMsg LIKE :#shortMsg LIMIT :#limit"
marshal
new
DataFormatDefinition
(
new
JacksonDataFormat
())
"jetty:http://localhost:8383/static?matchOnUriPrefix=true&handlers=#staticHandler"
-->
"log:a"
"jetty:http://localhost:8383/static?matchOnUriPrefix=true&handlers=#staticHandler"
-->
"log:a"
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment