compass_ae_console 2.0.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. checksums.yaml +7 -0
  2. data/app/controllers/compass_ae_console/erp_app/desktop/base_controller.rb +76 -66
  3. data/lib/compass_ae_console.rb +0 -1
  4. data/lib/compass_ae_console/engine.rb +1 -1
  5. data/lib/compass_ae_console/version.rb +5 -1
  6. data/public/javascripts/erp_app/desktop/applications/compass_ae_console/module.js +21 -159
  7. data/public/javascripts/erp_app/shared/console_panel.js +145 -0
  8. metadata +25 -99
  9. data/spec/dummy/db/data_migrations/20110525001935_add_usd_currency.erp_base_erp_svcs.rb +0 -12
  10. data/spec/dummy/db/data_migrations/20110608185830_create_default_dynamic_models_and_forms.erp_forms.rb +0 -33
  11. data/spec/dummy/db/data_migrations/20110609150135_add_iso_codes.erp_base_erp_svcs.rb +0 -19
  12. data/spec/dummy/db/data_migrations/20110728201729_erp_app_setup.erp_app.rb +0 -298
  13. data/spec/dummy/db/data_migrations/20110728201730_update_preferences.erp_app.rb +0 -53
  14. data/spec/dummy/db/data_migrations/20110802200222_schedule_delete_expired_sessions_job.erp_tech_svcs.rb +0 -16
  15. data/spec/dummy/db/data_migrations/20110816161238_create_desktop_app_audit_log_viewer.erp_app.rb +0 -21
  16. data/spec/dummy/db/data_migrations/20110817160743_add_file_manager_application.erp_app.rb +0 -32
  17. data/spec/dummy/db/data_migrations/20110824020426_create_desktop_app_console.compass_ae_console.rb +0 -20
  18. data/spec/dummy/db/data_migrations/20110828190913_create_desktop_app_dynamic_forms.erp_forms.rb +0 -19
  19. data/spec/dummy/db/data_migrations/20110913145838_setup_compass_ae_instance.erp_base_erp_svcs.rb +0 -12
  20. data/spec/dummy/db/data_migrations/20111108183739_add_default_capabilities.erp_app.rb +0 -30
  21. data/spec/dummy/db/data_migrations/20111108183740_add_new_contact_widgets.erp_app.rb +0 -51
  22. data/spec/dummy/db/data_migrations/20111111144706_setup_audit_log_types.erp_tech_svcs.rb +0 -22
  23. data/spec/dummy/db/data_migrations/20120109173616_create_download_capability_type.erp_tech_svcs.rb +0 -14
  24. data/spec/dummy/db/data_migrations/20120229160222_add_userinfo_widget.erp_app.rb +0 -31
  25. data/spec/dummy/db/data_migrations/20120405193721_create_party_and_role_type_for_communication_events.erp_app.rb +0 -11
  26. data/spec/dummy/db/data_migrations/20120411180756_create_user_management_mobile_application.erp_app.rb +0 -19
  27. data/spec/dummy/db/data_migrations/20120418164215_create_configuration_management_desktop_application.erp_app.rb +0 -23
  28. data/spec/dummy/db/data_migrations/20120824013449_create_ticket_form.erp_forms.rb +0 -67
  29. data/spec/dummy/db/data_migrations/20121026013449_update_ticket_form.erp_forms.rb +0 -65
  30. data/spec/dummy/db/data_migrations/20121026191738_update_contact_form.erp_forms.rb +0 -27
  31. data/spec/dummy/db/migrate/20121207195349_base_erp_services.erp_base_erp_svcs.rb +0 -461
  32. data/spec/dummy/db/migrate/20121207195350_base_tech_services.erp_tech_svcs.rb +0 -255
  33. data/spec/dummy/db/migrate/20121207195351_create_has_attribute_tables.erp_tech_svcs.rb +0 -39
  34. data/spec/dummy/db/migrate/20121207195352_base_app_framework.erp_app.rb +0 -276
  35. data/spec/dummy/db/migrate/20121207195353_dynamic_forms.erp_forms.rb +0 -95
  36. data/spec/dummy/db/migrate/20121207195354_create_tickets.erp_forms.rb +0 -19
  37. data/spec/dummy/db/migrate/20121207195355_upgrade_dynamic_forms_table.erp_forms.rb +0 -32
  38. data/spec/dummy/db/schema.rb +0 -879
  39. data/spec/dummy/db/spec.sqlite3 +0 -0
  40. data/spec/dummy/log/spec.log +0 -3827
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: fcfb01271f7ba1c6474ee78c6c2440ffd85e2fb8
4
+ data.tar.gz: 59cee03a3a8e0fb847b0fbdd67b9f0189fa7d35f
5
+ SHA512:
6
+ metadata.gz: 24b0b9a9eb3bd3bb57e041eb0bb40c2bfd5375ac0ec7ac49110650e87712d185d8ba38bf82eb299a17fddc71658fa626ebeedbd4bb996a14fa574c56b4a07249
7
+ data.tar.gz: e66eb2b633e7a04ef1c621ed281fe31ed571dcecab7cc12ba22c385ec75f9c5952b35ad778c0b4a6d5785842a898a9ed29922ebfa540570028c634bcf4362980
@@ -3,9 +3,8 @@ module CompassAeConsole
3
3
  module Desktop
