Archi Forum

Archi Plug-ins => jArchi => Topic started by: Alberto on June 20, 2019, 20:10:23 PM

Title: 'Expire' Assets via jArchi
Post by: Alberto on June 20, 2019, 20:10:23 PM
Hi folks, I need some jArchi help.

How can I run a script through a set of views that have a particular property? And is it possible to trigger this script (and finish) from the command line before generating an HTML report?

Setting:  I have a GIT model which gets published to HTML on a regular basis via CLI.  There are elements that have a 'last updated' date.  I want to modify these elements in Views that have been 'finalized and published' to change their appearance to a yellow/red outline if they are old (90 days) or too old (180 days) since 'last updated'.  I have the script to change the visual appearance (basically a modification of heat map script) but I don't know how to have it run on all views that have the 'finalized and published' property, and that the script runs (and finishes) before it gets exported into the HTML report.

Title: Re: 'Expire' Assets via jArchi
Post by: Phil Beauvoir on June 22, 2019, 14:53:04 PM
Are you able to query the properties in a View to find the property and its value?

Something like:

$("view").each(function(v) {
    var val = v.prop("yourKey");
    if(val == "some value") {
        // Do something
    }
});
Title: Re: 'Expire' Assets via jArchi
Post by: Jean-Baptiste Sarrodie on June 22, 2019, 19:15:34 PM
Hi,

There is another option: you can filter using a function:

$("view").filter(function(v) {
    return  v.prop("yourKey") == "some value"
}).each(function(v) {
    // Do something
});