Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Commit

Permalink
Fix formatting of databases in v4
Browse files Browse the repository at this point in the history
  • Loading branch information
bartvanb committed Oct 16, 2023
1 parent 308baa3 commit 855c59e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
3 changes: 2 additions & 1 deletion src/app/components/edit/task-create/task-create.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,8 @@ export class TaskCreateComponent extends BaseEditComponent implements OnInit {
this.modalService.openMessageModal([
'The task has been created!',
'Note that you do not have permissions to view if all required ' +
'nodes are online. If they are not, the task will not complete.',
'nodes are online. If they are not, the task will probably not ' +
'be completed.',
]);
return;
}
Expand Down
4 changes: 2 additions & 2 deletions src/app/components/view/task-view/task-view.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ export class TaskViewComponent
}

getDatabaseNames(): string {
let databases = this.task.databases ? this.task.databases : ['default'];
return databases.join(', ');
let databases = this.task.databases ? this.task.databases : [{'label': 'default'}];
return databases.map(db => db.label).join(', ');
}

getRunPanelTitle(run: Run): string {
Expand Down
2 changes: 1 addition & 1 deletion src/app/interfaces/task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export interface Task {
job_id: number;
parent_id: number | null;
parent?: Task;
databases: string[];
databases: any[];
initiator_id: number;
init_org?: Organization;
init_user_id: number;
Expand Down
16 changes: 10 additions & 6 deletions src/app/services/api/task-api.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,26 @@ export class TaskApiService extends BaseApiService {
});
}

let databases: string[] = task.databases;
if (!databases) {
databases = ['default'];
let databases: any[] = task.databases;
let formatted_databases = [];
if (databases.length === 0) {
formatted_databases = [{'label': 'default'}];
} else {
// delete any empty strings
databases = databases.filter((db) => db);
for (let db of databases) {
if (db !== '')
formatted_databases.push({'label': db});
}
}


// TODO add encryption option
let data: any = {
name: task.name,
description: task.description,
image: task.image,
organizations: org_input,
collaboration_id: collab_id,
databases: databases,
databases: formatted_databases,
};
return data;
}
Expand Down

0 comments on commit 855c59e

Please sign in to comment.