Fix safari websocket warning

This commit is contained in:
Vincent Fiduccia 2016-05-23 14:18:56 -07:00
parent fdd9e1db51
commit bde93f57c1
5 changed files with 15 additions and 13 deletions

View File

@ -169,6 +169,7 @@ export default Ember.Route.extend(Subscribe, {
reset() { reset() {
// Forget all the things // Forget all the things
console.log('Store Reset');
this.get('userStore').reset(); this.get('userStore').reset();
this.get('store').reset(); this.get('store').reset();
// Service has extra special hackery to cache relationships // Service has extra special hackery to cache relationships

View File

@ -2,7 +2,7 @@
<table class="grid fixed no-lines r-mb0"> <table class="grid fixed no-lines r-mb0">
<thead> <thead>
<tr> <tr>
<th>{{t 'k8s.containersSection.containersName'}}</th> <th>{{t 'k8s.containersSection.containerName'}}</th>
<th>{{t 'generic.image'}}</th> <th>{{t 'generic.image'}}</th>
<th width="120">{{t 'k8s.containersSection.status'}}</th> <th width="120">{{t 'k8s.containersSection.status'}}</th>
<th>{{t 'k8s.containersSection.message'}}</th> <th>{{t 'k8s.containersSection.message'}}</th>

View File

@ -27,7 +27,7 @@ export default Ember.Mixin.create({
var metadata = socket.getMetadata(); var metadata = socket.getMetadata();
var socketProject = metadata.projectId; var socketProject = metadata.projectId;
if ( currentProject !== socketProject ) { if ( currentProject !== socketProject ) {
console.error(`Subscribe ignoring message, current=${currentProject} socket=${socketProject}`, this.forStr()); console.error(`Subscribe ignoring message, current=${currentProject} socket=${socketProject} ` + this.forStr());
this.connectSubscribe(); this.connectSubscribe();
return; return;
} }
@ -84,7 +84,7 @@ export default Ember.Mixin.create({
var socket = this.get('subscribeSocket'); var socket = this.get('subscribeSocket');
if ( socket ) if ( socket )
{ {
console.log('Subscribe disconnect', this.forStr()); console.log('Subscribe disconnect ' + this.forStr());
socket.disconnect(); socket.disconnect();
} }
}, },
@ -127,14 +127,14 @@ export default Ember.Mixin.create({
// WebSocket disconnected (unexpectedly) // WebSocket disconnected (unexpectedly)
subscribeDisconnected: function() { subscribeDisconnected: function() {
console.log('Subscribe disconnected', this.forStr()); console.log('Subscribe disconnected ' + this.forStr());
if ( this.get('reconnect') ) { if ( this.get('reconnect') ) {
this.connectSubscribe(); this.connectSubscribe();
} }
}, },
subscribePing: function() { subscribePing: function() {
console.log('Subscribe ping', this.forStr()); console.log('Subscribe ping ' + this.forStr());
}, },
hostChanged: function(change) { hostChanged: function(change) {

View File

@ -14,8 +14,6 @@ const CLOSING = 'closing';
const RECONNECTING = 'reconnecting'; const RECONNECTING = 'reconnecting';
export default Ember.Object.extend(Ember.Evented, { export default Ember.Object.extend(Ember.Evented, {
growl: Ember.inject.service(),
url: null, url: null,
autoReconnect: true, autoReconnect: true,
frameTimeout: 11000, frameTimeout: 11000,
@ -170,7 +168,7 @@ export default Ember.Object.extend(Ember.Evented, {
}, },
_closed() { _closed() {
console.log('Socket', this.get('_closingId'), 'closed'); console.log(`Socket ${this.get('_closingId')} closed`);
let wasConnected = false; let wasConnected = false;
if ( [CONNECTED, CLOSING].indexOf(this.get('_state')) >= 0 ) if ( [CONNECTED, CLOSING].indexOf(this.get('_state')) >= 0 )
@ -189,12 +187,15 @@ export default Ember.Object.extend(Ember.Evented, {
this.set('_disconnectedAt', (new Date()).getTime()); this.set('_disconnectedAt', (new Date()).getTime());
} }
if ( isSafari && !safariWarningShown && !wasConnected && this.get('url').indexOf('wss://') === 0 ) if ( isSafari && !wasConnected && this.get('url').indexOf('wss://') === 0 )
{ {
this.set('autoReconnect', false); this.set('autoReconnect', false);
this.set('_state', DISCONNECTED); this.set('_state', DISCONNECTED);
safariWarningShown = true; if ( !safariWarningShown )
this.get('growl').error('Error connecting to WebSocket','Safari does not support WebSockets connecting to a self-signed or unrecognized certificate. Use http:// instead of https:// or reconfigure the server with a valid certificate from a recognized certificate authority. Streaming stats, logs, shell/console, and auto-updating of the state of resources in the UI will not work until this is resolved.'); {
safariWarningShown = true;
window.l('service:growl').error('Error connecting to WebSocket','Safari does not support WebSockets connecting to a self-signed or unrecognized certificate. Use http:// instead of https:// or reconfigure the server with a valid certificate from a recognized certificate authority. Streaming stats, logs, shell/console, and auto-updating of the state of resources in the UI will not work until this is resolved.');
}
} }
else if ( this.get('autoReconnect') ) else if ( this.get('autoReconnect') )
{ {
@ -218,6 +219,6 @@ export default Ember.Object.extend(Ember.Evented, {
args.push(`(state=${this.get('_state')}, id=${this.get('_socket.__sockId')})`); args.push(`(state=${this.get('_state')}, id=${this.get('_socket.__sockId')})`);
console.log.apply(console, args); console.log(args.join(" "));
}, },
}); });

View File

@ -1,6 +1,6 @@
{ {
"name": "ui", "name": "ui",
"version": "1.0.12", "version": "1.1.0",
"private": true, "private": true,
"directories": { "directories": {
"doc": "doc", "doc": "doc",