Skip to content
This repository has been archived by the owner on Jul 6, 2023. It is now read-only.

Commit

Permalink
fix: display project group the first time correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmadalfy committed Jan 19, 2020
1 parent 5df7df2 commit fbe916d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions scripts/projects.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ class Projects extends Base {
drawListing(projects) {
const projectsTemplates = [];
for (const project of projects) {
const group = this.dataService.data.groups.find(group => group.id === project.namespace.id);
projectsTemplates.push(html`
<tr>
<td class="listing__avatar"><img src="${project.avatar_url || './images/project.svg'}" alt="${project.name}" /></td>
<td>${project.name}</td>
<td>${project.group.name}</td>
<td>${group ? group.name : '-'}</td>
<td>${timeAgo.format(Date.parse(project.last_activity_at))}</td>
<td class="listing__actions">
<button @click=${()=> {this.showMembers(project.id)}}>Members</button>
Expand Down Expand Up @@ -53,10 +54,10 @@ class Projects extends Base {
}

checkData() {
db.projects.with({ group: 'group_id'}).then(content => {
this.drawListing(content);
this.dataService.data[this.component] = content;
document.querySelector(`#${this.component}-count`).innerHTML = content.length;
db.projects.with({ group: 'group_id'}).then(projects => {
this.drawListing(projects);
this.dataService.data.projects = projects;
document.querySelector('#projects-count').innerHTML = projects.length;
});
}
}
Expand Down

0 comments on commit fbe916d

Please sign in to comment.