Skip to content

[ui-Quick Start] Convert the Quick Start page within administrator server in ReactJS #4025

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Apr 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
297 changes: 2 additions & 295 deletions apps/about/src/about/templates/admin_wizard.mako
Original file line number Diff line number Diff line change
Expand Up @@ -14,306 +14,13 @@
## See the License for the specific language governing permissions and
## limitations under the License.

<%!
import sys

from django.urls import reverse

from metadata.conf import OPTIMIZER, has_optimizer

from desktop.auth.backend import is_admin
from desktop.conf import has_connectors
from desktop.views import commonheader, commonfooter

if sys.version_info[0] > 2:
from django.utils.translation import gettext as _
else:
from django.utils.translation import ugettext as _
%>

<%namespace name="layout" file="/about_layout.mako" />

% if not is_embeddable:
${ commonheader(_('Quick Start'), "quickstart", user, request, "70px") | n,unicode }
% endif

${ layout.menubar(section='quick_start') }

<div class="container-fluid" id="adminWizardComponents">
<div class="row-fluid" style="margin-bottom: 100px;">
<div>
<h1 class="margin-top-20 margin-bottom-30">
% if is_admin(user):
${ _('Quick Start') } -
% endif
<a href="https://gethue.com" target="_blank" title="${ _('Open Hue\'s website in a new tab') }">
Hue&trade;
${ version }
</a>
-
Query. Explore. Repeat.
</h1>

% if is_admin(user):
<div class="margin-bottom-30">
<div class="row-fluid">

<div class="span2">
<ul class="nav nav-pills nav-vertical-pills">
<li class="active"><a href="#step1" class="step">${ _('Step 1:') } <i class="fa fa-check"></i> ${ _('Checks') }</a></li>
<li><a href="#step2" class="step">${ _('Step 2:') } <i class="fa fa-exchange"></i> ${ _('Connectors') }</a></li>
<li><a href="#step3" class="step">${ _('Step 3:') } <i class="fa fa-book"></i> ${ _('Examples') }</a></li>
<li><a id="lastStep" href="#step4" class="step">${ _('Step 4:') } <i class="fa fa-group"></i> ${ _('Users') }</a></li>
</ul>
</div>

<div class="span10 steps">
<div id="step1" class="stepDetails">
<div>
<h3>${ _('Checking current configuration') }</h3>

<div id="check-config-section" class="margin-bottom-20">
<div class="spinner">
<i class="fa fa-spinner fa-spin" style="font-size: 60px; color: #DDD"></i>
</div>
<div class="info hide"></div>
</div>
</div>
</div>

<div id="step2" class="stepDetails hide">
<h3>${ _('Add connectors to data services') }</h3>

% if has_connectors():
<span id="connectorCounts">...</span> ${ _('connectors installed') }

<ul class="unstyled samples margin-top-20">
<li>
<a href="${ url('desktop.lib.connectors.views.index') }" title="${ _('Open the connector configuration page') }">
<i class="fa fa-plus"></i> ${ _('Add a Database') }
</a>
</li>
<li>
<a href="javascript:void(0)" class="installBtn" title="${ _('Install the connector examples') }" data-is-connector="true"
data-loading-text="${ _('Installing...') }" data-sample-url="${ url('connectors.api.install_connector_examples') }">
<i class="fa fa-download"></i> ${ _('Install examples') }
</a>
</li>
</ul>
% else:
<a href="${ url('desktop.views.dump_config') }" target="_blank">${ _('Configuration') }</a>
<br>
<a href="https://docs.gethue.com/administrator/configuration/" target="_blank">${ _('Documentation') }</a>
% endif
</div>

<div id="step3" class="stepDetails hide">
<div>
<h3>${ _('Install some data examples') }</h3>
<ul class="unstyled samples">

% if has_connectors():
<!-- ko foreach: connectors -->
<!-- ko if: ['hive', 'impala', 'mysql', 'postgresql', 'presto', 'phoenix', 'flink', 'ksql'].indexOf(dialect) != -1 -->
<li>
<a href="javascript:void(0)" data-bind="click: $root.installConnectorDataExample">
<i class="fa fa-download"></i> <span data-bind="text: name"></span>
</a>
</li>
<!-- /ko -->
<!-- /ko -->

