Remove hardcoded repository URL

This commit is contained in:
Yuri Sizov
2023-03-23 15:22:20 +01:00
parent 34a9de511a
commit 197b89ef70
4 changed files with 17 additions and 9 deletions

View File

@@ -195,7 +195,7 @@ export default class FileList extends LitElement {
@iconclick="${this._onItemIconClicked.bind(this, item.type, item.path, item.pulls)}" @iconclick="${this._onItemIconClicked.bind(this, item.type, item.path, item.pulls)}"
></gr-file-item> ></gr-file-item>
${(this.selectedFolders.includes(item.path)) ? ${(this.selectedFolders.includes(item.path)) ?
this.renderFolder(branchFiles, branchFiles[item.path] || []) : null this.renderFolder(branchFiles, branchFiles[item.path] || []) : null
} }
</div> </div>

View File

@@ -121,13 +121,17 @@ export default class PullRequestItem extends LitElement {
@property({ type: String, reflect: true }) url = ''; @property({ type: String, reflect: true }) url = '';
@property({ type: String, reflect: true }) diff_url = ''; @property({ type: String, reflect: true }) diff_url = '';
@property({ type: String, reflect: true }) patch_url = ''; @property({ type: String, reflect: true }) patch_url = '';
@property({ type: Boolean }) draft = false; @property({ type: Boolean }) draft = false;
@property({ type: String, reflect: true }) milestone = ''; @property({ type: String, reflect: true }) milestone = '';
@property({ type: String, reflect: true }) branch = ''; @property({ type: String, reflect: true }) branch = '';
@property({ type: String }) created_at = ''; @property({ type: String }) created_at = '';
@property({ type: String }) updated_at = ''; @property({ type: String }) updated_at = '';
@property({ type: Object }) author = null; @property({ type: Object }) author = null;
@property({ type: String }) repository = '';
render(){ render(){
const authorClassList = [ "pr-author-value" ]; const authorClassList = [ "pr-author-value" ];
if (this.author.pull_count > 40) { if (this.author.pull_count > 40) {
@@ -175,7 +179,7 @@ export default class PullRequestItem extends LitElement {
<span>author: </span> <span>author: </span>
<a <a
class="${authorClassList.join(" ")}" class="${authorClassList.join(" ")}"
href="https://github.com/godotengine/godot/pulls/${this.author.user}" href="https://github.com/${this.repository}/pulls/${this.author.user}"
target="_blank" target="_blank"
title="Open ${this.author.pull_count} ${(this.author.pull_count > 1) ? 'PRs' : 'PR'} by ${this.author.user}" title="Open ${this.author.pull_count} ${(this.author.pull_count > 1) ? 'PRs' : 'PR'} by ${this.author.user}"
> >
@@ -227,4 +231,4 @@ export default class PullRequestItem extends LitElement {
</div> </div>
`; `;
} }
} }

View File

@@ -106,7 +106,8 @@ export default class PullRequestList extends LitElement {
@property({ type: Array }) pulls = []; @property({ type: Array }) pulls = [];
@property({ type: Object }) authors = {}; @property({ type: Object }) authors = {};
@property({ type: String }) selectedRepository = "";
@property({ type: String }) selectedBranch = ""; @property({ type: String }) selectedBranch = "";
@property({ type: String }) selectedPath = ""; @property({ type: String }) selectedPath = "";
@property({ type: Array }) selectedPulls = []; @property({ type: Array }) selectedPulls = [];
@@ -132,7 +133,7 @@ export default class PullRequestList extends LitElement {
const total_pulls = this.pulls.length; const total_pulls = this.pulls.length;
let filtered_pulls = pulls.length let filtered_pulls = pulls.length
const has_pinned = (this.filteredPull !== ""); const has_pinned = (this.filteredPull !== "");
if (has_pinned) { if (has_pinned) {
filtered_pulls -= 1; filtered_pulls -= 1;
@@ -166,6 +167,7 @@ export default class PullRequestList extends LitElement {
.diff_url="${item.diff_url}" .diff_url="${item.diff_url}"
.patch_url="${item.patch_url}" .patch_url="${item.patch_url}"
.repository="${this.selectedRepository}"
/> />
`; `;
})} })}
@@ -211,10 +213,11 @@ export default class PullRequestList extends LitElement {
.diff_url="${item.diff_url}" .diff_url="${item.diff_url}"
.patch_url="${item.patch_url}" .patch_url="${item.patch_url}"
.repository="${this.selectedRepository}"
/> />
`; `;
})} })}
</div> </div>
`; `;
} }
} }

View File

@@ -128,7 +128,7 @@ export default class EntryComponent extends LitElement {
if (typeof branchFiles[file.parent] === "undefined") { if (typeof branchFiles[file.parent] === "undefined") {
branchFiles[file.parent] = []; branchFiles[file.parent] = [];
} }
branchFiles[file.parent].push(file); branchFiles[file.parent].push(file);
} }
}); });
@@ -141,10 +141,10 @@ export default class EntryComponent extends LitElement {
if (b.type === "folder" && a.type !== "folder") { if (b.type === "folder" && a.type !== "folder") {
return 1; return 1;
} }
const a_name = a.path.toLowerCase(); const a_name = a.path.toLowerCase();
const b_name = b.path.toLowerCase(); const b_name = b.path.toLowerCase();
if (a_name > b_name) return 1; if (a_name > b_name) return 1;
if (a_name < b_name) return -1; if (a_name < b_name) return -1;
return 0; return 0;
@@ -242,6 +242,7 @@ export default class EntryComponent extends LitElement {
<gr-pull-list <gr-pull-list
.pulls="${this._pulls}" .pulls="${this._pulls}"
.authors="${this._authors}" .authors="${this._authors}"
.selectedRepository="${this._selectedRepository}"
.selectedBranch="${this._selectedBranch}" .selectedBranch="${this._selectedBranch}"
.selectedPath="${this._selectedPath}" .selectedPath="${this._selectedPath}"
.selectedPulls="${this._selectedPathPulls}" .selectedPulls="${this._selectedPathPulls}"