Append the custom grafana dashboard into the current dashboard created by javascript (scripted dashboard)

Hello,
The below js is creating the dashboard with 2 rows : Basic & Advanced and with “dashboard.links” to the custom dashboard based on the “service” tag.
I am looking the way to append this custom dashboard as additional row to the current dashboard,
so during the creating the dashboard check if any custom dashboard (with tags : “service”) exists and if yes, add it as the next row to the dashboard

Thanks in advance for any help!

'use strict';

// accessible variables in this scope
var window, document, ARGS, $, jQuery, moment, kbn;

return function(callback) {

// Setup some variables
var dashboard;

// Intialize a skeleton with nothing but a rows array and service object
dashboard = {
      rows : [],
};

// Set a title
dashboard.title = 'K8S ' + service;

// Set default time
// time can be overriden in the url using from/to parameters, but this is
// handled automatically in grafana core during dashboard initialization
dashboard.time = {
      from: "now-1h",
        to: "now"
};

dashboard.tags = [
  service,
]
dashboard.editable = true;

dashboard.links = [
    {
      "asDropdown": false,
      "icon": "external link",
      "keepTime": true,
      "includeVars": true,
      "tags": [
        service,
      ],
      "title": "",
      "type": "dashboards"
    }    
  ]

var optional_rows = [];
optional_rows.push(row_basic_mem_cpu(DataSource,DC,cluster,namespace,service,bb));

optional_rows.push(row_advanced_cpu(DataSource,DC,cluster,namespace,service,bb))


  $.ajax({
    method: 'GET',
    url: '/'
  })
  .done(function(result) {

  // custom rows
  for (var i in optional_rows){
      dashboard.rows.push(optional_rows[i]);
  };

    // when dashboard is composed call the callback
    // function and pass the dashboard


    callback(dashboard);

  });
}

Hi,

If you do a http request and fetch a dashboard I guess it would be possibly to parse that response and generate panels based on that data.

Marcus