Skip to content
Browse files

deployment connections!

  • Loading branch information...
2 parents 35f1bf8 + 05b112b commit e8667becb1788a6c5f9696e229911d279a0c1628 Joe Ferraro committed Oct 3, 2012
View
6 Default.sublime-commands
@@ -44,7 +44,11 @@
"command": "new_apex_component"
},
{
- "caption": "Deploy To Server",
+ "caption": "MavensMate: Deploy To Server",
"command": "deploy_to_server"
+ },
+ {
+ "caption": "MavensMate: Deployment Connections",
+ "command": "org_connections"
}
]
View
4 Main.sublime-menu
@@ -28,6 +28,10 @@
{
"caption": "Compile Project",
"command": "compile_project"
+ },
+ {
+ "caption": "Deployment Connections",
+ "command": "org_connections"
}
]
},
View
2 commands/deployment_connections.rb
@@ -4,4 +4,4 @@
require SUPPORT + "/environment.rb"
require CONTROLLERS_ROOT + "/org_connection_controller.rb"
ENV["MM_CURRENT_PROJECT_DIRECTORY"] = ARGV[0]
-dispatch :controller => "project", :action => "index_new", :user_action => "checkout"
+dispatch :controller => "org_connection", :action => "index"
View
10 mavensmate.py
@@ -116,6 +116,14 @@ def run (self):
#mark_lines(self, None)
clear_marked_lines()
+#launches the org connections UI
+class OrgConnectionsCommand(sublime_plugin.ApplicationCommand):
+ def run(command):
+ start_local_server()
+ temp_file_name = generate_ui("deployment_connections", "'"+mm_project_directory()+"'")
+ launch_mavens_mate_window(temp_file_name)
+
+
#takes user to the update directions on github (should be unnecessary once package control support is finalized)
class UpdateMeCommand(sublime_plugin.ApplicationCommand):
def run(self):
@@ -665,7 +673,7 @@ def on_post_save(self, view):
settings = sublime.load_settings('mavensmate.sublime-settings')
active_file = get_active_file()
fileName, ext = os.path.splitext(active_file)
- valid_file_extensions = ['.page', '.component', '.cls', '.object', '.page', '.trigger', '.tab', '.layout', '.resource', '.remoteSite']
+ valid_file_extensions = ['.page', '.component', '.cls', '.object', '.page', '.trigger', '.tab', '.layout', '.resource', '.remoteSite', '.labels', '.app', '.dashboard']
if settings.get('mm_compile_on_save') == True and is_mm_project() == True and ext in valid_file_extensions:
printer = PanelPrinter.get(view.window().id())
printer.show()
View
3 support/app/controllers/deploy_controller.rb
@@ -21,7 +21,8 @@ def index
connections.push({
:un => connection["username"],
:pw => pw,
- :server_url => server_url
+ :server_url => server_url,
+ :type => connection["environment"]
})
end
rescue Exception => e
View
6 support/app/controllers/org_connection_controller.rb
@@ -17,9 +17,9 @@ def index
#adds a new deployment connection to a project, stores creds in keychain
def new_connection
begin
- un = params[:un]
- pw = params[:pw]
- server_url = params[:server_url]
+ un = params[:un].to_s
+ pw = params[:pw].to_s
+ server_url = params[:server_url].to_s
TextMate.call_with_progress( :title => "MavensMate", :message => "Validating Salesforce.com Credentials" ) do
client = MavensMate::Client.new({ :username => params[:un], :password => params[:pw], :endpoint => params[:server_url] })
View
461 support/app/views/deploy/_deploy.html.erb
@@ -1,13 +1,13 @@
<style>
- .bordered-table, .bordered-table td {
- -webkit-border-radius: 0px !important;
- border-radius: 0px !important;
- }
-
- .bordered-table {
- border-bottom:2px solid #ccc !important;
- }
-
+.bordered-table, .bordered-table td {
+ -webkit-border-radius: 0px !important;
+ border-radius: 0px !important;
+}
+
+.bordered-table {
+ border-bottom:2px solid #ccc !important;
+}
+
</style>
<div id="result_output">
@@ -31,6 +31,7 @@
<li class="active"><a href="#form">Deploy Options</a></li>
<li><a href="#metadata">Metadata</a></li>
<li><a href="#result" id="result_tab">Result</a></li>
+ <li><a href="#arcade" id="arcade_tab">Arcade</a></li>
</ul>
<div class="pill-content">
@@ -40,7 +41,7 @@
<div class="clearfix">
<label for="un">Deployment Targets</label>
<%
- display = connections.size == 0 ? "block" : "none"
+ display = connections.size == 0 ? "block" : "none"
%>
<% if connections.size > 0 %>
@@ -102,27 +103,27 @@
</div> -->
<!-- <div id="deploy_info" style="display:none;" class="alert-message block-message info">
<p><strong>This deployment will run in async mode.</strong></p>
- </div> -->
-
- </fieldset>
+ </div> -->
+
+ </fieldset>
</form>
</div>
<style>
- #filter {
- background-color:#f7f7f7;
- padding:5px;
- border-bottom:1px solid #ccc;
- margin-bottom:10px;
- position:relative;
- }
+ #filter {
+ background-color:#f7f7f7;
+ padding:5px;
+ border-bottom:1px solid #ccc;
+ margin-bottom:10px;
+ position:relative;
+ }
</style>
-
+
<div id="metadata">
<form class="form-stacked" style="padding-left:5px;margin-bottom:2px;">
- <fieldset>
+ <fieldset>
<!-- <div class="clearfix">
<label for="ptype">Package Type</label>
<select id="ptype">
@@ -135,23 +136,23 @@
<label for="cset">Changeset</label>
<select id="cset">
<% changesets.each do |c| %>
- <option><%= c %></option>
+ <option><%= c %></option>
<% end %>
</select>
</div>
</fieldset>
</form>
<script>
- $("#ptype").change(function() {
- if (this.value == "Custom") {
- $("#project_wrapper").show();
- $("#changesetwrapper").hide();
- } else {
- $("#project_wrapper").hide();
- $("#changesetwrapper").show();
- }
- })
+ $("#ptype").change(function() {
+ if (this.value == "Custom") {
+ $("#project_wrapper").show();
+ $("#changesetwrapper").hide();
+ } else {
+ $("#project_wrapper").hide();
+ $("#changesetwrapper").show();
+ }
+ })
</script>
<div id="project_wrapper">
@@ -160,20 +161,39 @@
<input type="text" id="txtFilter" style="width:165px" />
<a href="#" id="btnClearFilter" onclick="clearFilter();" class="btn small error" style="visibility:invisible;opacity:0;font-weight:bold;position:relative;top:1px;right:30px;padding:4px 7px 4px;">X</a>
<a href="#" id="btnSelectAll" class="btn small" style="font-weight:normal;padding:4px 7px 4px;">all</a>
- <a href="#" id="btnDeselectAll" class="btn small" style="font-weight:normal;padding:4px 7px 4px;">none</a>
+ <a href="#" id="btnDeselectAll" class="btn small" style="font-weight:normal;padding:4px 7px 4px;">none</a>
</div>
<div id="treewrapper">
<div id="tree">
<ul>
-
+
</ul>
</div>
<div id="info"></div>
</div>
</div>
</div>
+ <div class="content" id="arcade">
+ <ul class="tabs tabs-below">
+ <li class="game"><a href="#game_pacman">Pacman</a></li>
+ <li class="game"><a href="#game_tetris">Tetris</a></li>
+ <li class="game"><a href="#game_donkey">Donkey Kong</a></li>
+ </ul>
+ <div class="pill-content">
+ <div class="active" id="game_pacman">
+ <embed src="http://www.classicgamesarcade.com/games/pacman.swf" width="100%" height="75%" autostart="true" loop="false" controller="true" id="pacman" class="flash_game"></embed>
+ </div>
+ <div id="game_tetris">
+ <embed src="http://www.classicgamesarcade.com/games/flash-tetris.swf" width="100%" height="75%" autostart="true" loop="false" controller="true" id="tetris" class="flash_game"></embed>
+ </div>
+ <div id="game_donkey">
+ <embed src="http://www.classicgamesarcade.com/games/donkeykong.swf" width="100%" height="75%" autostart="true" loop="false" controller="true" id="donkey" class="flash_game"></embed>
+ </div>
+ </div>
+ </div>
+
<div id="result">
</div>
@@ -182,89 +202,71 @@
<form class="form-stacked" id="action_buttons">
- <fieldset style="padding-top:0px;">
+ <fieldset style="padding-top:0px;position:relative;">
<div class="actions">
<input id="btnDeploy" type="button" class="btn primary" value="Deploy to Server" onclick='deploy()'>
&nbsp;
<button type="reset" class="btn" onclick="window.close();">Cancel</button>
</div>
+ <img src="<%=ENV['TM_BUNDLE_SUPPORT']%>/resource/images/big_loading.gif" style="position:absolute;top:13px;right:25px;width:36px;display:none;" id="deployment_indicator"/>
</fieldset>
</form>
<script type="text/javascript">
- var mm_cpd = '<%= ENV["MM_CURRENT_PROJECT_DIRECTORY"] %>';
- var has_indexed_metadata = <%= File.exist? "#{ENV["MM_CURRENT_PROJECT_DIRECTORY"]}/config/.org_metadata" %>;
+var mm_cpd = '<%= ENV["MM_CURRENT_PROJECT_DIRECTORY"] %>';
+var has_indexed_metadata = <%= File.exist? "#{ENV["MM_CURRENT_PROJECT_DIRECTORY"]}/config/.org_metadata" %>;
- document.title = "Deploy To Server";
-
- var child_def = {}
- <%- child_metadata_definition.each do |child| -%>
- child_def['<%= child[:tag_name] %>'] = '<%= child[:xml_name] %>';
- <%- end -%>
-
- var pw_def = {}
- <%- connections.each do |c| -%>
- pw_def['<%= c[:un] %>'] = '<%= c[:pw] %>';
- <%- end -%>
-
- var surl_def = {}
- <%- connections.each do |c| -%>
- surl_def['<%= c[:un] %>'] = '<%= c[:server_url] %>';
- <%- end -%>
-
- function isValidateOnly() {
- if ($("#check_only").is(":checked")) {
- return "1";
- } else {
- return "0";
- }
+document.title = "Deploy To Server";
+
+var child_def = {}
+<%- child_metadata_definition.each do |child| -%>
+child_def['<%= child[:tag_name] %>'] = '<%= child[:xml_name] %>';
+<%- end -%>
+
+var pw_def = {}
+<%- connections.each do |c| -%>
+pw_def['<%= c[:un] %>'] = '<%= c[:pw] %>';
+<%- end -%>
+
+var surl_def = {}
+<%- connections.each do |c| -%>
+surl_def['<%= c[:un] %>'] = '<%= c[:server_url] %>';
+<%- end -%>
+
+function isValidateOnly() {
+ if ($("#check_only").is(":checked")) {
+ return "1";
+ } else {
+ return "0";
}
-
- function deployMode() {
- if ($("#set_and_forget").is(":checked")) {
- return "async";
- } else {
- return "";
- }
+}
+
+function deployMode() {
+ if ($("#set_and_forget").is(":checked")) {
+ return "async";
+ } else {
+ return "";
}
-
- $("#save_changeset").click(function() {
- if (this.checked) {
- $("#changeset_name_wrapper").show();
- } else {
- $("#changeset_name_wrapper").hide();
- }
- });
-
- function resizeWindowAfterResult() {
- window.resizeTo(800, window.innerHeight);
- window.moveTo(
- (screen.width-800)/2,
- (screen.height-document.getElementById('wrapper').offsetHeight-400)/2
- );
+}
+
+$("#save_changeset").click(function() {
+ if (this.checked) {
+ $("#changeset_name_wrapper").show();
+ } else {
+ $("#changeset_name_wrapper").hide();
}
+});
- $(function() {
-
- //if dom elements is removed, we need to resize the window
- $( "body" ).bind(
- "DOMNodeInserted",
- function( event ) {
- if (event.target.id == "result") {
- $("#result_tab").click();
- $(".result_table_class").height($(window).height() - 300)
- $(window).resize(function() {
- $(".result_table_class").height($(window).height() - 300)
- });
- resizeWindowAfterResult();
- }
- }
- );
-
- // $("#un").val($("#un_list").val());
- // $("#pw").val(pw_def[this.value]);
- // $("#server_url").val(surl_def[this.value]);
-
+function resizeWindowAfterResult() {
+ window.resizeTo(800, window.innerHeight);
+ window.moveTo(
+ (screen.width-800)/2,
+ (screen.height-document.getElementById('wrapper').offsetHeight-400)/2
+ );
+}
+
+$(function() {
+
$("#check_only").change(function() {
if (!this.checked) {
$("#btnDeploy").val('Deploy to Server');
@@ -291,26 +293,27 @@
$("#un").val($("#un_list").val());
$("#pw").val(pw_def[$("#un_list").val()]);
}
-
+
$('.tabs').tabs();
- $("#project_wrapper").height($(window).height() - 225)
+ $("#project_wrapper").height($(window).height() - 225)
- var resizeHeight = $("#form").height();
- resizeAndCenterWindowByHeight(resizeHeight + 250);
+ var resizeHeight = $("#form").height();
+ resizeAndCenterWindowByHeight(resizeHeight + 250);
- $(window).resize(function() {
- $("#project_wrapper").height($(window).height() - 225)
- });
+ $(window).resize(function() {
+ $("#project_wrapper").height($(window).height() - 225)
+ resize_games()
+ });
- $.expr[':'].Contains = function(a, i, m) {
- return (a.textContent || a.innerText || "").toUpperCase().indexOf(m[3].toUpperCase()) >= 0;
- };
+ $.expr[':'].Contains = function(a, i, m) {
+ return (a.textContent || a.innerText || "").toUpperCase().indexOf(m[3].toUpperCase()) >= 0;
+ };
- $("#txtFilter")
- .change(function() {
- var filter = $(this).val();
+ $("#txtFilter")
+ .change(function() {
+ var filter = $(this).val();
//if (filter.length < 3) return false;
// if (filter) {
// // this finds all links in a list that contain the input,
@@ -324,125 +327,121 @@
// } else {
// $(".dynatree-node").parent().show();
// }
- if (filter) {
- $("#btnClearFilter").css({opacity: 1.0, visibility: "visible"})
- expandAll();
- filter_tree(filter);
- } else {
- $("#btnClearFilter").css({opacity: 0.0, visibility: "invisible"})
- clearFilter();
- }
+ if (filter) {
+ $("#btnClearFilter").css({opacity: 1.0, visibility: "visible"})
+ expandAll();
+ filter_tree(filter);
+ } else {
+ $("#btnClearFilter").css({opacity: 0.0, visibility: "invisible"})
+ clearFilter();
+ }
return false;
})
- .keyup(function() {
+.keyup(function() {
// fire the above change event after every letter
- $(this).change();
+ $(this).change();
});
index_org(!has_indexed_metadata);
$("#un_list").chosen();
});
- function filter_tree(searchTerm) {
- var regex = new RegExp(searchTerm,"i");
- rootNode.visit(function(node) {
- if (node.isVisible() && node.data.title) {
- nodeTitle = node.data.title;
- if ( nodeTitle.match(regex) ) {
- node.visitParents(function(node) {
- $(node.li).show();
- return (node.parent != null);
- }, true);
- return 'skip';
- } else {
- $(node.li).hide();
- }
+function filter_tree(searchTerm) {
+ var regex = new RegExp(searchTerm,"i");
+ rootNode.visit(function(node) {
+ if (node.isVisible() && node.data.title) {
+ nodeTitle = node.data.title;
+ if ( nodeTitle.match(regex) ) {
+ node.visitParents(function(node) {
+ $(node.li).show();
+ return (node.parent != null);
+ }, true);
+ return 'skip';
+ } else {
+ $(node.li).hide();
}
- });
- }
-
- function expandAll() {
- $("#tree").dynatree("getRoot").visit(function(node){
- node.expand(true);
- });
- }
-
- function collapseAll() {
- $("#tree").dynatree("getRoot").visit(function(node){
- node.expand(false);
- });
- }
-
- function clearFilter() {
- $('#txtFilter').val('');
- $("#btnClearFilter").css({opacity: 0.0, visibility: "visible"});
- collapseAll();
- $(".dynatree-container li").show();
- $('#txtFilter').focus();
- }
-
- $("#btnDeselectAll").click(function(){
- $("#tree").dynatree("getRoot").visit(function(node){
- if ($(node.li).css('display') != 'none') {
- try {
- if (node.data.level > 1)
- node.select(false);
- } catch(e) {
- node.select(false);
- }
+ }
+ });
+}
+
+function expandAll() {
+ $("#tree").dynatree("getRoot").visit(function(node){
+ node.expand(true);
+ });
+}
+
+function collapseAll() {
+ $("#tree").dynatree("getRoot").visit(function(node){
+ node.expand(false);
+ });
+}
+
+function clearFilter() {
+ $('#txtFilter').val('');
+ $("#btnClearFilter").css({opacity: 0.0, visibility: "visible"});
+ collapseAll();
+ $(".dynatree-container li").show();
+ $('#txtFilter').focus();
+}
+
+$("#btnDeselectAll").click(function(){
+ $("#tree").dynatree("getRoot").visit(function(node){
+ if ($(node.li).css('display') != 'none') {
+ try {
+ if (node.data.level > 1)
+ node.select(false);
+ } catch(e) {
+ node.select(false);
}
- });
- return false;
+ }
});
- $("#btnSelectAll").click(function(){
- $("#tree").dynatree("getRoot").visit(function(node){
- if ($(node.li).css('display') != 'none') {
- try {
- if (node.data.level > 1)
- node.select(true);
- } catch(e) {
- node.select(true);
- }
- }
- });
- return false;
+ return false;
+});
+$("#btnSelectAll").click(function(){
+ $("#tree").dynatree("getRoot").visit(function(node){
+ if ($(node.li).css('display') != 'none') {
+ try {
+ if (node.data.level > 1)
+ node.select(true);
+ } catch(e) {
+ node.select(true);
+ }
+ }
});
+ return false;
+});
- var rootNode;
-
- function index_org(refresh) {
- console.log('indexing org')
- console.log(refresh)
- $.ajax({
- type: "GET",
- url: "http://127.0.0.1:7777/metadata/index",
- data: {
- mm_current_project_directory: mm_cpd,
- do_refresh: refresh
- },
- beforeSend: function() { showLoading('Indexing your Salesforce.com metatada. This operation could take a while depending on the size of your org. Thanks for being patient! :)'); },
- complete: function(data){
- console.log(data)
- $("#tree").dynatree("destroy")
- $("#tree ul").html(data.responseText);
- $("#tree").dynatree({
- persist: false,
- checkbox: true,
- selectMode: 3
- });
- $("#tree").dynatree("getRoot").visit(function(node) {
- node.expand(false);
- });
- rootNode = $("#tree").dynatree("getRoot");
- hideLoading();
- }
- });
- }
+var rootNode;
- function refresh_index() {
- index_org(true);
- }
+function index_org(refresh) {
+ console.log('indexing org')
+ console.log(refresh)
+ $.ajax({
+ type: "GET",
+ url: "http://127.0.0.1:7777/metadata/index",
+ data: {
+ mm_current_project_directory: mm_cpd,
+ do_refresh: refresh
+ },
+ beforeSend: function() { showLoading('Indexing your Salesforce.com metatada. This operation could take a while depending on the size of your org. Thanks for being patient! :)'); },
+ complete: function(data){
+ console.log(data)
+ $("#tree").dynatree("destroy")
+ $("#tree ul").html(data.responseText);
+ $("#tree").dynatree({
+ persist: false,
+ checkbox: true,
+ selectMode: 3
+ });
+ $("#tree").dynatree("getRoot").visit(function(node) {
+ node.expand(false);
+ });
+ rootNode = $("#tree").dynatree("getRoot");
+ hideLoading();
+ }
+ });
+}
function get_target_json() {
var targets = $("#un_list").val();
@@ -470,12 +469,30 @@
tree: get_tree(),
mm_current_project_directory: mm_cpd
},
- beforeSend: function() { showLoading('Deploying to Salesforce.com'); },
+ beforeSend: function() { showElement("deployment_indicator"); $("#btnDeploy").hide() },
complete: function(data){
console.log(data)
$("#result").html(data.responseText);
- hideLoading();
+
+ hideElement("deployment_indicator");
+ $("#btnDeploy").show();
+
+ $(".result_table_class").height($(window).height() - 300)
+ $(window).resize(function() {
+ $(".result_table_class").height($(window).height() - 300)
+ });
+
+ if ($("#arcade").css("display") == "none") {
+ $("#result_tab").click();
+ resizeWindowAfterResult();
+ }
}
});
- }
+ }
+
+function refresh_index() {
+ index_org(true);
+}
+
+
</script>
View
6 support/app/views/deploy/_deploy_result.html.erb
@@ -1,4 +1,4 @@
-<div id="result" style="padding:10px;">
+<div class="result_wrapper" style="padding:10px;">
<% if result[:is_success] %>
<div class="alert-message success">
<% deploy_type = (is_check_only == "1") ? "validation" : "deployment" %>
@@ -12,11 +12,11 @@
<% end %>
<% if ! result[:is_success] %>
<div id="error_message" class="alert-message error">
- <p><strong>Deployment Failed!</strong></p>
+ <p><strong>Deployment Failed!</strong>&nbsp;</p>
</div>
<% end %>
- <div id="result_table_wrapper" style="-webkit-border-radius: 4px 4px 4px 4px;overflow-y:auto;padding:0px;border:2px solid #ccc;">
+ <div class="result_table_class" style="-webkit-border-radius: 4px 4px 4px 4px;overflow-y:auto;padding:0px;border:2px solid #ccc;">
<% if result[:messages].size > 0 %>
<div style="padding:5px 10px;background-color:#f2f2f2;border-bottom:2px solid #ccc;cursor:pointer;" onclick="$('#result_table').toggle();">Deploy Messages</div>
View
21 support/app/views/deploy/_deploy_target_tabs.html.erb
@@ -0,0 +1,21 @@
+<ul class="tabs deploy_wrapper_tabs">
+ <% targets.each_with_index do |t, i| %>
+ <li class="<%= 'active' if i == 0 %>"><a href="#result-<%= i %>"><%= t[:un] %></a></li>
+ <% end %>
+</ul>
+
+<div class="pill-content" id="deploy_result_wrapper">
+ <%= deploy_result_html %>
+</div>
+
+<script>
+ var i = 0
+ $(".result_wrapper").each(function() {
+ $(this).attr("id", "result-"+i)
+ i++
+ })
+ $('#deploy_result_wrapper div').first().addClass("active")
+ $('.tabs.deploy_wrapper_tabs').tabs()
+ // $("#result-1").click();
+ // $("#result-0").click();
+</script>
View
4 support/app/views/layouts/base.html.erb
@@ -1,5 +1,5 @@
-<% script_tag = javascript_include_tag("jquery", "jqueryui", "twipsy", "tabs", "toggle", "dynatree2", "alerts", "popover", "tooltips", "mavensmate", "jquery.tablescroll") %>
-<% style_tag = style_include_tag("bootstrap", "mavensmate", "dynatree") %>
+<% script_tag = javascript_include_tag("jquery", "jqueryui", "twipsy", "tabs", "toggle", "dynatree2", "alerts", "popover", "tooltips", "mavensmate", "jquery.tablescroll", "chosen.jquery.js") %>
+<% style_tag = style_include_tag("bootstrap", "mavensmate", "dynatree", "chosen") %>
<html>
<head>
<title>MavensMate</title>
View
30 support/app/views/org_connection/_connections.html.erb
@@ -0,0 +1,30 @@
+<% if connections.size == 0 %>
+ <div class="alert-message block-message info">
+ <p><strong>A deployment connection is a Salesforce.com org that you wish to deploy to from this MavensMate project.</strong></p>
+ </div>
+ <div class="alert-message block-message warning">
+ <p><strong>You do not have any deployment connections set up </strong></p>
+ </div>
+<% else %>
+<div class="alert-message block-message-custom" style="margin-bottom:0px;padding: 5px;-webkit-border-radius: 4px 4px 0px 0px;">
+ <p style="float:left;"><strong>Deployment Connections</strong></p>
+ <div style="clear:both;"></div>
+</div>
+<table class="bordered-table test_result" style="-webkit-border-radius: 0px 0px 4px 4px;">
+ <thead>
+ <tr>
+ <th>Connection</th>
+ <th>Action</th>
+ </tr>
+ </thead>
+ <tbody id="connections_list">
+ <% connections.each do |c| %>
+ <tr>
+ <td><%= c[:un] %></td>
+ <td><a href="javascript:void(0);" onclick="deleteConnection('<%= c[:un] %>')">Remove</a></td>
+ </tr>
+ <% end %>
+ </tbody>
+</table>
+
+<% end %>
View
117 support/app/views/org_connection/_index.html.erb
@@ -1,39 +1,39 @@
-<div id="result_output">
-
-</div>
-
<div class="content">
-
- <% if connections.size == 0 %>
- <div class="alert-message block-message info">
- <p><strong>A deployment connection is a Salesforce.com org that you wish to deploy to from this MavensMate project.</strong></p>
- </div>
- <div class="alert-message block-message warning">
- <p><strong>You do not have any deployment connections set up </strong></p>
- </div>
- <% else %>
- <div class="alert-message block-message-custom" style="margin-bottom:0px;padding: 5px;-webkit-border-radius: 4px 4px 0px 0px;">
- <p style="float:left;"><strong>Deployment Connections</strong></p>
- <div style="clear:both;"></div>
- </div>
- <table class="bordered-table test_result" style="-webkit-border-radius: 0px 0px 4px 4px;">
- <thead>
- <tr>
- <th>Connection</th>
- <th>Action</th>
- </tr>
- </thead>
- <tbody>
- <% connections.each do |c| %>
- <tr>
- <td><%= c[:un] %></td>
- <td><a href="javascript:void(0);" onclick="deleteConnection('<%= c[:un] %>')">Remove</a></td>
- </tr>
- <% end %>
- </tbody>
- </table>
+ <div id="error_wrapper">
- <% end %>
+ </div>
+ <span id="connections_wrapper">
+ <% if connections.size == 0 %>
+ <div class="alert-message block-message info">
+ <p><strong>A deployment connection is a Salesforce.com org that you wish to deploy to from this MavensMate project.</strong></p>
+ </div>
+ <div class="alert-message block-message warning">
+ <p><strong>You do not have any deployment connections set up </strong></p>
+ </div>
+ <% else %>
+ <div class="alert-message block-message-custom" style="margin-bottom:0px;padding: 5px;-webkit-border-radius: 4px 4px 0px 0px;">
+ <p style="float:left;"><strong>Deployment Connections</strong></p>
+ <div style="clear:both;"></div>
+ </div>
+ <table class="bordered-table test_result" style="-webkit-border-radius: 0px 0px 4px 4px;">
+ <thead>
+ <tr>
+ <th>Connection</th>
+ <th>Action</th>
+ </tr>
+ </thead>
+ <tbody id="connections_list">
+ <% connections.each do |c| %>
+ <tr>
+ <td><%= c[:un] %></td>
+ <td><a href="javascript:void(0);" onclick="deleteConnection('<%= c[:un] %>')">Remove</a></td>
+ </tr>
+ <% end %>
+ </tbody>
+ </table>
+
+ <% end %>
+ </div>
<div id="form" class="active">
<form class="form-stacked">
@@ -51,6 +51,7 @@
<select id="server_url">
<option>https://www.salesforce.com</option>
<option>https://test.salesforce.com</option>
+ <option>https://prerellogin.pre.salesforce.com</option>
</select>
</div>
<div class="clearfix" style="margin-top:15px;">
@@ -74,11 +75,55 @@
<script type="text/javascript">
function deleteConnection(username) {
- $('body').html(dispatch({controller: 'org_connection', action: 'delete_connection', un: username }));
+ $.ajax({
+ type: "DELETE",
+ url: "http://127.0.0.1:7777/connections",
+ data: {
+ un: username,
+ pd: '<%= ENV['MM_CURRENT_PROJECT_DIRECTORY'] %>'
+
+ },
+ beforeSend: function() { showLoading('Removing connection'); },
+ complete: function(data){
+ $("#error_wrapper").html('')
+ console.log(data)
+ var response = JSON.parse(data.responseText)
+ if (response["success"] == false) {
+ $("#error_wrapper").html(response["message"])
+ } else {
+ $("#connections_wrapper").html(response["message"])
+ }
+ hideLoading()
+ }
+ });
}
function newConnection() {
- $('body').html(dispatch({controller: 'org_connection', action: 'new_connection', un: $('#un').val(), pw: $('#pw').val(), server_url: $('#server_url').val() }));
+ $.ajax({
+ type: "POST",
+ url: "http://127.0.0.1:7777/connections",
+ data: {
+ un: $("#un").val(),
+ pw: $("#pw").val(),
+ server_url: $("#server_url").val(),
+ pd: '<%= ENV['MM_CURRENT_PROJECT_DIRECTORY'] %>'
+
+ },
+ beforeSend: function() { showLoading('Adding connection'); },
+ complete: function(data){
+ $("#error_wrapper").html('')
+ console.log(data)
+ var response = JSON.parse(data.responseText)
+ if (response["success"] == false) {
+ $("#error_wrapper").html(response["message"])
+ } else {
+ $("#un").val('')
+ $("#pw").val('')
+ $("#connections_wrapper").html(response["message"])
+ }
+ hideLoading()
+ }
+ });
}
$(function() {
View
2 support/app/views/project/_project_new.html.erb
@@ -191,7 +191,7 @@
where: "<%= ENV['MM_WORKSPACE'] %>",
action: "checkout"
},
- beforeSend: function() { showLoading('Checking project our from source control'); },
+ beforeSend: function() { showLoading('Checking project out from source control'); },
complete: function(data){
console.log(data)
var response = JSON.parse(data.responseText)
View
418 support/app/views/unit_test/_index.html.erb
@@ -6,7 +6,7 @@
<style>
.results_hidden {
- display:none;
+ display:none;
}
#mm_logger {
display:none;
@@ -42,7 +42,7 @@ table.code td.covered {
table.code td.not_covered {
background: #fdd;
}
-
+
table.code tr td.line_numbers {
text-align: right;
vertical-align: top;
@@ -80,71 +80,71 @@ table.code td {
/*.container {
width: 100%;
margin-left: 12px;
-} */
+ } */
-h4 {
- background: none repeat scroll 0 0 #777777;
- border: none;
+ h4 {
+ background: none repeat scroll 0 0 #777777;
+ border: none;
font-weight:normal;
- border-radius: 4px 4px 0 0;
- color: #FFFFFF;
- margin: 0;
- padding: 3px;
- text-align: center;
+ border-radius: 4px 4px 0 0;
+ color: #FFFFFF;
+ margin: 0;
+ padding: 3px;
+ text-align: center;
line-height:1.3;
background-color:#222;background-color:#222222;background-repeat:repeat-x;background-image:-khtml-gradient(linear, left top, left bottom, from(#333333), to(#222222));background-image:-moz-linear-gradient(top, #333333, #222222);background-image:-ms-linear-gradient(top, #333333, #222222);background-image:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #333333), color-stop(100%, #222222));background-image:-webkit-linear-gradient(top, #333333, #222222);background-image:-o-linear-gradient(top, #333333, #222222);background-image:linear-gradient(top, #333333, #222222);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#333333', endColorstr='#222222', GradientType=0);-webkit-box-shadow:0 1px 3px rgba(0, 0, 0, 0.25),inset 0 -1px 0 rgba(0, 0, 0, 0.1);-moz-box-shadow:0 1px 3px rgba(0, 0, 0, 0.25),inset 0 -1px 0 rgba(0, 0, 0, 0.1);box-shadow:0 1px 3px rgba(0, 0, 0, 0.25),inset 0 -1px 0 rgba(0, 0, 0, 0.1);
-}
+ }
-.ms-selectable, .ms-selection {
- width:292px;
-}
+ .ms-selectable, .ms-selection {
+ width:292px;
+ }
-.ms-container {
- background: none !important;
-}
+ .ms-container {
+ background: none !important;
+ }
-.ms-selectable {
- margin-right:10px !important;
- margin-bottom: 10px !important;
-}
+ .ms-selectable {
+ margin-right:10px !important;
+ margin-bottom: 10px !important;
+ }
-table.test_result {
- border-top:none;
-}
-table.test_result th, table.test_result td {
- padding:5px;
- line-height:1;
-}
+ table.test_result {
+ border-top:none;
+ }
+ table.test_result th, table.test_result td {
+ padding:5px;
+ line-height:1;
+ }
-embed.hidden {
- position: absolute;
- left: -10000px;
-}
+ embed.hidden {
+ position: absolute;
+ left: -10000px;
+ }
-</style>
-<div class="content" id="content1">
-
- <ul class="tabs">
- <li class="active"><a href="#tests_content">Apex Tests</a></li>
- <li class="game"><a href="#game_content">Pacman</a></li>
- <li class="results_hidden"><a href="#tests_results" id="a_result">Test Results</a></li>
- <li class="results_hidden"><a href="#class_coverage" id="b_result">Class Coverage</a></li>
- <li class="results_hidden"><a href="#trigger_coverage" id="c_result">Trigger Coverage</a></li>
- <li class="results_hidden"><a href="#warnings" id="d_result">Warnings</a></li>
- <li class="results_hidden"><a href="#log" id="e_result">Log</a></li>
- </ul>
-
- <div class="pill-content">
- <div class="active" id="tests_content">
- <div style="" class="headers">
- <form style="margin-bottom:5px;">
- <select id="tests" multiple="multiple" class="multiselect" style="display: none;">
- <%
+ </style>
+ <div class="content" id="content1">
+
+ <ul class="tabs">
+ <li class="active"><a href="#tests_content">Apex Tests</a></li>
+ <li class="game"><a href="#arcade">Arcade</a></li>
+ <li class="results_hidden"><a href="#tests_results" id="a_result">Test Results</a></li>
+ <li class="results_hidden"><a href="#class_coverage" id="b_result">Class Coverage</a></li>
+ <li class="results_hidden"><a href="#trigger_coverage" id="c_result">Trigger Coverage</a></li>
+ <li class="results_hidden"><a href="#warnings" id="d_result">Warnings</a></li>
+ <li class="results_hidden"><a href="#log" id="e_result">Log</a></li>
+ </ul>
+
+ <div class="pill-content">
+ <div class="active" id="tests_content">
+ <div style="" class="headers">
+ <form style="margin-bottom:5px;">
+ <select id="tests" multiple="multiple" class="multiselect" style="display: none;">
+ <%
selected_file = ENV['TM_FILEPATH'] || ENV['TM_SELECTED_FILE']
base_name = ""
if ! selected_file.nil? and selected_file.include? ".cls"
@@ -153,138 +153,154 @@ embed.hidden {
end
base_name = File.basename(selected_file, ".cls")
end
- %>
- <% classes.each do |cls| %>
+ %>
+ <% classes.each do |cls| %>
<% selected = (cls == base_name) ? "selected=\"selected\"" : "" %>
<option <%= selected %> value="<%= cls %>"><%= cls %></option>
- <% end %>
- </select>
- </form>
- </div>
- <form class="form" style="margin:0px;">
- <fieldset style="margin:0px;padding:0px;">
- <div class="clearfix">
- <label for="api" style="width:110px;margin-right:10px;">Endpoint</label>
- <select id="api">
- <option value="metadata">Metadata API</option>
- <option value="apex">Apex API</option>
- </select>
+ <% end %>
+ </select>
+ </form>
+ </div>
+ <form class="form" style="margin:0px;">
+ <fieldset style="margin:0px;padding:0px;">
+ <div class="clearfix">
+ <label for="api" style="width:110px;margin-right:10px;">Endpoint</label>
+ <select id="api">
+ <option value="metadata">Metadata API</option>
+ <option value="apex">Apex API</option>
+ </select>
+ </div>
+ <div class="clearfix">
+ <label for="category" style="width:110px;margin-right:10px;">Log Category</label>
+ <select id="category">
+ <option>Db</option>
+ <option>Workflow</option>
+ <option>Validation</option>
+ <option>Callout</option>
+ <option value="Apex_code" selected="true">Apex Code</option>
+ <option value="Apex_profiling">Apex Profiling</option>
+ <option>All</option>
+ </select>
+ </div>
+ </fieldset>
+ <fieldset style="margin:0px;padding:0px;">
+ <div class="clearfix" id="levelwrapper">
+ <label for="level" style="width:110px;margin-right:10px;">Log Level</label>
+ <select id="level">
+ <option value="ERROR">ERROR</option>
+ <option value="WARN">WARN</option>
+ <option value="INFO">INFO</option>
+ <option value="DEBUG" selected="true">DEBUG</option>
+ <option value="FINE">FINE</option>
+ <option value="FINER">FINER</option>
+ <option value="FINEST">FINEST</option>
+ </select>
+ </div>
+ </fieldset>
+ </form>
+ </div>
+ <div class="content" id="arcade">
+ <ul class="tabs tabs-below">
+ <li class="game"><a href="#game_pacman">Pacman</a></li>
+ <li class="game"><a href="#game_tetris">Tetris</a></li>
+ <li class="game"><a href="#game_donkey">Donkey Kong</a></li>
+ </ul>
+ <div class="pill-content">
+ <div class="active" id="game_pacman">
+ <embed class="" src="http://www.classicgamesarcade.com/games/pacman.swf" width="100%" height="75%" autostart="true" loop="false" controller="true" id="pacman"></embed>
+ </div>
+ <div id="game_tetris">
+ <embed src="http://www.classicgamesarcade.com/games/flash-tetris.swf" width="100%" height="75%" autostart="true" loop="false" controller="true" id="tetris"></embed>
+ </div>
+ <div id="game_donkey">
+ <embed src="http://www.classicgamesarcade.com/games/donkeykong.swf" width="100%" height="75%" autostart="true" loop="false" controller="true" id="donkey"></embed>
+ </div>
</div>
- <div class="clearfix">
- <label for="category" style="width:110px;margin-right:10px;">Log Category</label>
- <select id="category">
- <option>Db</option>
- <option>Workflow</option>
- <option>Validation</option>
- <option>Callout</option>
- <option value="Apex_code" selected="true">Apex Code</option>
- <option value="Apex_profiling">Apex Profiling</option>
- <option>All</option>
- </select>
+ </div>
+
+ <div id="tests_results">
+ <div id="result_output">
+ <div id="result_wrapper" style="-webkit-border-radius: 4px 4px 4px 4px;overflow-y:auto;padding:0px;position:relative;">
+ </div>
</div>
- </fieldset>
- <fieldset style="margin:0px;padding:0px;">
- <div class="clearfix" id="levelwrapper">
- <label for="level" style="width:110px;margin-right:10px;">Log Level</label>
- <select id="level">
- <option value="ERROR">ERROR</option>
- <option value="WARN">WARN</option>
- <option value="INFO">INFO</option>
- <option value="DEBUG" selected="true">DEBUG</option>
- <option value="FINE">FINE</option>
- <option value="FINER">FINER</option>
- <option value="FINEST">FINEST</option>
- </select>
+ </div>
+ <div id="class_coverage">
+ <div id="class_coverage_wrapper" style="-webkit-border-radius: 4px 4px 4px 4px;overflow-y:auto;padding:0px;position:relative;">
+ </div>
+ </div>
+ <div id="trigger_coverage">
+ <div id="trigger_coverage_wrapper" style="-webkit-border-radius: 4px 4px 4px 4px;overflow-y:auto;padding:0px;position:relative;">
</div>
- </fieldset>
- </form>
- </div>
- <div id="game_content">
- <embed class="" src="http://www.classicgamesarcade.com/games/pacman.swf" width="100%" height="75%" autostart="true" loop="false" controller="true" id="pacman"></embed>
- </div>
- <div id="tests_results">
- <div id="result_output">
- <div id="result_wrapper" style="-webkit-border-radius: 4px 4px 4px 4px;overflow-y:auto;padding:0px;position:relative;">
</div>
- </div>
- </div>
- <div id="class_coverage">
- <div id="class_coverage_wrapper" style="-webkit-border-radius: 4px 4px 4px 4px;overflow-y:auto;padding:0px;position:relative;">
- </div>
- </div>
- <div id="trigger_coverage">
- <div id="trigger_coverage_wrapper" style="-webkit-border-radius: 4px 4px 4px 4px;overflow-y:auto;padding:0px;position:relative;">
- </div>
- </div>
- <div id="warnings">
- <div id="warnings_coverage_wrapper" style="-webkit-border-radius: 4px 4px 4px 4px;overflow-y:auto;padding:0px;position:relative;">
- </div>
- </div>
- <div id="log">
- <div id="log_coverage_wrapper" style="-webkit-border-radius: 4px 4px 4px 4px;overflow-y:auto;padding:0px;position:relative;">
- </div>
- </div>
- </div>
-</div>
-
-<form class="form-stacked" id="action_buttons" style="padding-left:12px;">
- <fieldset style="padding-top:0px;position:relative;">
- <div class="actions">
- <input type="button" class="btn primary" value="Run Tests" onclick="run_tests()" id="btnRunTests">
- &nbsp;
- <button type="reset" class="btn" onclick="window.close();">Cancel</button>
- </div>
- <img src="<%=ENV['TM_BUNDLE_SUPPORT']%>/resource/images/big_loading.gif" style="position:absolute;top:13px;right:25px;width:36px;display:none;" id="running_tests_indicator"/>
- </fieldset>
-</form>
-
-
-<script>
-
-function run_tests() {
- $.ajax({
- type: "POST",
- url: "http://127.0.0.1:7777/test",
- dataType: "html",
- data: {
- selected_tests: $('#tests').val().join(),
- mm_current_project_directory: '<%= ENV['MM_CURRENT_PROJECT_DIRECTORY'] %>',
- level: $("#level").val(),
- category: $("#category").val(),
- api: $("#api").val()
- },
- beforeSend: function() { showElement("running_tests_indicator"); $("#btnRunTests").hide() },
- complete: function(data){
- console.log(data)
- $("#result_wrapper").html(data.responseText)
-
- $("#class_coverage_wrapper").html(
- $("#class_wrapper").html()
- )
- $("#trigger_coverage_wrapper").html(
- $("#trigger_wrapper").html()
- )
- $("#warnings_coverage_wrapper").html(
- $("#warnings_wrapper").html()
- )
- $("#log_coverage_wrapper").html(
- $("#log_wrapper").html()
- )
- $("#class_wrapper").remove()
- $("#trigger_wrapper").remove()
- $("#warnings_wrapper").remove()
- $("#log_wrapper").remove()
-
- $(".results_hidden").show();
- if ($("#game_content").css("display") == "none") {
- $("#a_result").click();
- window.resizeTo(760, document.getElementById('result_wrapper').scrollHeight+175);
- }
-
- hideElement("running_tests_indicator");
- $("#btnRunTests").show();
- }
- });
+ <div id="warnings">
+ <div id="warnings_coverage_wrapper" style="-webkit-border-radius: 4px 4px 4px 4px;overflow-y:auto;padding:0px;position:relative;">
+ </div>
+ </div>
+ <div id="log">
+ <div id="log_coverage_wrapper" style="-webkit-border-radius: 4px 4px 4px 4px;overflow-y:auto;padding:0px;position:relative;">
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <form class="form-stacked" id="action_buttons" style="padding-left:12px;">
+ <fieldset style="padding-top:0px;position:relative;">
+ <div class="actions">
+ <input type="button" class="btn primary" value="Run Tests" onclick="run_tests()" id="btnRunTests">
+ &nbsp;
+ <button type="reset" class="btn" onclick="window.close();">Cancel</button>
+ </div>
+ <img src="<%=ENV['TM_BUNDLE_SUPPORT']%>/resource/images/big_loading.gif" style="position:absolute;top:13px;right:25px;width:36px;display:none;" id="running_tests_indicator"/>
+ </fieldset>
+ </form>
+
+
+ <script>
+
+ function run_tests() {
+ $.ajax({
+ type: "POST",
+ url: "http://127.0.0.1:7777/test",
+ dataType: "html",
+ data: {
+ selected_tests: $('#tests').val().join(),
+ mm_current_project_directory: '<%= ENV['MM_CURRENT_PROJECT_DIRECTORY'] %>',
+ level: $("#level").val(),
+ category: $("#category").val(),
+ api: $("#api").val()
+ },
+ beforeSend: function() { showElement("running_tests_indicator"); $("#btnRunTests").hide() },
+ complete: function(data){
+ console.log(data)
+ $("#result_wrapper").html(data.responseText)
+
+ $("#class_coverage_wrapper").html(
+ $("#class_wrapper").html()
+ )
+ $("#trigger_coverage_wrapper").html(
+ $("#trigger_wrapper").html()
+ )
+ $("#warnings_coverage_wrapper").html(
+ $("#warnings_wrapper").html()
+ )
+ $("#log_coverage_wrapper").html(
+ $("#log_wrapper").html()
+ )
+ $("#class_wrapper").remove()
+ $("#trigger_wrapper").remove()
+ $("#warnings_wrapper").remove()
+ $("#log_wrapper").remove()
+
+ $(".results_hidden").show();
+ if ($("#arcade").css("display") == "none") {
+ $("#a_result").click();
+ window.resizeTo(760, document.getElementById('result_wrapper').scrollHeight+175);
+ }
+
+ hideElement("running_tests_indicator");
+ $("#btnRunTests").show();
+ }
+ });
}
function resize() {
@@ -308,9 +324,9 @@ function resize_pacman() {
$(function(){
$('#tests').multiSelect({
- selectableHeader : '<div class="alert-message block-message-custom" style="padding: 7px 12px !important;border:none;border-bottom:1px solid #ccc;margin-bottom:0px;padding: 5px;-webkit-border-radius: 4px 4px 0px 0px;"><p style="float:left;"><strong>Available Tests</strong></p><p style="float:right;"><a style="color:#0069D6;" href="javascript:void(0);" onclick="$(\'#tests\').multiSelect(\'select_all\');">Select All</a></p><div style="clear:both;"></div></div>',
- selectedHeader : '<div class="alert-message block-message-custom" style="padding: 7px 12px !important;border:none;border-bottom:1px solid #ccc;margin-bottom:0px;padding: 5px;-webkit-border-radius: 4px 4px 0px 0px;"><p style="float:left;"><strong>Selected Tests</strong></p><p style="float:right;"><a style="color:#0069D6;" href="javascript:void(0);" onclick="$(\'#tests\').multiSelect(\'deselect_all\');">Select None</a></p><div style="clear:both;"></div></div>'
- });
+ selectableHeader : '<div class="alert-message block-message-custom" style="padding: 7px 12px !important;border:none;border-bottom:1px solid #ccc;margin-bottom:0px;padding: 5px;-webkit-border-radius: 4px 4px 0px 0px;"><p style="float:left;"><strong>Available Tests</strong></p><p style="float:right;"><a style="color:#0069D6;" href="javascript:void(0);" onclick="$(\'#tests\').multiSelect(\'select_all\');">Select All</a></p><div style="clear:both;"></div></div>',
+ selectedHeader : '<div class="alert-message block-message-custom" style="padding: 7px 12px !important;border:none;border-bottom:1px solid #ccc;margin-bottom:0px;padding: 5px;-webkit-border-radius: 4px 4px 0px 0px;"><p style="float:left;"><strong>Selected Tests</strong></p><p style="float:right;"><a style="color:#0069D6;" href="javascript:void(0);" onclick="$(\'#tests\').multiSelect(\'deselect_all\');">Select None</a></p><div style="clear:both;"></div></div>'
+ });
$('.tabs').tabs()
@@ -351,13 +367,13 @@ $("#trigger_coverage_wrapper").height($(window).height() - 175)
$("#warnings_coverage_wrapper").height($(window).height() - 175)
$("#log_coverage_wrapper").height($(window).height() - 175)
$(window).resize(function() {
- $("#result_wrapper").height($(window).height() - 175)
- $("#class_coverage_wrapper").height($(window).height() - 175)
- $("#trigger_coverage_wrapper").height($(window).height() - 175)
- $("#warnings_coverage_wrapper").height($(window).height() - 175)
+ $("#result_wrapper").height($(window).height() - 175)
+ $("#class_coverage_wrapper").height($(window).height() - 175)
+ $("#trigger_coverage_wrapper").height($(window).height() - 175)
+ $("#warnings_coverage_wrapper").height($(window).height() - 175)
$("#log_coverage_wrapper").height($(window).height() - 175)
- resize_test_container_sizes()
- resize_pacman()
+ resize_test_container_sizes()
+ resize_pacman()
});
$("#category").change(function() {
@@ -369,20 +385,20 @@ $("#category").change(function() {
})
jQuery.fn.selectText = function(){
- var doc = document;
- var element = this[0];
- console.log(this, element);
- if (doc.body.createTextRange) {
- var range = document.body.createTextRange();
- range.moveToElementText(element);
- range.select();
- } else if (window.getSelection) {
- var selection = window.getSelection();
- var range = document.createRange();
- range.selectNodeContents(element);
- selection.removeAllRanges();
- selection.addRange(range);
- }
+ var doc = document;
+ var element = this[0];
+ console.log(this, element);
+ if (doc.body.createTextRange) {
+ var range = document.body.createTextRange();
+ range.moveToElementText(element);
+ range.select();
+ } else if (window.getSelection) {
+ var selection = window.getSelection();
+ var range = document.createRange();
+ range.selectNodeContents(element);
+ selection.removeAllRanges();
+ selection.addRange(range);
+ }
};
</script>
View
155 support/lib/local_server.rb
@@ -55,6 +55,7 @@ def start
server.mount('/metadata/index', MetadataIndexServlet)
server.mount('/deploy', DeployServlet)
server.mount('/execute', ExecuteApexServlet)
+ server.mount('/connections', OrgConnectionServlet)
server.start
end
@@ -243,26 +244,62 @@ class DeployServlet < WEBrick::HTTPServlet::AbstractServlet
def do_POST(req, resp)
begin
resp['Content-Type'] = 'html'
+ response = ''
ENV["MM_CURRENT_PROJECT_DIRECTORY"] = req.query["mm_current_project_directory"]
- params = {}
- params[:un] = req.query["un"]
- params[:pw] = req.query["pw"]
- params[:server_url] = req.query["server_url"]
- params[:package] = eval(req.query["tree"])
- params[:check_only] = req.query["check_only"]
- params[:package_type] = "Custom"
- deploy_result = MavensMate.deploy_to_server(params)
- html = nil
- begin
- result = MavensMate::Util.parse_deploy_response(deploy_result)
- ac = ApplicationController.new
- html = ac.render_to_string "deploy/_deploy_result", :locals => { :result => result, :is_check_only => params[:check_only] }
- rescue
- html = '<div id="error_message" class="alert-message error"><p><strong>Deployment Failed!</strong></p><p>'+deploy_result[:message]+'</p></div> '
+ targets = JSON.parse(req.query["targets"].to_s)
+ connections = []
+ deploy_targets = []
+ pconfig = MavensMate.get_project_config
+ pconfig['org_connections'].each do |connection|
+ pw = KeyChain::find_internet_password("#{pconfig['project_name']}-mm-#{connection['username']}")
+ server_url = connection["environment"] == "production" ? "https://www.salesforce.com" : "https://test.salesforce.com"
+ connections.push({
+ :un => connection["username"],
+ :pw => pw,
+ :server_url => server_url,
+ :type => connection["environment"]
+ })
end
- resp.body = html
+
+ targets.each do |t|
+ un = t["username"]
+ type = t["type"]
+ c = connections.detect { |c| c[:un] == un and c[:type] == type }
+ deploy_targets.push(c)
+ end
+
+ Thread.abort_on_exception = true
+ threads = []
+ tree = eval(req.query["tree"].to_s)
+ is_check_only = req.query["check_only"]
+
+ deploy_targets.each do |t|
+ threads << Thread.new {
+ params = {}
+ params[:un] = t[:un]
+ params[:pw] = t[:pw]
+ params[:endpoint_type] = t[:type]
+ params[:package] = tree
+ params[:check_only] = is_check_only
+ params[:package_type] = "Custom"
+ deploy_result = MavensMate.deploy_to_server(params)
+ html = nil
+ begin
+ result = MavensMate::Util.parse_deploy_response(deploy_result)
+ ac = ApplicationController.new
+ html = ac.render_to_string "deploy/_deploy_result", :locals => { :result => result, :is_check_only => params[:check_only], :target_username => t[:un] }
+ rescue
+ html = '<div id="error_message" class="alert-message error"><p><strong>Deployment Failed!</strong></p><p>'+deploy_result[:message]+'</p></div> '
+ end
+ response << html
+ }
+ end
+ threads.each { |t| t.join }
+ ac = ApplicationController.new
+ html_payload = ac.render_to_string "deploy/_deploy_target_tabs", :locals => { :deploy_result_html => response, :targets => deploy_targets }
+ resp.body = html_payload
rescue Exception => e
- result = '<div id="error_message" class="alert-message error"><p><strong>Deployment Failed!</strong></p><p>'+e.message+'</p></div> '
+ result = '<div id="error_message" class="alert-message error"><p><strong>Deployment Failed!</strong></p><p>'+e.message + e.backtrace.join("\n")+'</p></div> '
resp.body = result
end
end
@@ -329,6 +366,90 @@ def do_POST(req, resp)
end
end
+ class OrgConnectionServlet < WEBrick::HTTPServlet::AbstractServlet
+ def do_POST(req, resp)
+ begin
+ un = req.query["un"].to_s
+ pw = req.query["pw"].to_s
+ server_url = req.query["server_url"].to_s
+ client = MavensMate::Client.new({
+ :username => req.query["un"],
+ :password => req.query["pw"],
+ :endpoint => req.query["server_url"],
+ :override_session => true
+ })
+ project_directory = req.query["pd"].to_s
+ ENV['MM_CURRENT_PROJECT_DIRECTORY'] = project_directory
+ environment = MavensMate::Util.get_endpoint_type_by_short_url(server_url)
+ require 'yaml'
+ yml = YAML::load(File.open("#{project_directory}/config/settings.yaml"))
+ project_name = yml['project_name']
+ connections = []
+ if yml["org_connections"]
+ connections = yml["org_connections"]
+ keychain_name = project_name + "-mm-"
+ %x{security add-generic-password -a '#{project_name}-mm-#{un}' -s \"#{project_name}-mm-#{un}\" -w #{pw} -U}
+ connections.push({ "username" => un, "environment" => environment })
+ else
+ %x{security add-generic-password -a '#{project_name}-mm-#{un}' -s \"#{project_name}-mm-#{un}\" -w #{pw} -U}
+ yml["org_connections"] = [{ "username" => un, "environment" => environment }]
+ connections.push({ "username" => un, "environment" => environment })
+ end
+ File.open("#{project_directory}/config/settings.yaml", 'w') { |f| YAML.dump(yml, f) }
+ resp['Content-Type'] = 'json'
+ ac = ApplicationController.new
+ connections = MavensMate.get_org_connections
+ html = ac.render_to_string "org_connection/_connections", :locals => { :connections => connections }
+ result = {
+ :success => true,
+ :message => html
+ }
+ resp.body = result.to_json
+ rescue Exception => e
+ html = '<div id="error_message" class="alert-message error"><p><strong>Error!</strong></p><p>'+e.message+'</p></div> '
+ result = {
+ :success => false,
+ :message => html
+ }
+ resp.body = result.to_json
+ end
+ end
+
+ def do_DELETE(req, resp)
+ begin
+ un = req.query["un"].to_s
+ require 'yaml'
+ project_directory = req.query["pd"].to_s
+ ENV['MM_CURRENT_PROJECT_DIRECTORY'] = project_directory
+ yml = YAML::load(File.open("#{project_directory}/config/settings.yaml"))
+ project_name = yml['project_name']
+ conns = nil
+ if yml["org_connections"]
+ conns = yml["org_connections"]
+ conns.delete_if{|conn| conn["username"] == un }
+ yml["org_connections"] = conns
+ end
+ File.open("#{project_directory}/config/settings.yaml", 'w') { |f| YAML.dump(yml, f) }
+ resp['Content-Type'] = 'json'
+ ac = ApplicationController.new
+ connections = MavensMate.get_org_connections
+ html = ac.render_to_string "org_connection/_connections", :locals => { :connections => connections }
+ result = {
+ :success => true,
+ :message => html
+ }
+ resp.body = result.to_json
+ rescue Exception => e
+ html = '<div id="error_message" class="alert-message error"><p><strong>Error!</strong></p><p>'+e.message+'</p></div> '
+ result = {
+ :success => false,
+ :message => html
+ }
+ resp.body = result.to_json
+ end
+ end
+ end
+
class ProjectEditServlet < WEBrick::HTTPServlet::AbstractServlet
def do_POST(req, resp)
begin
View
7 support/lib/mavensmate.rb
@@ -186,7 +186,12 @@ def self.checkout_project(params)
threads << Thread.new {
Dir.mkdir(project_folder) unless File.exists?(project_folder)
if vc_type == "Git"
- %x{git clone '#{vc_url}' -b '#{vc_branch}' '#{project_folder}#{project_name}'}
+ if(vc_branch.downcase == 'head')
+ %x{git clone '#{vc_url}' '#{project_folder}#{project_name}'}
+ else
+ branchname = vc_branch.split('/').last
+ %x{git clone '#{vc_url}' -b '#{branchname}' '#{project_folder}#{project_name}'}
+ end
elsif vc_type == "SVN"
Dir.mkdir("#{project_folder}#{project_name}") unless File.exists?("#{project_folder}#{project_name}")
Dir.chdir("#{project_folder}")
View
397 support/resource/css/chosen.css
@@ -0,0 +1,397 @@
+/* @group Base */
+.chzn-container {
+ font-size: 13px;
+ position: relative;
+ display: inline-block;
+ zoom: 1;
+ *display: inline;
+}
+.chzn-container .chzn-drop {
+ background: #fff;
+ border: 1px solid #aaa;
+ border-top: 0;
+ position: absolute;
+ top: 29px;
+ left: 0;
+ -webkit-box-shadow: 0 4px 5px rgba(0,0,0,.15);
+ -moz-box-shadow : 0 4px 5px rgba(0,0,0,.15);
+ box-shadow : 0 4px 5px rgba(0,0,0,.15);
+ z-index: 1010;
+}
+/* @end */
+
+/* @group Single Chosen */
+.chzn-container-single .chzn-single {
+ background-color: #ffffff;
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#eeeeee', GradientType=0 );
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, color-stop(20%, #ffffff), color-stop(50%, #f6f6f6), color-stop(52%, #eeeeee), color-stop(100%, #f4f4f4));
+ background-image: -webkit-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
+ background-image: -moz-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
+ background-image: -o-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
+ background-image: linear-gradient(#ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
+ -webkit-border-radius: 5px;
+ -moz-border-radius : 5px;
+ border-radius : 5px;
+ -moz-background-clip : padding;
+ -webkit-background-clip: padding-box;
+ background-clip : padding-box;
+ border: 1px solid #aaaaaa;
+ -webkit-box-shadow: 0 0 3px #ffffff inset, 0 1px 1px rgba(0,0,0,0.1);
+ -moz-box-shadow : 0 0 3px #ffffff inset, 0 1px 1px rgba(0,0,0,0.1);
+ box-shadow : 0 0 3px #ffffff inset, 0 1px 1px rgba(0,0,0,0.1);
+ display: block;
+ overflow: hidden;
+ white-space: nowrap;
+ position: relative;
+ height: 23px;
+ line-height: 24px;
+ padding: 0 0 0 8px;
+ color: #444444;
+ text-decoration: none;
+}
+.chzn-container-single .chzn-default {
+ color: #999;
+}
+.chzn-container-single .chzn-single span {
+ margin-right: 26px;
+ display: block;
+ overflow: hidden;
+ white-space: nowrap;
+ -o-text-overflow: ellipsis;
+ -ms-text-overflow: ellipsis;
+ text-overflow: ellipsis;
+}
+.chzn-container-single .chzn-single abbr {
+ display: block;
+ position: absolute;
+ right: 26px;
+ top: 6px;
+ width: 12px;
+ height: 13px;
+ font-size: 1px;
+ background: url('../images/chosen-sprite.png') right top no-repeat;
+}
+.chzn-container-single .chzn-single abbr:hover {
+ background-position: right -11px;
+}
+.chzn-container-single.chzn-disabled .chzn-single abbr:hover {
+ background-position: right top;
+}
+.chzn-container-single .chzn-single div {
+ position: absolute;
+ right: 0;
+ top: 0;
+ display: block;
+ height: 100%;
+ width: 18px;
+}
+.chzn-container-single .chzn-single div b {
+ background: url('../images/chosen-sprite.png') no-repeat 0 0;
+ display: block;
+ width: 100%;
+ height: 100%;
+}
+.chzn-container-single .chzn-search {
+ padding: 3px 4px;
+ position: relative;
+ margin: 0;
+ white-space: nowrap;
+ z-index: 1010;
+}
+.chzn-container-single .chzn-search input {
+ background: #fff url('../images/chosen-sprite.png') no-repeat 100% -22px;
+ background: url('../images/chosen-sprite.png') no-repeat 100% -22px, -webkit-gradient(linear, 0 0, 0 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
+ background: url('../images/chosen-sprite.png') no-repeat 100% -22px, -webkit-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
+ background: url('../images/chosen-sprite.png') no-repeat 100% -22px, -moz-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
+ background: url('../images/chosen-sprite.png') no-repeat 100% -22px, -o-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
+ background: url('../images/chosen-sprite.png') no-repeat 100% -22px, linear-gradient(#eeeeee 1%, #ffffff 15%);
+ margin: 1px 0;
+ padding: 4px 20px 4px 5px;
+ outline: 0;
+ border: 1px solid #aaa;
+ font-family: sans-serif;
+ font-size: 1em;
+}
+.chzn-container-single .chzn-drop {
+ -webkit-border-radius: 0 0 4px 4px;
+ -moz-border-radius : 0 0 4px 4px;
+ border-radius : 0 0 4px 4px;
+ -moz-background-clip : padding;
+ -webkit-background-clip: padding-box;
+ background-clip : padding-box;
+}
+/* @end */
+
+.chzn-container-single-nosearch .chzn-search input {
+ position: absolute;
+ left: -9000px;
+}
+
+/* @group Multi Chosen */
+.chzn-container-multi .chzn-choices {
+ background-color: #fff;
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
+ background-image: -webkit-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
+ background-image: -moz-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
+ background-image: -o-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
+ background-image: linear-gradient(#eeeeee 1%, #ffffff 15%);
+ border: 1px solid #aaa;
+ margin: 0;
+ padding: 0;
+ cursor: text;
+ overflow: hidden;
+ height: auto !important;
+ height: 1%;
+ position: relative;
+}
+.chzn-container-multi .chzn-choices li {
+ float: left;
+ list-style: none;
+}
+.chzn-container-multi .chzn-choices .search-field {
+ white-space: nowrap;
+ margin: 0;
+ padding: 0;
+}
+.chzn-container-multi .chzn-choices .search-field input {
+ color: #666;
+ background: transparent !important;
+ border: 0 !important;
+ font-family: sans-serif;
+ font-size: 100%;
+ height: 15px;
+ padding: 5px;
+ margin: 1px 0;
+ outline: 0;
+ -webkit-box-shadow: none;
+ -moz-box-shadow : none;
+ box-shadow : none;
+}
+.chzn-container-multi .chzn-choices .search-field .default {
+ color: #999;
+}
+.chzn-container-multi .chzn-choices .search-choice {
+ -webkit-border-radius: 3px;
+ -moz-border-radius : 3px;
+ border-radius : 3px;
+ -moz-background-clip : padding;
+ -webkit-background-clip: padding-box;
+ background-clip : padding-box;
+ background-color: #e4e4e4;
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f4f4f4', endColorstr='#eeeeee', GradientType=0 );
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee));
+ background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
+ background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
+ background-image: -o-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
+ background-image: linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
+ -webkit-box-shadow: 0 0 2px #ffffff inset, 0 1px 0 rgba(0,0,0,0.05);
+ -moz-box-shadow : 0 0 2px #ffffff inset, 0 1px 0 rgba(0,0,0,0.05);
+ box-shadow : 0 0 2px #ffffff inset, 0 1px 0 rgba(0,0,0,0.05);
+ color: #333;
+ border: 1px solid #aaaaaa;
+ line-height: 13px;
+ padding: 3px 20px 3px 5px;
+ margin: 3px 0 3px 5px;
+ position: relative;
+ cursor: default;
+}
+.chzn-container-multi .chzn-choices .search-choice.search-choice-disabled {
+ background-color: #e4e4e4;
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f4f4f4', endColorstr='#eeeeee', GradientType=0 );
+ background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee));
+ background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
+ background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
+ background-image: -o-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
+ background-image: -ms-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
+ background-image: linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
+ color: #666;
+ border: 1px solid #cccccc;
+ padding-right: 5px;
+}
+.chzn-container-multi .chzn-choices .search-choice-focus {
+ background: #d4d4d4;
+}
+.chzn-container-multi .chzn-choices .search-choice .search-choice-close {
+ display: block;
+ position: absolute;
+ right: 3px;
+ top: 4px;
+ width: 12px;
+ height: 13px;
+ font-size: 1px;
+ background: url('../images/chosen-sprite.png') right top no-repeat;
+}
+.chzn-container-multi .chzn-choices .search-choice .search-choice-close:hover {
+ background-position: right -11px;
+}
+.chzn-container-multi .chzn-choices .search-choice-focus .search-choice-close {
+ background-position: right -11px;
+}
+/* @end */
+
+/* @group Results */
+.chzn-container