<li>
<div id="check-config-section" class="margin-bottom-20" data-bind="visible: isInstallingSample">
<div class="spinner">
<i class="fa fa-spinner fa-spin" style="font-size: 60px; color: #DDD"></i>
</div>
</div>
</li>
% else:
% if 'hive' in app_names:
<li>
<a href="javascript:void(0)" class="installBtn" data-loading-text="${ _('Installing...') }"
data-sample-url="${ url('beeswax:install_examples') }">
<i class="fa fa-download"></i> ${ apps['beeswax'].nice_name }
</a>
</li>
% endif
% if 'impala' in app_names:
<li>
<a href="javascript:void(0)" class="installBtn" data-loading-text="${ _('Installing...') }"
data-sample-url="${ url('impala:install_examples') }">
<i class="fa fa-download"></i> ${ apps['impala'].nice_name }
</a>
</li>
% endif
% if has_optimizer() and OPTIMIZER.QUERY_HISTORY_UPLOAD_LIMIT.get() > 0:
<li>
<a href="javascript:void(0)" class="installBtn" data-loading-text="${ _('Uploading...') }"
data-sample-url="${ url('metadata:upload_history') }" title="${ _('Send and analyze past %s executed queries to provide smarter SQL recommendations') % OPTIMIZER.QUERY_HISTORY_UPLOAD_LIMIT.get() }">
<i class="fa fa-download"></i> ${ _('SQL Query history') }
</a>
</li>
% endif
% if 'search' in app_names:
<li>
<a href="javascript:void(0)" class="installAllBtn" data-loading-text="${ _('Installing...') }"
data-sample-url="${ url('search:install_examples') }" data-sample-data='["log_analytics_demo", "twitter_demo", "yelp_demo"]'>
<i class="fa fa-download"></i> ${ apps['search'].nice_name }
</a>
</li>
% endif
% if 'spark' in app_names:
<li>
<a href="javascript:void(0)" class="installBtn" data-loading-text="${ _('Installing...') }"
data-sample-url="${ url('notebook:install_examples') }">
<i class="fa fa-download"></i> ${ apps['spark'].nice_name }
</a>
</li>
% endif
% if 'oozie' in app_names:
<li>
<a href="javascript:void(0)" class="installBtn" data-loading-text="${ _('Installing...') }"
data-sample-url="${ url('oozie:install_examples') }">
<i class="fa fa-download"></i> ${ apps['oozie'].nice_name }
</a>
</li>
% endif
% if 'hbase' in app_names:
<li>
<a href="javascript:void(0)" class="installBtn" data-loading-text="${ _('Installing...') }"
data-sample-url="${ url('hbase:install_examples') }">
<i class="fa fa-download"></i> ${ apps['hbase'].nice_name }
</a>
</li>
% endif
% if 'pig' in app_names:
<li>
<a href="javascript:void(0)" class="installBtn" data-loading-text="${ _('Installing...') }"
data-sample-url="${ url('pig:install_examples') }">
<i class="fa fa-download"></i> ${ apps['pig'].nice_name }
</a>
</li>
% endif
% if 'oozie' in app_names:
<li>
<a href="javascript:void(0)" class="installBtn" data-loading-text="${ _('Installing...') }"
data-sample-url="${ url('oozie:install_examples') }">
<i class="fa fa-download"></i> ${ _('Job Editor') }
</a>
</li>
% elif 'jobsub' in app_names:
<li>
<a href="javascript:void(0)" class="installBtn" data-loading-text="${ _('Installing...') }"
data-sample-url="${ url('oozie:install_examples') }">
<i class="fa fa-download"></i> ${ apps['jobsub'].nice_name }
</a>
</li>
% endif
% endif
</ul>
</div>
</div>

<div id="step4" class="stepDetails hide">
<div>
<h3>${ _('Create or import users') }</h3>
<a href="${ url('useradmin:useradmin.views.list_users') }"
% if not is_embeddable:
target="_blank"
% endif
><i class="fa fa-user"></i> ${ _('User Admin') }</a>
</div>

<div class="margin-top-30">
<h3>${ _('Anonymous usage analytics') }</h3>
<label class="checkbox">
<input class="updatePreferences" type="checkbox" name="collect_usage" style="margin-right: 10px"
title="${ _('Check to enable usage analytics') }" ${ collect_usage and 'checked' or '' }/>
${ _('Help improve Hue with anonymous usage analytics.') }
<a href="javascript:void(0)" style="display: inline" data-trigger="hover" data-toggle="popover"
data-placement="right" rel="popover"
title="${ _('How does it work?') }"
data-content="${ _('Hue is using Google Analytics to see how many times an application or specific section of an application is used, nothing more.') }">
<i class="fa fa-question-circle"></i>
</a>
</label>
</div>

% if not is_embeddable:
<div class="margin-top-30">
<h3>${ _('Skip wizard next time') }</h3>
<label class="checkbox">
<input id="updateSkipWizard" type="checkbox" style="margin-right: 10px" title="${ _('Check to skip this wizard next time.') }"/>
${ _('Skip the Quick Start Wizard at next login and land directly on your starred application.') }
</label>
</div>
% endif

</div>
</div>

