snapshot of https://github.com/cortezaproject/corteza.git (2024.9.x, 2026-09-18; blobs > 131072B omitted)
Some checks failed
SonarQube / SonarQube (push) Failing after 5m28s
E2e test on main branch push / server and client test (map[name:admin port:8080]) (push) Failing after 3m33s
Server and lib tests / Library test (js) (push) Failing after 1m36s
Server and lib tests / Library test (vue) (push) Successful in 2m24s
Server and lib tests / Web client test (admin) (push) Successful in 2m52s
Server and lib tests / Web client test (compose) (push) Successful in 3m23s
Server and lib tests / Web client test (discovery) (push) Successful in 2m49s
Server and lib tests / Web client test (one) (push) Successful in 2m52s
Server and lib tests / Web client test (privacy) (push) Successful in 2m44s
Server and lib tests / Web client test (reporter) (push) Successful in 2m56s
Server and lib tests / Web client test (workflow) (push) Successful in 3m0s
Server and lib tests / Server tests (push) Failing after 4m55s
E2e test on main branch push / notify-failure (push) Failing after 9s
Server and lib tests / Send matrix testing notification (push) Successful in 2s
Mark stale issues and pull requests / stale (push) Successful in 40s
Some checks failed
SonarQube / SonarQube (push) Failing after 5m28s
E2e test on main branch push / server and client test (map[name:admin port:8080]) (push) Failing after 3m33s
Server and lib tests / Library test (js) (push) Failing after 1m36s
Server and lib tests / Library test (vue) (push) Successful in 2m24s
Server and lib tests / Web client test (admin) (push) Successful in 2m52s
Server and lib tests / Web client test (compose) (push) Successful in 3m23s
Server and lib tests / Web client test (discovery) (push) Successful in 2m49s
Server and lib tests / Web client test (one) (push) Successful in 2m52s
Server and lib tests / Web client test (privacy) (push) Successful in 2m44s
Server and lib tests / Web client test (reporter) (push) Successful in 2m56s
Server and lib tests / Web client test (workflow) (push) Successful in 3m0s
Server and lib tests / Server tests (push) Failing after 4m55s
E2e test on main branch push / notify-failure (push) Failing after 9s
Server and lib tests / Send matrix testing notification (push) Successful in 2s
Mark stale issues and pull requests / stale (push) Successful in 40s
This commit is contained in:
181
lib/vue/src/components/input/CInputConfirm.vue
Normal file
181
lib/vue/src/components/input/CInputConfirm.vue
Normal file
@@ -0,0 +1,181 @@
|
||||
<template>
|
||||
<div class="d-inline-flex gap-1">
|
||||
<b-button
|
||||
v-if="!inConfirmation"
|
||||
v-b-tooltip.noninteractive.hover="{ title: tooltip, boundary: 'body' }"
|
||||
:data-test-id="dataTestId"
|
||||
:variant="variant"
|
||||
:size="size"
|
||||
:disabled="disabled || processing"
|
||||
:class="`${buttonClass} ${borderless ? 'border-0' : ''} flex-fill`"
|
||||
:style="buttonStyle"
|
||||
@click.stop.prevent="onPrompt"
|
||||
>
|
||||
<b-spinner
|
||||
v-if="processing"
|
||||
data-test-id="spinner"
|
||||
class="align-middle"
|
||||
small
|
||||
/>
|
||||
|
||||
<template v-else>
|
||||
<font-awesome-icon
|
||||
v-if="showIcon || !text"
|
||||
:icon="icon"
|
||||
:class="iconClass"
|
||||
/>
|
||||
|
||||
<span
|
||||
v-if="text"
|
||||
:class="textClass"
|
||||
>
|
||||
{{ text }}
|
||||
</span>
|
||||
</template>
|
||||
</b-button>
|
||||
|
||||
<template v-else>
|
||||
<b-button
|
||||
:data-test-id="`${dataTestId}-confirm`"
|
||||
:variant="variantOk"
|
||||
:size="sizeConfirm"
|
||||
:disabled="okDisabled"
|
||||
:class="[ borderless && 'border-0', 'flex-fill' ]"
|
||||
@blur.prevent="onCancel()"
|
||||
@click.prevent.stop="onConfirmation()"
|
||||
>
|
||||
<slot name="yes">
|
||||
<font-awesome-icon
|
||||
data-test-id="confirm"
|
||||
:icon="['fas', 'check']"
|
||||
/>
|
||||
</slot>
|
||||
</b-button>
|
||||
|
||||
<b-button
|
||||
:data-test-id="`${dataTestId}-cancel`"
|
||||
:variant="variantCancel"
|
||||
:size="sizeConfirm"
|
||||
:disabled="cancelDisabled"
|
||||
:class="[ borderless && 'border-0', 'flex-fill' ]"
|
||||
@click.prevent.stop="onCancel()"
|
||||
>
|
||||
<slot name="no">
|
||||
<font-awesome-icon
|
||||
data-test-id="reject"
|
||||
:icon="['fas', 'times']"
|
||||
/>
|
||||
</slot>
|
||||
</b-button>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="js">
|
||||
export default {
|
||||
props: {
|
||||
disabled: Boolean,
|
||||
okDisabled: Boolean,
|
||||
cancelDisabled: Boolean,
|
||||
noPrompt: Boolean,
|
||||
processing: Boolean,
|
||||
showIcon: Boolean,
|
||||
|
||||
icon: {
|
||||
type: Array,
|
||||
default: () => ['far', 'trash-alt'],
|
||||
},
|
||||
|
||||
buttonClass: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
|
||||
buttonStyle: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
|
||||
iconClass: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
|
||||
textClass: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
|
||||
borderless: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
|
||||
variant: {
|
||||
type: String,
|
||||
default: 'outline-danger',
|
||||
},
|
||||
|
||||
size: {
|
||||
type: String,
|
||||
default: 'sm',
|
||||
},
|
||||
|
||||
variantOk: {
|
||||
type: String,
|
||||
default: 'danger',
|
||||
},
|
||||
|
||||
variantCancel: {
|
||||
type: String,
|
||||
default: 'light',
|
||||
},
|
||||
|
||||
sizeConfirm: {
|
||||
type: String,
|
||||
default: 'sm',
|
||||
},
|
||||
|
||||
tooltip: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
|
||||
text: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
|
||||
dataTestId: {
|
||||
type: String,
|
||||
default: 'button-delete',
|
||||
},
|
||||
},
|
||||
|
||||
data () {
|
||||
return {
|
||||
inConfirmation: false,
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
onPrompt () {
|
||||
if (this.noPrompt) {
|
||||
this.$emit('confirmed')
|
||||
} else {
|
||||
this.inConfirmation = true
|
||||
}
|
||||
},
|
||||
|
||||
onConfirmation () {
|
||||
this.inConfirmation = false
|
||||
this.$emit('confirmed')
|
||||
},
|
||||
|
||||
onCancel () {
|
||||
this.inConfirmation = false
|
||||
this.$emit('canceled')
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user