Skip to content
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

Crest v1.4.1 code changes #51

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
198 changes: 108 additions & 90 deletions app/README.md

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions app/README/alert_actions.conf.spec
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ param.paramTwo = <string> Field Name for Parameter Two

[launch_notebook]
python.version = python3
param.notebook_path = <string> Notebook path. It's a required parameter.
param.revision_timestamp = <string> Revision timestamp.
param.notebook_parameters = <string> Notebook parameters.
param.cluster_name = <string> Cluster name.
param.notebook_path = <string> Notebook Path. It's a required parameter.
param.revision_timestamp = <string> Revision Timestamp.
param.notebook_parameters = <string> Notebook Parameters.
param.cluster_name = <string> Cluster Name.
param.run_name = <string> Run Name.
param._cam = <json> Active response parameters.
2 changes: 2 additions & 0 deletions app/README/ta_databricks_account.conf.spec
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ aad_client_id =
aad_tenant_id =
aad_client_secret =
aad_access_token =
config_for_dbquery =
cluster_name =
warehouse_id =
databricks_pat =
7 changes: 6 additions & 1 deletion app/README/ta_databricks_settings.conf.spec
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,9 @@ proxy_rdns =
use_for_oauth =

[logging]
loglevel =
loglevel =

[additional_parameters]
admin_command_timeout =
query_result_limit =
index =
2 changes: 1 addition & 1 deletion app/app.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"id": {
"group": null,
"name": "TA-Databricks",
"version": "1.2.0"
"version": "1.4.1"
},
"author": [
{
Expand Down
107 changes: 107 additions & 0 deletions app/appserver/static/cancel_button.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
.cancel_button{
display: inline-block;
padding: 4px 12px;
margin-bottom: 0;
border-radius: 100px;
text-align: center;
font-size: 17px;
line-height: 16px;
cursor: pointer;
background-color: #00A36C;
color: #fff;
}

.loading{
display: inline-block;
padding: 4px 12px;
margin-bottom: 0;
border-radius: 100px;
text-align: center;
font-size: 17px;
line-height: 16px;
cursor: pointer;
background-color: #0096FF;
color: #fff;
}

.cancel_button_disabled{
display: inline-block;
padding: 4px 12px;
margin-bottom: 0;
border-radius: 100px;
text-align: center;
font-size: 17px;
line-height: 16px;
cursor: pointer;
background-color: grey;
color: #fff;
}

.popup-container-for-no-cancelation {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
background-color: rgba(0, 0, 0, 0.5);
}

.popup-content-for-no-cancelation {
background-color: black;
color: white;
padding: 20px;
border-radius: 8px;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
max-width: 80%;
text-align: center;
font-size: 18px;
}

.popup-container-for-successful-cancelation {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
background-color: rgba(0, 0, 0, 0.5);
}

.popup-content-for-successful-cancelation {
background-color: green;
color: white;
padding: 20px;
border-radius: 8px;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
max-width: 80%;
text-align: center;
font-size: 18px;
}

.popup-container-for-err-in-cancelation {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
background-color: rgba(0, 0, 0, 0.5);
}

.popup-content-for-err-in-cancelation {
background-color: red;
color: white;
padding: 20px;
border-radius: 8px;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
max-width: 80%;
text-align: center;
font-size: 18px;
}
102 changes: 102 additions & 0 deletions app/appserver/static/cancel_button.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
require([
'underscore',
'splunkjs/mvc',
'splunkjs/mvc/tableview',
'splunkjs/mvc/searchmanager',
'splunkjs/mvc/simplexml/ready!'
], function(_, mvc, TableView, SearchManager) {

var runDetailsTable = mvc.Components.get("databricks_run_table");
var jobDetailsTable = mvc.Components.get("databricks_job_table");
customRenderer = TableView.BaseCellRenderer.extend({
canRender: function (cell) {
return _(['Cancel Run']).contains(cell.field);
},
render: function ($td, cell) {
if(cell.field == "Cancel Run"){
let isCancelled = false;
var run_details = cell.value;
var array = run_details.split("||");
var run_ex_status = array[2];

if(run_ex_status !== "Running" && run_ex_status !== "Initiated" && run_ex_status !== "Pending"){
$td.html("<div class='ar_containter'><div class='cancel_button_disabled' value='Cancel'>Cancel Run</div></div>");
$td.on('click', function(event) {
var popupContainer = document.createElement('div');
popupContainer.className = 'popup-container-for-no-cancelation';
var popupContent = document.createElement('div');
popupContent.className = 'popup-content-for-no-cancelation';
popupContent.innerHTML = 'This can not be canceled as Execution Status is not in Running, Pending or Initiated mode!';
popupContainer.appendChild(popupContent);
document.body.appendChild(popupContainer);
popupContainer.addEventListener('click', function() {
document.body.removeChild(popupContainer);
});
});
}
else{
$td.html("<div class='ar_containter'><div class='cancel_button' value='Cancel'>Cancel Run</div></div>");
$td.on('click', function (event) {
if (isCancelled){
return;
}
$td.html("<div class='ar_containter'><div class='loading' value='Loading'>Canceling..</div></div>");
var fields = {}
fields['run_id'] = array[0]
var ENDPOINT_URL = '/services/cancel_run'
var service = mvc.createService({ owner: "nobody" });
fields['account_name'] = array[1]
fields['uid'] = array[3]
$td.css("pointer-events", "none");

service.post(ENDPOINT_URL, fields, function (err, response) {
if (response != undefined && (response.data != null || response.data != undefined)) {
canceled_response = response.data['canceled']
if (canceled_response == "Success"){
var popupContainer = document.createElement('div');
popupContainer.className = 'popup-container-for-successful-cancelation';
var popupContent = document.createElement('div');
popupContent.className = 'popup-content-for-successful-cancelation';
popupContent.innerHTML = 'Successfully Canceled the run! An updated event with canceled execution status will be ingested in Splunk in few minutes.';
popupContainer.appendChild(popupContent);
document.body.appendChild(popupContainer);
popupContainer.addEventListener('click', function() {
document.body.removeChild(popupContainer);
});
$td.html("<div class='ar_containter'><div class='cancel_button_disabled' value='Cancel'>Canceled</div></div>");
isCancelled = true;
}
}
else {
var popupContainer = document.createElement('div');
popupContainer.className = 'popup-container-for-err-in-cancelation';
var popupContent = document.createElement('div');
popupContent.className = 'popup-content-for-err-in-cancelation';
popupContent.innerHTML = 'Error while Canceling the run! Please try after sometime!';
popupContainer.appendChild(popupContent);
document.body.appendChild(popupContainer);
popupContainer.addEventListener('click', function() {
document.body.removeChild(popupContainer);
});
$td.html("<div class='ar_containter'><div class='cancel_button' value='Cancel'>Cancel Run</div></div>");
}
$td.css("pointer-events", "auto");
});
});
}
}
}
});
if (runDetailsTable !== undefined) {
runDetailsTable.getVisualization(function (tableView) {
tableView.table.addCellRenderer(new customRenderer());
tableView.table.render();
});
}
if (jobDetailsTable !== undefined) {
jobDetailsTable.getVisualization(function (tableView) {
tableView.table.addCellRenderer(new customRenderer());
tableView.table.render();
});
}
})
62 changes: 62 additions & 0 deletions app/appserver/static/dashboard.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#run_name_text.input.input-text::after {
content: "Run Name to identify the run execution.";
display: inline-block;
color: black;
margin-left: 5px;
font-size: 12px;
font-style: italic;
}

#path_text.input.input-text::after {
content: "[Required] Absolute path of notebook to be run in Databricks. eg: /Users/user_1/notebook_1";
display: inline-block;
color: black;
margin-left: 5px;
font-size: 12px;
font-style: italic;
}

