Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc Rempel committed Jul 6, 2022
2 parents 18060e3 + 8d7e041 commit 1e155bb
Show file tree
Hide file tree
Showing 5 changed files with 9,482 additions and 12 deletions.
4 changes: 1 addition & 3 deletions AMD_Modules/src/OE_LayerActions/OE_LayerActionsModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,7 @@ export class OE_LayerActionsModule extends ModuleBase {
// check to see if div id already added, else create a new one
if (args.childRegions[0].activeViews.length > 1) {
let layerListView = args.childRegions[0].activeViews.filter((av: any) => av.id === "LayerActionsView");
if (layerListView.length > 0 &&
layerListView[0].viewModel.menuContext.value.description != undefined &&
layerListView[0].viewModel.menuContext.value.description != null) {
if (layerListView.length > 0 && layerListView[0].viewModel.menuContext.value.description != undefined && layerListView[0].viewModel.menuContext.value.description != null) {
this.layer_desc_full = layerListView[0].viewModel.menuContext.value.description.split("Metadata:")[0];
this.layer_desc_full = this.layer_desc_full.split('Abstract:').length > 1
? this.layer_desc_full.split('Abstract:')[1]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ export class OE_SearchToWorkflowViewModel extends ViewModelBase {

suggestionSearchDelayMS: number;
minLengthToSearch: number;
searchEventCountTrigger: number; //the search event progress moves through various stages, this determines when to do our custom stuff
searchEventCountTrigger: number; //the search event progress moves through various stages, this determines when to do our custom stuff
launchWorkflowLocked: boolean;
launchWorkflowLockedTimeout: number; //timeout for each workflow launch request

suggestTimeout: any;
suggestionsVisible: Observable<boolean> = new Observable<boolean>(false);
Expand All @@ -62,6 +64,8 @@ export class OE_SearchToWorkflowViewModel extends ViewModelBase {
this.suggestionSearchDelayMS = config.suggestionSearchDelayMS || 250;
this.minLengthToSearch = config.minLengthToSearch || 3;
this.searchEventCountTrigger = 3; ///config.searchEventCountTrigger || 4;
this.launchWorkflowLockedTimeout = config.launchWorkflowLockedTimeout || 1000; //default ms
this.launchWorkflowLocked = false;

let tmpText = config.workflowSearchText || "Address Search";
this.workflowSearchText.set(tmpText);
Expand Down Expand Up @@ -227,10 +231,17 @@ export class OE_SearchToWorkflowViewModel extends ViewModelBase {
else if (this.searchType && this.searchType.get() == "workflow") {

//prevent default search results
this.app.commandRegistry.command("DeactivateView").execute("DataFrameResultsContainerView");
try {
this.app.commandRegistry.command("DeactivateView").execute("DataFrameResultsContainerView");
}
catch (viewError){}

//mobile version
this.app.commandRegistry.command("DeactivateView").execute("ResultsViewContainerView");

try {
this.app.commandRegistry.command("DeactivateView").execute("ResultsViewContainerView");
}
catch (viewError){}

this.toggleSearchClearButton(true);
this.suggestionsVisible.set(false);

Expand All @@ -243,8 +254,13 @@ export class OE_SearchToWorkflowViewModel extends ViewModelBase {
return;
}

if (this.eventCount >= this.searchEventCountTrigger) {
this.eventCount = 0;
if (!this.launchWorkflowLocked && this.eventCount >= this.searchEventCountTrigger) {

this.launchWorkflowLocked = true;

console.log("Starting workflow");

this.eventCount = 0; //this.searchEventCountAfterWorkflowRun; //0;

var workflowArgs: any = {};
workflowArgs.workflowId = this.searchWorkflowID;
Expand All @@ -256,8 +272,13 @@ export class OE_SearchToWorkflowViewModel extends ViewModelBase {
workflowArgs["magicKey"] = suggestObject.magicKey;
}

this.app.commandRegistry.command("RunWorkflowWithArguments").execute(workflowArgs);

let thisScope = this;

this.app.commandRegistry.command("RunWorkflowWithArguments").execute(workflowArgs);
window.setTimeout(() => {
thisScope.launchWorkflowLocked = false;
}, thisScope.launchWorkflowLockedTimeout);
}
}

Expand Down Expand Up @@ -332,14 +353,16 @@ export class OE_SearchToWorkflowViewModel extends ViewModelBase {

searchSuggestRequest() {

this.launchWorkflowLocked = false;

this.suggestionSelectedIndex = -1;
this.suggestionSelectedText = null;

let searchString = encodeURI($(this.targetInputBoxID).val().toString());
let requestURL = "https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/suggest?text=" + searchString + "&category=Address,Postal&searchExtent=-124.83,41.85,-116.37,46.36&location=&f=json";

let thisScope = this;

var jqxhr = $.getJSON(requestURL, function (data) {
console.log("success");
thisScope.suggestionResults(data);
Expand Down
2 changes: 1 addition & 1 deletion Web/Index.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@

var viewerConfig = {
"configurations": {
"default": "Resources/Config/Default/dev_configs/oitt/Desktop.json.js",
"default": "Resources/Config/Default/dev_configs/wildfire2022/Desktop.json.js",
"imagery": "Resources/Config/Default/dev_configs/imagery/Desktop.json.js",
"default_original": "Resources/Config/Default/" + shellName + ".json.js"
},
Expand Down
Loading

0 comments on commit 1e155bb

Please sign in to comment.