Comments (3)
I spent a considerable amount of time on this today, first setting up the necessary modifications to the delta so that the app would know when we receive the 'first' delta for the model (especially important for switching models) After doing that it was impossible to know when necessary elements were actually added to the canvas as they aren't done in the delta calls, or on the 'next' db update. But some time down the line.
I then attempted to panToCenter
only when nodes were created but the createServiceNode
method is not just called when creating new service nodes, sometimes it'll be called 16+ times simply when dragging a service.
The only 'fix' I could reliably get to work was a setTimeout after processing the 'first' delta but this is fraught with issues, as the 'time to ready' is heavily dependant on the size of the model and connection speeds.
from juju-gui.
The modifications I made are included below if anyone wants to take a look with fresh eyes
diff --git a/jujugui/static/gui/src/app/app.js b/jujugui/static/gui/src/app/app.js
index e44e6ea..7ed40d1 100644
--- a/jujugui/static/gui/src/app/app.js
+++ b/jujugui/static/gui/src/app/app.js
@@ -545,7 +545,7 @@ YUI.add('juju-gui', function(Y) {
}
// Feed environment changes directly into the database.
- this.env.on('delta', this.db.onDelta, this.db);
+ this.env.on('delta', this._onDelta, this);
// Handlers for adding and removing services to the service list.
this.endpointsController = new juju.EndpointsController({
@@ -662,6 +662,10 @@ YUI.add('juju-gui', function(Y) {
}, this);
},
+ _onDelta: function(delta) {
+ this.db.onDelta.call(this.db, delta);
+ },
+
/**
Parses the application URL to populate the state object without
dispatching
diff --git a/jujugui/static/gui/src/app/store/env/go.js b/jujugui/static/gui/src/app/store/env/go.js
index 5342dfb..f28ad2e 100644
--- a/jujugui/static/gui/src/app/store/env/go.js
+++ b/jujugui/static/gui/src/app/store/env/go.js
@@ -277,7 +277,7 @@ YUI.add('juju-env-go', function(Y) {
console.log('aiiiiie!'); // retry and eventually alert user XXX
} else {
this._allWatcherId = data.Response.AllWatcherId;
- this._next();
+ this._next(true);
}
}
);
@@ -327,7 +327,10 @@ YUI.add('juju-env-go', function(Y) {
if (b[1] === 'remove') { scoreB = -scoreB; }
return scoreA - scoreB;
});
- this.fire('delta', {data: {result: deltas}});
+ this.fire('delta', {
+ initial: data.initialRequest,
+ data: {result: deltas}
+ });
},
/**
@@ -335,9 +338,13 @@ YUI.add('juju-env-go', function(Y) {
@method _next
@private
+ @param {Boolean} firstRequest If this is the first call to _next. This
+ is used to flag the response delta as the first response when
+ connecting to an environment so that we can perform actions only on
+ the first delta.
@return {undefined} Sends a message to the server only.
*/
- _next: function() {
+ _next: function(firstRequest) {
this._send_rpc({
Type: 'AllWatcher',
Request: 'Next',
@@ -347,6 +354,7 @@ YUI.add('juju-env-go', function(Y) {
if (data.Error) {
console.log('aiiiiie!'); // XXX
} else {
+ data.initialRequest = firstRequest || false;
this.fire('_rpc_response', data);
}
});
diff --git a/jujugui/static/gui/src/app/views/topology/service.js b/jujugui/static/gui/src/app/views/topology/service.js
index 528b7f7..faf1933 100644
--- a/jujugui/static/gui/src/app/views/topology/service.js
+++ b/jujugui/static/gui/src/app/views/topology/service.js
@@ -1634,6 +1634,7 @@ YUI.add('juju-topology-service', function(Y) {
node.each(function(data) {
self.attachTouchstartEvents(data, this);
});
+ self.get('component').fire('panToCenter');
},
/*
from juju-gui.
This is fixed.
from juju-gui.
Related Issues (20)
- Align 'k8s' tag in the GUI store with 'Kubernetes' tag in jaas.ai store HOT 4
- Email popup module instead of 'join us' JAAS expert page HOT 1
- Juju shell icon disappeared from the canvas HOT 1
- Could not add the credential: no such request - method CloudV5.UpdateCredentials is not implemented HOT 2
- The GUI Development hacking document is out of date
- Error when clicking Shell button
- add sentry.js
- Console error when deleting a model from profile
- Copy change from Tengu (via Usabilla) HOT 1
- Name change from Tengu (via Usabilla) HOT 1
- Blocking K8s deployment in Juju GUI doesn't show notification and link to docs for how to do that HOT 12
- Loading revision-info for bundles and charms HOT 1
- Release GUI with revision-info fix
- Broken logo HOT 2
- The entity details are not loading HOT 10
- Case studies - link from homepage strip
- Juju shell unavailable HOT 3
- SAAS Support - UI crash when viewing SAAS relations HOT 2
- Juju shell unavailable HOT 1
- Juju shell unavailable HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from juju-gui.