Skip to content

Commit

Permalink
refactor(cc-kv-*): rename some variables
Browse files Browse the repository at this point in the history
  • Loading branch information
pdesoyres-cc committed Nov 26, 2024
1 parent cde5880 commit f8801ca
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 32 deletions.
14 changes: 7 additions & 7 deletions src/components/cc-kv-explorer/cc-kv-explorer.js
Original file line number Diff line number Diff line change
Expand Up @@ -656,11 +656,11 @@ export class CcKvExplorer extends LitElement {
* @return {TemplateResult}
*/
_renderKey({ keyState, skeleton }, index) {
const selected = keyState.type === 'selected';
const loading = keyState.type === 'loading';
const deleting = keyState.type === 'deleting';
const isSelected = keyState.type === 'selected';
const isLoading = keyState.type === 'loading';
const isDeleting = keyState.type === 'deleting';
const id = `key-${keyState.key.name}`;
const buttonTabindex = selected || loading ? undefined : -1;
const buttonTabindex = isSelected || isLoading ? undefined : -1;

return html`<div class="key">
<input
Expand All @@ -669,7 +669,7 @@ export class CcKvExplorer extends LitElement {
id=${id}
name="selectedKey"
.value=${keyState.key.name}
.checked=${selected || loading}
.checked=${isSelected || isLoading}
.disabled=${skeleton}
/>
<label for=${id}>
Expand All @@ -678,8 +678,8 @@ export class CcKvExplorer extends LitElement {
<cc-button
class="delete-key-button"
tabindex=${ifDefined(buttonTabindex)}
?disabled=${loading || skeleton}
?waiting=${deleting}
?disabled=${isLoading || skeleton}
?waiting=${isDeleting}
?skeleton=${skeleton}
hide-text
danger
Expand Down
14 changes: 7 additions & 7 deletions src/components/cc-kv-hash-explorer/cc-kv-hash-explorer.js
Original file line number Diff line number Diff line change
Expand Up @@ -437,23 +437,23 @@ export class CcKvHashExplorer extends LitElement {
}

_renderAddForm() {
const loading = this.state.type === 'loading';
const adding = this.state.type !== 'loading' && this.state.addForm.type === 'adding';
const readonly = loading || adding;
const isLoading = this.state.type === 'loading';
const isAdding = this.state.type !== 'loading' && this.state.addForm.type === 'adding';
const isReadonly = isLoading || isAdding;

return html`
<form class="add-form" ${ref(this._addFormRef)} ${formSubmit(this._onAddFormSubmit)}>
<cc-input-text
name="field"
label=${i18n('cc-kv-hash-explorer.add-form.element-field')}
?readonly=${readonly}
?readonly=${isReadonly}
?disabled=${this.disabled}
inline
></cc-input-text>
<cc-input-text
name="value"
label=${i18n('cc-kv-hash-explorer.add-form.element-value')}
?readonly=${readonly}
?readonly=${isReadonly}
?disabled=${this.disabled}
inline
multi
Expand All @@ -462,8 +462,8 @@ export class CcKvHashExplorer extends LitElement {
type="submit"
a11y-name=${i18n('cc-kv-hash-explorer.add-form.submit.a11y')}
.icon=${iconAdd}
?waiting=${adding}
?disabled=${loading || this.disabled}
?waiting=${isAdding}
?disabled=${isLoading || this.disabled}
>${i18n('cc-kv-hash-explorer.add-form.submit')}</cc-button
>
</form>
Expand Down
12 changes: 6 additions & 6 deletions src/components/cc-kv-list-explorer/cc-kv-list-explorer.js
Original file line number Diff line number Diff line change
Expand Up @@ -432,9 +432,9 @@ export class CcKvListExplorer extends LitElement {
{ label: i18n('cc-kv-list-explorer.add-form.element-position.head'), value: 'head' },
];

const loading = this.state.type === 'loading';
const adding = this.state.type !== 'loading' && this.state.addForm.type === 'adding';
const readonly = loading || adding;
const isLoading = this.state.type === 'loading';
const isAdding = this.state.type !== 'loading' && this.state.addForm.type === 'adding';
const isReadonly = isLoading || isAdding;

return html`<form class="add-form" ${ref(this._addFormRef)} ${formSubmit(this._onAddFormSubmit)}>
<cc-select
Expand All @@ -449,7 +449,7 @@ export class CcKvListExplorer extends LitElement {
<cc-input-text
name="value"
label=${i18n('cc-kv-list-explorer.add-form.element-value')}
?readonly=${readonly}
?readonly=${isReadonly}
?disabled=${this.disabled}
inline
multi
Expand All @@ -458,8 +458,8 @@ export class CcKvListExplorer extends LitElement {
type="submit"
a11y-name=${i18n('cc-kv-list-explorer.add-form.submit.a11y')}
.icon=${iconAdd}
?waiting=${adding}
?disabled=${loading || this.disabled}
?waiting=${isAdding}
?disabled=${isLoading || this.disabled}
>${i18n('cc-kv-list-explorer.add-form.submit')}</cc-button
>
</form>`;
Expand Down
12 changes: 6 additions & 6 deletions src/components/cc-kv-set-explorer/cc-kv-set-explorer.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,15 +271,15 @@ export class CcKvSetExplorer extends LitElement {
}

_renderAddForm() {
const loading = this.state.type === 'loading';
const adding = this.state.type !== 'loading' && this.state.addForm.type === 'adding';
const readonly = loading || adding;
const isLoading = this.state.type === 'loading';
const isAdding = this.state.type !== 'loading' && this.state.addForm.type === 'adding';
const isReadonly = isLoading || isAdding;

return html`<form class="add-form" ${ref(this._addFormRef)} ${formSubmit(this._onAddFormSubmit)}>
<cc-input-text
name="element"
label=${i18n('cc-kv-set-explorer.add-form.element-value')}
?readonly=${readonly}
?readonly=${isReadonly}
?disabled=${this.disabled}
inline
multi
Expand All @@ -288,8 +288,8 @@ export class CcKvSetExplorer extends LitElement {
type="submit"
a11y-name=${i18n('cc-kv-set-explorer.add-form.submit.a11y')}
.icon=${iconAdd}
?waiting=${adding}
?disabled=${loading || this.disabled}
?waiting=${isAdding}
?disabled=${isLoading || this.disabled}
>${i18n('cc-kv-set-explorer.add-form.submit')}</cc-button
>
</form>`;
Expand Down
12 changes: 6 additions & 6 deletions src/components/cc-kv-string-editor/cc-kv-string-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,28 +56,28 @@ export class CcKvStringEditor extends LitElement {
}

render() {
const loading = this.state.type === 'loading';
const saving = this.state.type === 'saving';
const isLoading = this.state.type === 'loading';
const isSaving = this.state.type === 'saving';
const value = this.state.type === 'loading' ? '' : this.state.value;
const isDisabled = this.disabled;

return html`<form ${formSubmit(this._onFormSubmit)}>
<cc-input-text
name="value"
label=${i18n('cc-kv-string-editor.form.value')}
.skeleton=${loading}
.skeleton=${isLoading}
?disabled=${isDisabled}
?readonly=${saving}
?readonly=${isSaving}
clipboard
multi
.resetValue=${value}
.value=${value}
></cc-input-text>
<div class="buttons">
<cc-button type="reset" .skeleton=${loading} .disabled=${isDisabled || saving}>
<cc-button type="reset" .skeleton=${isLoading} .disabled=${isDisabled || isSaving}>
${i18n('cc-kv-string-editor.form.reset')}
</cc-button>
<cc-button type="submit" primary .skeleton=${loading} .disabled=${isDisabled} .waiting=${saving}>
<cc-button type="submit" primary .skeleton=${isLoading} .disabled=${isDisabled} .waiting=${isSaving}>
${i18n('cc-kv-string-editor.form.save')}
</cc-button>
</div>
Expand Down

0 comments on commit f8801ca

Please sign in to comment.