$http({
method: 'GET',
url: 'xyz'
}).then(function onSuccess(response) {
console.log({"Data Response for dashboard": response});
var dashboardData = response.data;},
function onError(response) {
deferred.reject(response);
});
return deferred.promise;};
json file is looks like that {
"_index": "test",
"_type": "test",
"_id": "test",
"_version": 7,
"found": true,
"_source": {
"user": "guest",
"group": "guest",
"title": "test",
"tags": [
"test"
],
"dashboard": "{\"id\":null,\"title\":\"dasdasd\",\"originalTitle\":\"sdasdasdas",\"tags\":[\"sdada\"],\"style\":\"dark\",\"timezone\":\"utc\",\"editable\":true,\"hideControls\":false,\"rows\":[{\"title\":\"Delivered\",\"height\":\"300px\",\"editable\":true,\"collapse\":false,\"panels\":[{\"error\":false,\"span\":4,\"editable\":true,\"type\":\"graph\",\"id\":8,\"datasource\":null,\"renderer\":\"flot\",\"x-axis\":true,\"y-axis\":true,\"scale\":1,\"y_formats\":[\"short\",\"short\"],\"grid\":{\"leftMax\":null,\"rightMax\":null,\"leftMin\":0,\"rightMin\":null,\"threshold1\":null,\"threshold2\":null,\"threshold1Color\":\"rgba(216, 200, 27, 0.27)\",\"threshold2Color\":\"rgba(234, 112, 112, 0.22)\"},}
}
现在在上面的json中,我想在面板(_source.dashboard.rows.panel)“面板”中添加以下内容:[
{
"id": 1,
"span": 12,
"editable": true,
"type": "text",
"mode": "html",
"content": "<div class=\"text-center\" style=\"padding-top: 15px\">\n<img src=\"img/logo_transparent_200x.png\"> \n</div>",
"style": {},
"title": "Welcome to"
}
]
所以我将 response.data 存储到名为dashboarddata 的变量中,以便如何在面板(_source.dashboard.rows.panel)中附加上述内容