Hi @thomasneirynck
I've tried that too.
I'm using repo branch 6.0.
This is my index.js:
import { injectVars } from '../../src/core_plugins/kibana/inject_vars';
export default function (kibana) {
return new kibana.Plugin({
uiExports: {
app: {
title: 'Test Visualize',
description: 'Test vis dddd',
main: 'plugins/test_visualize_app/test_vis_app',
uses: [
'visTypes',
'visResponseHandlers',
'visRequestHandlers',
'visEditorTypes',
'savedObjectTypes',
'spyModes',
'fieldFormats',
],
injectVars
}
}
});
}
This is my whole controller:
'use strict';
import $ from 'jquery';
import { SavedObjectRegistryProvider } from 'ui/saved_objects/saved_object_registry';
import { VisProvider } from 'ui/vis';
import { VisualizeLoaderProvider } from 'ui/visualize/loader';
require('ui/autoload/all');
require('ui/routes').enable();
require('ui/chrome');
require('ui/visualize');
const app = require('ui/modules').get('apps/test_visualize_app', []);
require('ui/routes')
.when('/', {
template: require('./test_vis_app.html'),
reloadOnSearch: false,
});
app.controller('TestVisApp', function (
$compile,
$scope,
$timeout,
AppState,
config,
Private,
timefilter,
savedVisualizations
) {
const services = Private(SavedObjectRegistryProvider).byLoaderPropertiesName;
const visualizationService = services.visualizations;
const visualizeLoader = Private(VisualizeLoaderProvider);
const fetchItems = () => {
visualizationService.find()
.then(result => {
$scope.savedVisualizations = result.hits;
});
};
const visContainer = $('.test-vis-app-visualize');
const timeRange = {
min: '2017-09-01T00:00:00.000Z',
max: '2017-10-31T00:00:00.000Z'
};
$scope.$watch('selectedVisualization', (visualizationId) => {
if (!visualizationId) return;
visualizeLoader.embedVisualizationWithId(visContainer, visualizationId, {
timeRange: timeRange
}).then(() => {
console.log('renderComplete!');
});
});
$scope.savedVisualizations = [];
$scope.selectedVisualization = null;
fetchItems();
});
And this is my html:
<div class="test-vis-app app-container" ng-controller="TestVisApp">
<div class="test-vis-app-selector">
<select ng-options="item.id as item.title for item in savedVisualizations" ng-model="selectedVisualization"></select>
rendering: {{renderVisualization}}
</div>
<div class="test-vis-app-visualize"></div>
</div>
The selector successfully shows my saved visualizations:
And after you select a visualization the console shows the tabify response with the print after rendering is complete:
As I mention before, the HTML code get expanded, but nothing shows up in the screen: