Skip to content

Commit

Permalink
release 3.2.9
Browse files Browse the repository at this point in the history
  • Loading branch information
xjsender committed Mar 10, 2016
1 parent 8e45f8e commit d5bec82
Show file tree
Hide file tree
Showing 10 changed files with 83 additions and 59 deletions.
9 changes: 9 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ Release History
---------------


Release 3.2.9 (2016-03-10)
++++++++++++++++++
* Enhancement for ``role hierarchy exporting``
* Add new settings ``include_users_in_role_hierarchy`` to control whether including user in the CSV
* Deliver new feature, see issue #89
* upgrade build-in requests lib to 2.9.1
* change display message for list metadata in the output panel


Release 3.2.8 (2016-02-26)
++++++++++++++++++
* Fix issue #88
Expand Down
4 changes: 3 additions & 1 deletion config/commands/main.sublime-commands
Original file line number Diff line number Diff line change
Expand Up @@ -496,5 +496,7 @@
"args": {
"operation": "delete"
}
}
},
{"caption": "HaoIDE: View Id in Salesforce Web","command": "view_id_in_sfdc_web"},
{"caption": "HaoIDE: View in Salesforce Web","command": "show_in_sfdc_web"}
]
4 changes: 2 additions & 2 deletions config/menus/Context.sublime-menu
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@
{"caption": "Preview Page in Server","command": "preview_page"},

{"caption": "-"},
{"caption": "View File Attributes","command": "view_file_attributes"},
{"caption": "View Code Coverage","command": "view_code_coverage"},
{"caption": "View Debug Log Detail","command": "view_debug_log_detail"},
{"caption": "View Id in Salesforce Web","command": "view_id_in_sfdc_web"},
{"caption": "Show in Salesforce Web","command": "show_in_sfdc_web"}
{"caption": "View in Salesforce Web","command": "show_in_sfdc_web"},
{"caption": "View File Attributes","command": "view_file_attributes"}
]
}
]
11 changes: 11 additions & 0 deletions config/messages/3.2.9.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Build 3.2.9
-----------
Release Date: 10 Mar 2016

* Enhancement for ``role hierarchy exporting``
* Add new settings ``include_users_in_role_hierarchy`` to control whether including user in the CSV
* Deliver new feature, see issue #89
* upgrade build-in requests lib to 2.9.1
* change display message for list metadata in the output panel

* Restart your sublime when new version is installed
2 changes: 1 addition & 1 deletion config/settings/package.sublime-settings
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "HaoIDE",
"version": "3.2.8",
"version": "3.2.9",
"description": "HaoIDE is a Sublime Text 3 plugin for Salesforce and used for swift development on Force.com",
"author": "Hao Liu",
"email": "mouse.mliu@gmail.com",
Expand Down
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1939,7 +1939,7 @@ class ViewFileAttributes(sublime_plugin.TextCommand):
def run(self, edit):
view = sublime.active_window().new_file()
view.run_command("new_view", {
"name": self.cname,
"name": self.cname + " Attributes",
"input": json.dumps(self.component_attribute, indent=4)
})

Expand Down
1 change: 1 addition & 0 deletions messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
"3.2.6": "config/messages/3.2.6.md",
"3.2.7": "config/messages/3.2.7.md",
"3.2.8": "config/messages/3.2.8.md",
"3.2.9": "config/messages/3.2.9.md",
"install": "config/messages/install.txt"
}
4 changes: 0 additions & 4 deletions processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1503,10 +1503,6 @@ def handle_thread(thread, timeout):
thread = threading.Thread(target=api.create_trace_flag)
thread.start()

# If succeed, keep the lastModifiedDate in the cache
threading.Thread(target=util.set_component_attribute,
args=(component_attribute, result["lastModifiedDate"], )).start()

