Skip to content

Commit

Permalink
[featfix] add feature flag for enhance event log and token info (#3631)
Browse files Browse the repository at this point in the history
  • Loading branch information
tamvb2391 authored Jul 15, 2024
1 parent fbe4da7 commit bb9b136
Show file tree
Hide file tree
Showing 16 changed files with 203 additions and 74 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"start:dev": "ng serve",
"build": "ng build --aot=true --output-hashing=all",
"build:production": "ng build --aot=true --output-hashing=all --configuration production",
"featureflags": "node scripts/encryptFeatureFlags.mjs dev",
"featureflags": "node scripts/encryptFeatureFlags.mjs serenity",
"watch": "ng build --watch --configuration development",
"test": "ng test"
},
Expand Down
2 changes: 1 addition & 1 deletion scripts/feature-flags/dev/config.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "devTest": true }
{ "devTest": true, "enhanceEventLog": true, "setTokenInfo": true }
2 changes: 1 addition & 1 deletion scripts/feature-flags/euphoria/config.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "devTest": false }
{ "devTest": false, "enhanceEventLog": false, "setTokenInfo": false }
2 changes: 1 addition & 1 deletion scripts/feature-flags/mainnet/config.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "devTest": false }
{ "devTest": false, "enhanceEventLog": false, "setTokenInfo": false }
2 changes: 1 addition & 1 deletion scripts/feature-flags/serenity/config.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "devTest": false }
{ "devTest": false, "enhanceEventLog": true, "setTokenInfo": true }
2 changes: 2 additions & 0 deletions src/app/core/constants/feature-flags.enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ const FEATURE_FLAGS_NAMESPACE = '32bf670d-a39e-46a7-8546-2a11d3c16b33';

export enum FeatureFlags {
DevTest = uuidv5('devTest', FEATURE_FLAGS_NAMESPACE),
EnhanceEventLog = uuidv5('enhanceEventLog', FEATURE_FLAGS_NAMESPACE),
SetTokenInfo = uuidv5('setTokenInfo', FEATURE_FLAGS_NAMESPACE),
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<div class="text--white">
<div class="body-02 fw-semibold text--gray-4 mb-1">OVERVIEW</div>
<div class="text--gray-6" [innerHTML]="overviewInfo | newline"></div>
</div>
<div class="text--gray-6" [featureFlag]="'SetTokenInfo'" [flagEnabled]="false">
Aura gives you the joint benefits of open blockchain technology and traditional currency
</div>
<div class="text--gray-6" [featureFlag]="'SetTokenInfo'" [innerHTML]="overviewInfo | newline"></div>
</div>
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Component, Input, OnInit } from '@angular/core';
import { FeatureFlagService } from '../../../../../core/data-services/feature-flag.service';

