Update
This commit is contained in:
@@ -14,11 +14,22 @@
|
||||
font-display: swap;
|
||||
}
|
||||
|
||||
.obyte-qa-tool-shell,
|
||||
.obyte-qa-tool,
|
||||
.obyte-qa-tool * {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.obyte-qa-tool-shell {
|
||||
width: 100vw;
|
||||
max-width: 100vw;
|
||||
margin-left: calc(50% - 50vw);
|
||||
margin-right: calc(50% - 50vw);
|
||||
padding: 0 clamp(16px, 3vw, 34px);
|
||||
overflow-x: clip;
|
||||
background: #f5fbfe;
|
||||
}
|
||||
|
||||
.obyte-qa-tool {
|
||||
--oqt-blue: #00a7e6;
|
||||
--oqt-blue-soft: #33b9eb;
|
||||
@@ -36,8 +47,9 @@
|
||||
--oqt-danger: #c43b3b;
|
||||
--oqt-muted: #67717a;
|
||||
--oqt-focus: 0 0 0 3px rgba(0, 167, 230, 0.28);
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
width: min(1240px, 100%);
|
||||
max-width: 100%;
|
||||
margin: 0 auto;
|
||||
overflow: visible;
|
||||
border: 1px solid var(--oqt-line);
|
||||
border-radius: 8px;
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
this.root = root;
|
||||
this.template = null;
|
||||
this.dragIndex = -1;
|
||||
this.gitlabTemplatePath = "";
|
||||
this.gitlabTemplateModule = "";
|
||||
this.storageKey = "obyteQaToolState:" + window.location.pathname;
|
||||
this.els = this.collectElements();
|
||||
this.init();
|
||||
@@ -128,11 +130,15 @@
|
||||
self.loadGitlabTemplate(event.target.value);
|
||||
});
|
||||
|
||||
bind(this.els.addStep, "click", function () {
|
||||
bind(this.els.addStep, "click", function (event) {
|
||||
event.preventDefault();
|
||||
event.stopImmediatePropagation();
|
||||
self.addStep();
|
||||
});
|
||||
|
||||
bind(this.els.addGroup, "click", function () {
|
||||
bind(this.els.addGroup, "click", function (event) {
|
||||
event.preventDefault();
|
||||
event.stopImmediatePropagation();
|
||||
self.addGroup();
|
||||
});
|
||||
|
||||
@@ -274,13 +280,15 @@
|
||||
|
||||
QaTool.prototype.loadGitlabTemplate = async function (path) {
|
||||
if (!path) {
|
||||
this.gitlabTemplatePath = "";
|
||||
this.gitlabTemplateModule = "";
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
this.setTag(this.els.gitlabTplStatus, "GitLab: lade Datei", "");
|
||||
var data = await this.api("template?path=" + encodeURIComponent(path));
|
||||
this.loadTemplateText(data.content || "", path.split("/").pop());
|
||||
this.loadTemplateText(data.content || "", path.split("/").pop(), data.path || path);
|
||||
this.setTag(this.els.gitlabTplStatus, "GitLab: geladen", "ok");
|
||||
} catch (error) {
|
||||
this.setTag(this.els.gitlabTplStatus, "GitLab: Fehler", "bad");
|
||||
@@ -305,10 +313,12 @@
|
||||
}
|
||||
};
|
||||
|
||||
QaTool.prototype.loadTemplateText = function (text, fallbackName) {
|
||||
QaTool.prototype.loadTemplateText = function (text, fallbackName, sourcePath) {
|
||||
var parsed = parseTemplateText(text);
|
||||
var normalized = normalizeTemplate(parsed, fallbackName || "Template");
|
||||
this.template = normalized;
|
||||
this.gitlabTemplatePath = sourcePath || "";
|
||||
this.gitlabTemplateModule = sourcePath ? (normalized.module || "") : "";
|
||||
|
||||
if (this.els.tplName) {
|
||||
this.els.tplName.textContent = normalized.name || fallbackName || "Template";
|
||||
@@ -440,7 +450,9 @@
|
||||
return;
|
||||
}
|
||||
|
||||
var rows = Array.prototype.slice.call(this.els.stepsTableBody.querySelectorAll("tr"));
|
||||
var rows = Array.prototype.slice.call(this.els.stepsTableBody.querySelectorAll("tr")).filter(function (row) {
|
||||
return !row.classList.contains("oqt-empty-row");
|
||||
});
|
||||
this.template.steps = rows.map(function (row, index) {
|
||||
var kind = row.dataset.kind || "step";
|
||||
if (kind === "group") {
|
||||
@@ -474,6 +486,8 @@
|
||||
pbx_version: config.defaultPbxVersion || "",
|
||||
steps: []
|
||||
};
|
||||
this.gitlabTemplatePath = "";
|
||||
this.gitlabTemplateModule = "";
|
||||
if (this.els.tplName) {
|
||||
this.els.tplName.textContent = this.template.name;
|
||||
}
|
||||
@@ -481,8 +495,11 @@
|
||||
};
|
||||
|
||||
QaTool.prototype.addStep = function () {
|
||||
var hadTemplate = !!this.template;
|
||||
this.ensureTemplate();
|
||||
this.captureEditsIntoTemplate();
|
||||
if (hadTemplate) {
|
||||
this.captureEditsIntoTemplate();
|
||||
}
|
||||
this.template.steps.push({
|
||||
kind: "step",
|
||||
id: "",
|
||||
@@ -499,8 +516,11 @@
|
||||
};
|
||||
|
||||
QaTool.prototype.addGroup = function () {
|
||||
var hadTemplate = !!this.template;
|
||||
this.ensureTemplate();
|
||||
this.captureEditsIntoTemplate();
|
||||
if (hadTemplate) {
|
||||
this.captureEditsIntoTemplate();
|
||||
}
|
||||
this.template.steps.push({
|
||||
kind: "group",
|
||||
title: "Neue Gruppe",
|
||||
@@ -882,6 +902,8 @@
|
||||
pbx_version: run.pbx_version || "",
|
||||
steps: run.steps
|
||||
}, file.name);
|
||||
this.gitlabTemplatePath = "";
|
||||
this.gitlabTemplateModule = "";
|
||||
|
||||
if (this.els.tplName) {
|
||||
this.els.tplName.textContent = run.name || file.name;
|
||||
@@ -1251,8 +1273,8 @@
|
||||
if (data.report_id) {
|
||||
parts.push("Report-ID: " + data.report_id);
|
||||
}
|
||||
if (data.pdf_url) {
|
||||
parts.push('<a href="' + escAttr(data.pdf_url) + '" target="_blank" rel="noopener">PDF in Mediathek öffnen</a>');
|
||||
if (data.pdf_stored) {
|
||||
parts.push("PDF geschuetzt gespeichert");
|
||||
}
|
||||
if (data.docbee && data.docbee.ok) {
|
||||
var docbeeLink = data.docbee.url ? ' <a href="' + escAttr(data.docbee.url) + '" target="_blank" rel="noopener">DocBee öffnen</a>' : "";
|
||||
@@ -1295,11 +1317,16 @@
|
||||
button.classList.add("is-busy");
|
||||
}
|
||||
this.showMessage("GitLab: Template wird geschrieben...", "");
|
||||
var sourcePath = this.gitlabTemplatePath && sameModuleName(template.module, this.gitlabTemplateModule)
|
||||
? this.gitlabTemplatePath
|
||||
: "";
|
||||
var data = await this.api("gitlab/template", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ template: template, yaml: yaml })
|
||||
body: JSON.stringify({ template: template, yaml: yaml, source_path: sourcePath })
|
||||
});
|
||||
this.gitlabTemplatePath = data.path || sourcePath || "";
|
||||
this.gitlabTemplateModule = template.module || "";
|
||||
this.showMessage("GitLab: Template gespeichert: " + (data.path || ""), "ok");
|
||||
} catch (error) {
|
||||
this.showMessage("GitLab-Push fehlgeschlagen: " + error.message, "bad");
|
||||
@@ -1800,6 +1827,10 @@
|
||||
.replace(/[^\w.-]/g, "") || "qa";
|
||||
}
|
||||
|
||||
function sameModuleName(left, right) {
|
||||
return String(left || "").trim() === String(right || "").trim();
|
||||
}
|
||||
|
||||
function mdCell(valueToEscape) {
|
||||
return String(valueToEscape || "").replace(/\|/g, "\\|").replace(/\n/g, " ");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user