Fix license element deleting itself when pressing backspace. (#1389)

This commit is contained in:
chaos 2023-10-01 12:57:37 -07:00 committed by GitHub
parent 5c7dd10769
commit c4ddd08b0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -44,12 +44,12 @@
:close-on-select="true" :close-on-select="true"
:show-labels="false" :show-labels="false"
:class="{ :class="{
'known-error': license.short === '' && showKnownErrors, 'known-error': license?.short === '' && showKnownErrors,
}" }"
:disabled="!hasPermission" :disabled="!hasPermission"
/> />
<Checkbox <Checkbox
v-if="license.requiresOnlyOrLater" v-if="license?.requiresOnlyOrLater"
v-model="allowOrLater" v-model="allowOrLater"
:disabled="!hasPermission" :disabled="!hasPermission"
description="Allow later editions of this license" description="Allow later editions of this license"
@ -57,7 +57,7 @@
Allow later editions of this license Allow later editions of this license
</Checkbox> </Checkbox>
<Checkbox <Checkbox
v-if="license.friendly === 'Custom'" v-if="license?.friendly === 'Custom'"
v-model="nonSpdxLicense" v-model="nonSpdxLicense"
:disabled="!hasPermission" :disabled="!hasPermission"
description="License does not have a SPDX identifier" description="License does not have a SPDX identifier"
@ -65,7 +65,7 @@
License does not have a SPDX identifier License does not have a SPDX identifier
</Checkbox> </Checkbox>
<input <input
v-if="license.friendly === 'Custom'" v-if="license?.friendly === 'Custom'"
v-model="license.short" v-model="license.short"
type="text" type="text"
maxlength="2048" maxlength="2048"
@ -88,7 +88,7 @@
<button <button
type="button" type="button"
class="iconified-button brand-button" class="iconified-button brand-button"
:disabled="!hasChanges" :disabled="!hasChanges || license === null"
@click="saveChanges()" @click="saveChanges()"
> >
<SaveIcon /> <SaveIcon />
@ -253,6 +253,7 @@ export default defineNuxtComponent({
}, },
licenseId() { licenseId() {
let id = '' let id = ''
if (this.license === null) return id
if ( if (
(this.nonSpdxLicense && this.license.friendly === 'Custom') || (this.nonSpdxLicense && this.license.friendly === 'Custom') ||
this.license.short === 'All-Rights-Reserved' || this.license.short === 'All-Rights-Reserved' ||