From 8e72c0c94807c38ced2153b8eb980e54a9f5c65a Mon Sep 17 00:00:00 2001 From: Sven Ketelsen Date: Thu, 30 Sep 2021 09:30:17 +0200 Subject: [PATCH] feat: added smardigo callback to msteams --- .../provisioning/process/simple-connect.bpmn | 136 +++--------------- .../script/create-teams-message.groovy | 45 ++++++ 2 files changed, 62 insertions(+), 119 deletions(-) create mode 100644 smardigo/provisioning/script/create-teams-message.groovy diff --git a/smardigo/provisioning/process/simple-connect.bpmn b/smardigo/provisioning/process/simple-connect.bpmn index 427d6d6..61129c9 100644 --- a/smardigo/provisioning/process/simple-connect.bpmn +++ b/smardigo/provisioning/process/simple-connect.bpmn @@ -756,97 +756,23 @@ Keycloak Realm mit Administrator Account Flow_1nu8qqa - - - - https://${cluster.stage}-management-smardigo-01-connect.smardigo.digital/api/redirect/process/${contextScopeId}/dossier/simple-connect/${contextProcessId} - - - ${activityTitle} - ${activitySubtitle} - https://smardigo.de/wp-content/uploads/2020/01/smardigo-min.png - - - - - Flow_1nu8qqa - Flow_1f6k0y9 - - - - + - - - Flow_127qqnb - - - - MessageCard - http://schema.org/extensions - 0076D7 - Neue Aufgabe: ${comment} - ${sections} - ${potentialActions} - + - Flow_18kjr7f + Flow_1nu8qqa Flow_127qqnb - - - - - - - ${smardigoUrl} - - - - - Flow_1f6k0y9 - Flow_1imukyy - - - - - - - http://schema.org - ViewAction - Open in Smardigo - ${target} - - - - - ${section} - - - - - Flow_1imukyy - Flow_0vyypeb - - - - - - - ${potentialAction} - - - - - Flow_0vyypeb - Flow_18kjr7f - + + Flow_127qqnb + + @@ -1144,9 +1070,6 @@ Keycloak Realm mit Administrator Account - - - @@ -1343,6 +1266,9 @@ Keycloak Realm mit Administrator Account + + + @@ -1475,52 +1401,24 @@ Keycloak Realm mit Administrator Account - + - - - - - - - - - - - - - - - - - - + + - + - - - - - - - - - - + - - - - - + + diff --git a/smardigo/provisioning/script/create-teams-message.groovy b/smardigo/provisioning/script/create-teams-message.groovy new file mode 100644 index 0000000..bfad89b --- /dev/null +++ b/smardigo/provisioning/script/create-teams-message.groovy @@ -0,0 +1,45 @@ +def smardigoUrl = "https://" + cluster.stage + "-management-smardigo-01-connect.smardigo.digital/api/redirect/process/" + contextScopeId + "/dossier/simple-connect/" + contextProcessId +def smardigoMessageUrl = "https://" + cluster.stage + "-management-smardigo-01-connect.smardigo.digital/api/v1/scopes/" + contextScopeId + "/processes/" + contextProcessId + "/messages" + +def message = [:] +message["@type"] = "MessageCard" +message["@context"] = "http://schema.org/extensions" +message["themeColor"] = "0076D7" +message["summary"] = "Neue Aufgabe: " + comment + +def section = [:] +section["activityTitle"] = activityTitle +section["activitySubtitle"] = activitySubtitle +section["activityImage"] = "https://smardigo.de/wp-content/uploads/2020/01/smardigo-min.png" +section["facts"] = [ + [name:"Stage",value:cluster.stage], + [name:"Name",value:cluster.name], + [name:"Service",value:cluster.service], + [name:"Mandant",value:tenant.name] +] +message.sections = [section] + +def potentialAction = [] + +def openInSmardigo = [:] +openInSmardigo["@type"] = "ViewAction" +openInSmardigo["@context"] = "http://schema.org" +openInSmardigo["name"] = "Vorgang öffnen" +openInSmardigo["target"] = [smardigoUrl] +potentialAction.add(openInSmardigo) + +if (vorgang_status < 30) { + def approveInSmardigo = [:] + approveInSmardigo["@type"] = "HttpPOST" + approveInSmardigo["name"] = "Server freigeben" + approveInSmardigo["target"] = smardigoMessageUrl + approveInSmardigo["body"] = "{\"message\":\"process-approved-" + contextProcessId + "\"}" + approveInSmardigo["headers"] = [ + [name:"Smardigo-User-Token",value:"eyJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwiYWxnIjoiZGlyIn0..rCRO1cVFgkyZ45D5cJNK5g.fc6JVOo5ja5sqe-0PQTfJGOivJ6tyiD-rwgY6rXJ3-U.tOgqgJ2zTjB3_M9BGtvVjQ"] + ] + potentialAction.add(approveInSmardigo) +} + +message.potentialAction = potentialAction + +message \ No newline at end of file