Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
iobserve-ui-frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
iobserve-ui
iobserve-ui-frontend
Commits
31f2f3c9
Commit
31f2f3c9
authored
8 years ago
by
Mathis Neumann
Browse files
Options
Downloads
Patches
Plain Diff
update the graph whenever the changelog changes
parent
ba3dbf34
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/controllers/deployments/single.js
+34
-0
34 additions, 0 deletions
app/controllers/deployments/single.js
app/routes/deployments/single.js
+22
-14
22 additions, 14 deletions
app/routes/deployments/single.js
app/templates/deployments/single.hbs
+1
-1
1 addition, 1 deletion
app/templates/deployments/single.hbs
with
57 additions
and
15 deletions
app/controllers/deployments/single.js
0 → 100644
+
34
−
0
View file @
31f2f3c9
import
Ember
from
'
ember
'
;
const
observables
=
[
'
nodes
'
,
'
nodeGroups
'
,
'
serviceInstances
'
,
'
communicationInstances
'
];
export
default
Ember
.
Controller
.
extend
({
graphingService
:
Ember
.
inject
.
service
(),
init
()
{
this
.
debug
(
'
initializing controller
'
);
},
// gets automatically updated when any of the instances changes (updated from changelog stream)
graphModel
:
Ember
.
computed
(
`model.instances.{
${
observables
.
join
(
'
,
'
)}
}.[]`
,
function
()
{
const
systemId
=
this
.
get
(
'
model.systemId
'
);
const
instances
=
this
.
get
(
'
model.instances
'
);
/*
* Since we use findAll to not load ALL instances but only for a specific system,
* Ember would cache any instances by any system in the store,
* this might lead to unexpected behavior after navigating to multiple systems/deployments.
* Solution: filter out invalid
*/
const
filteredInstances
=
{};
Object
.
keys
(
instances
).
map
((
key
)
=>
{
filteredInstances
[
key
]
=
instances
[
key
].
filterBy
(
'
systemId
'
,
systemId
);
});
this
.
debug
(
'
creating graph
'
,
filteredInstances
);
return
this
.
get
(
'
graphingService
'
).
createGraph
(
filteredInstances
);
// TODO: update instead of complete recalculation?
}),
});
\ No newline at end of file
This diff is collapsed.
Click to expand it.
app/routes/deployments/single.js
+
22
−
14
View file @
31f2f3c9
...
...
@@ -2,7 +2,6 @@ import Ember from 'ember';
export
default
Ember
.
Route
.
extend
({
session
:
Ember
.
inject
.
service
(),
// loads services/session.js
graphingService
:
Ember
.
inject
.
service
(),
changelogStream
:
Ember
.
inject
.
service
(),
model
(
params
)
{
const
systemId
=
params
.
systemId
;
...
...
@@ -10,22 +9,31 @@ export default Ember.Route.extend({
const
changelogStream
=
this
.
get
(
'
changelogStream
'
);
// lazy loaded, requires session id
changelogStream
.
connect
(
systemId
);
const
graphingService
=
this
.
get
(
'
graphingService
'
);
const
createGraph
=
graphingService
.
createGraph
.
bind
(
graphingService
);
/*
* note that findAll returns an Observable Array which automatically
* update whenever new records are pushed into the store.
* The controller can observe this.
* Also note that since we changed the behavior of findAll() to use the systemId
* Ember will probably also update for other systems. These are filtered in the controller
*/
const
load
=
(
type
)
=>
this
.
store
.
findAll
(
type
);
this
.
set
(
'
loading
'
,
true
);
return
Ember
.
RSVP
.
hash
({
nodes
:
this
.
store
.
findAll
(
'
node
'
),
nodeGroups
:
this
.
store
.
findAll
(
'
nodegroup
'
),
services
:
this
.
store
.
findAll
(
'
service
'
),
serviceInstances
:
this
.
store
.
findAll
(
'
serviceinstance
'
),
communications
:
this
.
store
.
findAll
(
'
communication
'
),
communicationInstances
:
this
.
store
.
findAll
(
'
communicationinstance
'
)
}).
then
(
createGraph
).
then
((
graph
)
=>
{
this
.
set
(
'
loading
'
,
false
);
return
graph
;
nodes
:
load
(
'
node
'
),
nodeGroups
:
load
(
'
nodegroup
'
),
services
:
load
(
'
service
'
),
serviceInstances
:
load
(
'
serviceinstance
'
),
communications
:
load
(
'
communication
'
),
communicationInstances
:
load
(
'
communicationinstance
'
)
}).
then
((
models
)
=>
{
this
.
debug
(
'
loaded models
'
,
models
);
return
{
systemId
:
systemId
,
instances
:
models
};
});
},
actions
:
{
loadDetails
(
rawEntity
)
{
this
.
debug
(
'
loadDetails action
'
,
rawEntity
);
...
...
@@ -42,7 +50,7 @@ export default Ember.Route.extend({
});
this
.
transitionTo
(
url
);
},
willTransition
()
{
willTransition
()
{
// FIXME: do not disconnect for subpages!
this
.
get
(
'
changelogStream
'
).
disconnect
();
}
}
...
...
This diff is collapsed.
Click to expand it.
app/templates/deployments/single.hbs
+
1
−
1
View file @
31f2f3c9
{{#
architecture-viewer
graph
=
m
odel
}}
{{#
architecture-viewer
graph
=
graphM
odel
}}
{{!-- show entity details in sidebar if subroute (details) is used --}}
{{
outlet
}}
{{/
architecture-viewer
}}
\ No newline at end of file
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