From 515ae6f7543d6dfcb578bd8c3ce2ee87d8709142 Mon Sep 17 00:00:00 2001 From: Park Byung Eun Date: Fri, 19 Aug 2022 07:43:52 +0000 Subject: [PATCH 1/3] checkbox bug fix --- .../components/list.component.html | 36 +++++++------- .../components/list.component.ts | 47 +++++++++++++++---- 2 files changed, 57 insertions(+), 26 deletions(-) diff --git a/src/app/modules/admin/member/partner-recommendation/components/list.component.html b/src/app/modules/admin/member/partner-recommendation/components/list.component.html index 3514db2..74c23c2 100644 --- a/src/app/modules/admin/member/partner-recommendation/components/list.component.html +++ b/src/app/modules/admin/member/partner-recommendation/components/list.component.html @@ -25,21 +25,23 @@ @@ -178,21 +180,23 @@ diff --git a/src/app/modules/admin/member/partner-recommendation/components/list.component.ts b/src/app/modules/admin/member/partner-recommendation/components/list.component.ts index 023eb50..6672632 100644 --- a/src/app/modules/admin/member/partner-recommendation/components/list.component.ts +++ b/src/app/modules/admin/member/partner-recommendation/components/list.component.ts @@ -115,7 +115,8 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { selectedPartnerRecommendation?: PartnerRecommendation; pagination?: PartnerRecommendationPagination; - selection = new SelectionModel(true, []); + registSelection = new SelectionModel(true, []); + removeSelection = new SelectionModel(true, []); private _unsubscribeAll: Subject = new Subject(); @@ -234,30 +235,56 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { // ----------------------------------------------------------------------------------------------------- /** Selects all rows if they are not all selected; otherwise clear selection. */ - __toggleAllRows() { - if (this.__isAllSelected()) { - this.selection.clear(); + __registToggleAllRows() { + if (this.__registIsAllSelected()) { + this.registSelection.clear(); return; } - this.selection.select(...this.registPartnerStoreDataSource.data); + this.registSelection.select(...this.registPartnerStoreDataSource.data); } - __isAllSelected() { - const numSelected = this.selection.selected.length; + __registIsAllSelected() { + const numSelected = this.registSelection.selected.length; const numRows = this.registPartnerStoreDataSource.data.length; return numSelected === numRows; } /** The label for the checkbox on the passed row */ - __checkboxLabel(row?: MemberModel): string { + __registCheckboxLabel(row?: MemberModel): string { if (!row) { - return `${this.__isAllSelected() ? 'deselect' : 'select'} all`; + return `${this.__registIsAllSelected() ? 'deselect' : 'select'} all`; } return `${ - this.selection.isSelected(row) ? 'deselect' : 'select' + this.registSelection.isSelected(row) ? 'deselect' : 'select' } row ${row.getUsername()}`; } + + __removeToggleAllRows() { + if (this.__removeIsAllSelected()) { + this.removeSelection.clear(); + return; + } + + this.removeSelection.select(...this.removePartnerStoreDataSource.data); + } + + __removeIsAllSelected() { + const numSelected = this.removeSelection.selected.length; + const numRows = this.removePartnerStoreDataSource.data.length; + return numSelected === numRows; + } + + /** The label for the checkbox on the passed row */ + __removeCheckboxLabel(row?: MemberModel): string { + if (!row) { + return `${this.__removeIsAllSelected() ? 'deselect' : 'select'} all`; + } + return `${ + this.removeSelection.isSelected(row) ? 'deselect' : 'select' + } row ${row.getUsername()}`; + } + /** * Create product */ From a4626f601f23517a4d571ab570492aced359f834 Mon Sep 17 00:00:00 2001 From: PARK BYUNG JUN Date: Fri, 19 Aug 2022 07:44:41 +0000 Subject: [PATCH 2/3] api for frontend is added --- .../proto/c2se/frontend/api/game_pb.d.ts | 6 +++++ .../proto/c2se/frontend/api/game_pb.js | 27 +++++++++++++++++++ .../proto/c2se/frontend/api/vendor_pb.d.ts | 6 +++++ .../proto/c2se/frontend/api/vendor_pb.js | 27 +++++++++++++++++++ 4 files changed, 66 insertions(+) create mode 100644 src/app/modules/proto/c2se/frontend/api/game_pb.d.ts create mode 100644 src/app/modules/proto/c2se/frontend/api/game_pb.js create mode 100644 src/app/modules/proto/c2se/frontend/api/vendor_pb.d.ts create mode 100644 src/app/modules/proto/c2se/frontend/api/vendor_pb.js diff --git a/src/app/modules/proto/c2se/frontend/api/game_pb.d.ts b/src/app/modules/proto/c2se/frontend/api/game_pb.d.ts new file mode 100644 index 0000000..ec9df27 --- /dev/null +++ b/src/app/modules/proto/c2se/frontend/api/game_pb.d.ts @@ -0,0 +1,6 @@ +// package: bet.beteran.c2se.frontend.api.game +// file: c2se/frontend/api/game.proto + +import * as jspb from 'google-protobuf'; + +export const SUBJECT_LIST_GAMES: string; diff --git a/src/app/modules/proto/c2se/frontend/api/game_pb.js b/src/app/modules/proto/c2se/frontend/api/game_pb.js new file mode 100644 index 0000000..caa9d57 --- /dev/null +++ b/src/app/modules/proto/c2se/frontend/api/game_pb.js @@ -0,0 +1,27 @@ +// source: c2se/frontend/api/game.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require("google-protobuf"); +var goog = jspb; +var global = function () { + return this || window || global || self || Function("return this")(); +}.call(null); + +goog.exportSymbol("proto.bet.beteran.c2se.frontend.api.game", null, global); + +proto.bet.beteran.c2se.frontend.api.game = {}; + +proto.bet.beteran.c2se.frontend.api.game.SUBJECT_LIST_GAMES = + "bet.beteran.c2se.frontend.api.game.ListGames"; + +goog.object.extend(exports, proto.bet.beteran.c2se.frontend.api.game); diff --git a/src/app/modules/proto/c2se/frontend/api/vendor_pb.d.ts b/src/app/modules/proto/c2se/frontend/api/vendor_pb.d.ts new file mode 100644 index 0000000..8b70de1 --- /dev/null +++ b/src/app/modules/proto/c2se/frontend/api/vendor_pb.d.ts @@ -0,0 +1,6 @@ +// package: bet.beteran.c2se.frontend.api.vendor +// file: c2se/frontend/api/vendor.proto + +import * as jspb from 'google-protobuf'; + +export const SUBJECT_LIST_VENDORS: string; diff --git a/src/app/modules/proto/c2se/frontend/api/vendor_pb.js b/src/app/modules/proto/c2se/frontend/api/vendor_pb.js new file mode 100644 index 0000000..e57f9d5 --- /dev/null +++ b/src/app/modules/proto/c2se/frontend/api/vendor_pb.js @@ -0,0 +1,27 @@ +// source: c2se/frontend/api/vendor.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require("google-protobuf"); +var goog = jspb; +var global = function () { + return this || window || global || self || Function("return this")(); +}.call(null); + +goog.exportSymbol("proto.bet.beteran.c2se.frontend.api.vendor", null, global); + +proto.bet.beteran.c2se.frontend.api.vendor = {}; + +proto.bet.beteran.c2se.frontend.api.vendor.SUBJECT_LIST_VENDORS = + "bet.beteran.c2se.frontend.api.vendor.ListVendors"; + +goog.object.extend(exports, proto.bet.beteran.c2se.frontend.api.vendor); From 4cc31a17ab27fbccb56a83c2a4f48949bbd72ef4 Mon Sep 17 00:00:00 2001 From: PARK BYUNG JUN Date: Fri, 19 Aug 2022 07:58:34 +0000 Subject: [PATCH 3/3] MemberReferrerService is added --- src/app/app.module.ts | 2 + .../member_referrer/member_referrer.module.ts | 16 ++ .../member_referrer/services/index.ts | 5 + .../services/member_referrer.service.ts | 156 ++++++++++++++++++ .../c2se/backend/member_referrer_pb.d.ts | 10 ++ .../proto/c2se/backend/member_referrer_pb.js | 39 +++++ 6 files changed, 228 insertions(+) create mode 100644 src/app/modules/polyglot/member_referrer/member_referrer.module.ts create mode 100644 src/app/modules/polyglot/member_referrer/services/index.ts create mode 100644 src/app/modules/polyglot/member_referrer/services/member_referrer.service.ts create mode 100644 src/app/modules/proto/c2se/backend/member_referrer_pb.d.ts create mode 100644 src/app/modules/proto/c2se/backend/member_referrer_pb.js diff --git a/src/app/app.module.ts b/src/app/app.module.ts index e4bf6bd..74c5968 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -28,6 +28,7 @@ import { MemberBankDepositModule } from 'app/modules/polyglot/member_bank_deposi import { MemberBankWithdrawModule } from 'app/modules/polyglot/member_bank_withdraw/member_bank_withdraw.module'; import { MemberClassModule } from 'app/modules/polyglot/member_class/member_class.module'; import { MemberLevelModule } from 'app/modules/polyglot/member_level/member_level.module'; +import { MemberReferrerModule } from 'app/modules/polyglot/member_referrer/member_referrer.module'; import { MemberModule } from 'app/modules/polyglot/member/member.module'; import { SiteModule } from 'app/modules/polyglot/site/site.module'; @@ -70,6 +71,7 @@ const routerConfig: ExtraOptions = { MemberBankWithdrawModule.forRoot(), MemberClassModule.forRoot(), MemberLevelModule.forRoot(), + MemberReferrerModule.forRoot(), MemberModule.forRoot(), SiteModule.forRoot(), diff --git a/src/app/modules/polyglot/member_referrer/member_referrer.module.ts b/src/app/modules/polyglot/member_referrer/member_referrer.module.ts new file mode 100644 index 0000000..63da405 --- /dev/null +++ b/src/app/modules/polyglot/member_referrer/member_referrer.module.ts @@ -0,0 +1,16 @@ +import { ModuleWithProviders, NgModule } from '@angular/core'; + +import { SERVICES } from './services'; + +@NgModule({}) +export class MemberReferrerRootModule {} + +@NgModule({}) +export class MemberReferrerModule { + public static forRoot(): ModuleWithProviders { + return { + ngModule: MemberReferrerRootModule, + providers: [...SERVICES], + }; + } +} diff --git a/src/app/modules/polyglot/member_referrer/services/index.ts b/src/app/modules/polyglot/member_referrer/services/index.ts new file mode 100644 index 0000000..af8c96b --- /dev/null +++ b/src/app/modules/polyglot/member_referrer/services/index.ts @@ -0,0 +1,5 @@ +import { Type } from '@angular/core'; + +import { MemberReferrerService } from './member_referrer.service'; + +export const SERVICES: Type[] = [MemberReferrerService]; diff --git a/src/app/modules/polyglot/member_referrer/services/member_referrer.service.ts b/src/app/modules/polyglot/member_referrer/services/member_referrer.service.ts new file mode 100644 index 0000000..fa26a99 --- /dev/null +++ b/src/app/modules/polyglot/member_referrer/services/member_referrer.service.ts @@ -0,0 +1,156 @@ +import { Injectable } from '@angular/core'; +import { NatsService } from 'app/core/nats/services/nats.service'; +import * as nats from 'nats.ws'; + +import { Error } from 'app/modules/proto/protobuf/rpc_pb'; + +import { + ListMemberReferrersRequest, + ListMemberReferrersResponse, + CreateMemberReferrerRequest, + CreateMemberReferrerResponse, + UpdateMemberReferrerRequest, + UpdateMemberReferrerResponse, + DeleteMemberReferrerRequest, + DeleteMemberReferrerResponse, + GetMemberReferrerResponse, + GetMemberReferrerRequest, +} from 'app/modules/proto/c2se/member_referrer_pb'; +import { + SUBJECT_LIST_MEMBER_REFERRERS, + SUBJECT_CREATE_MEMBER_REFERRER, + SUBJECT_UPDATE_MEMBER_REFERRER, + SUBJECT_DELETE_MEMBER_REFERRER, + SUBJECT_GET_MEMBER_REFERRER, +} from 'app/modules/proto/c2se/backend/member_referrer_pb'; + +@Injectable({ + providedIn: 'root', +}) +export class MemberReferrerService { + /** + * Constructor + */ + constructor(private __natsService: NatsService) {} + + // ----------------------------------------------------------------------------------------------------- + // @ Accessors + // ----------------------------------------------------------------------------------------------------- + + // ----------------------------------------------------------------------------------------------------- + // @ Public methods + // ----------------------------------------------------------------------------------------------------- + + createMemberReferrer(): Promise { + return new Promise( + (resolve, reject) => { + let req = new CreateMemberReferrerRequest(); + + this.__natsService + .request( + SUBJECT_CREATE_MEMBER_REFERRER, + req.serializeBinary(), + CreateMemberReferrerResponse.deserializeBinary + ) + .then((result) => { + console.log('success', result, result.getMemberReferrer()); + return resolve(result); + }) + .catch((e: Error) => { + console.log('failed', e); + return reject(e); + }); + } + ); + } + + listMemberReferrers(): Promise { + return new Promise( + (resolve, reject) => { + let req = new ListMemberReferrersRequest(); + + this.__natsService + .request( + SUBJECT_LIST_MEMBER_REFERRERS, + req.serializeBinary(), + ListMemberReferrersResponse.deserializeBinary + ) + .then((result) => { + console.log('success', result, result.getMemberReferrersList()); + return resolve(result); + }) + .catch((e: Error) => { + console.log('failed', e); + reject(e); + }); + } + ); + } + + getMemberReferrer(): Promise { + return new Promise((resolve, reject) => { + let req = new GetMemberReferrerRequest(); + + this.__natsService + .request( + SUBJECT_GET_MEMBER_REFERRER, + req.serializeBinary(), + GetMemberReferrerResponse.deserializeBinary + ) + .then((result) => { + console.log('success', result, result.getMemberReferrer()); + return resolve(result); + }) + .catch((e: Error) => { + console.log('failed', e); + return reject(e); + }); + }); + } + + updateMemberReferrer(): Promise { + return new Promise( + (resolve, reject) => { + let req = new UpdateMemberReferrerRequest(); + + this.__natsService + .request( + SUBJECT_UPDATE_MEMBER_REFERRER, + req.serializeBinary(), + UpdateMemberReferrerResponse.deserializeBinary + ) + .then((result) => { + console.log('success', result, result.getMemberReferrer()); + return resolve(result); + }) + .catch((e: Error) => { + console.log('failed', e); + return reject(e); + }); + } + ); + } + + deleteMemberReferrer(): Promise { + return new Promise( + (resolve, reject) => { + let req = new DeleteMemberReferrerRequest(); + + this.__natsService + .request( + SUBJECT_DELETE_MEMBER_REFERRER, + req.serializeBinary(), + DeleteMemberReferrerResponse.deserializeBinary + ) + .then((result) => { + console.log('success', result); + return resolve(result); + }) + .catch((e: Error) => { + console.log('failed', e); + return reject(e); + }); + } + ); + } +} diff --git a/src/app/modules/proto/c2se/backend/member_referrer_pb.d.ts b/src/app/modules/proto/c2se/backend/member_referrer_pb.d.ts new file mode 100644 index 0000000..4959224 --- /dev/null +++ b/src/app/modules/proto/c2se/backend/member_referrer_pb.d.ts @@ -0,0 +1,10 @@ +// package: bet.beteran.c2se.backend.member_level +// file: c2se/backend/member_level.proto + +import * as jspb from 'google-protobuf'; + +export const SUBJECT_CREATE_MEMBER_REFERRER: string; +export const SUBJECT_LIST_MEMBER_REFERRERS: string; +export const SUBJECT_GET_MEMBER_REFERRER: string; +export const SUBJECT_UPDATE_MEMBER_REFERRER: string; +export const SUBJECT_DELETE_MEMBER_REFERRER: string; diff --git a/src/app/modules/proto/c2se/backend/member_referrer_pb.js b/src/app/modules/proto/c2se/backend/member_referrer_pb.js new file mode 100644 index 0000000..20388bf --- /dev/null +++ b/src/app/modules/proto/c2se/backend/member_referrer_pb.js @@ -0,0 +1,39 @@ +// source: c2se/backend/member_referrer.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require("google-protobuf"); +var goog = jspb; +var global = function () { + return this || window || global || self || Function("return this")(); +}.call(null); + +goog.exportSymbol( + "proto.bet.beteran.c2se.backend.member_referrer", + null, + global +); + +proto.bet.beteran.c2se.backend.member_referrer = {}; + +proto.bet.beteran.c2se.backend.member_referrer.SUBJECT_CREATE_MEMBER_REFERRER = + "bet.beteran.c2se.backend.member_referrer.CreateMemberReferrer"; +proto.bet.beteran.c2se.backend.member_referrer.SUBJECT_LIST_MEMBER_REFERRERS = + "bet.beteran.c2se.backend.member_referrer.ListMemberReferrers"; +proto.bet.beteran.c2se.backend.member_referrer.SUBJECT_GET_MEMBER_REFERRER = + "bet.beteran.c2se.backend.member_referrer.GetMemberReferrer"; +proto.bet.beteran.c2se.backend.member_referrer.SUBJECT_UPDATE_MEMBER_REFERRER = + "bet.beteran.c2se.backend.member_referrer.UpdateMemberReferrer"; +proto.bet.beteran.c2se.backend.member_referrer.SUBJECT_DELETE_MEMBER_REFERRER = + "bet.beteran.c2se.backend.member_referrer.DeleteMemberReferrer"; + +goog.object.extend(exports, proto.bet.beteran.c2se.backend.member_referrer);