Added typing #134
This commit is contained in:
parent
ec9bc80392
commit
75ab159539
@ -79,11 +79,11 @@ export class AutoRolesRulesComponent implements OnInit {
|
|||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
getEmojiUrl(name: string): string {
|
public getEmojiUrl(name: string): string {
|
||||||
return this.guild?.emojis.filter(x => x.name == name)[0].url ?? "";
|
return this.guild?.emojis.filter(x => x.name == name)[0].url ?? "";
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
public ngOnInit(): void {
|
||||||
this.data.getServerFromRoute(this.route);
|
this.data.getServerFromRoute(this.route);
|
||||||
this.spinner.showSpinner();
|
this.spinner.showSpinner();
|
||||||
if (!this.route.snapshot.params["autoRoleId"]) {
|
if (!this.route.snapshot.params["autoRoleId"]) {
|
||||||
@ -116,7 +116,7 @@ export class AutoRolesRulesComponent implements OnInit {
|
|||||||
this.loadNextPage();
|
this.loadNextPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
loadNextPage() {
|
public loadNextPage(): void {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
this.data.query<AutoRoleRuleQuery>(Queries.autoRoleRulesQuery, {
|
this.data.query<AutoRoleRuleQuery>(Queries.autoRoleRulesQuery, {
|
||||||
id: this.sidebar.server$.value?.id, filter: this.filter, page: this.page, sort: this.sort
|
id: this.sidebar.server$.value?.id, filter: this.filter, page: this.page, sort: this.sort
|
||||||
@ -135,7 +135,7 @@ export class AutoRolesRulesComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
setFilterForm() {
|
public setFilterForm(): void {
|
||||||
this.filterForm = this.fb.group({
|
this.filterForm = this.fb.group({
|
||||||
id: new FormControl<number | null>(null),
|
id: new FormControl<number | null>(null),
|
||||||
emojiName: new FormControl<string | null>(null),
|
emojiName: new FormControl<string | null>(null),
|
||||||
@ -173,7 +173,7 @@ export class AutoRolesRulesComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
nextPage(event: LazyLoadEvent) {
|
public nextPage(event: LazyLoadEvent): void {
|
||||||
this.page.pageSize = event.rows ?? 0;
|
this.page.pageSize = event.rows ?? 0;
|
||||||
if (event.first != null && event.rows != null)
|
if (event.first != null && event.rows != null)
|
||||||
this.page.pageIndex = event.first / event.rows;
|
this.page.pageIndex = event.first / event.rows;
|
||||||
@ -183,15 +183,15 @@ export class AutoRolesRulesComponent implements OnInit {
|
|||||||
this.loadNextPage();
|
this.loadNextPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
resetFilters() {
|
public resetFilters(): void {
|
||||||
this.filterForm.reset();
|
this.filterForm.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
onRowEditInit(table: Table, autoRoleRule: AutoRoleRule, index: number) {
|
public onRowEditInit(table: Table, autoRoleRule: AutoRoleRule, index: number): void {
|
||||||
this.clonedUsers[index] = { ...autoRoleRule };
|
this.clonedUsers[index] = { ...autoRoleRule };
|
||||||
}
|
}
|
||||||
|
|
||||||
onRowEditSave(table: Table, newAutoRoleRule: AutoRoleRule, index: number) {
|
public onRowEditSave(table: Table, newAutoRoleRule: AutoRoleRule, index: number): void {
|
||||||
if (this.isEditingNew && JSON.stringify(newAutoRoleRule) === JSON.stringify(this.newAutoRoleTemplate)) {
|
if (this.isEditingNew && JSON.stringify(newAutoRoleRule) === JSON.stringify(this.newAutoRoleTemplate)) {
|
||||||
this.isEditingNew = false;
|
this.isEditingNew = false;
|
||||||
this.rules.splice(index, 1);
|
this.rules.splice(index, 1);
|
||||||
@ -239,7 +239,7 @@ export class AutoRolesRulesComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onRowEditCancel(index: number) {
|
public onRowEditCancel(index: number): void {
|
||||||
if (this.isEditingNew) {
|
if (this.isEditingNew) {
|
||||||
this.rules.splice(index, 1);
|
this.rules.splice(index, 1);
|
||||||
delete this.clonedUsers[index];
|
delete this.clonedUsers[index];
|
||||||
@ -251,7 +251,7 @@ export class AutoRolesRulesComponent implements OnInit {
|
|||||||
delete this.clonedUsers[index];
|
delete this.clonedUsers[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteAutoRoleRule(autoRoleRule: AutoRoleRule) {
|
public deleteAutoRoleRule(autoRoleRule: AutoRoleRule): void {
|
||||||
this.confirmDialog.confirmDialog(
|
this.confirmDialog.confirmDialog(
|
||||||
this.translate.instant("view.server.auto_roles.rules.message.auto_role_rule_delete"), this.translate.instant("view.server.auto_roles.rules.message.auto_role_rule_delete_q", { id: autoRoleRule.id }),
|
this.translate.instant("view.server.auto_roles.rules.message.auto_role_rule_delete"), this.translate.instant("view.server.auto_roles.rules.message.auto_role_rule_delete_q", { id: autoRoleRule.id }),
|
||||||
() => {
|
() => {
|
||||||
@ -271,7 +271,7 @@ export class AutoRolesRulesComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
addAutoRoleRule(table: Table) {
|
public addAutoRoleRule(table: Table): void {
|
||||||
const newAutoRole = JSON.parse(JSON.stringify(this.newAutoRoleTemplate));
|
const newAutoRole = JSON.parse(JSON.stringify(this.newAutoRoleTemplate));
|
||||||
newAutoRole.id = Math.max.apply(Math, this.rules.map(u => {
|
newAutoRole.id = Math.max.apply(Math, this.rules.map(u => {
|
||||||
return u.id ?? 0;
|
return u.id ?? 0;
|
||||||
|
@ -75,7 +75,7 @@ export class AutoRolesComponent implements OnInit {
|
|||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
public ngOnInit(): void {
|
||||||
this.data.getServerFromRoute(this.route);
|
this.data.getServerFromRoute(this.route);
|
||||||
|
|
||||||
this.spinner.showSpinner();
|
this.spinner.showSpinner();
|
||||||
@ -98,7 +98,7 @@ export class AutoRolesComponent implements OnInit {
|
|||||||
this.loadNextPage();
|
this.loadNextPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
loadNextPage() {
|
public loadNextPage(): void {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
this.data.query<AutoRoleQuery>(Queries.autoRolesQuery, {
|
this.data.query<AutoRoleQuery>(Queries.autoRolesQuery, {
|
||||||
id: this.sidebar.server$.value?.id, filter: this.filter, page: this.page, sort: this.sort
|
id: this.sidebar.server$.value?.id, filter: this.filter, page: this.page, sort: this.sort
|
||||||
@ -114,7 +114,7 @@ export class AutoRolesComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
setFilterForm() {
|
public setFilterForm(): void {
|
||||||
this.filterForm = this.fb.group({
|
this.filterForm = this.fb.group({
|
||||||
id: new FormControl<number | null>(null),
|
id: new FormControl<number | null>(null),
|
||||||
channelId: new FormControl<string | null>(null),
|
channelId: new FormControl<string | null>(null),
|
||||||
@ -159,7 +159,7 @@ export class AutoRolesComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
nextPage(event: LazyLoadEvent) {
|
public nextPage(event: LazyLoadEvent): void {
|
||||||
this.page.pageSize = event.rows ?? 0;
|
this.page.pageSize = event.rows ?? 0;
|
||||||
if (event.first != null && event.rows != null)
|
if (event.first != null && event.rows != null)
|
||||||
this.page.pageIndex = event.first / event.rows;
|
this.page.pageIndex = event.first / event.rows;
|
||||||
@ -169,15 +169,15 @@ export class AutoRolesComponent implements OnInit {
|
|||||||
this.loadNextPage();
|
this.loadNextPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
resetFilters() {
|
public resetFilters(): void {
|
||||||
this.filterForm.reset();
|
this.filterForm.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
onRowEditInit(table: Table, autoRole: AutoRole, index: number) {
|
public onRowEditInit(table: Table, autoRole: AutoRole, index: number): void {
|
||||||
this.clonedUsers[index] = { ...autoRole };
|
this.clonedUsers[index] = { ...autoRole };
|
||||||
}
|
}
|
||||||
|
|
||||||
onRowEditSave(table: Table, newAutoRole: AutoRole, index: number) {
|
public onRowEditSave(table: Table, newAutoRole: AutoRole, index: number): void {
|
||||||
if (this.isEditingNew && JSON.stringify(newAutoRole) === JSON.stringify(this.newAutoRoleTemplate)) {
|
if (this.isEditingNew && JSON.stringify(newAutoRole) === JSON.stringify(this.newAutoRoleTemplate)) {
|
||||||
this.isEditingNew = false;
|
this.isEditingNew = false;
|
||||||
this.auto_roles.splice(index, 1);
|
this.auto_roles.splice(index, 1);
|
||||||
@ -205,7 +205,7 @@ export class AutoRolesComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onRowEditCancel(index: number) {
|
public onRowEditCancel(index: number): void {
|
||||||
if (this.isEditingNew) {
|
if (this.isEditingNew) {
|
||||||
this.auto_roles.splice(index, 1);
|
this.auto_roles.splice(index, 1);
|
||||||
delete this.clonedUsers[index];
|
delete this.clonedUsers[index];
|
||||||
@ -217,7 +217,7 @@ export class AutoRolesComponent implements OnInit {
|
|||||||
delete this.clonedUsers[index];
|
delete this.clonedUsers[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteAutoRole(autoRole: AutoRole) {
|
public deleteAutoRole(autoRole: AutoRole): void {
|
||||||
this.confirmDialog.confirmDialog(
|
this.confirmDialog.confirmDialog(
|
||||||
this.translate.instant("view.server.auto_roles.message.auto_role_delete"), this.translate.instant("view.server.auto_roles.message.auto_role_delete_q", { id: autoRole.id }),
|
this.translate.instant("view.server.auto_roles.message.auto_role_delete"), this.translate.instant("view.server.auto_roles.message.auto_role_delete_q", { id: autoRole.id }),
|
||||||
() => {
|
() => {
|
||||||
@ -239,7 +239,7 @@ export class AutoRolesComponent implements OnInit {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
addAutoRole(table: Table) {
|
public addAutoRole(table: Table): void {
|
||||||
const newAutoRole = JSON.parse(JSON.stringify(this.newAutoRoleTemplate));
|
const newAutoRole = JSON.parse(JSON.stringify(this.newAutoRoleTemplate));
|
||||||
newAutoRole.id = Math.max.apply(Math, this.auto_roles.map(u => {
|
newAutoRole.id = Math.max.apply(Math, this.auto_roles.map(u => {
|
||||||
return u.id ?? 0;
|
return u.id ?? 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user