Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
load_views: function() {
// Needed for removing the initial empty tree view when the widget
// is loaded
var self = this,
result = this._super();
return $.when(result).then(function()
{
self.renderElement();
self.compute_totals();
self.$el.find('.edit').on(
'change', self.proxy(self.xy_value_change));
});
},
});
var self = this
this.$el = $el
this.transclusion = $el.html()
this._options = $.extend({}, View.defaults, options)
this._data = {}
$.each(this._options, function (key, option) {
if (Object.keys(View.defaults).indexOf(key) !== -1) return
self[key] = option
})
this.props = $.extend({}, this._options.props, utils.getProps($el))
this._directiveEvents = []
this._elementsWithEvents = []
$.when(this._getTemplate(), this._getInitialData())
.done(function (template, data) {
$.extend(self._data, data)
self._templateSource = template
self._template = new Template(template)
self.emit('template loaded')
self._start()
})
.fail(function (err) {
console.error(err)
})
}
function tryToGetNewsfeed(cb) {
$streamContainer = $(STEAM_CONTAINER_SELECTOR);
let $newsFeedElement = null;
let findNewsFeedContainer = $streamContainer.children().each(function() {
if (NEWSFEED_STREAM_MATCHER.test(this.id)) {
$newsFeedElement = $(this)
}
})
$.when(findNewsFeedContainer).done(() => {
return cb(null, $newsFeedElement)
})
}
componentDidMount() {
$.when(
$.getJSON('/assets/data/worldGeo.json'),
$.getJSON('/assets/data/map-1.json')
).then((geoData, data) => {
const dv = new DataSet.View().source(geoData[0], {
type: 'GeoJSON'
}).transform({
type: 'geo.projection',
projection: 'geoMercator',
as: ['x', 'y', 'centroidX', 'centroidY'],
});
const userData = new DataSet.View().source(data[0]).transform({
type: 'map',
callback: (obj) => {
const projectedCoord = dv.geoProjectPosition([obj.lng * 1, obj.lat * 1], 'geoMercator');
obj.x = projectedCoord[0];
aoi = self.get('area_of_interest'),
wkaoi = self.get('wkaoi'),
result = self.get('result');
if (aoi &&
!result &&
!utils.isWKAoIValid(wkaoi) &&
self.runWorksheetPromise === undefined) {
var taskHelper = {
contentType: 'application/json',
queryParams: null,
postData: JSON.stringify(aoi),
},
promises = self.start(taskHelper);
self.runWorksheetPromise = $.when(promises.startPromise,
promises.pollingPromise);
self.runWorksheetPromise
.always(function() {
delete self.runWorksheetPromise;
});
}
return self.runWorksheetPromise || $.when();
},
});
onload({featureFlags}) {
if (!featureFlags.siteK8s()) {
this.setDisabled();
return;
}
addSideNavItem({
title: 'Kubernetes',
Icon: Icons.Kubernetes,
exact: false,
to: cfg.getSiteK8sRoute(),
})
this.setProcessing();
$.when(
fetchDeployments(),
fetchServices(),
fetchNamespaces(),
fetchPods(),
fetchJobs(),
fetchCfgMaps(),
fetchDaemonSets())
.done(() => this.setReady())
.fail(this.setFailed.bind(this));
}
}
loadData(props) {
const { row } = props;
const applicationUrl = row._links.self.href;
const commandsUrl = activeCommandUrl(row._links.commands.href);
const allCommandsUrl = stripHateoasTemplateUrl(row._links.commands.href);
$.when(fetch(applicationUrl), fetch(commandsUrl)).done(
(application, commands) => {
application[0]._links.commands.href = allCommandsUrl;
this.setState({ application: application[0], commands: commands[0] });
}
);
}
this._submitXhr.then(data => {
this.setState({
loading: false,
text: ''
});
$.when([
youtubeController.invalidateComments(`commentThreads.${this.context.videoId}`),
youtubeController.invalidateComments(`comments.${this.context.videoId}`)
]).done(() => {
if (this.props.onComment) {
this.props.onComment(data);
}
});
});
});
let accs = neighborKeys.map((key, i) => {
let acc = this.getAccessor(key);
if (!acc) {
return this.findNodeByKey(neighborKeys[i]);
} else {
return $.when(acc);
}
});