Improved task reload and maintenance message and tests.
This commit is contained in:
parent
ec8a611b48
commit
78c6b96aa5
7 changed files with 171 additions and 86 deletions
|
@ -24,6 +24,13 @@ class App.Controller extends Spine.Controller
|
||||||
else
|
else
|
||||||
window.prompt( "Copy to clipboard: Ctrl+C, Enter", text )
|
window.prompt( "Copy to clipboard: Ctrl+C, Enter", text )
|
||||||
|
|
||||||
|
# disable all delay's and interval's
|
||||||
|
disconnectClient: ->
|
||||||
|
App.Delay.reset()
|
||||||
|
App.Interval.reset()
|
||||||
|
App.WebSocket.close( force: true )
|
||||||
|
|
||||||
|
|
||||||
# add @notify methode to create notification
|
# add @notify methode to create notification
|
||||||
notify: (data) ->
|
notify: (data) ->
|
||||||
App.Event.trigger 'notify', data
|
App.Event.trigger 'notify', data
|
||||||
|
@ -478,7 +485,7 @@ class App.ErrorModal extends App.ControllerModal
|
||||||
keyboard: false,
|
keyboard: false,
|
||||||
)
|
)
|
||||||
|
|
||||||
class App.SessionReloadModal extends App.ControllerModal
|
class App.SessionMessage extends App.ControllerModal
|
||||||
constructor: ->
|
constructor: ->
|
||||||
super
|
super
|
||||||
@render()
|
@render()
|
||||||
|
@ -497,15 +504,19 @@ class App.SessionReloadModal extends App.ControllerModal
|
||||||
)
|
)
|
||||||
|
|
||||||
# reload page on modal hidden
|
# reload page on modal hidden
|
||||||
@el.on('hidden', =>
|
if @forceReload
|
||||||
@reload()
|
@el.on('hidden', =>
|
||||||
)
|
@reload()
|
||||||
|
)
|
||||||
|
|
||||||
modalHide: (e) ->
|
modalHide: (e) =>
|
||||||
@reload(e)
|
if @forceReload
|
||||||
|
@reload(e)
|
||||||
|
@el.modal('hide')
|
||||||
|
|
||||||
submit: (e) ->
|
submit: (e) =>
|
||||||
@reload(e)
|
if @forceReload
|
||||||
|
@reload(e)
|
||||||
|
|
||||||
reload: (e) ->
|
reload: (e) ->
|
||||||
if e
|
if e
|
||||||
|
|
|
@ -12,15 +12,19 @@ class Message extends App.ControllerModal
|
||||||
@render(@message)
|
@render(@message)
|
||||||
|
|
||||||
render: (message = {}) ->
|
render: (message = {}) ->
|
||||||
@html App.view('modal')(
|
|
||||||
title: message.title,
|
if message.reload
|
||||||
message: message.message
|
@disconnectClient()
|
||||||
detail: message.detail
|
button = 'Reload application'
|
||||||
close: message.close
|
|
||||||
)
|
new App.SessionMessage(
|
||||||
@modalShow(
|
title: message.title
|
||||||
backdrop: true,
|
message: message.message
|
||||||
keyboard: true,
|
keyboard: false
|
||||||
|
backdrop: true
|
||||||
|
close: true
|
||||||
|
button: button
|
||||||
|
forceReload: message.reload
|
||||||
)
|
)
|
||||||
|
|
||||||
App.Config.set( 'maintenance', App.MaintenanceWidget, 'Widgets' )
|
App.Config.set( 'maintenance', App.MaintenanceWidget, 'Widgets' )
|
||||||
|
|
|
@ -49,19 +49,16 @@ class App.TaskWidget extends App.Controller
|
||||||
|
|
||||||
# only if new client id isnt own client id
|
# only if new client id isnt own client id
|
||||||
if data.taskbar_id isnt App.TaskManager.TaskbarId()
|
if data.taskbar_id isnt App.TaskManager.TaskbarId()
|
||||||
@error = new App.SessionReloadModal(
|
@error = new App.SessionMessage(
|
||||||
title: 'Session'
|
title: 'Session'
|
||||||
message: 'Session taken over... please reload page or work with other browser window.'
|
message: 'Session taken over... please reload page or work with other browser window.'
|
||||||
keyboard: false
|
keyboard: false
|
||||||
backdrop: true
|
backdrop: true
|
||||||
close: true
|
close: true
|
||||||
button: 'Reload application'
|
button: 'Reload application'
|
||||||
|
forceReload: true
|
||||||
)
|
)
|
||||||
|
@disconnectClient()
|
||||||
# disable all delay's and interval's
|
|
||||||
App.Delay.reset()
|
|
||||||
App.Interval.reset()
|
|
||||||
App.WebSocket.close( force: true )
|
|
||||||
|
|
||||||
render: ->
|
render: ->
|
||||||
|
|
||||||
|
|
|
@ -5,18 +5,24 @@
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label" for="title"><%- @T('Title') %></label>
|
<label class="control-label" for="title"><%- @T('Title') %></label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<input type="text" name="title" class="span7" placeholder="<%- @Ti('Title') %>" required>
|
<input type="text" name="title" class="span7" placeholder="<%- @Ti('some title') %>" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label" for="message"><%- @T('Message') %></label>
|
<label class="control-label" for="message"><%- @T('Message') %></label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<textarea name="message" class="span7" rows="8" placeholder="<%- @Ti('Maintenance Message') %>" required></textarea>
|
<textarea name="message" class="span7" rows="8" placeholder="<%- @Ti('what details') %>" required></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label" for="message"><%- @T('Reload application') %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<input name="reload" type="checkbox" value="1">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<button type="submit" class="btn btn-primary submit"><%- @T('Send Message') %></button>
|
<button type="submit" class="btn btn-primary submit"><%- @T('Send to clients') %></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -1811,6 +1811,7 @@ Translation.create_if_not_exists( :locale => 'de', :source => "Back to top", :ta
|
||||||
Translation.create_if_not_exists( :locale => 'de', :source => "Discard your unsaved changes.", :target => "Verwerfen der ungespeicherten Änderungen." )
|
Translation.create_if_not_exists( :locale => 'de', :source => "Discard your unsaved changes.", :target => "Verwerfen der ungespeicherten Änderungen." )
|
||||||
Translation.create_if_not_exists( :locale => 'de', :source => "Copy to clipboard: Ctrl+C, Enter", :target => "In die Zwischenablage kopieren: Strg+C, Return" )
|
Translation.create_if_not_exists( :locale => 'de', :source => "Copy to clipboard: Ctrl+C, Enter", :target => "In die Zwischenablage kopieren: Strg+C, Return" )
|
||||||
Translation.create_if_not_exists( :locale => 'de', :source => "Copy to clipboard", :target => "In die Zwischenablage kopieren" )
|
Translation.create_if_not_exists( :locale => 'de', :source => "Copy to clipboard", :target => "In die Zwischenablage kopieren" )
|
||||||
|
Translation.create_if_not_exists( :locale => 'de', :source => "Send to clients", :target => "An Clients senden" )
|
||||||
#Translation.create_if_not_exists( :locale => 'de', :source => "", :target => "" )
|
#Translation.create_if_not_exists( :locale => 'de', :source => "", :target => "" )
|
||||||
|
|
||||||
# install all packages in auto_install
|
# install all packages in auto_install
|
||||||
|
|
|
@ -6,7 +6,7 @@ class MaintenanceMessageTest < TestCase
|
||||||
message = 'message 1äöüß ' + rand(99999999999999999).to_s
|
message = 'message 1äöüß ' + rand(99999999999999999).to_s
|
||||||
tests = [
|
tests = [
|
||||||
{
|
{
|
||||||
:name => 'start',
|
:name => 'check #1',
|
||||||
:instance1 => browser_instance,
|
:instance1 => browser_instance,
|
||||||
:instance2 => browser_instance,
|
:instance2 => browser_instance,
|
||||||
:instance1_username => 'master@example.com',
|
:instance1_username => 'master@example.com',
|
||||||
|
@ -15,18 +15,6 @@ class MaintenanceMessageTest < TestCase
|
||||||
:instance2_password => 'test',
|
:instance2_password => 'test',
|
||||||
:url => browser_url,
|
:url => browser_url,
|
||||||
:action => [
|
:action => [
|
||||||
{
|
|
||||||
:where => :instance1,
|
|
||||||
:execute => 'check',
|
|
||||||
:css => '#login',
|
|
||||||
:result => false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
:where => :instance2,
|
|
||||||
:execute => 'check',
|
|
||||||
:css => '#login',
|
|
||||||
:result => false,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
:execute => 'wait',
|
:execute => 'wait',
|
||||||
:value => 1,
|
:value => 1,
|
||||||
|
@ -36,19 +24,11 @@ class MaintenanceMessageTest < TestCase
|
||||||
:execute => 'click',
|
:execute => 'click',
|
||||||
:css => 'a[href="#admin"]',
|
:css => 'a[href="#admin"]',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
:execute => 'wait',
|
|
||||||
:value => 1,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
:where => :instance1,
|
:where => :instance1,
|
||||||
:execute => 'click',
|
:execute => 'click',
|
||||||
:css => 'a[href="#maintenance"]',
|
:css => 'a[href="#maintenance"]',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
:execute => 'wait',
|
|
||||||
:value => 1,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
:where => :instance1,
|
:where => :instance1,
|
||||||
:execute => 'set',
|
:execute => 'set',
|
||||||
|
@ -70,6 +50,13 @@ class MaintenanceMessageTest < TestCase
|
||||||
:execute => 'wait',
|
:execute => 'wait',
|
||||||
:value => 5,
|
:value => 5,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
:where => :instance1,
|
||||||
|
:execute => 'match',
|
||||||
|
:css => 'body',
|
||||||
|
:value => message,
|
||||||
|
:match_result => false,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
:where => :instance2,
|
:where => :instance2,
|
||||||
:execute => 'check',
|
:execute => 'check',
|
||||||
|
@ -77,7 +64,7 @@ class MaintenanceMessageTest < TestCase
|
||||||
:result => true,
|
:result => true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
:where => :instance2,
|
:where => :instance2,
|
||||||
:execute => 'match',
|
:execute => 'match',
|
||||||
:css => 'body',
|
:css => 'body',
|
||||||
:value => message,
|
:value => message,
|
||||||
|
@ -86,76 +73,145 @@ class MaintenanceMessageTest < TestCase
|
||||||
{
|
{
|
||||||
:where => :instance2,
|
:where => :instance2,
|
||||||
:execute => 'click',
|
:execute => 'click',
|
||||||
:css => 'div.modal-backdrop.fade.in',
|
:css => 'div.modal-header .close',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
:execute => 'wait',
|
||||||
|
:value => 2,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
:name => 'start',
|
:name => 'check #2',
|
||||||
:action => [
|
:action => [
|
||||||
{
|
|
||||||
:where => :instance1,
|
|
||||||
:execute => 'check',
|
|
||||||
:css => '#login',
|
|
||||||
:result => false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
:where => :instance2,
|
|
||||||
:execute => 'check',
|
|
||||||
:css => '#login',
|
|
||||||
:result => false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
:execute => 'wait',
|
|
||||||
:value => 1,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
:where => :instance1,
|
:where => :instance1,
|
||||||
:execute => 'click',
|
:execute => 'click',
|
||||||
:css => 'a[href="#admin"]',
|
:css => 'a[href="#admin"]',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
:execute => 'wait',
|
|
||||||
:value => 1,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
:where => :instance1,
|
:where => :instance1,
|
||||||
:execute => 'click',
|
:execute => 'click',
|
||||||
:css => 'a[href="#maintenance"]',
|
:css => 'a[href="#maintenance"]',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
:execute => 'wait',
|
|
||||||
:value => 1,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
:where => :instance1,
|
:where => :instance1,
|
||||||
:execute => 'set',
|
:execute => 'set',
|
||||||
:css => 'input[name="title"]',
|
:css => 'input[name="title"]',
|
||||||
:value => message,
|
:value => message + ' #2',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
:where => :instance1,
|
:where => :instance1,
|
||||||
:execute => 'set',
|
:execute => 'set',
|
||||||
:css => 'textarea[name="message"]',
|
:css => 'textarea[name="message"]',
|
||||||
:value => message,
|
:value => message + ' #2',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
:where => :instance1,
|
||||||
|
:execute => 'click',
|
||||||
|
:css => 'button[type="submit"]',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
:execute => 'wait',
|
:execute => 'wait',
|
||||||
:value => 5,
|
:value => 5,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
:where => :instance2,
|
:where => :instance1,
|
||||||
|
:execute => 'match',
|
||||||
|
:css => 'body',
|
||||||
|
:value => message + ' #2',
|
||||||
|
:match_result => false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
:where => :instance1,
|
||||||
:execute => 'check',
|
:execute => 'check',
|
||||||
:css => 'div.modal-backdrop.fade.in',
|
:css => 'div.modal-backdrop.fade.in',
|
||||||
:result => false,
|
:result => false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
:where => :instance2,
|
:where => :instance2,
|
||||||
:execute => 'match',
|
:execute => 'match',
|
||||||
:css => 'body',
|
:css => 'body',
|
||||||
:value => message,
|
:value => message + ' #2',
|
||||||
|
:match_result => true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
:where => :instance2,
|
||||||
|
:execute => 'click',
|
||||||
|
:css => 'div.modal-header .close',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
:execute => 'wait',
|
||||||
|
:value => 2,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
:name => 'check #3',
|
||||||
|
:action => [
|
||||||
|
{
|
||||||
|
:where => :instance1,
|
||||||
|
:execute => 'click',
|
||||||
|
:css => 'a[href="#admin"]',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
:where => :instance1,
|
||||||
|
:execute => 'click',
|
||||||
|
:css => 'a[href="#maintenance"]',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
:where => :instance1,
|
||||||
|
:execute => 'set',
|
||||||
|
:css => 'input[name="title"]',
|
||||||
|
:value => message + ' #3' ,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
:where => :instance1,
|
||||||
|
:execute => 'set',
|
||||||
|
:css => 'textarea[name="message"]',
|
||||||
|
:value => message + ' #3',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
:where => :instance1,
|
||||||
|
:execute => 'setCheck',
|
||||||
|
:css => 'input[name="reload"][value="1"]',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
:where => :instance1,
|
||||||
|
:execute => 'click',
|
||||||
|
:css => 'button[type="submit"]',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
:execute => 'wait',
|
||||||
|
:value => 5,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
:where => :instance1,
|
||||||
|
:execute => 'check',
|
||||||
|
:css => 'div.modal-backdrop.fade.in',
|
||||||
|
:result => false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
:where => :instance1,
|
||||||
|
:execute => 'match',
|
||||||
|
:css => 'body',
|
||||||
|
:value => message + ' #3',
|
||||||
:match_result => false,
|
:match_result => false,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
:where => :instance2,
|
||||||
|
:execute => 'match',
|
||||||
|
:css => 'body',
|
||||||
|
:value => message + ' #3',
|
||||||
|
:match_result => true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
:where => :instance2,
|
||||||
|
:execute => 'match',
|
||||||
|
:css => 'body',
|
||||||
|
:value => 'Reload application',
|
||||||
|
:match_result => true,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
|
@ -248,7 +248,17 @@ class TestCase < Test::Unit::TestCase
|
||||||
else
|
else
|
||||||
assert( false, "(#{test[:name]}) unknow selector for '#{action[:element]}'" )
|
assert( false, "(#{test[:name]}) unknow selector for '#{action[:element]}'" )
|
||||||
end
|
end
|
||||||
if action[:execute] == 'set'
|
if action[:execute] == 'setCheck'
|
||||||
|
checked = element.attribute('checked')
|
||||||
|
if !checked
|
||||||
|
element.click
|
||||||
|
end
|
||||||
|
elsif action[:execute] == 'setUncheck'
|
||||||
|
checked = element.attribute('checked')
|
||||||
|
if checked
|
||||||
|
element.click
|
||||||
|
end
|
||||||
|
elsif action[:execute] == 'set'
|
||||||
element.clear
|
element.clear
|
||||||
if action[:value] == '###stack###'
|
if action[:value] == '###stack###'
|
||||||
element.send_keys( @stack )
|
element.send_keys( @stack )
|
||||||
|
|
Loading…
Reference in a new issue