Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}).then(res => {
this.dispatch(res);
domClass.remove('layer-modal', 'hidden');
}, err => {
// this.dispatch({});
storiesLayer.applyEdits([storyAffectedArea], null, null, function(msg) {
console.log(msg);
domClass.remove('success-modal', 'hidden');
}, function(err) {
console.log('err');
const isComplete = this._wu && this._wu.isComplete();
this.setDisabled(this.id + "Analyze", !!this._wu);
d3Select(`#${this.id}TargetSelectLabel`).style("color", !!this._wu ? "rgb(158,158,158)" : null);
this.setDisabled(this.id + "TargetSelect", !!this._wu);
this.setDisabled(this.id + "Delete", !this._wu);
this.setDisabled(this.id + "OptimizeDropDown", !isComplete);
this.setDisabled(this.id + "_RawData", !isComplete);
this.setDisabled(this.id + "_Workunit", !this._wu);
if (this._wu) {
this.targetSelectWidget.set("value", this._wu.Cluster);
}
const stateIconClass = this._wu ? getStateIconClass(this._wu.StateID, this._wu.isComplete(), this._wu.Archived) : "";
this.workunitWidget.set("iconClass", stateIconClass);
domClass.remove(this.id + "StateIdImage");
domClass.add(this.id + "StateIdImage", stateIconClass);
d3Select(`#${this.id}WU`).style("display", isComplete ? "none" : null);
const msg = [];
if (!this._wu) {
msg.push(this.i18n.DataPatternsNotStarted);
} else if (!this._wu.isComplete()) {
msg.push(this.i18n.DataPatternsStarted);
}
const dpMessage = d3Select(`#${this.id + "DPReport"}`).selectAll(".DPMessage").data(msg);
dpMessage.enter().insert("p", ":first-child")
.attr("class", "DPMessage")
.style("text-align", "center")
.merge(dpMessage as any)
showSearchModal () {
app.debug('ModalActions >>> showSearchModal');
domClass.remove('search-modal', 'hidden');
}
showBasemapModal () {
app.debug('ModalActions >>> showBasemapModal');
let currentCookie = cookie('windBasemapDecision');
if (currentCookie === undefined) {
domClass.remove('basemap-modal', 'hidden');
} else {
if (currentCookie === 'true') { //change basemap
this.dispatch('dark-gray');
}
}
}
storyTitle = dom.byId('story-title-input').value;
storyLocation = dom.byId('story-location-input').value;
storyDate = dom.byId('story-date-input').value || '';
storyDetails = dom.byId('story-details-textarea').value;
storyVideo = dom.byId('story-video-input').value;
//storyMedia = dom.byId('story-media-input').value;
storyName = dom.byId('story-title-input').value;
storyEmail = dom.byId('story-email-input').value;
storyTitleValid = storyTitle !== '';
storyAffectedAreaValid = storyAffectedArea !== undefined;
storyEmailValid = storyEmail !== '' && validateWeb.isEmailAddress(storyEmail) === true;
if (storyTitleValid) {
domClass.remove('story-title-label', 'field-required');
} else {
domClass.add('story-title-label', 'field-required');
}
if (storyAffectedAreaValid) {
domClass.remove('story-affected-areas-label', 'field-required');
} else {
domClass.add('story-affected-areas-label', 'field-required');
}
if (storyEmailValid) {
domClass.remove('story-email-label', 'field-required');
} else {
domClass.add('story-email-label', 'field-required');
}
showCanopyModal () {
app.debug('ModalActions >>> showCanopyModal');
domClass.remove('canopy-modal', 'hidden');
}
showSubscribeModal (graphic) {
app.debug('ModalActions >>> showAlertsModal');
this.dispatch(graphic);
domClass.remove('subscription-modal', 'hidden');
}
showFiresModal () {
app.debug('ModalActions >>> showFiresModal');
domClass.remove('fires-modal', 'hidden');
}
storyEmailValid = storyEmail !== '' && validateWeb.isEmailAddress(storyEmail) === true;
if (storyTitleValid) {
domClass.remove('story-title-label', 'field-required');
} else {
domClass.add('story-title-label', 'field-required');
}
if (storyAffectedAreaValid) {
domClass.remove('story-affected-areas-label', 'field-required');
} else {
domClass.add('story-affected-areas-label', 'field-required');
}
if (storyEmailValid) {
domClass.remove('story-email-label', 'field-required');
} else {
domClass.add('story-email-label', 'field-required');
}
if (storyTitleValid === false) {
focusUtil.focus(dom.byId('story-title-input'));
} else if (storyAffectedAreaValid === false) {
dom.byId('story-affected-areas-label').scrollIntoView();
} else if (storyEmailValid === false) {
focusUtil.focus(dom.byId('story-email-input'));
}
if (storyTitleValid &&
storyEmailValid &&
storyAffectedAreaValid) {