mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
client/#75 - modifications after review
This commit is contained in:
parent
0651bfe522
commit
2e4fcfe99d
5 changed files with 26 additions and 22 deletions
|
|
@ -26,7 +26,7 @@ class CollectSlackFamilies(pyblish.api.InstancePlugin):
|
|||
"tasks": task_name,
|
||||
"hosts": instance.data["anatomyData"]["app"],
|
||||
}
|
||||
self.log.debug("key_values {}".format(key_values))
|
||||
|
||||
profile = filter_profiles(self.profiles, key_values,
|
||||
logger=self.log)
|
||||
|
||||
|
|
@ -43,8 +43,6 @@ class CollectSlackFamilies(pyblish.api.InstancePlugin):
|
|||
|
||||
slack_token = (instance.context.data["project_settings"]
|
||||
["slack"]
|
||||
["publish"]
|
||||
["CollectSlackFamilies"]
|
||||
["token"])
|
||||
instance.data["slack_token"] = slack_token
|
||||
|
||||
|
|
|
|||
|
|
@ -34,20 +34,27 @@ class IntegrateSlackAPI(pyblish.api.InstancePlugin):
|
|||
def process(self, instance):
|
||||
message_templ = instance.data["slack_message"]
|
||||
|
||||
fill_pairs = set()
|
||||
for key, value in instance.data["anatomyData"].items():
|
||||
if not isinstance(value, str):
|
||||
continue
|
||||
fill_pairs.add((key, value))
|
||||
|
||||
message = message_templ.format(**prepare_template_data(fill_pairs))
|
||||
fill_pairs = (
|
||||
("project_name", instance.data["anatomyData"]["project"]["name"]),
|
||||
("project_code", instance.data["anatomyData"]["project"]["code"]),
|
||||
("asset", instance.data["anatomyData"]["asset"]),
|
||||
("subset", instance.data["anatomyData"]["subset"]),
|
||||
("task", instance.data["anatomyData"]["task"]),
|
||||
("username", instance.data["anatomyData"]["username"]),
|
||||
("app", instance.data["anatomyData"]["app"]),
|
||||
("family", instance.data["anatomyData"]["family"]),
|
||||
("version", str(instance.data["anatomyData"]["version"])),
|
||||
)
|
||||
message = None
|
||||
try:
|
||||
message = message_templ.format(
|
||||
**prepare_template_data(fill_pairs))
|
||||
except Exception:
|
||||
self.log.warning(
|
||||
"Some keys are missing in {}".format(message_templ),
|
||||
exc_info=True)
|
||||
|
||||
self.log.debug("message:: {}".format(message))
|
||||
if '{' in message:
|
||||
self.log.warning(
|
||||
"Missing values to fill message properly {}".format(message))
|
||||
|
||||
return
|
||||
|
||||
published_path = self._get_thumbnail_path(instance)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
{
|
||||
"token": "",
|
||||
"publish": {
|
||||
"CollectSlackFamilies": {
|
||||
"enabled": true,
|
||||
"optional": true,
|
||||
"token": "",
|
||||
"profiles": [
|
||||
{
|
||||
"families": [],
|
||||
|
|
|
|||
|
|
@ -5,7 +5,11 @@
|
|||
"collapsible": true,
|
||||
"is_file": true,
|
||||
"children": [
|
||||
|
||||
{
|
||||
"type": "text",
|
||||
"key": "token",
|
||||
"label": "Auth Token"
|
||||
},
|
||||
{
|
||||
"type": "dict",
|
||||
"collapsible": true,
|
||||
|
|
@ -32,11 +36,6 @@
|
|||
"key": "optional",
|
||||
"label": "Optional"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"key": "token",
|
||||
"label": "Auth Token"
|
||||
},
|
||||
{
|
||||
"type": "list",
|
||||
"collapsible": true,
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 34 KiB |
Loading…
Add table
Add a link
Reference in a new issue