# If not succeed, just go to the error line
# Because error line in page is always at the line 1, so just work in class or trigger
elif "success" in result and not result["success"]:
Expand Down
67 changes: 55 additions & 12 deletions salesforce/api/tooling.py
Original file line number Diff line number Diff line change
Expand Up @@ -963,22 +963,22 @@ def save_to_server(self, component_attribute, body, is_check_only, check_save_co
return result

# Why do the three date value has minor difference?
# LastModifiedDate : 2016-03-09T06:52:12.000+0000
# SystemModstamp : 2016-03-09T06:52:13.000+0000
# LastModifiedDate in local cache : 2016-03-09T06:52:13.000+0000
#
# Server LastModifiedDate : 2016-03-09T06:52:12.000+0000
# Server SystemModstamp : 2016-03-09T06:52:13.000+0000
# Local LastModifiedDate : 2016-03-09T06:52:13.000+0000

# Get Server Date and LastModifiedBy
class_attr = result["records"][0]
lastModifiedBy = class_attr["LastModifiedBy"]
serverLastModifiedDate = class_attr["SystemModstamp"]
serverLastModifiedDateZone = util.local_datetime(serverLastModifiedDate)
serverDateLiteral = class_attr["LastModifiedDate"]
serverLastModifiedDateZone = util.local_datetime(serverDateLiteral)

# Get local lastModifiedDate
localLastModifiedDate = component_attribute["lastModifiedDate"]
localDateLiteral = component_attribute.get("lastModifiedDate", None)

# Check lastModifiedDate
# lastModifiedDate in server : 2016-03-09T06:37:36.000+0000
# lastModifiedDate in local cache : 2016-03-09T06:37:36.000Z
if serverLastModifiedDate[:19] != localLastModifiedDate[:19]:
# If local date is different with server date,
# it means there has conflict
if serverDateLiteral[:19] != localDateLiteral[:19]:
message = "Modified by %s at %s, continue?" % (
lastModifiedBy["Name"], serverLastModifiedDateZone
)
Expand Down Expand Up @@ -1141,6 +1141,9 @@ def save_to_server(self, component_attribute, body, is_check_only, check_save_co
if return_result["success"] and component_type == "ApexClass":
sublime.set_timeout_async(self.write_symbol_table_cache(member_result["id"]), 5)

if return_result["success"]:
sublime.set_timeout_async(self.set_component_attribute(component_attribute), 5)

# Whatever succeed or failed, just delete MetadataContainerId
sublime.set_timeout_async(self.delete(container_url + "/" + container_id), 100)

Expand Down Expand Up @@ -1177,4 +1180,44 @@ def write_symbol_table_cache(self, member_id):
symboltable_dict[symbol_table["name"].lower()]["inners"] = inners

symbol_table_cache.set(self.settings["username"], symboltable_dict)
sublime.save_settings("symbol_table.sublime-settings")
sublime.save_settings("symbol_table.sublime-settings")

def set_component_attribute(self, attributes):
""" Set the LastModifiedDate for specified component
Params:
* attributes -- component attributes
"""
# Get the LastModifiedDate by attributes
query = "SELECT LastModifiedDate FROM %s WHERE Id ='%s'" % (
attributes["type"],
attributes["id"]
)
component = self.query(query, True)

# Start to write symbol table to cache
if not component or not component["records"]: return
lastModifiedDate = component["records"][0]["LastModifiedDate"]

# If sobjects is exist in local cache, just return it
username = self.settings["username"]
s = sublime.load_settings("component_metadata.sublime-settings")
if not s.has(username):
return

_type = attributes["type"]
fullName = attributes["name"] + attributes["extension"]
components_dict = s.get(username, {})

# Prevent exception if no component in org
if _type not in components_dict:
components_dict = {_type : {}}

# Build components dict
attr = components_dict[_type][fullName.lower()]
attr["lastModifiedDate"] = lastModifiedDate
components_dict[_type][fullName.lower()] = attr

# Save settings and show success message
s.set(username, components_dict)
sublime.save_settings("component_metadata.sublime-settings")
38 changes: 0 additions & 38 deletions util.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,44 +246,6 @@ def populate_lighting_applications():

return aura_attributes

def set_component_attribute(attributes, lastModifiedDate):
""" Set the LastModifiedDate for specified component
Params:
* attributes -- component attributes, such as
{
"name": "AccountFactory",
"url": "/services/data/v35.0/sobjects/ApexClass/01p90000006QGc6AAG",
"is_test": false,
"id": "01p90000006QGc6AAG",
...
}
"""
settings = context.get_settings()
username = settings["username"]

# If sobjects is exist in local cache, just return it
s = sublime.load_settings("component_metadata.sublime-settings")
if not s.has(username):
return

_type = attributes["type"]
fullName = attributes["name"] + attributes["extension"]
components_dict = s.get(username, {})

# Prevent exception if no component in org
if _type not in components_dict:
components_dict = {_type : {}}

# Build components dict
attr = components_dict[_type][fullName.lower()]
attr["lastModifiedDate"] = lastModifiedDate
components_dict[_type][fullName.lower()] = attr

# Save settings and show success message
s.set(username, components_dict)
sublime.save_settings("component_metadata.sublime-settings")

def populate_sobjects_describe():
"""
Get the sobjects list in org.
Expand Down

0 comments on commit d5bec82

Please sign in to comment.