</div>
</div>
<div class="card-body">
<div class="form-actions">
<a id="backBtn" class="btn disabled">${ _('Back') }</a>
<a id="nextBtn" class="btn btn-primary disable-feedback">${ _('Next') }</a>
<a id="doneBtn" class="btn btn-primary disable-feedback hide">${ _('Done') }</a>
<span class="pull-right muted" style="padding-right:30px">${ _('Hue and the Hue logo are trademarks of Cloudera, Inc.') }</span>
</div>
</div>
% else:
<div class="card-body">
<p>
${ _('Learn more about Hue and SQL Querying on') } <a href="https://gethue.com" target="_blank">https://gethue.com</a>.
<br/>
<br/>
<span class="pull-right muted">${ _('Hue and the Hue logo are trademarks of Cloudera, Inc.') }</span>
% if not user.is_authenticated:
<br/>
<a href="${ url('desktop_views_home2') }" class="btn btn-primary" style="margin-top: 50px;margin-bottom: 20px">
<i class="fa fa-sign-in"></i> ${ _('Sign in now!') }
</a>
% endif
</p>
</div>
% endif

</div>
</div>

<div id="Overview">
<OverviewTab class='antd cuix' data-reactcomponent='Overview'></OverviewTab>
</div>

% if is_admin(user):
<style type="text/css">
.steps {
min-height: 300px;
}

input[type=submit] {
margin-left: 50px;
}

ul.samples li {
padding-bottom: 5px;
}

.nav-pills.nav-vertical-pills li {
float: none;
margin-bottom: 10px;
}

.nav-pills.nav-vertical-pills li a {
line-height: 20px;
}

</style>

<script src="${ static('desktop/js/hue.routie.js') }" type="text/javascript" charset="utf-8"></script>
<script src="${ static('desktop/js/admin-wizard-inline.js') }" type="text/javascript"></script>
% endif

% if not is_embeddable:
${ commonfooter(request, messages) | n,unicode }
% endif
44 changes: 0 additions & 44 deletions apps/hive/src/hive/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,47 +21,3 @@

import aws
from desktop.lib.django_test_util import make_logged_in_client


@pytest.mark.django_db
def test_config_check():
with patch('beeswax.hive_site.get_metastore_warehouse_dir') as get_metastore_warehouse_dir:
with patch('aws.s3.s3fs.S3FileSystem._stats') as s3_stat:
with patch('aws.conf.is_enabled') as is_s3_enabled:
reset = aws.conf.AWS_ACCOUNTS.set_for_testing({
'default': {
'region': 'us-east-1',
'access_key_id': 'access_key_id',
'secret_access_key': 'secret_access_key'
}
}),
warehouse = 's3a://yingsdx0602/data1/warehouse/tablespace/managed/hive'
get_metastore_warehouse_dir.return_value = warehouse
is_s3_enabled.return_value = True
s3_stat.return_value = Mock(
DIR_MODE=16895,
FILE_MODE=33206,
aclBit=False,
atime=None,
group='',
isDir=True,
mode=16895,
mtime=None,
name='hive',
path='s3a://yingchensdx/data1/warehouse/tablespace/managed/hive/',
size=0,
type='DIRECTORY',
user=''
)

try:
cli = make_logged_in_client()
resp = cli.get('/desktop/debug/check_config')
s3_stat.assert_called()
err_msg = 'Failed to access Hive warehouse: %s' % warehouse
if not isinstance(err_msg, bytes):
err_msg = err_msg.encode('utf-8')
assert err_msg not in resp.content, resp
finally:
for old_conf in reset:
old_conf()
2 changes: 1 addition & 1 deletion desktop/core/src/desktop/api2_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,7 @@ class TestCheckConfigAPI:
def test_check_config_success(self):
with patch('desktop.api2.os.path.realpath') as mock_hue_conf_dir:
with patch('desktop.api2._get_config_errors') as mock_get_config_errors:
request = Mock(method='POST')
request = Mock(method='GET')
mock_hue_conf_dir.return_value = '/test/hue/conf'
mock_get_config_errors.return_value = [
{"name": "Hive", "message": "The application won't work without a running HiveServer2."},
Expand Down
2 changes: 1 addition & 1 deletion desktop/core/src/desktop/api_public.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def download_hue_logs(request):
return logs_api.download_hue_logs(django_request)


@api_view(["POST"])
@api_view(["GET"])
def check_config(request):
django_request = get_django_request(request)
return desktop_api.check_config(django_request)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,8 @@
// limitations under the License.

export const SERVER_LOGS_API_URL = '/api/v1/logs';
export const CHECK_CONFIG_EXAMPLES_API_URL = '/api/v1/check_config';
export const ANALYTICS_PREFERENCES_API_URL = '/about/update_preferences';
export const INSTALL_APP_EXAMPLES_API_URL = '/api/v1/install_app_examples';
export const INSTALL_AVAILABLE_EXAMPLES_API_URL = '/api/v1/available_app_examples';
export const HUE_DOCS_CONFIG_URL = 'https://docs.gethue.com/administrator/configuration/';
Loading