Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Task-1386] When adding tags in tag management, random colors are given by default. #1412

Merged
merged 5 commits into from
Dec 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion web-app/src/app/pojo/Tag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@ export class Tag {
id!: number;
name!: string;
value!: string;
color: string = '#ff4081';
color: string = this.getRandomColor();
// 标记类型 0:监控自动生成(monitorId,monitorName) 1: 用户生成 2: 系统预置
type!: number;
creator!: string;
modifier!: string;
gmtCreate!: number;
gmtUpdate!: number;

private getRandomColor(): string {
const colorArray = Array.from({ length: 6 }, () => '0123456789ABCDEF'[Math.floor(Math.random() * 16)]);
const colorCode = `#${colorArray.join('')}`;
return colorCode;
}
}
Loading