Skip to content

Commit

Permalink
Add if statements where merge requests are run
Browse files Browse the repository at this point in the history
  • Loading branch information
ammuradyan committed Oct 20, 2023
1 parent 95487cf commit 871affc
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 16 deletions.
15 changes: 10 additions & 5 deletions board/frontend/lib/api/gitlab.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import {get} from 'svelte/store';
import {settings} from "../store.js";

const GITLAB_API_URL = import.meta.env.VITE_GITLAB_API_URL;
const GITLAB_API_TOKEN = import.meta.env.VITE_GITLAB_API_TOKEN;

Expand Down Expand Up @@ -76,6 +79,7 @@ export const getAllProjectsIssues = async (projectIds) => {
};

export const getProjectIssues = async (projectId) => {
const storeSettings = get(settings);
const perPage = 100;
const issues = [];
let page = 1;
Expand All @@ -90,12 +94,13 @@ export const getProjectIssues = async (projectId) => {
}
});
data = await res.json();
/*
for (const i of data) {
const mrs = await getProjectIssueMergeRequests(projectId, i.iid);
i.merge_requests = mrs;

if (storeSettings.general.mergeRequests) {
for (const i of data) {
const mrs = await getProjectIssueMergeRequests(projectId, i.iid);
i.merge_requests = mrs;
}
}
*/
issues.push(...data);
} catch {
}
Expand Down
21 changes: 11 additions & 10 deletions board/frontend/lib/components/board/UserBoard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
import IssuesColumn from "./IssuesColumn.svelte";
import IssuesRow from "./IssuesRow.svelte";
import {beforeUpdate, afterUpdate} from "svelte";
import { issues, activeProjectFilter, teamprojects, displaymode, teams } from "../../store";
import { getLabelNameById } from "../utils/labels";
import { getTeamColumns } from "../utils/columns";
import { getMemberAvatar } from "../utils/member";
import {settings, issues, activeProjectFilter, teamprojects, displaymode, teams} from "../../store";
import {getLabelNameById} from "../utils/labels";
import {getTeamColumns} from "../utils/columns";
import {getMemberAvatar} from "../utils/member";
export let member;
let isOpen = false;
Expand Down Expand Up @@ -41,12 +41,13 @@
if (i.assignee && i.assignee.id == member.id && col.gitlab_label_ids.filter(x => i.labels.includes(getLabelNameById(x))).length > 0) {
return i;
}
/*
// Issues by merge requests
if (i.merge_requests.filter(mr => member.id && mr.assignee && mr.assignee.id == member.id).length > 0 && col.gitlab_label_ids.filter(x => i.labels.includes(getLabelNameById(x))).length > 0) {
return i;
if ($settings.general.mergeRequests) {
// Issues by merge requests
if (i.merge_requests.filter(mr => member.id && mr.assignee && mr.assignee.id == member.id).length > 0 && col.gitlab_label_ids.filter(x => i.labels.includes(getLabelNameById(x))).length > 0) {
return i;
}
}
*/
}
});
}
Expand Down Expand Up @@ -121,7 +122,7 @@
margin: 0;
}
.assignee-wrap:hover .assignee-name{
.assignee-wrap:hover .assignee-name {
text-decoration: underline;
}
Expand Down
8 changes: 7 additions & 1 deletion board/frontend/lib/components/pages/Home.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script>
import { onMount } from "svelte";
import {
settings,
projects,
teamprojects,
members,
Expand Down Expand Up @@ -96,7 +97,12 @@
$members = await getAllProjectsMembers($projects.map(({id}) => id));
$members = [...$members, {name: "No Assignee", id: null}].sort((a, b) => a.name.localeCompare(b.name));
$loadingBoardInfo = "Fetching issues and pull requests...";
if ($settings.general.mergeRequests) {
$loadingBoardInfo = "Fetching issues and pull requests...";
} else {
$loadingBoardInfo = "Fetching issues and pull requests...";
}
$issues = await getAllProjectsIssues($projects.map(({id}) => id));
showLoading = false;
});
Expand Down

0 comments on commit 871affc

Please sign in to comment.