Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bb8df87

Browse files
Add checks in past 30 days to hover text (#1)
* checks in past 30 days to hover text * update contract Co-authored-by: Vijaye Raji <[email protected]>
1 parent fbdd92c commit bb8df87

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/contracts/projects.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ export type APIConfigEntity = {
2121
defaultValue: boolean | Record<string, any>;
2222
enabled: boolean;
2323
rules: Array<APIConfigRule>;
24+
} & APIConfigSpecExtraData;
25+
26+
export type APIConfigSpecExtraData = {
27+
checksInPast30Days?: number;
2428
};
2529

2630
export type APIConfigRule = {

src/lib/configUtils.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as vsc from 'vscode';
22
import { APIConfigRule } from '../contracts/projects';
33
import { StatsigConfig } from '../state/ProjectsState';
4+
import ProjectsState from '../state/ProjectsState';
45
import { getTierPrefix } from './webUtils';
56

67
export function getConfigUrl(c: StatsigConfig): vsc.Uri {
@@ -27,6 +28,15 @@ function isPublic(rule: APIConfigRule): boolean {
2728
return rule.conditions[0].type === 'public';
2829
}
2930

31+
export function getStaleConfig(configName: string): StatsigConfig[] {
32+
const configs = getConfigsFromName(configName);
33+
return configs.filter((config) => config.data.checksInPast30Days === 0);
34+
}
35+
36+
export function getConfigsFromName(configName: string): StatsigConfig[] {
37+
return ProjectsState.instance.findConfig(configName);
38+
}
39+
3040
export type StaticConfigResult = 'pass' | 'fail' | 'mixed';
3141
// A quick heuristic to show GK pass rate. This is expected to work for simple
3242
// GKs (eg disabled, or a single public group that always passes), and might
@@ -114,6 +124,10 @@ export function renderConfigInMarkdown(
114124
)}\n\`\`\``;
115125
}
116126

127+
if (c.data.checksInPast30Days !== undefined) {
128+
body = `${body} \n\n Checks in past 30 days: ${c.data.checksInPast30Days}`;
129+
}
130+
117131
return new vsc.MarkdownString(
118132
`
119133
#### Statsig ${c.type === 'feature_gate' ? 'gate' : 'config'} \`${c.data.name}\`

0 commit comments

Comments
 (0)