chore: Update buttons in agents page (#11129)

This commit is contained in:
Sivin Varghese
2025-03-20 23:56:56 +05:30
committed by GitHub
parent 0cbcb8b80c
commit 48dd487db3
3 changed files with 54 additions and 48 deletions

View File

@@ -5,7 +5,7 @@ import { useI18n } from 'vue-i18n';
import { useAlert } from 'dashboard/composables'; import { useAlert } from 'dashboard/composables';
import { useVuelidate } from '@vuelidate/core'; import { useVuelidate } from '@vuelidate/core';
import { required, email } from '@vuelidate/validators'; import { required, email } from '@vuelidate/validators';
import WootSubmitButton from 'dashboard/components/buttons/FormSubmitButton.vue'; import Button from 'dashboard/components-next/button/Button.vue';
const emit = defineEmits(['close']); const emit = defineEmits(['close']);
@@ -148,16 +148,19 @@ const addAgent = async () => {
</div> </div>
<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">
<div class="w-full"> <Button
<WootSubmitButton faded
:disabled="v$.$invalid || uiFlags.isCreating" slate
:button-text="$t('AGENT_MGMT.ADD.FORM.SUBMIT')" type="reset"
:loading="uiFlags.isCreating" :label="$t('AGENT_MGMT.ADD.CANCEL_BUTTON_TEXT')"
/> @click.prevent="emit('close')"
<button class="button clear" @click.prevent="emit('close')"> />
{{ $t('AGENT_MGMT.ADD.CANCEL_BUTTON_TEXT') }} <Button
</button> type="submit"
</div> :label="$t('AGENT_MGMT.ADD.FORM.SUBMIT')"
:disabled="v$.$invalid || uiFlags.isCreating"
:is-loading="uiFlags.isCreating"
/>
</div> </div>
</form> </form>
</div> </div>

View File

@@ -5,7 +5,7 @@ import { required, minLength } from '@vuelidate/validators';
import { useStore, useMapGetter } from 'dashboard/composables/store'; import { useStore, useMapGetter } from 'dashboard/composables/store';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useAlert } from 'dashboard/composables'; import { useAlert } from 'dashboard/composables';
import WootSubmitButton from 'dashboard/components/buttons/FormSubmitButton.vue'; import Button from 'dashboard/components-next/button/Button.vue';
import Auth from '../../../../api/auth'; import Auth from '../../../../api/auth';
import wootConstants from 'dashboard/constants/globals'; import wootConstants from 'dashboard/constants/globals';
@@ -200,25 +200,31 @@ const resetPassword = async () => {
</label> </label>
</div> </div>
<div class="flex flex-row justify-end w-full gap-2 px-0 py-2"> <div class="flex flex-row justify-start w-full gap-2 px-0 py-2">
<div class="w-[50%]"> <div class="w-[50%] ltr:text-left rtl:text-right">
<WootSubmitButton <Button
:disabled="v$.$invalid || uiFlags.isUpdating" ghost
:button-text="$t('AGENT_MGMT.EDIT.FORM.SUBMIT')" type="button"
:loading="uiFlags.isUpdating" icon="i-lucide-lock-keyhole"
/> class="!px-2"
<button class="button clear" @click.prevent="emit('close')"> :label="$t('AGENT_MGMT.EDIT.PASSWORD_RESET.ADMIN_RESET_BUTTON')"
{{ $t('AGENT_MGMT.EDIT.CANCEL_BUTTON_TEXT') }}
</button>
</div>
<div class="w-[50%] text-right">
<woot-button
icon="lock-closed"
variant="clear"
@click.prevent="resetPassword" @click.prevent="resetPassword"
> />
{{ $t('AGENT_MGMT.EDIT.PASSWORD_RESET.ADMIN_RESET_BUTTON') }} </div>
</woot-button> <div class="w-[50%] flex justify-end items-center gap-2">
<Button
faded
slate
type="reset"
:label="$t('AGENT_MGMT.EDIT.CANCEL_BUTTON_TEXT')"
@click.prevent="emit('close')"
/>
<Button
type="submit"
:label="$t('AGENT_MGMT.EDIT.FORM.SUBMIT')"
:disabled="v$.$invalid || uiFlags.isUpdating"
:is-loading="uiFlags.isUpdating"
/>
</div> </div>
</div> </div>
</form> </form>

View File

@@ -13,6 +13,7 @@ import AddAgent from './AddAgent.vue';
import EditAgent from './EditAgent.vue'; import EditAgent from './EditAgent.vue';
import BaseSettingsHeader from '../components/BaseSettingsHeader.vue'; import BaseSettingsHeader from '../components/BaseSettingsHeader.vue';
import SettingsLayout from '../SettingsLayout.vue'; import SettingsLayout from '../SettingsLayout.vue';
import Button from 'dashboard/components-next/button/Button.vue';
const getters = useStoreGetters(); const getters = useStoreGetters();
const store = useStore(); const store = useStore();
@@ -149,13 +150,11 @@ const confirmDeletion = () => {
feature-name="agents" feature-name="agents"
> >
<template #actions> <template #actions>
<woot-button <Button
class="rounded-md button nice" icon="i-lucide-circle-plus"
icon="add-circle" :label="$t('AGENT_MGMT.HEADER_BTN_TXT')"
@click="openAddPopup" @click="openAddPopup"
> />
{{ $t('AGENT_MGMT.HEADER_BTN_TXT') }}
</woot-button>
</template> </template>
</BaseSettingsHeader> </BaseSettingsHeader>
</template> </template>
@@ -225,24 +224,22 @@ const confirmDeletion = () => {
</td> </td>
<td class="py-4"> <td class="py-4">
<div class="flex justify-end gap-1"> <div class="flex justify-end gap-1">
<woot-button <Button
v-if="showEditAction(agent)" v-if="showEditAction(agent)"
v-tooltip.top="$t('AGENT_MGMT.EDIT.BUTTON_TEXT')" v-tooltip.top="$t('AGENT_MGMT.EDIT.BUTTON_TEXT')"
variant="smooth" icon="i-lucide-pen"
size="tiny" slate
color-scheme="secondary" xs
icon="edit" faded
class-names="grey-btn"
@click="openEditPopup(agent)" @click="openEditPopup(agent)"
/> />
<woot-button <Button
v-if="showDeleteAction(agent)" v-if="showDeleteAction(agent)"
v-tooltip.top="$t('AGENT_MGMT.DELETE.BUTTON_TEXT')" v-tooltip.top="$t('AGENT_MGMT.DELETE.BUTTON_TEXT')"
variant="smooth" icon="i-lucide-trash-2"
color-scheme="alert" xs
size="tiny" ruby
icon="dismiss-circle" faded
class-names="grey-btn"
:is-loading="loading[agent.id]" :is-loading="loading[agent.id]"
@click="openDeletePopup(agent, index)" @click="openDeletePopup(agent, index)"
/> />