@Component({
selector: 'app-evm-token-info-tab',
Expand All @@ -10,4 +11,3 @@ export class EvmTokenInfoTabComponent implements OnInit {
@Input() overviewInfo?: string;
ngOnInit(): void {}
}

Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import { NameTagService } from 'src/app/core/services/name-tag.service';
import { TokenService } from 'src/app/core/services/token.service';
import { transferAddress } from 'src/app/core/utils/common/address-converter';
import local from 'src/app/core/utils/storage/local';
import { FeatureFlagService } from '../../../core/data-services/feature-flag.service';
import { FeatureFlags } from '../../../core/constants/feature-flags.enum';

@Component({
selector: 'app-evm-token-content',
Expand Down Expand Up @@ -65,6 +67,7 @@ export class EvmTokenContentComponent implements OnInit {
private nameTagService: NameTagService,
private router: Router,
private beautyAddress: EvmAddressPipe,
private featureFlag: FeatureFlagService,
) {}

ngOnInit(): void {
Expand Down Expand Up @@ -108,12 +111,14 @@ export class EvmTokenContentComponent implements OnInit {
this.searchTemp = this.nameTagService.findNameTagByAddress(this.searchTemp);
}

if (!this.paramQuery) {
this.TABS.push({
key: TokenTab.Info,
value: 'Info',
});
this.tabsBackup = this.TABS;
if (this.featureFlag.isEnabled(FeatureFlags.SetTokenInfo)) {
if (!this.paramQuery) {
this.TABS.push({
key: TokenTab.Info,
value: 'Info',
});
this.tabsBackup = this.TABS;
}
}
});

Expand Down Expand Up @@ -239,4 +244,3 @@ export class EvmTokenContentComponent implements OnInit {
.toFixed();
}
}

Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<div class="text--white">
<div class="body-02 fw-semibold text--gray-4 mb-1">OVERVIEW</div>
<div class="text--gray-6" [innerHTML]="overviewInfo | newline"></div>
</div>
<div class="text--gray-6" [featureFlag]="'SetTokenInfo'" [flagEnabled]="false">
Aura gives you the joint benefits of open blockchain technology and traditional currency
</div>
<div class="text--gray-6" [featureFlag]="'SetTokenInfo'" [innerHTML]="overviewInfo | newline"></div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import { NameTagService } from 'src/app/core/services/name-tag.service';
import { TokenService } from 'src/app/core/services/token.service';
import { transferAddress } from 'src/app/core/utils/common/address-converter';
import local from 'src/app/core/utils/storage/local';
import { FeatureFlagService } from '../../../core/data-services/feature-flag.service';
import { FeatureFlags } from '../../../core/constants/feature-flags.enum';

@Component({
selector: 'app-token-content',
Expand All @@ -26,9 +28,9 @@ export class TokenContentComponent implements OnInit {
@Input() channelPath: any;
@Output() hasMore = new EventEmitter<any>();

tabStaking = [TokenTab.Holders, TokenTab.Info];
tabIBC = [TokenTab.Transfers, TokenTab.Holders, TokenTab.Info];
tabToken = [TokenTab.Transfers, TokenTab.Holders, TokenTab.Contract, TokenTab.Info];
tabStaking = [TokenTab.Holders];
tabIBC = [TokenTab.Transfers, TokenTab.Holders];
tabToken = [TokenTab.Transfers, TokenTab.Holders, TokenTab.Contract];
tabNFT = [TokenTab.Transfers, TokenTab.Holders, TokenTab.Inventory, TokenTab.Contract];
TABS = [];
paramQuery = '';
Expand Down Expand Up @@ -67,9 +69,16 @@ export class TokenContentComponent implements OnInit {
private nameTagService: NameTagService,
private contractService: ContractService,
private router: Router,
private featureFlag: FeatureFlagService,
) {}

ngOnInit(): void {
if (this.featureFlag.isEnabled(FeatureFlags.SetTokenInfo)) {
this.tabStaking = [TokenTab.Holders, TokenTab.Info];
this.tabIBC = [TokenTab.Transfers, TokenTab.Holders, TokenTab.Info];
this.tabToken = [TokenTab.Transfers, TokenTab.Holders, TokenTab.Contract, TokenTab.Info];
}

this.linkAddress = this.route.snapshot.paramMap.get('contractAddress');
let tabFilter;
switch (this.tokenDetail.modeToken) {
Expand Down Expand Up @@ -254,4 +263,3 @@ export class TokenContentComponent implements OnInit {
.toFixed();
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,16 @@
<div class="mb-6">Transaction Receipt Event Logs ({{ eventLog?.length }})</div>
<div class="">
<app-evm-transaction-event-log
[featureFlag]="'EnhanceEventLog'"
[flagEnabled]="false"
*ngFor="let log of eventLog; index as idx"
[eventLog]="log"
[arrTopicDecode]="arrTopicDecode"
[index]="idx">
</app-evm-transaction-event-log>

<app-evm-transaction-event-log
[featureFlag]="'EnhanceEventLog'"
*ngFor="let topic of topicsDecoded; let i = index"
[eventLog]="eventLog[i]"
[arrTopicDecode]="arrTopicDecode"
Expand Down
Loading

0 comments on commit bb9b136

Please sign in to comment.