From e12f1839680f7e47f9ed358bc390e31a1b39d8fb Mon Sep 17 00:00:00 2001 From: guillermo Date: Tue, 31 Jan 2023 13:46:42 +0100 Subject: [PATCH 1/3] refs #4975 Added chat/send in mdbVersion/upload --- modules/mdb/back/methods/mdbVersion/upload.js | 50 +++++++++++++++++-- modules/mdb/back/model-config.json | 3 ++ modules/mdb/back/models/mdbConfig.json | 24 +++++++++ modules/mdb/back/models/mdbVersionTree.json | 3 ++ 4 files changed, 77 insertions(+), 3 deletions(-) create mode 100644 modules/mdb/back/models/mdbConfig.json diff --git a/modules/mdb/back/methods/mdbVersion/upload.js b/modules/mdb/back/methods/mdbVersion/upload.js index 1df4365a9..decbe82db 100644 --- a/modules/mdb/back/methods/mdbVersion/upload.js +++ b/modules/mdb/back/methods/mdbVersion/upload.js @@ -26,6 +26,11 @@ module.exports = Self => { type: 'string', required: true, description: `The old version number` + }, { + arg: 'description', + type: 'string', + required: false, + description: `The description of changes` }, { arg: 'unlock', type: 'boolean', @@ -42,8 +47,7 @@ module.exports = Self => { verb: 'POST' } }); - - Self.upload = async(ctx, appName, toVersion, branch, fromVersion, unlock, options) => { + Self.upload = async(ctx, options) => { const models = Self.app.models; const myOptions = {}; const $t = ctx.req.__; // $translate @@ -51,6 +55,12 @@ module.exports = Self => { const AccessContainer = models.AccessContainer; const fileOptions = {}; let tx; + const appName = ctx.args.appName; + const toVersion = ctx.args.toVersion; + const branch = ctx.args.branch; + const fromVersion = ctx.args.fromVersion; + let description = ctx.args.description; + const unlock = ctx.args.unlock; if (typeof options == 'object') Object.assign(myOptions, options); @@ -132,13 +142,47 @@ module.exports = Self => { await fs.symlink(rootRelative, destinationRoot); } } + if (description) { + let formatDesc; + const mainBranches = new Set(['master', 'test', 'dev']); + if (mainBranches.has(branch)) + formatDesc = `> :branch_${branch}: `; + else + formatDesc = `> :branch: `; + formatDesc += `*${appName.toUpperCase()}* v.${toVersion} `; + + let fromBranch = await models.MdbVersionTree.find({ + where: {version: fromVersion}, + fields: ['branchFk'] + }); + fromBranch = fromBranch[0].branchFk; + + if (branch == fromBranch) + formatDesc += `[*${branch}*]: `; + else + formatDesc += `[*${fromBranch}* » *${branch}*]: `; + + const params = await models.MdbConfig.find({}); + const issueTrackerUrl = params[0].issueTrackerUrl; + const issueNumberRegex = params[0].issueNumberRegex; + const chatDestination = params[0].chatDestination; + + const regex = new RegExp(issueNumberRegex, 'g'); + formatDesc += description.replace(regex, (match, issueId) => { + const newUrl = issueTrackerUrl.replace('{index}', issueId); + return `[#${issueId}](${newUrl})`; + }); + + await models.Chat.send(ctx, chatDestination, formatDesc, myOptions); + } await models.MdbVersionTree.create({ app: appName, version: toVersion, branchFk: branch, fromVersion, - userFk: userId + userFk: userId, + description, }, myOptions); await models.MdbVersion.upsert({ diff --git a/modules/mdb/back/model-config.json b/modules/mdb/back/model-config.json index 8010afca2..b59a4fda0 100644 --- a/modules/mdb/back/model-config.json +++ b/modules/mdb/back/model-config.json @@ -11,6 +11,9 @@ "MdbVersionTree": { "dataSource": "vn" }, + "MdbConfig": { + "dataSource": "vn" + }, "AccessContainer": { "dataSource": "accessStorage" } diff --git a/modules/mdb/back/models/mdbConfig.json b/modules/mdb/back/models/mdbConfig.json new file mode 100644 index 000000000..60634104a --- /dev/null +++ b/modules/mdb/back/models/mdbConfig.json @@ -0,0 +1,24 @@ +{ + "name": "MdbConfig", + "base": "VnModel", + "options": { + "mysql": { + "table": "mdbConfig" + } + }, + "properties": { + "id": { + "type": "string", + "id": true + }, + "issueTrackerUrl": { + "type": "string" + }, + "issueNumberRegex": { + "type": "string" + }, + "chatDestination": { + "type": "string" + } + } +} \ No newline at end of file diff --git a/modules/mdb/back/models/mdbVersionTree.json b/modules/mdb/back/models/mdbVersionTree.json index 8c0260e54..106473b64 100644 --- a/modules/mdb/back/models/mdbVersionTree.json +++ b/modules/mdb/back/models/mdbVersionTree.json @@ -23,6 +23,9 @@ }, "userFk": { "type": "number" + }, + "description": { + "type": "string" } }, "relations": { From 18168b07bbf8b4b17dc45b8ed4dab826aaff493a Mon Sep 17 00:00:00 2001 From: guillermo Date: Tue, 31 Jan 2023 14:47:24 +0100 Subject: [PATCH 2/3] refs #4975 Changes --- modules/mdb/back/methods/mdbVersion/upload.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/modules/mdb/back/methods/mdbVersion/upload.js b/modules/mdb/back/methods/mdbVersion/upload.js index decbe82db..864a73f52 100644 --- a/modules/mdb/back/methods/mdbVersion/upload.js +++ b/modules/mdb/back/methods/mdbVersion/upload.js @@ -152,21 +152,20 @@ module.exports = Self => { formatDesc += `*${appName.toUpperCase()}* v.${toVersion} `; - let fromBranch = await models.MdbVersionTree.find({ + const oldVersion = await models.MdbVersionTree.findOne({ where: {version: fromVersion}, fields: ['branchFk'] - }); - fromBranch = fromBranch[0].branchFk; + }, myOptions); - if (branch == fromBranch) + if (branch == oldVersion.branchFk) formatDesc += `[*${branch}*]: `; else - formatDesc += `[*${fromBranch}* » *${branch}*]: `; + formatDesc += `[*${oldVersion.branchFk}* » *${branch}*]: `; - const params = await models.MdbConfig.find({}); - const issueTrackerUrl = params[0].issueTrackerUrl; - const issueNumberRegex = params[0].issueNumberRegex; - const chatDestination = params[0].chatDestination; + const params = await models.MdbConfig.findOne(myOptions); + const issueTrackerUrl = params.issueTrackerUrl; + const issueNumberRegex = params.issueNumberRegex; + const chatDestination = params.chatDestination; const regex = new RegExp(issueNumberRegex, 'g'); formatDesc += description.replace(regex, (match, issueId) => { From 2ef7b0d756bce0571572017af1aea3cbe1704673 Mon Sep 17 00:00:00 2001 From: alexandre Date: Wed, 1 Feb 2023 08:48:33 +0100 Subject: [PATCH 3/3] refs #5157 clip-path deleted --- front/core/components/field/style.scss | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/front/core/components/field/style.scss b/front/core/components/field/style.scss index 9012b8c4c..0d539b029 100644 --- a/front/core/components/field/style.scss +++ b/front/core/components/field/style.scss @@ -82,8 +82,6 @@ } &[type=time], &[type=date] { - clip-path: inset(0 20px 0 0); - &::-webkit-inner-spin-button, &::-webkit-clear-button { display: none; @@ -99,7 +97,7 @@ } &[type=number] { -moz-appearance: textfield; - + &::-webkit-outer-spin-button, &::-webkit-inner-spin-button { -webkit-appearance: none;