Add JSDoc documentation and file headers to all source files
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -113,6 +113,16 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
// The Lucia project.
|
||||
// Copyright 2024-2026 DSP, inc. All rights reserved.
|
||||
// Authors:
|
||||
// cindy.chang@dsp.im (Cindy Chang), 2024/5/30
|
||||
/**
|
||||
* @module views/AccountManagement/AccountAdmin Account
|
||||
* administration page with user list, search, create/edit/
|
||||
* delete actions, admin toggle, and infinite scroll.
|
||||
*/
|
||||
|
||||
import { ref, computed, onMounted, watch } from 'vue';
|
||||
import { useLoadingStore } from '@/stores/loading';
|
||||
import { useModalStore } from '@/stores/modal';
|
||||
@@ -287,8 +297,8 @@ const onAdminInputClick = async(userData, inputIsAdminOn) => {
|
||||
}
|
||||
|
||||
/**
|
||||
* 無限滾動: 監聯 scroll 有沒有滾到底部
|
||||
* @param {element} event 滾動傳入的事件
|
||||
* Loads more account data when the user scrolls near the bottom.
|
||||
* @param {Event} event - The scroll event from the data grid.
|
||||
*/
|
||||
const handleScroll = (event) => {
|
||||
const container = event.target;
|
||||
|
||||
@@ -182,6 +182,16 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
// The Lucia project.
|
||||
// Copyright 2024-2026 DSP, inc. All rights reserved.
|
||||
// Authors:
|
||||
// cindy.chang@dsp.im (Cindy Chang), 2024/5/30
|
||||
/**
|
||||
* @module views/AccountManagement/ModalAccountEditCreate Modal
|
||||
* for creating new accounts or editing existing accounts with
|
||||
* username, name, password fields and validation.
|
||||
*/
|
||||
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import i18next from "@/i18n/i18n.js";
|
||||
import { useModalStore } from '@/stores/modal';
|
||||
|
||||
@@ -23,6 +23,17 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
// The Lucia project.
|
||||
// Copyright 2024-2026 DSP, inc. All rights reserved.
|
||||
// Authors:
|
||||
// cindy.chang@dsp.im (Cindy Chang), 2024/5/30
|
||||
// imacat.yang@dsp.im (imacat), 2023/9/23
|
||||
/**
|
||||
* @module views/AccountManagement/ModalAccountInfo Account
|
||||
* information modal displaying user details, admin/suspended
|
||||
* status badges, and visit count.
|
||||
*/
|
||||
|
||||
import { onBeforeMount, computed, ref } from 'vue';
|
||||
import i18next from '@/i18n/i18n.js';
|
||||
import { useAcctMgmtStore } from '@/stores/acctMgmt';
|
||||
|
||||
@@ -11,6 +11,17 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
// The Lucia project.
|
||||
// Copyright 2024-2026 DSP, inc. All rights reserved.
|
||||
// Authors:
|
||||
// cindy.chang@dsp.im (Cindy Chang), 2024/5/30
|
||||
// imacat.yang@dsp.im (imacat), 2023/9/23
|
||||
/**
|
||||
* @module views/AccountManagement/ModalContainer Container
|
||||
* that renders the appropriate account management modal
|
||||
* based on the current modal type.
|
||||
*/
|
||||
|
||||
import { computed } from 'vue';
|
||||
import { useModalStore } from '@/stores/modal';
|
||||
import ModalAccountEditCreate from './ModalAccountEditCreate.vue';
|
||||
|
||||
@@ -28,6 +28,16 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
// The Lucia project.
|
||||
// Copyright 2024-2026 DSP, inc. All rights reserved.
|
||||
// Authors:
|
||||
// cindy.chang@dsp.im (Cindy Chang), 2024/5/30
|
||||
// imacat.yang@dsp.im (imacat), 2023/9/23
|
||||
/**
|
||||
* @module views/AccountManagement/ModalDeleteAlert Confirmation
|
||||
* modal for account deletion with yes/no buttons.
|
||||
*/
|
||||
|
||||
import { useModalStore } from '@/stores/modal';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useAcctMgmtStore } from '@/stores/acctMgmt';
|
||||
@@ -39,6 +49,7 @@ const modalStore = useModalStore();
|
||||
const toast = useToast();
|
||||
const router = useRouter();
|
||||
|
||||
/** Confirms account deletion, shows success toast, and navigates to account admin page. */
|
||||
const onDeleteConfirmBtnClick = async() => {
|
||||
if(await acctMgmtStore.deleteAccount(acctMgmtStore.currentViewingUser.username)){
|
||||
toast.success(i18next.t("AcctMgmt.MsgAccountDeleteSuccess"));
|
||||
@@ -48,6 +59,7 @@ const onDeleteConfirmBtnClick = async() => {
|
||||
}
|
||||
};
|
||||
|
||||
/** Cancels deletion and closes the modal. */
|
||||
const onNoBtnClick = () => {
|
||||
modalStore.closeModal();
|
||||
};
|
||||
|
||||
@@ -12,6 +12,16 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
// The Lucia project.
|
||||
// Copyright 2024-2026 DSP, inc. All rights reserved.
|
||||
// Authors:
|
||||
// cindy.chang@dsp.im (Cindy Chang), 2024/5/30
|
||||
// imacat.yang@dsp.im (imacat), 2023/9/23
|
||||
/**
|
||||
* @module views/AccountManagement/ModalHeader Reusable modal
|
||||
* header with title text and close button.
|
||||
*/
|
||||
|
||||
import { useModalStore } from '@/stores/modal';
|
||||
|
||||
defineProps({
|
||||
|
||||
@@ -115,6 +115,16 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
// The Lucia project.
|
||||
// Copyright 2024-2026 DSP, inc. All rights reserved.
|
||||
// Authors:
|
||||
// cindy.chang@dsp.im (Cindy Chang), 2024/5/30
|
||||
// imacat.yang@dsp.im (imacat), 2023/9/23
|
||||
/**
|
||||
* @module views/AccountManagement/MyAccount My Account page for
|
||||
* viewing and editing the current user's name and password.
|
||||
*/
|
||||
|
||||
import { onMounted, computed, ref } from 'vue';
|
||||
import i18next from '@/i18n/i18n.js';
|
||||
import { useLoginStore } from '@/stores/login';
|
||||
@@ -147,18 +157,22 @@ const isPwdEditable = ref(false);
|
||||
const isPwdEyeOn = ref(false);
|
||||
const isPwdLengthValid = ref(true);
|
||||
|
||||
/** Enables the name editing input. */
|
||||
const onEditNameClick = () => {
|
||||
isNameEditable.value = true;
|
||||
};
|
||||
|
||||
/** Enables the password editing input. */
|
||||
const onResetPwdClick = () => {
|
||||
isPwdEditable.value = true;
|
||||
};
|
||||
|
||||
/** Validates that the password meets the minimum length requirement. */
|
||||
const validatePwdLength = () => {
|
||||
isPwdLengthValid.value = inputPwd.value.length >= PWD_VALID_LENGTH;
|
||||
};
|
||||
|
||||
/** Saves the edited name to the server and refreshes user data. */
|
||||
const onSaveNameClick = async() => {
|
||||
if(inputName.value.length > 0) {
|
||||
await acctMgmtStore.editAccountName(username, inputName.value);
|
||||
@@ -169,6 +183,7 @@ const onSaveNameClick = async() => {
|
||||
}
|
||||
};
|
||||
|
||||
/** Validates and saves the new password. */
|
||||
const onSavePwdClick = async() => {
|
||||
validatePwdLength();
|
||||
if (isPwdLengthValid.value) {
|
||||
@@ -180,17 +195,23 @@ const onSavePwdClick = async() => {
|
||||
}
|
||||
};
|
||||
|
||||
/** Cancels name editing and restores the original value. */
|
||||
const onCancelNameClick = () => {
|
||||
isNameEditable.value = false;
|
||||
inputName.value = name.value;
|
||||
};
|
||||
|
||||
/** Cancels password editing and clears the input. */
|
||||
const onCancelPwdClick = () => {
|
||||
isPwdEditable.value = false;
|
||||
inputPwd.value = '';
|
||||
isPwdLengthValid.value = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Toggles the password visibility eye button.
|
||||
* @param {boolean} toBeOpen - Whether to show the password.
|
||||
*/
|
||||
const togglePwdEyeBtn = (toBeOpen) => {
|
||||
isPwdEyeOn.value = toBeOpen;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user