1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-04 18:29:17 +02:00

Added optional --user-profile-url for opening user profile page in an external domain, it was hardcoded.

This commit is contained in:
Gunther Brunner 2015-03-17 19:48:41 +09:00
parent f5cb2f91c0
commit e1a7560bc0
6 changed files with 21 additions and 22 deletions

View file

@ -593,6 +593,9 @@ program
.option('-w, --websocket-url <url>' .option('-w, --websocket-url <url>'
, 'URL to websocket client' , 'URL to websocket client'
, String) , String)
.option('--user-profile-url <url>'
, 'URL to external user profile page'
, String)
.option('-d, --disable-watch' .option('-d, --disable-watch'
, 'disable watching resources') , 'disable watching resources')
.action(function(options) { .action(function(options) {
@ -612,6 +615,7 @@ program
, ssid: options.ssid , ssid: options.ssid
, authUrl: options.authUrl , authUrl: options.authUrl
, websocketUrl: options.websocketUrl , websocketUrl: options.websocketUrl
, userProfileUrl: options.userProfileUrl
, disableWatch: options.disableWatch , disableWatch: options.disableWatch
}) })
}) })
@ -871,6 +875,9 @@ program
, 'ADB port (defaults to 5037)' , 'ADB port (defaults to 5037)'
, Number , Number
, 5037) , 5037)
.option('--user-profile-url <url>'
, 'URL to external user profile page'
, String)
.action(function() { .action(function() {
var log = logger.createLogger('cli:local') var log = logger.createLogger('cli:local')
, args = arguments , args = arguments
@ -965,6 +972,9 @@ program
if (options.disableWatch) { if (options.disableWatch) {
extra.push('--disable-watch') extra.push('--disable-watch')
} }
if (options.userProfileUrl) {
extra.push('--user-profile-url', options.userProfileUrl)
}
return extra return extra
})())) })()))

View file

@ -111,6 +111,13 @@ module.exports = function(options) {
} }
, user: req.user , user: req.user
} }
if (options.userProfileUrl) {
state.config.userProfileUrl = (function () {
return options.userProfileUrl
})()
}
res.type('application/javascript') res.type('application/javascript')
res.send('var GLOBAL_APPSTATE = ' + JSON.stringify(state)) res.send('var GLOBAL_APPSTATE = ' + JSON.stringify(state))
}) })

View file

@ -1,3 +1,4 @@
module.exports = angular.module('stf/device/enhance-device', [ module.exports = angular.module('stf/device/enhance-device', [
require('stf/app-state').name
]) ])
.factory('EnhanceDeviceService', require('./enhance-device-service')) .factory('EnhanceDeviceService', require('./enhance-device-service'))

View file

@ -245,7 +245,7 @@ module.exports = function DeviceColumnService($filter, gettext) {
return device.owner ? device.owner.name : '' return device.owner ? device.owner.name : ''
} }
, link: function(device) { , link: function(device) {
return device.owner ? device.enhancedUserContactUrl : '' return device.owner ? device.enhancedUserProfileUrl : ''
} }
}) })
} }

View file

@ -1,28 +1,9 @@
module.exports = angular.module('stf.user-profile', []) module.exports = angular.module('stf.user-profile', [])
.config(function ($routeProvider) { .config(function ($routeProvider) {
// if CONFIG.externalProfileURL else show page
var externalProfileURL = ''
var templateString
if (!externalProfileURL) {
templateString = require('./user.jade')
}
$routeProvider $routeProvider
.when('/user/:user*', { .when('/user/:user*', {
template: function (params) { template: require('./user.jade')
console.log('params', params)
if (externalProfileURL) {
window.location.href = 'http://www.google.com';
}
return '<div></div>'
},
controller: function () {
}
}) })
}) })
.controller('UserProfileCtrl', require('./user-controller')) .controller('UserProfileCtrl', require('./user-controller'))

View file

@ -1 +1 @@
h1 Hola h1 User