chore: Update buttons in automation page (#11124)

This commit is contained in:
Sivin Varghese
2025-03-20 21:18:57 +05:30
committed by GitHub
parent 2310d92805
commit 3cf3aca760
5 changed files with 74 additions and 67 deletions

View File

@@ -1,6 +1,11 @@
<script> <script>
import NextButton from 'dashboard/components-next/button/Button.vue';
export default { export default {
name: 'FilterInput', name: 'FilterInput',
components: {
NextButton,
},
props: { props: {
modelValue: { modelValue: {
type: Object, type: Object,
@@ -242,12 +247,7 @@ export default {
:placeholder="$t('FILTER.INPUT_PLACEHOLDER')" :placeholder="$t('FILTER.INPUT_PLACEHOLDER')"
/> />
</div> </div>
<woot-button <NextButton icon="i-lucide-x" slate ghost @click="removeFilter" />
icon="dismiss"
variant="clear"
color-scheme="secondary"
@click="removeFilter"
/>
</div> </div>
<p v-if="errorMessage" class="filter-error"> <p v-if="errorMessage" class="filter-error">
{{ errorMessage }} {{ errorMessage }}

View File

@@ -250,10 +250,9 @@ export default {
blue blue
faded faded
sm sm
:label="$t('AUTOMATION.ADD.CONDITION_BUTTON_LABEL')"
@click="appendNewCondition" @click="appendNewCondition"
> />
{{ $t('AUTOMATION.ADD.CONDITION_BUTTON_LABEL') }}
</NextButton>
</div> </div>
</div> </div>
</section> </section>
@@ -294,22 +293,29 @@ export default {
blue blue
faded faded
sm sm
:label="$t('AUTOMATION.ADD.ACTION_BUTTON_LABEL')"
@click="appendNewAction" @click="appendNewAction"
> />
{{ $t('AUTOMATION.ADD.ACTION_BUTTON_LABEL') }}
</NextButton>
</div> </div>
</div> </div>
</section> </section>
<!-- // Actions End --> <!-- // Actions End -->
<div class="w-full"> <div class="w-full">
<div class="flex flex-row justify-end w-full gap-2 px-0 py-2"> <div class="flex flex-row justify-end w-full gap-2 px-0 py-2">
<NextButton ghost blue @click.prevent="onClose"> <NextButton
{{ $t('AUTOMATION.ADD.CANCEL_BUTTON_TEXT') }} faded
</NextButton> slate
<NextButton solid blue @click="emitSaveAutomation"> type="reset"
{{ $t('AUTOMATION.ADD.SUBMIT') }} :label="$t('AUTOMATION.ADD.CANCEL_BUTTON_TEXT')"
</NextButton> @click.prevent="onClose"
/>
<NextButton
solid
blue
type="submit"
:label="$t('AUTOMATION.ADD.SUBMIT')"
@click="emitSaveAutomation"
/>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -1,5 +1,6 @@
<script setup> <script setup>
import { messageStamp } from 'shared/helpers/timeHelper'; import { messageStamp } from 'shared/helpers/timeHelper';
import Button from 'dashboard/components-next/button/Button.vue';
const props = defineProps({ const props = defineProps({
automation: { automation: {
@@ -43,34 +44,30 @@ const toggle = () => {
</td> </td>
<td class="py-4 min-w-xs"> <td class="py-4 min-w-xs">
<div class="flex gap-1 justify-end flex-shrink-0"> <div class="flex gap-1 justify-end flex-shrink-0">
<woot-button <Button
v-tooltip.top="$t('AUTOMATION.FORM.EDIT')" v-tooltip.top="$t('AUTOMATION.FORM.EDIT')"
variant="smooth" icon="i-lucide-pen"
size="tiny" slate
color-scheme="secondary" xs
class-names="grey-btn" faded
icon="edit"
:is-loading="loading" :is-loading="loading"
@click="$emit('edit', automation)" @click="$emit('edit', automation)"
/> />
<woot-button <Button
v-tooltip.top="$t('AUTOMATION.CLONE.TOOLTIP')" v-tooltip.top="$t('AUTOMATION.CLONE.TOOLTIP')"
variant="smooth" icon="i-lucide-copy-plus"
size="tiny" xs
faded
:is-loading="loading" :is-loading="loading"
color-scheme="primary"
class-names="grey-btn"
icon="copy"
@click="$emit('clone', automation)" @click="$emit('clone', automation)"
/> />
<woot-button <Button
v-tooltip.top="$t('AUTOMATION.FORM.DELETE')" v-tooltip.top="$t('AUTOMATION.FORM.DELETE')"
variant="smooth"
:is-loading="loading" :is-loading="loading"
color-scheme="alert" icon="i-lucide-trash-2"
size="tiny" xs
icon="dismiss-circle" ruby
class-names="grey-btn" faded
@click="$emit('delete', automation)" @click="$emit('delete', automation)"
/> />
</div> </div>

View File

@@ -3,6 +3,7 @@ import { mapGetters } from 'vuex';
import { useAutomation } from 'dashboard/composables/useAutomation'; import { useAutomation } from 'dashboard/composables/useAutomation';
import { useEditableAutomation } from 'dashboard/composables/useEditableAutomation'; import { useEditableAutomation } from 'dashboard/composables/useEditableAutomation';
import FilterInputBox from 'dashboard/components/widgets/FilterInput/Index.vue'; import FilterInputBox from 'dashboard/components/widgets/FilterInput/Index.vue';
import NextButton from 'dashboard/components-next/button/Button.vue';
import AutomationActionInput from 'dashboard/components/widgets/AutomationActionInput.vue'; import AutomationActionInput from 'dashboard/components/widgets/AutomationActionInput.vue';
import { import {
getFileName, getFileName,
@@ -20,6 +21,7 @@ import { AUTOMATION_RULE_EVENTS, AUTOMATION_ACTION_TYPES } from './constants';
export default { export default {
components: { components: {
FilterInputBox, FilterInputBox,
NextButton,
AutomationActionInput, AutomationActionInput,
}, },
props: { props: {
@@ -226,15 +228,14 @@ export default {
@remove-filter="removeFilter(i)" @remove-filter="removeFilter(i)"
/> />
<div class="mt-4"> <div class="mt-4">
<woot-button <NextButton
icon="add" icon="i-lucide-plus"
color-scheme="success" blue
variant="smooth" faded
size="small" sm
:label="$t('AUTOMATION.ADD.CONDITION_BUTTON_LABEL')"
@click="appendNewCondition" @click="appendNewCondition"
> />
{{ $t('AUTOMATION.ADD.CONDITION_BUTTON_LABEL') }}
</woot-button>
</div> </div>
</div> </div>
</section> </section>
@@ -266,31 +267,34 @@ export default {
@remove-action="removeAction(i)" @remove-action="removeAction(i)"
/> />
<div class="mt-4"> <div class="mt-4">
<woot-button <NextButton
icon="add" icon="i-lucide-plus"
color-scheme="success" blue
variant="smooth" faded
size="small" sm
:label="$t('AUTOMATION.ADD.ACTION_BUTTON_LABEL')"
@click="appendNewAction" @click="appendNewAction"
> />
{{ $t('AUTOMATION.ADD.ACTION_BUTTON_LABEL') }}
</woot-button>
</div> </div>
</div> </div>
</section> </section>
<!-- // Actions End --> <!-- // Actions End -->
<div class="w-full"> <div class="w-full">
<div class="flex flex-row justify-end w-full gap-2 px-0 py-2"> <div class="flex flex-row justify-end w-full gap-2 px-0 py-2">
<woot-button <NextButton
class="button" faded
variant="clear" slate
type="reset"
:label="$t('AUTOMATION.EDIT.CANCEL_BUTTON_TEXT')"
@click.prevent="onClose" @click.prevent="onClose"
> />
{{ $t('AUTOMATION.EDIT.CANCEL_BUTTON_TEXT') }} <NextButton
</woot-button> solid
<woot-button @click="emitSaveAutomation"> blue
{{ $t('AUTOMATION.EDIT.SUBMIT') }} type="submit"
</woot-button> :label="$t('AUTOMATION.EDIT.SUBMIT')"
@click="emitSaveAutomation"
/>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -8,6 +8,8 @@ import { computed, onMounted, ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useStoreGetters, useStore } from 'dashboard/composables/store'; import { useStoreGetters, useStore } from 'dashboard/composables/store';
import AutomationRuleRow from './AutomationRuleRow.vue'; import AutomationRuleRow from './AutomationRuleRow.vue';
import Button from 'dashboard/components-next/button/Button.vue';
const getters = useStoreGetters(); const getters = useStoreGetters();
const store = useStore(); const store = useStore();
const { t } = useI18n(); const { t } = useI18n();
@@ -185,13 +187,11 @@ const tableHeaders = computed(() => {
feature-name="automation" feature-name="automation"
> >
<template #actions> <template #actions>
<woot-button <Button
class="button nice rounded-md" icon="i-lucide-circle-plus"
icon="add-circle" :label="$t('AUTOMATION.HEADER_BTN_TXT')"
@click="openAddPopup" @click="openAddPopup"
> />
{{ $t('AUTOMATION.HEADER_BTN_TXT') }}
</woot-button>
</template> </template>
</BaseSettingsHeader> </BaseSettingsHeader>
</template> </template>