Fixed add new infinity id bug & fixed translations #1.1.0.rc5
This commit is contained in:
parent
19ed164845
commit
919970d199
@ -73,7 +73,7 @@ export class AuthUserComponent extends ComponentWithTable implements OnInit, OnD
|
||||
private fb: FormBuilder,
|
||||
private translate: TranslateService
|
||||
) {
|
||||
super("auth-users", ["first_name", "last_name", "email", "active", 'auth_role', 'password']);
|
||||
super("auth-users", ["first_name", "last_name", "email", "active", "auth_role", "password"]);
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
@ -265,7 +265,7 @@ export class AuthUserComponent extends ComponentWithTable implements OnInit, OnD
|
||||
this.spinnerService.hideSpinner();
|
||||
this.toastService.error(this.translate.instant("admin.auth_users.message.user_change_failed"), this.translate.instant("admin.auth_users.message.user_change_failed_d", { email: newUser.email }));
|
||||
this.initUserList();
|
||||
return throwError(() => error);
|
||||
return throwError(() => error);
|
||||
}))
|
||||
.subscribe(_ => {
|
||||
this.initUserList();
|
||||
@ -319,7 +319,7 @@ export class AuthUserComponent extends ComponentWithTable implements OnInit, OnD
|
||||
|
||||
addUser(table: Table) {
|
||||
const newUser = JSON.parse(JSON.stringify(this.newUserTemplate));
|
||||
newUser.id = Math.max.apply(Math, this.users.map(u => {
|
||||
newUser.id = this.users.length == 0 ? 1 : Math.max.apply(Math, this.users.map(u => {
|
||||
return u.id ?? 0;
|
||||
})) + 1;
|
||||
|
||||
|
@ -39,7 +39,7 @@ export class ConfigListComponent {
|
||||
}
|
||||
|
||||
addNew(table: Table) {
|
||||
const id = Math.max.apply(Math, this.internal_data.map(value => {
|
||||
const id = this.internal_data.length == 0 ? 1 : Math.max.apply(Math, this.internal_data.map(value => {
|
||||
return value.id ?? 0;
|
||||
})) + 1;
|
||||
const newItem = { id: id, value: "" };
|
||||
|
@ -27,7 +27,7 @@ export class FeatureFlagListComponent extends ConfigListComponent implements OnI
|
||||
}
|
||||
|
||||
override addNew(table: Table) {
|
||||
const id = Math.max.apply(Math, this.internal_data.map(value => {
|
||||
const id = this.internal_data.length == 0 ? 1 : Math.max.apply(Math, this.internal_data.map(value => {
|
||||
return value.id ?? 0;
|
||||
})) + 1;
|
||||
const newItem = { id: id, value: { key: "", value: false } };
|
||||
|
@ -303,7 +303,7 @@ export class AchievementComponent extends ComponentWithTable implements OnInit,
|
||||
|
||||
public addAchievement(table: Table): void {
|
||||
const newAchievement = JSON.parse(JSON.stringify(this.newAchievementTemplate));
|
||||
newAchievement.id = Math.max.apply(Math, this.achievements.map(l => {
|
||||
newAchievement.id = this.achievements.length == 0 ? 1 : Math.max.apply(Math, this.achievements.map(l => {
|
||||
return l.id ?? 0;
|
||||
})) + 1;
|
||||
|
||||
|
@ -216,7 +216,7 @@ export class AutoRolesComponent extends ComponentWithTable implements OnInit, On
|
||||
})).subscribe(result => {
|
||||
this.isEditingNew = false;
|
||||
this.spinner.hideSpinner();
|
||||
this.toastService.success(this.translate.instant("view.server.auto_roles.message.auto_role_created"), this.translate.instant("view.server.auto_roles.message.auto_role_create_d", { id: result.autoRole.createAutoRole?.id }));
|
||||
this.toastService.success(this.translate.instant("view.server.auto_roles.message.auto_role_create"), this.translate.instant("view.server.auto_roles.message.auto_role_create_d", { id: result.autoRole.createAutoRole?.id }));
|
||||
this.loadNextPage();
|
||||
});
|
||||
}
|
||||
@ -256,7 +256,7 @@ export class AutoRolesComponent extends ComponentWithTable implements OnInit, On
|
||||
|
||||
public addAutoRole(table: Table): void {
|
||||
const newAutoRole = JSON.parse(JSON.stringify(this.newAutoRoleTemplate));
|
||||
newAutoRole.id = Math.max.apply(Math, this.auto_roles.map(u => {
|
||||
newAutoRole.id = this.auto_roles.length == 0 ? 1 : Math.max.apply(Math, this.auto_roles.map(u => {
|
||||
return u.id ?? 0;
|
||||
})) + 1;
|
||||
|
||||
|
@ -260,7 +260,7 @@ export class LevelsComponent extends ComponentWithTable implements OnInit, OnDes
|
||||
|
||||
public addLevel(table: Table): void {
|
||||
const newLevel = JSON.parse(JSON.stringify(this.newLevelTemplate));
|
||||
newLevel.id = Math.max.apply(Math, this.levels.map(l => {
|
||||
newLevel.id = this.levels.length == 0 ? 1 : Math.max.apply(Math, this.levels.map(l => {
|
||||
return l.id ?? 0;
|
||||
})) + 1;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user