4
4
  class BaseController < ::ErpApp::Desktop::BaseController
5
5
  def command
6
- logger.debug("command received:#{params}")
7
6
  begin
8
- result=""
7
+ result = ""
9
8
 
10
9
  # NOTE- the console uses a shared binding. this is due to the fact
11
10
  # that binding instances are not serializable and cant be stored
@@ -15,127 +14,138 @@ module CompassAeConsole
15
14
 
16
15
  # the shared binding is needed to allow for variable scope visibility
17
16
  # across multiple requests
18
- if($session_binding==nil)
17
+ if ($session_binding==nil)
19
18
  $session_binding=binding
20
19
  end
21
20
 
22
21
  command_message=params[:command_message]
23
- logger.debug("console session context:#{$session_binding}")
24
- logger.debug("command:#{command_message}")
25
22
 
26
23
  # here we handle any desktop console-specific command
27
24
  # these can include non-eval related funtions
28
25
  # or provide shortcuts to common eval expressions
29
- result = case command_message
30
- when /^-help/
31
- help_message
32
- when /^-clear/
33
- #this is actually handled in the console desktop application
34
- #evaluate_command("")
35
- when /^-time/
36
- evaluate_command("Time.now")
37
- when /^-whoami/
38
- evaluate_command("current_user.username")
39
- else
40
- evaluate_command(command_message)
41
- end
26
+ result = case command_message
27
+ when /^-help/
28
+ help_message
29
+ when /^-clear/
30
+ #this is handled in the console desktop application
31
+ when /^-time/
32
+ evaluate_command("Time.now")
33
+ when /^-whoami/
34
+ evaluate_command("current_user.username")
35
+ else
36
+ evaluate_command(command_message)
37
+ end
42
38
 
43
- logger.debug("result#{result}")
44
-
45
- result_message =result.to_s.gsub("\n", "<br />\n")
46
- render :json=> {:success=>"#{result_message}<hr><br>"}
39
+ result_message = result.to_s.gsub("\n", "<br />\n")
40
+ render :json => {:success => "#{result_message}<hr><br>"}
47
41
  end
48
42
  end
43
+
49
44
  private
45
+
50
46
  #****************************************************************************
51
47
  def help_message()
52
- message = "<font color='lightgray'><b>Compass Desktop Console Help<b><hr>"
48
+ message = "<span color='lightgray'><b>Compass Desktop Console Help<b><hr>"
53
49
  message<< "<ul>"
54
- message<< "<li>-clear : <font color='yellow'>Clear screen contents.</font></li>"
55
- message<< "<li>-help : <font color='yellow'>This help list.</font></li>"
56
- message<< "<li>-time : <font color='yellow'>Current time.</font></li>"
57
- message<< "<li>-whoami : <font color='yellow'>Logged in as.</font></li>"
58
- message<< "</ul> </font>"
50
+ message<< "<li>-clear : Clear screen contents.</li>"
51
+ message<< "<li>-help : This help list.</li>"
52
+ message<< "<li>-time : Current time.</li>"
53
+ message<< "<li>-whoami : Logged in as.</li>"
54
+ message<< "</ul> </span>"
59
55
  end
56
+
60
57
  #****************************************************************************
61
58
  def highlight_class(klass)
62
- klass.columns.map do |column|
63
- "<font color='yellow'>#{column.name}</font><font color='lightgray'>:</font><font color='gold'>#{column.type}</font>"
59
+ "".tap do |buffer|
60
+ klass.columns.each do |column|
61
+ buffer << "<div>#{column.name}<span style='color:gray'>:</span><span style='color:gold'>#{column.type}</span></div>"
62
+ end
64
63
  end
65
64
  end
66
-
65
+
67
66
  def hightlight_instance(instance)
68
67
  "".tap do |buffer|
69
68
  instance.attributes.keys.sort.each do |model_attribute_key|
