projects
/
osm
/
UI.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
User friendly error for VIM accounts
[osm/UI.git]
/
skyquake
/
framework
/
widgets
/
skyquake_container
/
skyquakeContainerStore.js
diff --git
a/skyquake/framework/widgets/skyquake_container/skyquakeContainerStore.js
b/skyquake/framework/widgets/skyquake_container/skyquakeContainerStore.js
index
fe4a7b0
..
56ebdda
100644
(file)
--- a/
skyquake/framework/widgets/skyquake_container/skyquakeContainerStore.js
+++ b/
skyquake/framework/widgets/skyquake_container/skyquakeContainerStore.js
@@
-1,5
+1,5
@@
/*
/*
- *
+ *
* Copyright 2016 RIFT.IO Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Copyright 2016 RIFT.IO Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@
-20,9
+20,10
@@
import Alt from './skyquakeAltInstance.js';
import SkyquakeContainerSource from './skyquakeContainerSource.js';
import SkyquakeContainerActions from './skyquakeContainerActions';
import Alt from './skyquakeAltInstance.js';
import SkyquakeContainerSource from './skyquakeContainerSource.js';
import SkyquakeContainerActions from './skyquakeContainerActions';
-import _
from 'lodash
';
+import _
indexOf from 'lodash/indexOf
';
//Temporary, until api server is on same port as webserver
//Temporary, until api server is on same port as webserver
-var rw = require('utils/rw.js');
+import rw from 'utils/rw.js';
+
var API_SERVER = rw.getSearchParams(window.location).api_server;
var UPLOAD_SERVER = rw.getSearchParams(window.location).upload_server;
var API_SERVER = rw.getSearchParams(window.location).api_server;
var UPLOAD_SERVER = rw.getSearchParams(window.location).upload_server;
@@
-35,6
+36,7
@@
class SkyquakeContainerStore {
//Notification defaults
this.notificationMessage = '';
this.displayNotification = false;
//Notification defaults
this.notificationMessage = '';
this.displayNotification = false;
+ this.notificationType = 'error';
//Screen Loader default
this.displayScreenLoader = false;
this.bindActions(SkyquakeContainerActions);
//Screen Loader default
this.displayScreenLoader = false;
this.bindActions(SkyquakeContainerActions);
@@
-81,9
+83,9
@@
class SkyquakeContainerStore {
let connection = data.connection;
let streamSource = data.streamSource;
console.log('Success opening notification socket for stream ', streamSource);
let connection = data.connection;
let streamSource = data.streamSource;
console.log('Success opening notification socket for stream ', streamSource);
-
+
let ws = window.multiplexer.channel(connection);
let ws = window.multiplexer.channel(connection);
-
+
if (!connection) return;
self.setState({
socket: ws.ws,
if (!connection) return;
self.setState({
socket: ws.ws,
@@
-99,7
+101,7
@@
class SkyquakeContainerStore {
} else {
// Temp to test before adding multi-sources
data.notification.source = streamSource;
} else {
// Temp to test before adding multi-sources
data.notification.source = streamSource;
- if (_
.
indexOf(self.notifications, data.notification) == -1) {
+ if (_indexOf(self.notifications, data.notification) == -1) {
// newly appreared event.
// Add to the notifications list and setState
self.notifications.unshift(data.notification);
// newly appreared event.
// Add to the notifications list and setState
self.notifications.unshift(data.notification);
@@
-162,20
+164,21
@@
class SkyquakeContainerStore {
//Notifications
showNotification = (data) => {
//Notifications
showNotification = (data) => {
- if(typeof(data) == 'string') {
- this.setState({
+ let state = {
displayNotification: true,
displayNotification: true,
- notificationMessage: data
- });
+ notificationMessage: data,
+ notificationType: 'error',
+ displayScreenLoader: false
+ }
+ if(typeof(data) == 'string') {
+
} else {
} else {
- if(data.type == 'error') {
- this.setState({
- displayNotification: true,
- notificationMessage: data.msg,
- displayScreenLoader: false
- });
+ state.notificationMessage = data.msg;
+ if(data.type) {
+ state.notificationType = data.type;
}
}
}
}
+ this.setState(state);
}
hideNotification = () => {
this.setState({
}
hideNotification = () => {
this.setState({
@@
-234,4
+237,4
@@
function getCurrentPlugin() {
}
}
}
}
-export default Alt.createStore(SkyquakeContainerStore);
+export default Alt.createStore(SkyquakeContainerStore
, 'SkyquakeContainerStore'
);