@@ -311,202 +311,7 @@ ${ layout.menubar(section='quick_start') }
311311 </style >
312312
313313<script src =" ${ static('desktop/js/hue.routie.js') }" type =" text/javascript" charset =" utf-8" ></script >
314- <script >
315- routie .setPathname (' /about' );
316- </script >
317-
318-
319- <script type =" text/javascript" >
320- var AdminWizardViewModel = function () {
321- var self = this ;
322-
323- self .connectors = ko .observableArray ();
324- self .isInstallingSample = ko .observable (false );
325-
326- self .installConnectorDataExample = function (connector , event ) {
327- self .isInstallingSample (true );
328- $ .post (" ${ url('notebook:install_examples') }" , {
329- connector: connector .id
330- }, function (data ) {
331- if (data .message ) {
332- huePubSub .publish (' hue.global.info' , { message: data .message });
333- }
334- if (data .errorMessage ) {
335- huePubSub .publish (' hue.global.error' , { message: data .errorMessage });
336- }
337- if (data .status == 0 && $ (event .target ).data (" is-connector" )) {
338- huePubSub .publish (' cluster.config.refresh.config' );
339- }
340- }).always (function (data ) {
341- self .isInstallingSample (false );
342- });
343- }
344- };
345-
346- function installConnectorExample () {
347- var button = $ (this );
348- $ (button).button (' loading' );
349- $ .post (button .data (" sample-url" ), function (data ) {
350- if (data .status == 0 ) {
351- if (data .message ) {
352- huePubSub .publish (' hue.global.info' , { message: data .message });
353- } else {
354- huePubSub .publish (' hue.global.info' , { message: ' ${ _("Examples refreshed") }' });
355- }
356- if ($ (button).data (" is-connector" )) {
357- huePubSub .publish (' cluster.config.refresh.config' );
358- }
359- } else {
360- huePubSub .publish (' hue.global.error' , {message: data .message });
361- }
362- })
363- .always (function (data ) {
364- $ (button).button (' reset' );
365- });
366- }
367-
368- $ (document ).ready (function (){
369-
370- var adminWizardViewModel = new AdminWizardViewModel ();
371- ko .applyBindings (adminWizardViewModel, $ (' #adminWizardComponents' )[0 ]);
372-
373- function checkConfig () {
374- $ .get (" ${ url('desktop.views.check_config') }" , function (response ) {
375- $ (" #check-config-section .spinner" ).css ({
376- ' position' : ' absolute' ,
377- ' top' : ' -100px'
378- });
379- $ (" #check-config-section .info" ).html (response);
380- $ (" #check-config-section .info" ).removeClass (' hide' );
381- })
382- .fail (function () {
383- huePubSub .publish (' hue.global.error' , {message: ' ${ _("Check config failed: ")}' });
384- });
385- }
386-
387- $ (" [rel='popover']" ).popover ();
388-
389- % if has_connectors ():
390- var configUpdated = function (clusterConfig ) {
391- if (clusterConfig && clusterConfig .app_config && clusterConfig .app_config .editor ) {
392- var connectors = clusterConfig .app_config .editor .interpreters .filter (c => c .name != ' notebook' );
393- $ (' #connectorCounts' ).text (connectors .length );
394- adminWizardViewModel .connectors (connectors);
395- }
396- };
397- huePubSub .subscribe (' cluster.config.set.config' , configUpdated);
398- huePubSub .publish (' cluster.config.refresh.config' , configUpdated);
399- % endif
400-
401- $ (" .installBtn" ).click (installConnectorExample);
402-
403- $ (" .installAllBtn" ).click (function () {
404- var button = $ (this );
405- $ (button).button (' loading' );
406- var calls = jQuery .map ($ (button).data (" sample-data" ), function (app ) {
407- return $ .post ($ (button).data (" sample-url" ), {data: app}, function (data ) {
408- if (data .status != 0 ) {
409- huePubSub .publish (' hue.global.error' , {message: data .message });
410- }
411- });
412- });
413- $ .when .apply (this , calls)
414- .then (function () {
415- huePubSub .publish (' hue.global.info' , { message: ' ${ _("Examples refreshed") }' });
416- })
417- .always (function (data ) {
418- $ (button).button (' reset' );
419- });
420- });
421-
422- var currentStep = " step1" ;
423-
424- routie ({
425- " step1 " : function () {
426- showStep (" step1" );
427- },
428- " step2 " : function () {
429- showStep (" step2" );
430- },
431- " step3 " : function () {
432- showStep (" step3" );
433- },
434- " step4 " : function () {
435- showStep (" step4" );
436- }
437- });
438-
439- if (window .location .hash === ' ' ) {
440- checkConfig ();
441- }
442-
443- function showStep (step ) {
444- if (window .location .hash === ' #step1' ) {
445- checkConfig ();
446- }
447-
448- currentStep = step;
449- if (step != " step1" ) {
450- $ (" #backBtn" ).removeClass (" disabled" );
451- } else {
452- $ (" #backBtn" ).addClass (" disabled" );
453- }
454-
455- if (step != $ (" .stepDetails:last" ).attr (" id" )) {
456- $ (" #nextBtn" ).removeClass (" hide" );
457- $ (" #doneBtn" ).addClass (" hide" );
458- } else {
459- $ (" #nextBtn" ).addClass (" hide" );
460- $ (" #doneBtn" ).removeClass (" hide" );
461- }
462-
463- $ (" a.step" ).parent ().removeClass (" active" );
464- $ (" a.step[href='#" + step + " ']" ).parent ().addClass (" active" );
465- if (step == " step4" ) {
466- $ (" #lastStep" ).parent ().addClass (" active" );
467- }
468- $ (" .stepDetails" ).hide ();
469- $ (" #" + step).show ();
470- }
471-
472- $ (" #backBtn" ).click (function () {
473- var nextStep = (currentStep .substr (4 ) * 1 - 1 );
474- if (nextStep >= 1 ) {
475- routie (" step" + nextStep);
476- }
477- });
478-
479- $ (" #nextBtn" ).click (function () {
480- var nextStep = (currentStep .substr (4 ) * 1 + 1 );
481- if (nextStep <= $ (" .step" ).length ) {
482- routie (" step" + nextStep);
483- }
484- });
485-
486- $ (" #doneBtn" ).click (function () {
487- huePubSub .publish (' open.link' , " ${ is_embeddable and '/' or url('desktop_views_home2') }" );
488- });
489-
490- $ (" .updatePreferences" ).click (function () {
491- $ .post (" ${ url('about:update_preferences') }" , $ (" input" ).serialize (), function (data ) {
492- if (data .status == 0 ) {
493- huePubSub .publish (' hue.global.info' , { message: ' ${ _("Configuration updated") }' });
494- } else {
495- huePubSub .publish (' hue.global.error' , {message: data .data });
496- }
497- });
498- });
499-
500- $ (" #updateSkipWizard" ).prop (' checked' , $ .cookie (" hueLandingPage" , {path: " /" }) == " home" );
501-
502- $ (" #updateSkipWizard" ).change (function () {
503- $ .cookie (" hueLandingPage" , this .checked ? " home" : " wizard" , {
504- path: " /" ,
505- secure: window .location .protocol .indexOf (' https' ) > - 1
506- });
507- });
508- });
509- </script >
314+ <script src =" ${ static('desktop/js/admin-wizard-inline.js') }" type =" text/javascript" ></script >
510315% endif
511316
512317% if not is_embeddable:
0 commit comments