70
- Rails.logger.debug("key:#{model_attribute_key}")
71
- buffer << "<font color='yellow'>#{model_attribute_key}</font> <font color='lightgray'>=</font><font color='gold'>#{instance.attributes[model_attribute_key]}</font> <font color='lightgray'>, </font>"
69
+ buffer << "<div>#{model_attribute_key} <span style='color:lightgray'>=</span><span style='color:gold'>#{instance.attributes[model_attribute_key]}</span></div>"
72
70
  end
73
71
  end
74
72
  end
73
+
75
74
  #****************************************************************************
76
75
 
77
76
  def evaluate_command(command_message)
78
- Rails.logger.debug("evaluate_command(#{command_message}")
79
77
  begin
80
78
  result_eval = $session_binding.eval(command_message)
81
- if(result_eval.respond_to?("superclass") && result_eval.superclass == ActiveRecord::Base)
82
- result = render_active_record_model(result_eval)
83
- elsif(result_eval.class.respond_to?("superclass") && result_eval.class.superclass == ActiveRecord::Base)
84
- result = render_array([result_eval])
85
- elsif (result_eval.is_a? Array)
86
- result = render_array(result_eval)
87
- elsif (result_eval.is_a? Hash)
88
- result = render_hash(result_eval)
89
- else
90
- result = "#{result_eval.to_s}<br>"
91
- end
92
- rescue Exception => e
93
- result = "<font color='red'>#{e.to_s}</font>"
79
+
80
+ result = if result_eval.respond_to?("columns") # If it responds to columns, this is an ActiveRecord model
81
+
82
+ render_active_record_model(result_eval)
83
+ elsif result_eval.respond_to?("class") && result_eval.class.ancestors.include?(ActiveRecord::Base)
84
+
85
+ render_model(result_eval)
86
+ elsif result_eval.is_a? Array
87
+
88
+ render_array(result_eval)
89
+ elsif result_eval.is_a? Hash
90
+
91
+ render_hash(result_eval)
92
+ else
93
+
94
+ "#{result_eval.inspect}"
95
+ end
96
+ rescue => ex
97
+ result = "<span style='color:red'>#{ex.to_s}</span>"
94
98
  end
95
99
 
96
100
  result
97
101
  end
102
+
98
103
  #****************************************************************************
99
104
  def render_active_record_model(result_eval)
100
- Rails.logger.debug("render_active_record_model:#{result_eval}")
101
- "<font color='YellowGreen'>#{result_eval.class} </font><br>#{highlight_class(result_eval)} "
105
+ "<div>#{highlight_class(result_eval)}<div>"
102
106
  end
107
+
108
+ #****************************************************************************
109
+ def render_model(result_eval)
110
+ "<div style='color:YellowGreen'>#{result_eval.class}</div><div>#{hightlight_instance(result_eval)}<div>"
111
+ end
112
+
103
113
  #****************************************************************************
104
114
  def render_array(result_eval)
105
- result="#{result_eval.class.to_s}<br>"
106
- Rails.logger.debug("render_array:#{result_eval}")
107
- count=0
115
+ result = "#{result_eval.class.to_s}"
116
+ count = 0
117
+
108
118
  result_eval.each do |array_element|
109
- if(array_element.is_a? ActiveRecord::Base)
110
- result << "<font color='YellowGreen'>#{array_element.class}<font color='yellow'>[</font><font color='white'>#{count}</font><font color='yellow'>]</font> </font>#{hightlight_instance(array_element)} <br><br>"
119
+ if array_element.is_a? ActiveRecord::Base
120
+ result << "<span style='color:YellowGreen'>#{array_element.class}[<span color='white'>#{count}</span>] </span>#{hightlight_instance(array_element)} <br>"
111
121
  else
112
- result << "<font color='YellowGreen'>#{array_element.class}<font color='yellow'>[</font><font color='white'>#{count}</font><font color='yellow'>]</font> </font>#{array_element} <br><br>"
122
+ result << "<span style='color:YellowGreen'>#{array_element.class}[<span color='white'>#{count}</span>] </span>#{array_element} <br>"
113
123
  end
114
124
  count=count+1
115
125
  end
116
126
  result
117
127
  end
128
+
118
129
  #****************************************************************************
119
130
  def render_hash(result_eval)
120
- Rails.logger.debug("render_hash:#{result_eval}")
121
- result="#{result_eval.class.to_s}<br>"
122
- count=0
131
+ result = "#{result_eval.class.to_s}<br>"
132
+ count = 0
133
+
123
134
  result_eval.keys.each do |hash_key|
124
135
  symbol_modifier=''
