From 757ef0aa533e1dec1a47593aca9472d19c48e56b Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Tue, 2 Aug 2016 19:00:21 -0700 Subject: [PATCH] CRM-19169 - ang/crmCxn - If `welcome` link defined, open it --- ang/crmCxn.js | 2 +- ang/crmCxn/ManageCtrl.js | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ang/crmCxn.js b/ang/crmCxn.js index 2d2193959a..c2fa6ec287 100644 --- a/ang/crmCxn.js +++ b/ang/crmCxn.js @@ -14,7 +14,7 @@ apiCalls: function(crmApi){ var reqs = {}; reqs.cxns = ['Cxn', 'get', {sequential: 1}]; - reqs.appMetas = ['CxnApp', 'get', {sequential: 1, return: ['id', 'title', 'desc', 'appId', 'appUrl', 'perm']}]; + reqs.appMetas = ['CxnApp', 'get', {sequential: 1, return: ['id', 'title', 'desc', 'appId', 'appUrl', 'links', 'perm']}]; reqs.cfg = ['Cxn', 'getcfg', {}]; reqs.sysCheck = ['System', 'check', {}]; // FIXME: filter on checkCxnOverrides return crmApi(reqs); diff --git a/ang/crmCxn/ManageCtrl.js b/ang/crmCxn/ManageCtrl.js index b23901b0cf..cd843c3304 100644 --- a/ang/crmCxn/ManageCtrl.js +++ b/ang/crmCxn/ManageCtrl.js @@ -75,12 +75,20 @@ }; $scope.register = function(appMeta) { - var reg = crmApi('Cxn', 'register', {app_guid: appMeta.appId}).then($scope.refreshCxns); + var reg = crmApi('Cxn', 'register', {app_guid: appMeta.appId}).then($scope.refreshCxns).then(function() { + if (appMeta.links.welcome) { + return $scope.openLink(appMeta, 'welcome', {title: ts('%1: Welcome (External)', {1: appMeta.title})}); + } + }); return block(crmStatus({start: ts('Connecting...'), success: ts('Connected')}, reg)); }; $scope.reregister = function(appMeta) { - var reg = crmApi('Cxn', 'register', {app_guid: appMeta.appId}).then($scope.refreshCxns); + var reg = crmApi('Cxn', 'register', {app_guid: appMeta.appId}).then($scope.refreshCxns).then(function() { + if (appMeta.links.welcome) { + return $scope.openLink(appMeta, 'welcome', {title: ts('%1: Welcome (External)', {1: appMeta.title})}); + } + }); return block(crmStatus({start: ts('Reconnecting...'), success: ts('Reconnected')}, reg)); }; -- 2.25.1