Testing Application in Gainsight, I am unable to map dynamic URLs in Gainsight. Please let me know how to map dynamic URLs in Gainsight. However working for static URLs.
Example : Some of the pages have dynamic URL i.e. https://blabla.com/#/bla/id/details. Here id may be any number.
How to set Scope & Selector for any dynamic URL in Gainsight?
Related
I'm trying to call a http endpoint. For that I need to specify a url that uses a query string to filter data.
Sample URL: http://example.com?date=2017-10-04T22:18.007Z
I need to use the current system time as a value for date query string.
I created a script and assigned the generated url with the current datetime to a variable. However, when I assigned that variable for the url field in the source HTTP definition, it did not resolve the variable.
Is there a way to solve this issue?
I do this all the time. As long as your script is running properly (you can test that with the test feature on the script), you are writing the URL value to a global variable (something like $URL), and you are writing that global variable out in your target (something like [URL]), it should work.
If you want to show your script (just where you are creating the URL), and your target URL field that could help narrow down the problem.
Suppose I have a url like:
site.com/param1/value1/param2/value2/param3/value3/param4/value4
I need to convert this url when a user writes it in url line to:
site.com/param1/value1/param2/value2?param3=value3¶m4=value4
P.S. - the number of parameters is variable.
How can I do it?
You need to change the UrlManager Rules according to the situation.
You need to configure the Url manager to handle the first two params as path url and let the rest
I would like my links to be full absolute paths to the resource being linked without me having to hard code the scheme and URI to the resource. I wish to do this in relation to using itemprop='url' on links to have the full url appear in the href attribute.
There are several approaches. The first one I would suggest is a basic helper function passed to jade during the rendering. Perhaps bound to the current request:
In your express code:
function absolute(req, url) {
//you'll need more logic here, but this is the concept
return req.originalUrl + url;
}
res.render("somePage", {absolute: absolute.bind(null, req)});
In your jade markup:
a(itemprop=url, href=absolute(url))
//- This is assuming "url" is a variable with a string like "/cars/42"
I have various products with their own set paths. Eg:
electronics/mp3-players/sony-hg122
fitness/devices/gymboss
If want to be able to access URLs in this format. For example:
http://www.mysite.com/fitness/devices/gymboss
http://www.mysite.com/electronics/mp3-players/sony-hg122
My strategy was to override the "init" function of the SiteController in order to catch the paths and then direct it to my own implementation of a render function. However, this doesn't allow me to catch the path.
Am I going about it the wrong way? What would be the correct strategy to do this?
** EDIT **
I figure I have to make use of the URL manager. But how do I dynamically add path formats if they are all custom in a database?
Eskimo's setup is a good solid approach for most Yii systems. However, for yours, I would suggest creating a custom UrlRule to query your database:
http://www.yiiframework.com/doc/guide/1.1/en/topics.url#using-custom-url-rule-classes
Note: the URL rules are parsed on every single Yii request, so be careful in there. If you aren't efficient, you can rapidly slow down your site. By default rules are cached (if you have a cache setup), but I don't know if that applies to dynamic DB rules (I would think not).
In your URL manager (protected/config/main.php), Set urlFormat to path (and toptionally set showScriptName to false (this hides the index.php part of the URL))
'urlManager' => array(
'urlFormat' => 'path',
'showScriptName'=>false,
Next, in your rules, you could setup something like:
catalogue/<category_url:.+>/<product_url:.+> => product/view,
So what this does is route and request with a structure like catalogue/electronics/ipods to the ProductController actionView. You can then access the category_url and product_url portions of the URL like so:
$_GET['category_url'];
$_GET['product_url'];
How this rule works is, any URL which starts with the word catalogue (directly after your domain name) which is followed by another word (category_url), and another word (product_url), will be directed to that controller/action.
You will notice that in my example I am preceding the category and product with the word catalogue. Obviously you could replace this with whatever you prefer or leave it out all together. The reason I have put it in is, consider the following URL:
http://mywebsite.com/site/about
If you left out the 'catalogue' portion of the URL and defined your rule only as:
<category_url:.+>/<product_url:.+> => product/view,
the URL Manager would see the site portion of the URL as the category_url value, and the about portion as the product_url. To prevent this you can either have the catalogue protion of the URL, or define rules for the non catalogue pages (ie; define a rule for site/about)
Rules are interpreted top to bottom, and only the first rule is matched. Obviously you can add as many rules as you need for as many different URL structures as you need.
I hope this gets you on the right path, feel free to comment with any questions or clarifications you need
I am trying to dynamically create a route to my router. I know there is serialize for doing this, but it appears to only accept a finite amount of parameters. For example, I need to be able to build a route that could be /:a or /:a/:b/:c.
My question is, is there a way to get what the original path request was?
I will need to:
get the original path
pause the router so an ajax call can be made to retrieve path info.
request from the server the path and return the module if it exists
(I have that much set up).
If path exists, create the route and move the application into that
state.
You can access the requested location via the router's location property.
You could then split the returned string and access the different parameters.
locationString = App.router.get('location.location.hash')
// something like "/1/2"
params = locationString.split(/\//)
param1 = params[1] // => "1"
param2 = params[2] // => "2"