125
- if(hash_key.is_a? Symbol)
136
+ if hash_key.is_a? Symbol
126
137
  symbol_modifier=':'
127
138
  end
128
- if(hash_key.is_a? ActiveRecord::Base)
129
-
130
- result<< "<font color='YellowGreen'>#{result_eval.class}<font color='yellow'>[</font><font color='white'>#{symbol_modifier}#{hash_key}</font><font color='yellow'>] => </font> </font>#{highlight(result_eval[hash_key])} <br>"
139
+ if hash_key.is_a? ActiveRecord::Base
140
+ result<< "<span style='color:YellowGreen'>#{result_eval.class}[<span style='color:white'>#{symbol_modifier}#{hash_key}</span>] => </span>#{highlight(result_eval[hash_key])} <br>"
131
141
  else
132
- result<<"<font color='YellowGreen'>#{result_eval.class}<font color='yellow'>[</font><font color='white'>#{symbol_modifier}#{hash_key}</font><font color='yellow'>] => </font> </font>#{result_eval[hash_key]} <br>"
142
+ result<<"<span style='color:YellowGreen'>#{result_eval.class}</span>[<span style='color:white'>#{symbol_modifier}#{hash_key}</span>] => #{result_eval[hash_key]} <br>"
133
143
  end
134
144
  count=count+1
135
145
  end
136
146
  result
137
147
  end
138
148
  end
139
- end#end BaseController
140
- end#end ErpApp
141
- end#end Console
149
+ end #end BaseController
150
+ end #end ErpApp
151
+ end #end Console
@@ -1,6 +1,5 @@
1
1
  #compass libraries
2
2
  require 'erp_app'
3
- require 'erp_forms'
4
3
 
5
4
  require "compass_ae_console/version"
6
5
  require "compass_ae_console/engine"
@@ -3,7 +3,7 @@ module CompassAeConsole
3
3
  isolate_namespace CompassAeConsole
4
4
 
5
5
  initializer "compass_console.merge_public" do |app|
6
- app.middleware.insert_before Rack::Lock, ::ActionDispatch::Static, "#{root}/public"
6
+ app.middleware.insert_before Rack::Runtime, ::ActionDispatch::Static, "#{root}/public"
7
7
  end
8
8
 
9
9
  ErpBaseErpSvcs.register_as_compass_ae_engine(config, self)
@@ -1,9 +1,13 @@
1
1
  module CompassAeConsole
2
2
  module VERSION #:nodoc:
3
- MAJOR = 2
3
+ MAJOR = 3
4
4
  MINOR = 0
5
5
  TINY = 0
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].compact.join('.')
8
8
  end
9
+
10
+ def self.version
11
+ CompassAeConsole::VERSION::STRING
12
+ end
9
13
  end
