Skip to content

Commit

Permalink
refactor: SonarCloud suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
toxophilist committed Dec 2, 2024
1 parent cdaa37a commit 41900bc
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 30 deletions.
14 changes: 7 additions & 7 deletions ocd/packages/react/src/components/OcdProperties.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ const OcdResourceTags = ({ocdDocument, setOcdDocument}: DesignerResourceProperti
<div className='tr'>
<div className='th'>Key</div>
<div className='th'>Value</div>
<div className='th action-button-background add-property' onClick={onFreeformTagAddClick}></div>
<div className='th action-button-background add-property' onClick={onFreeformTagAddClick} aria-hidden></div>
</div>
</div>
<div className='tbody ocd-tags-list-body'>
Expand Down Expand Up @@ -304,7 +304,7 @@ const OcdResourceTags = ({ocdDocument, setOcdDocument}: DesignerResourceProperti
<div className='th'>Namespace</div>
<div className='th'>Key</div>
<div className='th'>Value</div>
<div className='th action-button-background add-property' onClick={onDefinedTagAddClick}></div>
<div className='th action-button-background add-property' onClick={onDefinedTagAddClick} aria-hidden></div>
</div>
</div>
<div className='tbody ocd-tags-list-body'>
Expand Down Expand Up @@ -432,10 +432,10 @@ const OcdResourceArrangement = ({ocdDocument, setOcdDocument}: DesignerResourceP
return (
<div className={`ocd-properties-panel ocd-properties-panel-theme ocd-properties-arrangement-panel`}>
<div className={`ocd-arrangement-z-positioning`}>
<div onClick={() => toFrontClick()}><span>To Front</span></div>
<div onClick={() => toBackClick()}><span>To Back</span></div>
<div onClick={() => bringForwardClick()}><span>Bring Forward</span></div>
<div onClick={() => sendBackwardClick()}><span>Send Backward</span></div>
<div onClick={() => toFrontClick()} aria-hidden><span>To Front</span></div>
<div onClick={() => toBackClick()} aria-hidden><span>To Back</span></div>
<div onClick={() => bringForwardClick()} aria-hidden><span>Bring Forward</span></div>
<div onClick={() => sendBackwardClick()} aria-hidden><span>Send Backward</span></div>
</div>
<div className={`ocd-arrangement-size ${!container ? 'hidden' : ''}`}>
<div><span>Size</span></div>
Expand Down Expand Up @@ -643,7 +643,7 @@ const OcdColourPicker = ({colour, setColour}: DesignerColourPicker): JSX.Element
onMouseLeave={() => setPickerOpen(false)}>
<div className='ocd-colour-picker-swatch'
style={{ backgroundColor: colour }}
onClick={() => setPickerOpen(!pickerOpen)}
onClick={() => setPickerOpen(!pickerOpen)} aria-hidden
></div>
{pickerOpen && <div className='ocd-colour-picker-popup'>
{/* <div><RgbaColorPicker color={rgbaColor} onChange={setRgbaColor} /></div> */}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const OciVolumeAttachmentsObjectList = ({ ocdDocument, setOcdDocument, re
return (
<div className='ocd-property-row'>
<details open={true}>
<summary className='summary-background ocd-summary-row'><div>Volume Attachements</div><div className='add-property action-button-background action-button-column action-button' onClick={onClick}></div></summary>
<summary className='summary-background ocd-summary-row'><div>Volume Attachements</div><div className='add-property action-button-background action-button-column action-button' onClick={onClick} aria-hidden></div></summary>
<div className='ocd-resource-properties'>
{ocdDocument.getOciResourceList('volume_attachment').filter((r: Model.OciVolumeAttachment) => r.instanceId === resource.id).map((r: Model.OciVolumeAttachment) => {return <OciVolumeAttachmentsObject ocdDocument={ocdDocument} setOcdDocument={(ocdDocument:OcdDocument) => setOcdDocument(ocdDocument)} resource={r} configs={configs} rootResource={rootResource} onDelete={onDelete} key={r.id}/>})}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const OciLoadBalancerBackendsObjectList = ({ ocdDocument, setOcdDocument,
return (
<div className='ocd-property-row'>
<details open={true}>
<summary className='summary-background ocd-summary-row'><div>Backends</div><div className='add-property action-button-background action-button-column action-button' onClick={onClick}></div></summary>
<summary className='summary-background ocd-summary-row'><div>Backends</div><div className='add-property action-button-background action-button-column action-button' onClick={onClick} aria-hidden></div></summary>
<div className='ocd-resource-properties'>
{ocdDocument.getOciResourceList('load_balancer_backend').filter((r: Model.OciLoadBalancerBackend) => r.backendSetId === resource.id).map((r: Model.OciLoadBalancerBackend) => {return <OciLoadBalancerBackendsObject ocdDocument={ocdDocument} setOcdDocument={(ocdDocument:OcdDocument) => setOcdDocument(ocdDocument)} resource={r} configs={configs} rootResource={rootResource} onDelete={onDelete} key={r.id}/>})}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const OciNetworkSecurityGroupSecurityRulesObjectList = ({ ocdDocument, se
return (
<div className='ocd-property-row'>
<details open={true}>
<summary className='summary-background ocd-summary-row'><div>Security Rules</div><div className='add-property action-button-background action-button-column action-button' onClick={onClick}></div></summary>
<summary className='summary-background ocd-summary-row'><div>Security Rules</div><div className='add-property action-button-background action-button-column action-button' onClick={onClick} aria-hidden></div></summary>
<div className='ocd-resource-properties'>
{ocdDocument.getOciResourceList('network_security_group_security_rule').filter((r: Model.OciNetworkSecurityGroupSecurityRule) => r.networkSecurityGroupId === resource.id).map((r: Model.OciNetworkSecurityGroupSecurityRule) => {return <OciNetworkSecurityGroupSecurityRulesObject ocdDocument={ocdDocument} setOcdDocument={(ocdDocument:OcdDocument) => setOcdDocument(ocdDocument)} resource={r} configs={configs} rootResource={rootResource} onDelete={onDelete} key={r.id}/>})}
</div>
Expand Down
18 changes: 9 additions & 9 deletions ocd/packages/react/src/pages/OcdCommonTags.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,23 @@ export const OcdCommonTags = ({ ocdConsoleConfig, setOcdConsoleConfig, ocdDocume
const tag = definedTags.find((t) => t.namespace === oldNamespace && t.key === key)
if (tag) {
tag.namespace = newNamespace
setDefinedTags(definedTags)
setDefinedTags([...definedTags])
updateDefinedTags(definedTags)
}
})
const onOciDefinedKeyChange = ((namespace: string, oldKey: string, newKey: string) => {
const tag = definedTags.find((t) => t.namespace === namespace && t.key === oldKey)
if (tag) {
tag.key = newKey
setDefinedTags(definedTags)
setDefinedTags([...definedTags])
updateDefinedTags(definedTags)
}
})
const onOciDefinedValueChange = ((namespace: string, key: string, value: string) => {
const tag = definedTags.find((t) => t.namespace === namespace && t.key === key)
if (tag) {
tag.value = value
setDefinedTags(definedTags)
setDefinedTags([...definedTags])
updateDefinedTags(definedTags)
}
})
Expand Down Expand Up @@ -80,15 +80,15 @@ export const OcdCommonTags = ({ ocdConsoleConfig, setOcdConsoleConfig, ocdDocume
const tag = freeformTags.find((t) => t.key === oldKey)
if (tag) {
tag.key = newKey
setFreeformTags(freeformTags)
setFreeformTags([...freeformTags])
updateFreeformTags(freeformTags)
}
})
const onFreeformValueChange = ((key: string, value: string) => {
const tag = freeformTags.find((t) => t.key === key)
if (tag) {
tag.value = value
setFreeformTags(freeformTags)
setFreeformTags([...freeformTags])
updateFreeformTags(freeformTags)
}
})
Expand All @@ -106,7 +106,7 @@ export const OcdCommonTags = ({ ocdConsoleConfig, setOcdConsoleConfig, ocdDocume
<div className='tr'>
<div className='th'>Key</div>
<div className='th'>Value</div>
<div className='th action-button-background add-property' onClick={onOciFreeformTagAddClick}></div>
<div className='th action-button-background add-property' onClick={onOciFreeformTagAddClick} aria-hidden></div>
</div>
</div>
<div className='tbody ocd-tags-list-body'>
Expand Down Expand Up @@ -134,7 +134,7 @@ export const OcdCommonTags = ({ ocdConsoleConfig, setOcdConsoleConfig, ocdDocume
<div className='th'>Namespace</div>
<div className='th'>Key</div>
<div className='th'>Value</div>
<div className='th action-button-background add-property' onClick={onOciDefinedTagAddClick}></div>
<div className='th action-button-background add-property' onClick={onOciDefinedTagAddClick} aria-hidden></div>
</div>
</div>
<div className='tbody ocd-tags-list-body'>
Expand Down Expand Up @@ -181,7 +181,7 @@ export const OciDefinedTagRow = ({ocdDocument, setOcdDocument, tag, onDeleteClic
<div className='td'><input type='text' placeholder='Namespace' value={namespace} onChange={onNamespaceChange}></input></div>
<div className='td'><input type='text' placeholder='Key' value={key} onChange={onKeyChange}></input></div>
<div className='td'><input type='text' placeholder='Value' value={value} onChange={onValueChange}></input></div>
<div className='td action-button-background delete-property' onClick={onDeleteClick}></div>
<div className='td action-button-background delete-property' onClick={onDeleteClick} aria-hidden></div>
</div>
)
}
Expand All @@ -201,7 +201,7 @@ export const OciFreeformTagRow = ({ocdDocument, setOcdDocument, tag, onDeleteCli
<div className='ocd-tag-row tr'>
<div className='td'><input type='text' placeholder='Name' value={key} onChange={onKeyChange}></input></div>
<div className='td'><input type='text' placeholder='Value' value={value} onChange={onValueChange}></input></div>
<div className='td action-button-background delete-property' onClick={onDeleteClick}></div>
<div className='td action-button-background delete-property' onClick={onDeleteClick} aria-hidden></div>
</div>
)
}
Expand Down
14 changes: 7 additions & 7 deletions ocd/packages/react/src/pages/OcdDesigner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const OcdDesignerViewConfigEditor = ({ ocdConsoleConfig, setOcdConsoleConfig }:
return (
<div className='ocd-console-toolbar-dropdown ocd-console-toolbar-dropdown-theme ocd-toolbar-separator-right'>
<ul>
<li className='ocd-console-toolbar-dropdown-item' onClick={toggleDropdown}>
<li className='ocd-console-toolbar-dropdown-item' onClick={toggleDropdown} aria-hidden>
<div className='left-palette ocd-console-toolbar-icon'></div>
<ul className={`${dropdown ? 'show' : 'hidden'}`}>
<li className='ocd-dropdown-menu-item'><div><label><input id='verboseProviderPalette' type='checkbox' onChange={verboseProviderPaletteOnChange} ref={cbRef} checked={ocdConsoleConfig.config.verboseProviderPalette}/>Verbose Palette</label></div></li>
Expand Down Expand Up @@ -159,9 +159,9 @@ const OcdDesignerViewZoomControls = ({ ocdConsoleConfig, setOcdConsoleConfig, oc
<option value={300}>300%</option>
</select>
</div>
<div className={`zoom-out ocd-console-toolbar-icon`} onClick={onZoomOutClick}></div>
{/* <div className={`zoom-121 ocd-console-toolbar-icon`} onClick={onZoom121Click}></div> */}
<div className={`zoom-in ocd-console-toolbar-icon`} onClick={onZoomInClick}></div>
<div className={`zoom-out ocd-console-toolbar-icon`} onClick={onZoomOutClick} aria-hidden></div>
{/* <div className={`zoom-121 ocd-console-toolbar-icon`} onClick={onZoom121Click} aria-hidden></div> */}
<div className={`zoom-in ocd-console-toolbar-icon`} onClick={onZoomInClick} aria-hidden></div>
</div>
)
}
Expand All @@ -179,7 +179,7 @@ export const OcdDesignerLeftToolbar = ({ ocdConsoleConfig, setOcdConsoleConfig,
ocdConsoleConfig={ocdConsoleConfig}
setOcdConsoleConfig={(ocdConsoleConfig: OcdConsoleConfig) => setOcdConsoleConfig(ocdConsoleConfig)}
/>
<div className={panelLeftClassName} title={panelLeftTitle} onClick={onPanelLeftCollapseExpandClick}></div>
<div className={panelLeftClassName} title={panelLeftTitle} onClick={onPanelLeftCollapseExpandClick} aria-hidden></div>
<OcdDesignerViewZoomControls
ocdConsoleConfig={ocdConsoleConfig}
setOcdConsoleConfig={(ocdConsoleConfig: OcdConsoleConfig) => setOcdConsoleConfig(ocdConsoleConfig)}
Expand Down Expand Up @@ -208,8 +208,8 @@ export const OcdDesignerRightToolbar = ({ ocdConsoleConfig, setOcdConsoleConfig,
const panelBothTitle = bothCollapsed ? 'Show side panels' : 'Hide side panels'
return (
<div className='ocd-designer-toolbar'>
<div className={panelBothClassName} title={panelBothTitle} onClick={() => onPanelBothCollapseExpandClick(bothCollapsed)}></div>
<div className={panelRightClassName} title={panelRightTitle} onClick={onPanelRightCollapseExpandClick}></div>
<div className={panelBothClassName} title={panelBothTitle} onClick={() => onPanelBothCollapseExpandClick(bothCollapsed)} aria-hidden></div>
<div className={panelRightClassName} title={panelRightTitle} onClick={onPanelRightCollapseExpandClick} aria-hidden></div>
</div>
)
}
Expand Down
2 changes: 1 addition & 1 deletion ocd/packages/react/src/pages/OcdTabular.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const OcdTabular = ({ ocdConsoleConfig, setOcdConsoleConfig, ocdDocument, setOcd
<div className='ocd-tabular-view'>
<div id='ocd_resources_bar' className='ocd-designer-canvas-layers'>
{Object.keys(ociResources).sort(OcdUtils.simpleSort).map((k: string) => {
return <div className={`ocd-designer-canvas-layer ${k === selected ? 'ocd-layer-selected' : ''}`} key={k}><label id={k} onClick={onClick}>{`${OcdUtils.toTitle(k)} (${ociResources[k].length})`}</label></div>
return <div className={`ocd-designer-canvas-layer ${k === selected ? 'ocd-layer-selected' : ''}`} key={k}><label id={k} onClick={onClick} aria-hidden>{`${OcdUtils.toTitle(k)} (${ociResources[k].length})`}</label></div>
})}
</div>
<div id='selected_resource_tab' className='ocd-selected-tabular-content'>
Expand Down
2 changes: 1 addition & 1 deletion ocd/packages/react/src/pages/OcdTerraform.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const OcdTerraform = ({ ocdConsoleConfig, setOcdConsoleConfig, ocdDocument, setO
<div className='ocd-terraform-view'>
<div id='terraform_files' className='ocd-designer-canvas-layers'>
{Object.keys(terraform).map((k: string) => {
return <div className={`ocd-designer-canvas-layer ${k === selected ? 'ocd-layer-selected' : ''}`} key={k}><label id={k} onClick={onClick}>{k}</label></div>
return <div className={`ocd-designer-canvas-layer ${k === selected ? 'ocd-layer-selected' : ''}`} key={k}><label id={k} onClick={onClick} aria-hidden>{k}</label></div>
})}
</div>
<div id='selected_terraform_file' className="ocd-selected-terraform-content"><pre>{selectedTerraform}</pre></div>
Expand Down
4 changes: 2 additions & 2 deletions ocd/packages/react/src/pages/OcdVariables.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const OcdVariables = ({ ocdConsoleConfig, setOcdConsoleConfig, ocdDocument, setO
<div className='th'>Name</div>
<div className='th'>Default</div>
<div className='th'>Description</div>
<div className='th action-button-background add-property' onClick={onOciAddClick}></div>
<div className='th action-button-background add-property' onClick={onOciAddClick} aria-hidden></div>
</div>
</div>
<div className='tbody ocd-variables-list-body'>
Expand Down Expand Up @@ -74,7 +74,7 @@ const OcdVariableRow = ({ocdDocument, setOcdDocument, variable, onDeleteClick}:
<div className='td'><input type='text' placeholder='Name' value={variable.name} onChange={onNameChange}></input></div>
<div className='td'><input type='text' placeholder='Default Value' value={variable.default} onChange={onDefaultChange}></input></div>
<div className='td'><input type='text' placeholder='Description' value={variable.description} onChange={onDescriptionChange}></input></div>
<div className='td action-button-background delete-property' onClick={onDeleteClick}></div>
<div className='td action-button-background delete-property' onClick={onDeleteClick} aria-hidden></div>
</div>
)
}
Expand Down

0 comments on commit 41900bc

Please sign in to comment.