Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
unstable
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PROINFODATA
unstable
Commits
cfacbe43
Commit
cfacbe43
authored
11 years ago
by
Eduardo L. Buratti
Browse files
Options
Downloads
Patches
Plain Diff
web: Fix data ordering to match db result order
Signed-off-by:
Eduardo L. Buratti
<
elb09@c3sl.ufpr.br
>
parent
38b9bd0b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
web/app/models/OS.java
+18
-10
18 additions, 10 deletions
web/app/models/OS.java
web/public/charts/os.js
+15
-13
15 additions, 13 deletions
web/public/charts/os.js
with
33 additions
and
23 deletions
web/app/models/OS.java
+
18
−
10
View file @
cfacbe43
package
models
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.*
;
import
java.sql.*
;
import
play.db.*
;
...
...
@@ -14,21 +12,31 @@ import org.codehaus.jackson.*;
public
class
OS
implements
java
.
io
.
Serializable
{
private
static
final
long
serialVersionUID
=
-
79175334936007860L
;
private
Map
<
String
,
ArrayList
<
String
[]
>>
items
;
private
List
<
Map
<
String
,
Object
>>
items
;
public
OS
()
{
this
.
items
=
new
HashMap
<
String
,
ArrayList
<
String
[]
>>();
this
.
items
=
new
ArrayList
<
Map
<
String
,
Object
>>();
}
public
void
addRow
(
String
os
,
String
date
,
Long
count
)
{
ArrayList
<
String
[]>
list
=
this
.
items
.
get
(
os
)
;
Map
<
String
,
Object
>
row
=
null
;
if
(
list
==
null
)
list
=
new
ArrayList
<
String
[]>();
for
(
Map
<
String
,
Object
>
r
:
this
.
items
)
{
if
(
r
.
get
(
"name"
).
equals
(
os
))
{
row
=
r
;
break
;
}
}
list
.
add
(
new
String
[]
{
date
,
count
.
toString
()});
if
(
row
==
null
)
{
row
=
new
HashMap
<
String
,
Object
>();
row
.
put
(
"name"
,
os
);
row
.
put
(
"data"
,
new
ArrayList
<
String
[]>());
this
.
items
.
add
(
row
);
}
this
.
items
.
put
(
os
,
list
);
List
<
String
[]>
list
=
(
List
)
row
.
get
(
"data"
);
list
.
add
(
new
String
[]
{
date
,
count
.
toString
()});
}
public
JsonNode
toJson
()
{
...
...
This diff is collapsed.
Click to expand it.
web/public/charts/os.js
+
15
−
13
View file @
cfacbe43
...
...
@@ -185,9 +185,9 @@ var Charts = {
}
var
distrosArray
=
[];
$
.
each
(
data
,
function
(
key
,
value
)
{
var
val
=
parseInt
(
value
[
0
][
1
]);
var
distro
=
distros
[
key
];
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
var
val
=
parseInt
(
data
[
i
].
data
[
0
][
1
]);
var
distro
=
distros
[
data
[
i
].
name
];
/*if (key === "Linux Educacional 4.0") {
val = 1;
...
...
@@ -198,10 +198,10 @@ var Charts = {
}
distro
.
category
.
y
+=
val
;
distro
.
name
=
key
;
distro
.
name
=
data
[
i
].
name
;
distro
.
y
+=
val
;
total
+=
val
;
}
)
;
};
var
les
=
[],
windows
=
[],
...
...
@@ -259,23 +259,25 @@ var Charts = {
contentType
:
"
application/json
"
,
data
:
'
{"type": "historical", "project": "
'
+
project
+
'
"}
'
,
success
:
function
(
data
)
{
$
.
each
(
data
,
function
(
key
,
value
)
{
var
distro
=
distros
[
key
];
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
var
serie
=
data
[
i
];
var
distro
=
distros
[
serie
.
name
];
if
(
typeof
distro
===
'
undefined
'
)
{
distro
=
DEFAULT_DISTRO
;
}
for
(
var
i
=
0
;
i
<
value
.
length
;
i
++
)
{
value
[
i
][
0
]
=
parseInt
(
value
[
i
][
0
]);
value
[
i
][
1
]
=
parseInt
(
value
[
i
][
1
]);
for
(
var
j
=
0
;
j
<
serie
.
data
.
length
;
j
++
)
{
serie
.
data
[
j
][
0
]
=
parseInt
(
serie
.
data
[
j
][
0
]);
serie
.
data
[
j
][
1
]
=
parseInt
(
serie
.
data
[
j
][
1
]);
};
Charts
.
histChart
.
addSeries
({
name
:
key
,
data
:
value
,
name
:
serie
.
name
,
data
:
serie
.
data
,
color
:
distro
.
color
},
false
);
}
)
;
};
Charts
.
histChart
.
redraw
();
...
...
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