Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf3d091f

Browse files
authored
fix(site): improve rendering of provisioner tags (#11575)
* fix(site): improve rendering of provisioner tags* fixup! fix(site): improve rendering of provisioner tags* Update site/src/pages/HealthPage/ProvisionerDaemonsPage.tsx* fixup! Update site/src/pages/HealthPage/ProvisionerDaemonsPage.tsx
1 parent4a08082 commitf3d091f

File tree

2 files changed

+64
-9
lines changed

2 files changed

+64
-9
lines changed

‎site/src/pages/HealthPage/ProvisionerDaemonsPage.tsx‎

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
import{Header,HeaderTitle,HealthyDot,Main,Pill}from"./Content";
1+
import{
2+
BooleanPill,
3+
Header,
4+
HeaderTitle,
5+
HealthyDot,
6+
Main,
7+
Pill,
8+
}from"./Content";
29
import{Helmet}from"react-helmet-async";
310
import{pageTitle}from"utils/page";
411
import{useTheme}from"@mui/material/styles";
@@ -116,13 +123,9 @@ export const ProvisionerDaemonsPage = () => {
116123
</span>
117124
</Pill>
118125
</Tooltip>
119-
{Object.keys(extraTags).map((k)=>(
120-
<Tooltipkey={k}title={k}>
121-
<Pillkey={k}icon={<Sell/>}>
122-
{extraTags[k]}
123-
</Pill>
124-
</Tooltip>
125-
))}
126+
{Object.keys(extraTags).map((k)=>
127+
renderTag(k,extraTags[k]),
128+
)}
126129
</div>
127130
</header>
128131

@@ -163,4 +166,29 @@ export const ProvisionerDaemonsPage = () => {
163166
);
164167
};
165168

169+
constparseBool=(s:string):{valid:boolean;value:boolean}=>{
170+
switch(s.toLowerCase()){
171+
case"true":
172+
case"yes":
173+
case"1":
174+
return{valid:true,value:true};
175+
case"false":
176+
case"no":
177+
case"0":
178+
case"":
179+
return{valid:true,value:false};
180+
default:
181+
return{valid:false,value:false};
182+
}
183+
};
184+
185+
constrenderTag=(k:string,v:string)=>{
186+
const{ valid,value:boolValue}=parseBool(v);
187+
constkv=`${k}:${v}`;
188+
if(valid){
189+
return<BooleanPillvalue={boolValue}>{kv}</BooleanPill>;
190+
}
191+
return<Pillicon={<Sell/>}>{kv}</Pill>;
192+
};
193+
166194
exportdefaultProvisionerDaemonsPage;

‎site/src/testHelpers/entities.ts‎

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3129,7 +3129,30 @@ export const MockHealth: TypesGen.HealthcheckReport = {
31293129
tags:{
31303130
owner:"",
31313131
scope:"organization",
3132-
custom_tag_name:"custom_tag_value",
3132+
tag_value:"value",
3133+
tag_true:"true",
3134+
tag_1:"1",
3135+
tag_yes:"yes",
3136+
},
3137+
},
3138+
warnings:[],
3139+
},
3140+
{
3141+
provisioner_daemon:{
3142+
id:"00000000-0000-0000-000000000000",
3143+
created_at:"2024-01-04T15:53:03.21563Z",
3144+
last_seen_at:"2024-01-04T16:05:03.967551Z",
3145+
name:"user-scoped",
3146+
version:"v2.34-devel+abcd1234",
3147+
api_version:"1.0",
3148+
provisioners:["echo","terraform"],
3149+
tags:{
3150+
owner:"12345678-1234-1234-1234-12345678abcd",
3151+
scope:"user",
3152+
tag_VALUE:"VALUE",
3153+
tag_TRUE:"TRUE",
3154+
tag_1:"1",
3155+
tag_YES:"YES",
31333156
},
31343157
},
31353158
warnings:[],
@@ -3146,6 +3169,10 @@ export const MockHealth: TypesGen.HealthcheckReport = {
31463169
tags:{
31473170
owner:"",
31483171
scope:"organization",
3172+
tag_string:"value",
3173+
tag_false:"false",
3174+
tag_0:"0",
3175+
tag_no:"no",
31493176
},
31503177
},
31513178
warnings:[

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp