Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
targetRoute !== this.routeName &&
targetRoute !== transition.targetName &&
targetRoute !== this.router.currentRouteName
) {
if (
// only want to redirect if we're going to authenticate
targetRoute === AUTH &&
transition.targetName !== CLUSTER_INDEX &&
!EXCLUDED_REDIRECT_URLS.includes(this.router.currentURL)
) {
return this.transitionTo(targetRoute, { queryParams: { redirect_to: this.router.currentURL } });
}
return this.transitionTo(targetRoute);
}
return RSVP.resolve();
},
exports.connect = function (serviceName, protocol, api, discovery) {
var clientChannel = bichannel.create(serviceName + "-amqp-transport-client");
//logger.trace('[*** TRANSPORT:CLIENT:BOOTSTRAP ***] connected to amqp-api');
var handshakeId = uuid.v4();
var serviceQueueName = helper.serviceNegotiationQueueName(serviceName);
var serverListenQueueName = serviceName + ".listen." + handshakeId;
var replyQueueName = serviceName + ".reply." + handshakeId;
var handshakeHeaders = helper.handshakeRequestHeaders(protocol, serverListenQueueName, replyQueueName);
logger.trace('[*** TRANSPORT:CLIENT:BOOTSTRAP ***] preparing to handshake...');
RSVP.resolve()
.then(findService(serviceName, discovery))
.then(readyInboundSocket(replyQueueName, api, clientChannel.rightConnection(), serverListenQueueName, replyQueueName, serviceQueueName, handshakeHeaders))
.then(readyOutboundSocket(serverListenQueueName, protocol, api, clientChannel.rightConnection(), serverListenQueueName, replyQueueName))
.catch(function (err) {
logger.warn('client error: ' + err.message);
if (err.message.indexOf('unable to find muon service') > -1) {
try {
// return muon socket messages unable to find server
var failureMsg = messages.failure(protocol, 'ServiceNotFound', 'transport cannot find service "' + serviceName + '"');
clientChannel.rightConnection().send(failureMsg);
} catch (err2) {
logger.error(err2.stack);
throw new Error(err2);
}
} else {
var negotiationErr = new Error(err);
MockWatcher.prototype.then = function() {
var promise = RSVP.resolve({
directory: path.resolve(__dirname, '../fixtures/express-server')
});
return promise.then.apply(promise, arguments);
};
_loadBlueprintFromPath(path) {
logger.info(`Loading blueprint from "${path}" ...`);
return RSVP.resolve().then(() => Blueprint.load(path));
}
typeDocumentations: this.get('clusterStore').findAll('typedocumentation')
};
if (params && params.hostId )
{
promises.clonedModel = this.getHost(params.hostId);
}
if ( this.get('access.admin') ) {
let settings = this.get('settings');
promises.apiHostSet = settings.load(C.SETTING.API_HOST).then(() => {
return !!settings.get(C.SETTING.API_HOST);
});
} else {
promises.apiHostSet = resolve(true);
}
return hash(promises).then((hash) => {
hash.availableDrivers = this.get('machineDrivers');
if ( this.get('scope.currentProject.isWindows') ) {
hash.availableDrivers = [];
}
return EmberObject.create(hash);
});
},
save(
options /*: Object */
) /*: Promise */ {
let content /*: Object */ = get(this, CONTENT);
let savePromise /*: mixed | Promise */ = resolve(this);
(this /*: ChangesetDef */).execute();
if (typeof content.save === 'function') {
let result /*: mixed | Promise */ = content.save(options);
savePromise = result;
}
return resolve(savePromise).then((result) => {
(this /*: ChangesetDef */).rollback();
return result;
});
},
function getPromise(object, property) {
return resolve(get(object, property));
}
} catch (e) {
return reject(new UnsupportedMediaTypeError());
}
};
reader.readAsText(file);
});
}
let accept = this.get('importMimeType');
if (!isBlank(accept) && file && accept.indexOf(file.type) === -1) {
return RSVP.reject(new UnsupportedMediaTypeError());
}
return RSVP.resolve();
},
_getNotificationPermissionState() {
if (navigator.permissions) {
return navigator.permissions.query({ name: 'notifications' })
.then((result) => {
return result.state;
});
}
return RSVP.resolve(Notification.permission);
},
run.next(() => {
let promise = resolve();
if (this.serializeTypeMap()) {
promise = this.get('stage').save();
}
promise.then(() => {
if (close) {
this.send('close');
}
}).catch((error) => {
this.set('error', error);
}).finally(() => {
this.get('appState').reset();
});
});
},