#revision_timestamp_text.input.input-text::after {
content: "The timestamp of the revision of the notebook.";
display: inline-block;
color: black;
margin-left: 5px;
font-size: 12px;
font-style: italic;
}

#params_text.input.input-text::after {
content: "Parameters to pass while executing the notebook. eg: key1=value1||key2=value2";
display: inline-block;
color: black;
margin-left: 5px;
font-size: 12px;
font-style: italic;
}

#cluster_text.input.input-text::after {
content: "Name of Databricks cluster to use for execution.";
display: inline-block;
color: black;
margin-left: 5px;
font-size: 12px;
font-style: italic;
}

#acct_dropdown.input.input-dropdown::after {
content: "[Required] Name of Databricks Account to use for execution.";
display: inline-block;
color: black;
margin-left: 5px;
font-size: 12px;
font-style: italic;
}

#auto_fwd.input.input-dropdown::after {
content: "Whether to directly redirect to Databricks portal.";
display: inline-block;
color: black;
margin-left: 5px;
font-size: 12px;
font-style: italic;
}
Binary file modified app/appserver/static/img/DB_config.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added app/appserver/static/img/databricks_job.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/appserver/static/img/databricks_run.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed app/appserver/static/img/dbrun_cc_example.png
Binary file not shown.
Binary file removed app/appserver/static/img/launch_notebook_ar.webm
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
14 changes: 14 additions & 0 deletions app/appserver/static/js/build/custom/auth_select_hook.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ class AuthSelectHook {
this.toggleAADFields(false);
}
}
if (field == 'config_for_dbquery') {
if (value == 'interactive_cluster') {
this.hideWarehouseField(false);
} else {
this.hideWarehouseField(true);
}
}
}

onRender() {
Expand All @@ -24,7 +31,14 @@ class AuthSelectHook {
} else {
this.toggleAADFields(false);
}
}

hideWarehouseField(state) {
this.util.setState((prevState) => {
let data = {...prevState.data };
data.warehouse_id.display = state;
return { data }
});
}

toggleAADFields(state) {
Expand Down
Loading