Browse Source

Merge pull request #1184 from jitsi/separate-disconnect-overlay

Separate disconnect overlay
master
hristoterezov 8 years ago
parent
commit
a6fed4da65

+ 8
- 0
css/_mixins.scss View File

150
   overflow: hidden;
150
   overflow: hidden;
151
   text-overflow: ellipsis;
151
   text-overflow: ellipsis;
152
   white-space: nowrap;
152
   white-space: nowrap;
153
+}
154
+
155
+/**
156
+ * Creates a semi-transparent background with the given color and alpha
157
+ * (opacity) value.
158
+ */
159
+@mixin transparentBg($color, $alpha) {
160
+  background-color: rgba(red($color), green($color), blue($color), $alpha);
153
 }
161
 }

+ 4
- 0
css/components/_button-control.scss View File

82
             color: $linkHoverFontColor;
82
             color: $linkHoverFontColor;
83
         }
83
         }
84
     }
84
     }
85
+
86
+    &_center {
87
+        float: none !important;
88
+    }
85
 }
89
 }

+ 6
- 1
css/overlay/_overlay.scss View File

1
 .overlay {
1
 .overlay {
2
-    &__container {
2
+    &__container,
3
+    &__container-light {
3
         top: 0;
4
         top: 0;
4
         left: 0;
5
         left: 0;
5
         width: 100%;
6
         width: 100%;
9
         background: $defaultBackground;
10
         background: $defaultBackground;
10
     }
11
     }
11
 
12
 
13
+    &__container-light {
14
+        @include transparentBg($defaultBackground, 0.7);
15
+    }
16
+
12
     &__content {
17
     &__content {
13
         position: absolute;
18
         position: absolute;
14
         margin: 0 auto;
19
         margin: 0 auto;

+ 3
- 0
lang/main.json View File

215
         "failedpermissions": "Failed to obtain permissions to use the local microphone and/or camera.",
215
         "failedpermissions": "Failed to obtain permissions to use the local microphone and/or camera.",
216
         "conferenceReloadTitle": "Unfortunately, something went wrong",
216
         "conferenceReloadTitle": "Unfortunately, something went wrong",
217
         "conferenceReloadMsg": "We're trying to fix this",
217
         "conferenceReloadMsg": "We're trying to fix this",
218
+        "conferenceDisconnectTitle": "You have been disconnected. You may want to check your network connection.",
219
+        "conferenceDisconnectMsg": "Reconnecting in...",
220
+        "reconnectNow": "Reconnect now",
218
         "conferenceReloadTimeLeft": "__seconds__ sec.",
221
         "conferenceReloadTimeLeft": "__seconds__ sec.",
219
         "maxUsersLimitReached": "The limit for maximum number of participants in the conference has been reached. The conference is full. Please try again later!",
222
         "maxUsersLimitReached": "The limit for maximum number of participants in the conference has been reached. The conference is full. Please try again later!",
220
         "lockTitle": "Lock failed",
223
         "lockTitle": "Lock failed",

+ 1
- 1
modules/UI/UI.js View File

17
 import GumPermissionsOverlay
17
 import GumPermissionsOverlay
18
     from './gum_overlay/UserMediaPermissionsGuidanceOverlay';
18
     from './gum_overlay/UserMediaPermissionsGuidanceOverlay';
19
 
19
 
20
-import PageReloadOverlay from './reload_overlay/PageReloadOverlay';
20
+import * as PageReloadOverlay from './reload_overlay/PageReloadOverlay';
21
 import SuspendedOverlay from './suspended_overlay/SuspendedOverlay';
21
 import SuspendedOverlay from './suspended_overlay/SuspendedOverlay';
22
 import VideoLayout from "./videolayout/VideoLayout";
22
 import VideoLayout from "./videolayout/VideoLayout";
23
 import FilmStrip from "./videolayout/FilmStrip";
23
 import FilmStrip from "./videolayout/FilmStrip";

+ 18
- 6
modules/UI/overlay/Overlay.js View File

15
          * @type {jQuery}
15
          * @type {jQuery}
16
          */
16
          */
17
         this.$overlay = null;
17
         this.$overlay = null;
18
+
19
+        /**
20
+         * Indicates if this overlay should use the light look & feel or the
21
+         * standard one.
22
+         * @type {boolean}
23
+         */
24
+        this.isLightOverlay = false;
18
     }
25
     }
19
     /**
26
     /**
20
      * Template method which should be used by subclasses to provide the overlay
27
      * Template method which should be used by subclasses to provide the overlay
21
      * content. The contents provided by this method are later subject to
28
      * content. The contents provided by this method are later subject to
22
      * the translation using {@link APP.translation.translateElement}.
29
      * the translation using {@link APP.translation.translateElement}.
23
      * @return {string} HTML representation of the overlay dialog contents.
30
      * @return {string} HTML representation of the overlay dialog contents.
24
-     * @private
31
+     * @protected
25
      */
32
      */
26
     _buildOverlayContent() {
33
     _buildOverlayContent() {
27
         return '';
34
         return '';
28
     }
35
     }
29
     /**
36
     /**
30
      * Constructs the HTML body of the overlay dialog.
37
      * Constructs the HTML body of the overlay dialog.
38
+     *
39
+     * @private
31
      */
40
      */
32
-    buildOverlayHtml() {
41
+    _buildOverlayHtml() {
33
 
42
 
34
         let overlayContent = this._buildOverlayContent();
43
         let overlayContent = this._buildOverlayContent();
35
 
44
 
45
+        let containerClass = this.isLightOverlay    ? "overlay__container-light"
46
+                                                    : "overlay__container";
47
+
36
         this.$overlay = $(`
48
         this.$overlay = $(`
37
-            <div class='overlay__container'>
49
+            <div class=${containerClass}>
38
                 <div class='overlay__content'>
50
                 <div class='overlay__content'>
39
                     ${overlayContent}
51
                     ${overlayContent}
40
                 </div>
52
                 </div>
53
     /**
65
     /**
54
      * Template method called just after the overlay is displayed for the first
66
      * Template method called just after the overlay is displayed for the first
55
      * time.
67
      * time.
56
-     * @private
68
+     * @protected
57
      */
69
      */
58
     _onShow() {
70
     _onShow() {
59
         // To be overridden by subclasses.
71
         // To be overridden by subclasses.
60
     }
72
     }
61
     /**
73
     /**
62
-     * Shows the overlay dialog adn attaches the underlying HTML representation
74
+     * Shows the overlay dialog and attaches the underlying HTML representation
63
      * to the DOM.
75
      * to the DOM.
64
      */
76
      */
65
     show() {
77
     show() {
66
 
78
 
67
-        !this.$overlay && this.buildOverlayHtml();
79
+        !this.$overlay && this._buildOverlayHtml();
68
 
80
 
69
         if (!this.isVisible()) {
81
         if (!this.isVisible()) {
70
             this.$overlay.appendTo('body');
82
             this.$overlay.appendTo('body');

+ 77
- 39
modules/UI/reload_overlay/PageReloadOverlay.js View File

1
 /* global $, APP, AJS */
1
 /* global $, APP, AJS */
2
 const logger = require("jitsi-meet-logger").getLogger(__filename);
2
 const logger = require("jitsi-meet-logger").getLogger(__filename);
3
 
3
 
4
-import Overlay from '../overlay/Overlay';
4
+import Overlay from "../overlay/Overlay";
5
 
5
 
6
 /**
6
 /**
7
  * An overlay dialog which is shown before the conference is reloaded. Shows
7
  * An overlay dialog which is shown before the conference is reloaded. Shows
12
      * Creates new <tt>PageReloadOverlayImpl</tt>
12
      * Creates new <tt>PageReloadOverlayImpl</tt>
13
      * @param {number} timeoutSeconds how long the overlay dialog will be
13
      * @param {number} timeoutSeconds how long the overlay dialog will be
14
      * displayed, before the conference will be reloaded.
14
      * displayed, before the conference will be reloaded.
15
+     * @param {string} title the title of the overlay message
16
+     * @param {string} message the message of the overlay
17
+     * @param {string} buttonHtml the button html or an empty string if there's
18
+     * no button
19
+     * @param {boolean} isLightOverlay indicates if the overlay should be a
20
+     * light overlay or a standard one
15
      */
21
      */
16
-    constructor(timeoutSeconds) {
22
+    constructor(timeoutSeconds, title, message, buttonHtml, isLightOverlay) {
17
         super();
23
         super();
18
         /**
24
         /**
19
          * Conference reload counter in seconds.
25
          * Conference reload counter in seconds.
25
          * @type {number}
31
          * @type {number}
26
          */
32
          */
27
         this.timeout = timeoutSeconds;
33
         this.timeout = timeoutSeconds;
34
+
35
+        this.title = title;
36
+        this.message = message;
37
+        this.buttonHtml = buttonHtml;
38
+        this.isLightOverlay = isLightOverlay;
28
     }
39
     }
29
     /**
40
     /**
30
      * Constructs overlay body with the warning message and count down towards
41
      * Constructs overlay body with the warning message and count down towards
33
      */
44
      */
34
     _buildOverlayContent() {
45
     _buildOverlayContent() {
35
         return `<div class="inlay">
46
         return `<div class="inlay">
36
-                    <span data-i18n='dialog.conferenceReloadTitle'
47
+                    <span data-i18n=${this.title}
37
                           class='reload_overlay_title'></span>
48
                           class='reload_overlay_title'></span>
38
-                    <span data-i18n='dialog.conferenceReloadMsg'
49
+                    <span data-i18n=${this.message}
39
                           class='reload_overlay_msg'></span>
50
                           class='reload_overlay_msg'></span>
40
                     <div>
51
                     <div>
41
                         <div id='reloadProgressBar'
52
                         <div id='reloadProgressBar'
47
                             class='reload_overlay_msg'>
58
                             class='reload_overlay_msg'>
48
                         </span>
59
                         </span>
49
                     </div>
60
                     </div>
61
+                    ${this.buttonHtml}
50
                 </div>`;
62
                 </div>`;
51
     }
63
     }
52
 
64
 
67
      * @override
79
      * @override
68
      */
80
      */
69
     _onShow() {
81
     _onShow() {
82
+        $("#reconnectNow").click(() => {
83
+            APP.ConferenceUrl.reload();
84
+        });
70
 
85
 
71
         // Initialize displays
86
         // Initialize displays
72
         this.updateDisplay();
87
         this.updateDisplay();
98
  */
113
  */
99
 let overlay;
114
 let overlay;
100
 
115
 
101
-export default {
102
-    /**
103
-     * Checks whether the page reload overlay has been displayed.
104
-     * @return {boolean} <tt>true</tt> if the page reload overlay is currently
105
-     * visible or <tt>false</tt> otherwise.
106
-     */
107
-    isVisible() {
116
+/**
117
+ * Checks whether the page reload overlay has been displayed.
118
+ * @return {boolean} <tt>true</tt> if the page reload overlay is currently
119
+ * visible or <tt>false</tt> otherwise.
120
+ */
121
+export function isVisible() {
108
         return overlay && overlay.isVisible();
122
         return overlay && overlay.isVisible();
109
-    },
110
-    /**
111
-     * Shows the page reload overlay which will do the conference reload after
112
-     * the given amount of time.
113
-     *
114
-     * @param {number} timeoutSeconds how many seconds before the conference
115
-     * reload will happen.
116
-     * @param {boolean} isNetworkFailure <tt>true</tt> indicates that it's
117
-     * caused by network related failure or <tt>false</tt> when it's
118
-     * the infrastructure.
119
-     * @param {string} reason a label string identifying the reason for the page
120
-     * reload which will be included in details of the log event
121
-     */
122
-    show(timeoutSeconds, isNetworkFailure, reason) {
123
-
124
-        if (!overlay) {
125
-            overlay = new PageReloadOverlayImpl(timeoutSeconds);
126
-        }
127
-        // Log the page reload event
128
-        if (!this.isVisible()) {
129
-            // FIXME (CallStats - issue) this event will not make it to
130
-            // the CallStats, because the log queue is not flushed, before
131
-            // "fabric terminated" is sent to the backed
132
-            APP.conference.logEvent(
133
-                'page.reload', undefined /* value */, reason /* label */);
134
-        }
135
-        overlay.show();
123
+}
124
+
125
+/**
126
+ * Shows the page reload overlay which will do the conference reload after
127
+ * the given amount of time.
128
+ *
129
+ * @param {number} timeoutSeconds how many seconds before the conference
130
+ * reload will happen.
131
+ * @param {boolean} isNetworkFailure <tt>true</tt> indicates that it's
132
+ * caused by network related failure or <tt>false</tt> when it's
133
+ * the infrastructure.
134
+ * @param {string} reason a label string identifying the reason for the page
135
+ * reload which will be included in details of the log event
136
+ */
137
+export function show(timeoutSeconds, isNetworkFailure, reason) {
138
+    let title;
139
+    let message;
140
+    let buttonHtml;
141
+    let isLightOverlay;
142
+
143
+    if (isNetworkFailure) {
144
+        title = "dialog.conferenceDisconnectTitle";
145
+        message = "dialog.conferenceDisconnectMsg";
146
+        buttonHtml
147
+            = `<button id="reconnectNow" data-i18n="dialog.reconnectNow"
148
+                    class="button-control button-control_primary
149
+                            button-control_center"></button>`;
150
+        isLightOverlay = true;
151
+    }
152
+    else {
153
+        title = "dialog.conferenceReloadTitle";
154
+        message = "dialog.conferenceReloadMsg";
155
+        buttonHtml = "";
156
+        isLightOverlay = false;
136
     }
157
     }
137
-};
158
+
159
+    if (!overlay) {
160
+        overlay = new PageReloadOverlayImpl(timeoutSeconds,
161
+                                            title,
162
+                                            message,
163
+                                            buttonHtml,
164
+                                            isLightOverlay);
165
+    }
166
+    // Log the page reload event
167
+    if (!this.isVisible()) {
168
+        // FIXME (CallStats - issue) this event will not make it to
169
+        // the CallStats, because the log queue is not flushed, before
170
+        // "fabric terminated" is sent to the backed
171
+        APP.conference.logEvent(
172
+            'page.reload', undefined /* value */, reason /* label */);
173
+    }
174
+    overlay.show();
175
+}

Loading…
Cancel
Save