mirror of
https://github.com/bakhirev/assayo.git
synced 2025-09-01 10:09:39 +00:00
update
This commit is contained in:
parent
7602bcef4d
commit
38a4c872b0
18 changed files with 117 additions and 80 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -95,6 +95,11 @@
|
|||
|
||||
&_button {
|
||||
color: var(--color-temp-title);
|
||||
background-color: var(--color-temp-bg);
|
||||
|
||||
&:hover {
|
||||
background-color: var(--color-temp-bg);
|
||||
}
|
||||
}
|
||||
|
||||
background-color: var(--color-temp-bg);
|
||||
|
|
|
@ -13,6 +13,7 @@ const MASTER_BRANCH = {
|
|||
master: true,
|
||||
dev: true,
|
||||
develop: true,
|
||||
release: true,
|
||||
};
|
||||
|
||||
let prevDate = new Date();
|
||||
|
@ -105,6 +106,7 @@ export default function getCommitInfo(logString: string): ICommit | ISystemCommi
|
|||
commitType = COMMIT_TYPE.PR_GITHUB;
|
||||
[prId, repository, branch, toBranch] = getGithubPrInfo(message);
|
||||
task = getTask(branch);
|
||||
[type] = getTypeAndScope(branch, task);
|
||||
|
||||
} else if (isBitbucketPR) { // "Pull request #3: TASK-123 fix: Add profile"
|
||||
commitType = COMMIT_TYPE.PR_BITBUCKET;
|
||||
|
@ -124,11 +126,15 @@ export default function getCommitInfo(logString: string): ICommit | ISystemCommi
|
|||
} else if (isGitlabPR) {
|
||||
commitType = COMMIT_TYPE.PR_GITLAB;
|
||||
[branch, toBranch] = getGitlabPrInfo(message);
|
||||
if (toBranch && MASTER_BRANCH[toBranch]) {
|
||||
task = getTask(branch);
|
||||
taskNumber = getTaskNumber(branch);
|
||||
const branchToParse = toBranch && MASTER_BRANCH[toBranch]
|
||||
? (branch || toBranch)
|
||||
: (toBranch || branch);
|
||||
if (branchToParse) {
|
||||
task = getTask(branchToParse);
|
||||
taskNumber = getTaskNumber(branchToParse);
|
||||
prId = `#${taskNumber}-${Math.random()}`;
|
||||
if (!task && taskNumber) task = `#${taskNumber}`;
|
||||
[type] = getTypeAndScope(branchToParse, task);
|
||||
}
|
||||
}
|
||||
taskNumber = getTaskNumber(task);
|
||||
|
|
|
@ -15,10 +15,9 @@ export function getGithubPrInfo(text: string) {
|
|||
}
|
||||
|
||||
/* "Merge branch 'J123456' into 'develop'" */
|
||||
/* "Merge branch 'J123456' into develop" */
|
||||
export function getGitlabPrInfo(text: string) {
|
||||
const prefix = text.substring(14, text.length - 1);
|
||||
const index = prefix.indexOf("'");
|
||||
const branch = prefix.substring(0, index);
|
||||
const toBranch = prefix.substring(index + 8);
|
||||
return [branch, toBranch];
|
||||
return text
|
||||
.replace(/(["'\r\n]+)|(Merge\sbranch\s)/gim, '')
|
||||
.split(' into ');
|
||||
}
|
||||
|
|
|
@ -18,57 +18,60 @@ const Header = observer((): React.ReactElement | null => {
|
|||
const { t, i18n } = useTranslation();
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
const options = [
|
||||
{ id: 'ru', title: 'RU' },
|
||||
{ id: 'en', title: 'EN' },
|
||||
{ id: 'zh', title: 'ZH' },
|
||||
{ id: 'es', title: 'ES' },
|
||||
{ id: 'fr', title: 'FR' },
|
||||
{ id: 'pt', title: 'PT' },
|
||||
{ id: 'de', title: 'DE' },
|
||||
{ id: 'ja', title: 'JA' },
|
||||
{ id: 'ko', title: 'KO' },
|
||||
];
|
||||
|
||||
return (
|
||||
<header className={style.header}>
|
||||
<Title/>
|
||||
{settingsForm.isEdited ? (
|
||||
<Buttons/>
|
||||
) : (
|
||||
<>
|
||||
<Filters/>
|
||||
<Select
|
||||
className={style.header_lang}
|
||||
value={localization.language}
|
||||
options={[
|
||||
{ id: 'ru', title: 'RU' },
|
||||
{ id: 'en', title: 'EN' },
|
||||
{ id: 'zh', title: 'ZH' },
|
||||
{ id: 'es', title: 'ES' },
|
||||
{ id: 'fr', title: 'FR' },
|
||||
{ id: 'pt', title: 'PT' },
|
||||
{ id: 'de', title: 'DE' },
|
||||
{ id: 'ja', title: 'JA' },
|
||||
{ id: 'ko', title: 'KO' },
|
||||
]}
|
||||
onChange={(item: any, id: string) => {
|
||||
localization.language = id;
|
||||
i18n.changeLanguage(id);
|
||||
if (id === BROWSER_LANGUAGE) {
|
||||
localStorage.removeItem('language');
|
||||
} else {
|
||||
localStorage.setItem('language', id);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<img
|
||||
title={t('sidebar.buttons.print')}
|
||||
className={style.header_print}
|
||||
src="./assets/menu/print.svg"
|
||||
onClick={() => {
|
||||
printStore.open(navigate, location.pathname);
|
||||
}}
|
||||
/>
|
||||
<img
|
||||
title={t('sidebar.buttons.settings')}
|
||||
className={style.header_setting}
|
||||
src="./assets/menu/setting.svg"
|
||||
onClick={() => {
|
||||
navigate('/settings');
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
<div className={style.header_wrapper}>
|
||||
<Title/>
|
||||
{settingsForm.isEdited ? (
|
||||
<Buttons/>
|
||||
) : (
|
||||
<>
|
||||
<Filters/>
|
||||
<Select
|
||||
className={style.header_lang}
|
||||
value={localization.language}
|
||||
options={options}
|
||||
onChange={(item: any, id: string) => {
|
||||
localization.language = id;
|
||||
i18n.changeLanguage(id);
|
||||
if (id === BROWSER_LANGUAGE) {
|
||||
localStorage.removeItem('language');
|
||||
} else {
|
||||
localStorage.setItem('language', id);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<img
|
||||
title={t('sidebar.buttons.print')}
|
||||
className={style.header_print}
|
||||
src="./assets/menu/print.svg"
|
||||
onClick={() => {
|
||||
printStore.open(navigate, location.pathname);
|
||||
}}
|
||||
/>
|
||||
<img
|
||||
title={t('sidebar.buttons.settings')}
|
||||
className={style.header_setting}
|
||||
src="./assets/menu/setting.svg"
|
||||
onClick={() => {
|
||||
navigate('/settings');
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</header>
|
||||
);
|
||||
});
|
||||
|
|
|
@ -3,11 +3,18 @@
|
|||
.header {
|
||||
grid-area: header;
|
||||
display: block;
|
||||
padding: 20px 34px 20px 24px;
|
||||
box-sizing: border-box;
|
||||
text-align: right;
|
||||
text-align: left;
|
||||
background-color: var(--color-white);
|
||||
|
||||
&_wrapper {
|
||||
display: block;
|
||||
width: calc(100vw - 258px);
|
||||
padding: 20px 47px 20px 24px;
|
||||
box-sizing: border-box;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
&_title {
|
||||
float: left;
|
||||
font-size: 24px;
|
||||
|
@ -56,6 +63,12 @@
|
|||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1000px) {
|
||||
.header_wrapper {
|
||||
width: calc(100vw - 78px);
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 700px) {
|
||||
.header {
|
||||
&_print,
|
||||
|
|
|
@ -14,23 +14,33 @@ function groupByType(prs: any[]) {
|
|||
}, {});
|
||||
}
|
||||
|
||||
function getTaskDescription(pr: any) {
|
||||
const message = pr.message.substring(pr.message.lastIndexOf(':') + 2)
|
||||
function getTaskDescription(pr: any, taskById: any) {
|
||||
let message = pr.message.substring(pr.message.lastIndexOf(':') + 2)
|
||||
.replace(pr.task, '')
|
||||
.trim();
|
||||
|
||||
const prefix = userSettings?.settings?.linksPrefix?.task || '/';
|
||||
const formattedTask = pr.task?.[0] === '#'
|
||||
const taskId = pr.task?.[0] === '#'
|
||||
? pr.task.replace('#', '')
|
||||
: pr.task;
|
||||
const task = taskById.get(taskId);
|
||||
const formattedTask = task?.task || taskId;
|
||||
message = message.indexOf('pull request') !== -1
|
||||
? (task?.comments || '')
|
||||
: message;
|
||||
if (!formattedTask && !message) return '';
|
||||
return `- [${formattedTask}](${prefix}${formattedTask}) ${message}`;
|
||||
}
|
||||
|
||||
function getReleaseDescription(prs: any) {
|
||||
function getReleaseDescription(prs: any, taskById: any) {
|
||||
const types = groupByType(prs);
|
||||
return Object.keys(types)
|
||||
.sort()
|
||||
.map((type: string) => {
|
||||
const tasks = types[type].map(getTaskDescription).join('\n');
|
||||
const tasks = types[type]
|
||||
.map((pr: any) => getTaskDescription(pr, taskById))
|
||||
.filter((v: string) => v)
|
||||
.join('\n');
|
||||
if (!type) return `\n${tasks}`;
|
||||
return `\n### ${type}\n${tasks}`;
|
||||
}).join('\n');
|
||||
|
@ -40,10 +50,11 @@ function getChangeLogString() {
|
|||
const rows = dataGripStore.dataGrip.release.statistic;
|
||||
const list = rows.map((release: any) => {
|
||||
const date = getDateForExcel(release.lastCommit.date);
|
||||
const prs = release.pr
|
||||
const prs = release.prIds
|
||||
.map((prId: string) => dataGripStore.dataGrip.pr.pr.get(prId))
|
||||
.filter((v: any) => v);
|
||||
const description = getReleaseDescription(prs);
|
||||
const taskById = dataGripStore.dataGrip.tasks.statisticByName;
|
||||
const description = getReleaseDescription(prs, taskById);
|
||||
return `
|
||||
## [${release.title}] - ${date}
|
||||
${description}`;
|
||||
|
|
|
@ -219,7 +219,7 @@ export default `
|
|||
§ page.team.extension.current.count: Number
|
||||
§ page.team.extension.removed.count: Number of removed
|
||||
§ page.team.extension.files: files
|
||||
§ page.team.release.download: Download
|
||||
§ page.team.release.download: CHANGELOG.md
|
||||
§ page.team.release.title: Release
|
||||
§ page.team.release.from: Created date
|
||||
§ page.team.release.to: Delivery date
|
||||
|
|
|
@ -221,7 +221,7 @@ export default `
|
|||
§ page.team.extension.current.count: Number
|
||||
§ page.team.extension.removed.count: Number of removed
|
||||
§ page.team.extension.files: files
|
||||
§ page.team.release.download: Download
|
||||
§ page.team.release.download: CHANGELOG.md
|
||||
§ page.team.release.title: Release
|
||||
§ page.team.release.from: Created date
|
||||
§ page.team.release.to: Delivery date
|
||||
|
|
|
@ -221,7 +221,7 @@ export default `
|
|||
§ page.team.extension.current.count: Number
|
||||
§ page.team.extension.removed.count: Number of removed
|
||||
§ page.team.extension.files: files
|
||||
§ page.team.release.download: Download
|
||||
§ page.team.release.download: CHANGELOG.md
|
||||
§ page.team.release.title: Release
|
||||
§ page.team.release.from: Created date
|
||||
§ page.team.release.to: Delivery date
|
||||
|
|
|
@ -221,7 +221,7 @@ export default `
|
|||
§ page.team.extension.current.count: Number
|
||||
§ page.team.extension.removed.count: Number of removed
|
||||
§ page.team.extension.files: files
|
||||
§ page.team.release.download: Download
|
||||
§ page.team.release.download: CHANGELOG.md
|
||||
§ page.team.release.title: Release
|
||||
§ page.team.release.from: Created date
|
||||
§ page.team.release.to: Delivery date
|
||||
|
|
|
@ -221,7 +221,7 @@ export default `
|
|||
§ page.team.extension.current.count: Number
|
||||
§ page.team.extension.removed.count: Number of removed
|
||||
§ page.team.extension.files: files
|
||||
§ page.team.release.download: Download
|
||||
§ page.team.release.download: CHANGELOG.md
|
||||
§ page.team.release.title: Release
|
||||
§ page.team.release.from: Created date
|
||||
§ page.team.release.to: Delivery date
|
||||
|
|
|
@ -221,7 +221,7 @@ export default `
|
|||
§ page.team.extension.current.count: 수량
|
||||
§ page.team.extension.removed.count: 삭제된 수
|
||||
§ page.team.extension.files: 파일
|
||||
§ page.team.release.download: 다운로드
|
||||
§ page.team.release.download: CHANGELOG.md
|
||||
§ page.team.release.title: 릴리스
|
||||
§ page.team.release.from: 생성 날짜
|
||||
§ page.team.release.to: 완료 날짜
|
||||
|
|
|
@ -221,7 +221,7 @@ export default `
|
|||
§ page.team.extension.current.count: Number
|
||||
§ page.team.extension.removed.count: Number of removed
|
||||
§ page.team.extension.files: files
|
||||
§ page.team.release.download: Download
|
||||
§ page.team.release.download: CHANGELOG.md
|
||||
§ page.team.release.title: Release
|
||||
§ page.team.release.from: Created date
|
||||
§ page.team.release.to: Delivery date
|
||||
|
|
|
@ -221,7 +221,7 @@ export default `
|
|||
§ page.team.extension.current.count: Количество
|
||||
§ page.team.extension.removed.count: Количество удалённых
|
||||
§ page.team.extension.files: файлов
|
||||
§ page.team.release.download: Скачать
|
||||
§ page.team.release.download: CHANGELOG.md
|
||||
§ page.team.release.title: Релиз
|
||||
§ page.team.release.from: Дата создания
|
||||
§ page.team.release.to: Дата завершения
|
||||
|
|
|
@ -212,7 +212,7 @@ export default `
|
|||
§ page.team.extension.current.count: Количество
|
||||
§ page.team.extension.removed.count: Количество удалённых
|
||||
§ page.team.extension.files: файлов
|
||||
§ page.team.release.download: Скачать
|
||||
§ page.team.release.download: CHANGELOG.md
|
||||
§ page.team.release.title: Релиз
|
||||
§ page.team.release.from: Дата создания
|
||||
§ page.team.release.to: Дата завершения
|
||||
|
|
|
@ -216,7 +216,7 @@ export default `
|
|||
§ page.team.extension.current.count: Number
|
||||
§ page.team.extension.removed.count: Number of removed
|
||||
§ page.team.extension.files: files
|
||||
§ page.team.release.download: Download
|
||||
§ page.team.release.download: CHANGELOG.md
|
||||
§ page.team.release.title: Release
|
||||
§ page.team.release.from: Created date
|
||||
§ page.team.release.to: Delivery date
|
||||
|
|
Loading…
Add table
Reference in a new issue