@@ -1,176 +1,38 @@
1
- //**************************************************
2
- // Compass Desktop Console
3
- //**************************************************
4
- var desktop_console_history=new Array();
5
- var desktop_console_history_index=0;
6
- //----------------------------------
7
- // add startsWith method to string
8
- String.prototype.startsWith = function (str){
9
- return this.indexOf(str) == 0;
10
- };
11
- //---------------------------------
12
- var startup_heading="<font color='goldenrod'><b>Compass Console Version 0.01</b>&nbsp;(<font color='white'>-help</font> for Help)</font><br>"
13
- //---------------------------------
14
- function sendCommand(destination,command){
15
- update_history_panel("<font color='white'>"+command+"</font>")
16
-
17
- if(command.startsWith("-clear")){
18
- clear_history_panel(startup_heading+"<br><hr>");
19
- }else{
20
-
21
- Ext.Ajax.request({
22
- url: '/compass_ae_console/erp_app/desktop/command',
23
- params: {
24
-
25
- command_message: command
26
- },
27
- success: function(response){
28
- var text = response.responseText;
29
- var result =Ext.JSON.decode(text)
30
- update_history_panel("<font color='yellow'>"+result.success+"</font>")
31
- }
32
- });
33
- }
34
- }
35
- //---------------------------------
36
- function clear_history_panel(text){
37
- var panel=Ext.getCmp('console_history_panel');
38
-
39
- panel.update(""+text+"<br>");
40
-
41
- var d = panel.body.dom;
42
- d.scrollTop = d.scrollHeight - d.offsetHeight+10;
43
- panel.doLayout();
44
- }
45
- //---------------------------------
46
- function update_history_panel(text){
47
- var panel=Ext.getCmp('console_history_panel');
48
- var old = panel.body.dom.innerHTML;
49
- panel.update(old+""+text+"<br>");
50
-
51
- var d = panel.body.dom;
52
- d.scrollTop = d.scrollHeight - d.offsetHeight+10;
53
- panel.doLayout();
54
- }
55
-
56
- //---------------------------------
57
- var console_history_panel ={
58
- xtype: 'panel',
59
- id : 'console_history_panel',
60
- region: 'center',
61
- bodyStyle: "background-color:#000;",
62
- autoScroll:true,
63
- html : startup_heading
64
- }
65
-
66
- //---------------------------------
67
-
68
- var console_text_area ={
69
- xtype: 'textarea',
70
- region : 'south',
71
- autoscroll: true,
72
- id: "console_text_area",
73
- enableKeyEvents: true,
74
- listeners: {
75
- afterrender: function(field) {
76
- field.focus();
77
- },
78
- // use key-up for textarea since ENTER does not affect focus traversal
79
- keyup: function(field, e){
80
- //console.log("textarea keyup:"+e);
81
- if (e.getKey() == e.ENTER){
82
-
83
- sendCommand('console_text_area',field.getValue());
84
- // add to history
85
- desktop_console_history[desktop_console_history.length]=field.getValue().substring(0,field.getValue().length-1);
86
- //update index
87
- desktop_console_history_index=desktop_console_history.length
88
- field.setValue("");
89
- }else if (e.getKey() == e.UP){
90
-
91
- if(desktop_console_history.length==0){
92
- // no history to display
93
- }else{
94
- desktop_console_history_index--;
95
- if(desktop_console_history_index >=0){
96
-
97
- }
98
- else{
99
- desktop_console_history_index=desktop_console_history.length-1
100
- }
101
- field.setValue(desktop_console_history[desktop_console_history_index]);
102
- }
103
-
104
- }else if (e.getKey() == e.DOWN){
105
-
106
- if(desktop_console_history.length==0){
107
- // no history to display
108
- }else{
109
- desktop_console_history_index++;
110
- if(desktop_console_history_index >=(desktop_console_history.length)){
111
- desktop_console_history_index=0
112
- }
113
- else{
114
- //desktop_console_history_index=desktop_console_history.length-1
115
- }
116
- field.setValue(desktop_console_history[desktop_console_history_index]);
117
- }
118
- }
119
- }
120
-
121
- }
122
- }
123
- //---------------------------------
124
- var console_panel={
125
- xtype: 'panel',
126
- layout: 'border',
127
- items :[ console_history_panel,console_text_area]
128
-
129
- }
130
-
131
- //---------------------------------
132
-
133
- Ext.define("Compass.ErpApp.Desktop.Applications.CompassAeConsole",{
134
- extend:"Ext.ux.desktop.Module",
135
- id:'compass_console-win',
136
- init : function(){
1
+ Ext.define("Compass.ErpApp.Desktop.Applications.CompassAeConsole", {
2
+ extend: "Ext.ux.desktop.Module",
3
+ id: 'compass_console-win',
4
+ init: function () {
137
5
  this.launcher = {
138
6
  text: 'Compass Console',
139
- iconCls:'icon-console',
7
+ iconCls: 'icon-console',
140
8
  handler: this.createWindow,
141
9
  scope: this
142
- }
10
+ };
143
11
  },
144
12
 
145
- createWindow : function(){
13
+ createWindow: function () {
146
14
  var desktop = this.app.getDesktop();
147
15
  var win = desktop.getWindow('console');
148
- if(!win){
16
+ if (!win) {
149
17
  win = desktop.createWindow({
150
18
  id: 'console',
151
- title:'Compass Console',
152
- width:1000,
153
- height:670,
154
- iconCls: 'console_icon',
155
- shim:false,
156
- animCollapse:false,
157
- resizable : false,
158
- constrainHeader:true,
19
+ title: 'Compass Console',
20
+ width: 800,
21
+ height: 600,
22
+ iconCls: 'icon-console',
23
+ shim: false,
24
+ animCollapse: false,
25
+ resizable: true,
26
+ constrainHeader: true,
159
27
  layout: 'fit',
160
- items:[console_panel]
161
- ,
162
- tools:[
163
- {
164
- type:'help',
165
- tooltip: 'about',
166
- handler: function(event, toolEl, panel){
167
- Ext.Msg.alert("About","<center><b>Compass Console</b><br><i>Version 0.01</i>")
28
+ items: [
29
+ {
30
+ xtype: 'compass_ae_console_panel',
31
+ header: false
168
32
  }
169
- }]
170
-
33
+ ]
171
34
  });
172
35
  }
173
36
  win.show();
174
- sendCommand('console_text_area',"Rails.version ");
175
37
  }
176
38
  });