taskchef 7.15.0 → 7.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/src/dashboard/app.js
CHANGED
|
@@ -61,13 +61,19 @@ const elements = {
|
|
|
61
61
|
};
|
|
62
62
|
let notificationDescriptionSerial = 0;
|
|
63
63
|
|
|
64
|
-
function referenceLink(link, { compact = false } = {}) {
|
|
64
|
+
function referenceLink(link, { compact = false, typePrefix = false } = {}) {
|
|
65
65
|
const anchor = document.createElement("a");
|
|
66
66
|
anchor.className = compact ? "github-link github-link-compact" : "github-link";
|
|
67
67
|
anchor.href = link.url;
|
|
68
68
|
anchor.target = "_blank";
|
|
69
69
|
anchor.rel = "noopener noreferrer";
|
|
70
|
-
|
|
70
|
+
const label = link.label ?? link.text;
|
|
71
|
+
const visibleLabel = typePrefix && link.type === "pull"
|
|
72
|
+
? `PR ${label}`
|
|
73
|
+
: typePrefix && link.type === "issue"
|
|
74
|
+
? `Issue ${label}`
|
|
75
|
+
: label;
|
|
76
|
+
anchor.textContent = visibleLabel;
|
|
71
77
|
const githubKind = link.type === "issue"
|
|
72
78
|
? ", GitHub issue"
|
|
73
79
|
: link.type === "pull"
|
|
@@ -75,7 +81,7 @@ function referenceLink(link, { compact = false } = {}) {
|
|
|
75
81
|
: link.provider === "github" || link.owner ? " on GitHub" : "";
|
|
76
82
|
anchor.setAttribute(
|
|
77
83
|
"aria-label",
|
|
78
|
-
`${
|
|
84
|
+
`${visibleLabel}${githubKind} (opens in a new tab)`,
|
|
79
85
|
);
|
|
80
86
|
anchor.addEventListener("click", (event) => event.stopPropagation());
|
|
81
87
|
return anchor;
|
|
@@ -87,7 +93,7 @@ function appendLinkedText(container, text, task) {
|
|
|
87
93
|
taskRepository: task.relatedGitHubRepository,
|
|
88
94
|
}).map((segment) => {
|
|
89
95
|
if (segment.kind === "text") return document.createTextNode(segment.text);
|
|
90
|
-
if (segment.kind === "link") return referenceLink(segment);
|
|
96
|
+
if (segment.kind === "link") return referenceLink(segment, { typePrefix: true });
|
|
91
97
|
const ambiguous = document.createElement("span");
|
|
92
98
|
ambiguous.className = "github-reference-ambiguous";
|
|
93
99
|
ambiguous.textContent = segment.text;
|
|
@@ -100,7 +106,12 @@ function appendLinkedText(container, text, task) {
|
|
|
100
106
|
}
|
|
101
107
|
|
|
102
108
|
function relatedGitHubLinks(task, { compact = false } = {}) {
|
|
103
|
-
const
|
|
109
|
+
const seen = new Set();
|
|
110
|
+
const links = (task.relatedGitHubLinks ?? []).filter((link) => {
|
|
111
|
+
if (link.type === "repository" || seen.has(link.label)) return false;
|
|
112
|
+
seen.add(link.label);
|
|
113
|
+
return true;
|
|
114
|
+
});
|
|
104
115
|
const container = document.createElement("nav");
|
|
105
116
|
container.className = `github-links${compact ? " github-links-compact" : ""}`;
|
|
106
117
|
container.setAttribute("aria-label", `Related GitHub links for ${task.title}`);
|
|
@@ -118,6 +129,26 @@ function relatedGitHubLinks(task, { compact = false } = {}) {
|
|
|
118
129
|
return container;
|
|
119
130
|
}
|
|
120
131
|
|
|
132
|
+
function renderProject(container, task) {
|
|
133
|
+
const children = [document.createTextNode(task.project.name)];
|
|
134
|
+
const repository = task.relatedGitHubRepository;
|
|
135
|
+
if (repository) {
|
|
136
|
+
const [owner, repositoryName] = repository.split("/");
|
|
137
|
+
children.push(
|
|
138
|
+
document.createTextNode(" "),
|
|
139
|
+
referenceLink({
|
|
140
|
+
label: repository,
|
|
141
|
+
owner,
|
|
142
|
+
provider: "github",
|
|
143
|
+
repository: repositoryName,
|
|
144
|
+
type: "repository",
|
|
145
|
+
url: `https://github.com/${repository}`,
|
|
146
|
+
}),
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
container.replaceChildren(...children);
|
|
150
|
+
}
|
|
151
|
+
|
|
121
152
|
function timestampControl(value, { accessibleName, key, prefix = "" }) {
|
|
122
153
|
if (!parsedTimestamp(value)) {
|
|
123
154
|
const missing = document.createElement("span");
|
|
@@ -340,7 +371,7 @@ function renderDialog(task) {
|
|
|
340
371
|
results: task.results ?? preservedResults ?? [],
|
|
341
372
|
};
|
|
342
373
|
state.selectedTask = detailedTask;
|
|
343
|
-
elements.dialogProject
|
|
374
|
+
renderProject(elements.dialogProject, task);
|
|
344
375
|
elements.dialogTitle.textContent = task.title;
|
|
345
376
|
elements.dialogRelatedLinks.replaceChildren(...relatedGitHubLinks(detailedTask).children);
|
|
346
377
|
elements.dialogRelatedLinks.setAttribute(
|
|
@@ -421,7 +452,7 @@ function taskCard(task) {
|
|
|
421
452
|
heading.append(title, badge);
|
|
422
453
|
const project = document.createElement("p");
|
|
423
454
|
project.className = "task-project";
|
|
424
|
-
project
|
|
455
|
+
renderProject(project, task);
|
|
425
456
|
const summary = document.createElement("p");
|
|
426
457
|
summary.className = "task-summary";
|
|
427
458
|
const latest = latestTurnPresentation(task);
|
|
@@ -323,7 +323,8 @@ export function taskGitHubProjection(task) {
|
|
|
323
323
|
taskRepository,
|
|
324
324
|
})) {
|
|
325
325
|
if (segment.kind !== "link") continue;
|
|
326
|
-
|
|
326
|
+
if (segment.type === "repository") continue;
|
|
327
|
+
const key = relatedLinkLabel(segment);
|
|
327
328
|
if (seen.has(key)) continue;
|
|
328
329
|
if (links.length === MAX_RELATED_GITHUB_LINKS) {
|
|
329
330
|
truncated = true;
|