Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
activate: function() {
let context = this.get('currentProjectContext');
if (context.singleStageMode) {
let store = this.get('store');
let modelName = 'fd-dev-stage';
let predicate = new SimplePredicate('id', FilterOperator.Eq, context.context.stage);
let builder = new Builder(store)
.from(modelName)
.select('id,name,configuration.id')
.where(predicate);
this.get('appState').loading();
store.query(modelName, builder.build()).then((result) => {
if (result && result.get('length') !== undefined && result.get('length') === 1) {
let stage = result.objectAt(0);
context.setCurrentConfiguration(stage.get('configuration'));
context.setCurrentStage(stage);
FdPreloadStageMetadata.call(this, store, context.getCurrentStage()).then(() =>
context.getAutogeneratedSystemPromise()).then(() => {
if (this.get('controller.currentRouteName') === 'fd-appstruct-form') {
this.refresh();
} else {
this.transitionTo('fd-appstruct-form');
return new Promise((resolve, reject) => {
let modelName = 'fd-project';
let builder = new Builder(_this.store, modelName)
.select('id,name')
.top(1);
_this.store.query(modelName, builder.build()).then((projects)=> {
model.set('project', projects.toArray()[0]);
resolve();
}).catch(error => { reject(error); });
});
}
}
let promises = [];
let templateClassId = model.get('description');
let store = this.get('store');
let builderStage = new Builder(store)
.from('fd-dev-stage')
.selectByProjection('ListFormView');
promises.push(store.query('fd-dev-stage', builderStage.build()));
if (!isNone(templateClassId)) {
let id = templateClassId.substring(1, templateClassId.length - 1);
let builderClass = new Builder(store)
.from('fd-dev-class')
.selectByProjection('ListFormView')
.byId(id);
let selectClassPromise = store.queryRecord('fd-dev-class', builderClass.build()).then((selectClass) => {
let stage = selectClass.get('stage');
_this.getClassesForStage(store, stage).then((classes) => {
let classArray = A(classes);
let classNames = classArray.mapBy('name');
classNames.unshift('');
_this.set('classItems', {
names: classNames,
objects: classArray,
});
_this.set('classValue', selectClass.get('name'));
function getPromise(store, stagePk, modelName, projectionName) {
let stagePkPredicate = new SimplePredicate('stage.id', FilterOperator.Eq, stagePk);
let q = new Builder(store, modelName)
.selectByProjection(projectionName)
.where(stagePkPredicate)
.build();
return store.query(modelName, q);
}
model() {
let modelHash = {
run: undefined,
success: undefined,
error: undefined,
other: undefined,
};
let store = this.get('store');
let modelName = 'fd-generation';
let projectionName = 'EditFormView';
let builder = new Builder(store)
.from(modelName)
.selectByProjection(projectionName)
.where('stage', 'eq', this.get('currentProjectContext').getCurrentStage())
.orderBy('startTime desc');
return store.query(modelName, builder.build()).then((result) => {
let runningGenerations = result.filterBy('state', GenerationStateEnum.Running);
let wrapRunningGenerations = this.wrapModel(runningGenerations);
modelHash.run = A(wrapRunningGenerations);
let successGenerations = result.filterBy('state', GenerationStateEnum.Success);
let wrapSuccessGenerations = this.wrapModel(successGenerations);
modelHash.success = A(wrapSuccessGenerations);
let errorGenerations = result.filterBy('state', GenerationStateEnum.Error);
let wrapErrorGenerations = this.wrapModel(errorGenerations);
getClassesForStage(store, stage) {
let predicate = new SimplePredicate('stage', FilterOperator.Eq, stage.get('id'));
let builderClasses = new Builder(store)
.from('fd-dev-class')
.selectByProjection('ListFormView')
.where(predicate);
return store.query('fd-dev-class', builderClasses.build());
},
if (isNone(queryParams) || Object.keys(queryParams).length === 0) {
return resolve();
}
let gotostage = get(queryParams, 'gotostage');
if (isBlank(gotostage)) {
return resolve();
}
let currentProjectContext = this.get('currentProjectContext');
let store = this.get('store');
let modelName = 'fd-dev-stage';
let predicate = new SimplePredicate('id', FilterOperator.Eq, gotostage);
let builder = new Builder(store)
.from(modelName)
.selectByProjection('ListFormView')
.where(predicate);
this.get('appState').loading();
return store.queryRecord(modelName, builder.build()).then((stage) => {
currentProjectContext.setCurrentConfiguration(stage.get('configuration'));
currentProjectContext.setCurrentStage(stage);
return FdPreloadStageMetadata.call(this, store, currentProjectContext.getCurrentStage());
})
.then(() => currentProjectContext.getAutogeneratedSystemPromise())
.then(() => {
let gotoobj = get(queryParams, 'gotoobj')
if (get(queryParams, 'gototype') === 'fd-dev-view') {
let view = store.peekRecord('fd-dev-view', gotoobj);
_storageType: computed('model.id', function() {
let currentStage = this.get('model.id');
let stageEqualNull = new SimplePredicate('stage', '==', null);
let stageEqualCurrentStage = new SimplePredicate('stage', '==', currentStage);
let condition = stageEqualNull.or(stageEqualCurrentStage);
let store = this.get('store');
let builder = new Builder(store)
.from('fd-storage-type')
.selectByProjection('EditFormView')
.where(condition);
return store.query('fd-storage-type', builder.build()).then(function(data) {
let results = data.map(item => item.get('shortName'));
return results;
});
}),