Skip to content

Commit

Permalink
filter out dry_run project when show projects in web or console.
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuamshana committed Jan 18, 2022
1 parent ee514a3 commit 521eaac
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions functions/routers/project.router.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export const syncProjectsFromDbToOrchestration = bfast.functions().onGetHttpRequ
console.log(e, 'INFO : try to remove instance');
}
}

async function faasCheck(project) {
if (project.dry_run === true) {
return;
Expand All @@ -53,11 +54,12 @@ export const syncProjectsFromDbToOrchestration = bfast.functions().onGetHttpRequ
console.log(e && e.response ? e.response.data : e.toString());
}
if (!(faasHealth && typeof faasHealth.message === "string")) {
projectFactory.deployProjectInCluster(project, [],!!project.dry_run)
projectFactory.deployProjectInCluster(project, [], !!project.dry_run)
.then(v => console.log('re-sync ' + project.projectId))
.catch(console.log);
}
}

async function daasCheck(project) {
if (project.dry_run === true) {
return;
Expand All @@ -71,11 +73,12 @@ export const syncProjectsFromDbToOrchestration = bfast.functions().onGetHttpRequ
console.log(e && e.response ? e.response.data : e.toString());
}
if (!(daasHealth && typeof daasHealth.message === "string")) {
projectFactory.deployProjectInCluster(project, [],!!project.dry_run)
projectFactory.deployProjectInCluster(project, [], !!project.dry_run)
.then(v => console.log('re-sync ' + project.projectId))
.catch(console.log);
}
}

for (const project of projects) {
const type = project.type.toString();
if (type === 'faas') {
Expand Down Expand Up @@ -182,10 +185,8 @@ export const getProjects = bfast.functions().onGetHttpRequest(`${prefix}`, [
const size = request.query.size ? parseInt(request.query.size) : 1000;
const skip = request.query.skip ? parseInt(request.query.skip) : 0;
projectFactory.getUserProjects(request.uid, size, skip).then((value) => {
// console.log(value);
response.json(value);
response.json(value.filter(x => x.dry_run === false));
}).catch((reason) => {
// console.log(reason);
response.status(400).send(reason);
});
}
Expand Down Expand Up @@ -226,7 +227,7 @@ export const patchProject = bfast.functions().onPutHttpRequest(
// },
(request, response) => {
const body = request.body;
if (body && Object.keys(body).length === 0){
if (body && Object.keys(body).length === 0) {
response.status(400).send({message: 'Input is empty'});
}
const projectId = request.params.projectId;
Expand Down

0 comments on commit 521eaac

Please sign in to comment.