mirror of
https://iceshrimp.dev/crimekillz/trashposs
synced 2024-11-25 10:19:06 +01:00
feat: rename workspaces
This commit is contained in:
parent
24c23c6474
commit
569f754d85
@ -1806,7 +1806,9 @@ _deck:
|
||||
popRight: "Pop column to the right"
|
||||
profile: "Workspace"
|
||||
newProfile: "New workspace"
|
||||
renameProfile: "Rename workspace"
|
||||
deleteProfile: "Delete workspace"
|
||||
nameAlreadyExists: "This workspace name already exists."
|
||||
introduction: "Create the perfect interface for you by arranging columns freely!"
|
||||
introduction2: "Click on the + on the right of the screen to add new colums whenever you want."
|
||||
widgetsIntroduction: "Please select \"Edit widgets\" in the column menu and add a widget."
|
||||
|
@ -1803,7 +1803,9 @@ _deck:
|
||||
popRight: "右に出す"
|
||||
profile: "ワークスペース"
|
||||
newProfile: "新規ワークスペース"
|
||||
renameProfile: "ワークスペース名を変更"
|
||||
deleteProfile: "ワークスペースを削除"
|
||||
nameAlreadyExists: "この名前のワークスペースは既に存在します。"
|
||||
introduction: "カラムを組み合わせて自分だけのインターフェイスを作りましょう!"
|
||||
introduction2: "画面の右にある + を押して、いつでもカラムを追加できます。"
|
||||
widgetsIntroduction: "カラムのメニューから、「ウィジェットの編集」を選択してウィジェットを追加してください"
|
||||
|
@ -1731,7 +1731,9 @@ _deck:
|
||||
popRight: "向右弹出"
|
||||
profile: "配置文件"
|
||||
newProfile: "新建配置文件"
|
||||
renameProfile: "重命名配置文件"
|
||||
deleteProfile: "删除配置文件"
|
||||
nameAlreadyExists: "该配置文件名已存在。"
|
||||
introduction: "将各列进行组合以创建您自己的界面!"
|
||||
introduction2: "您可以随时通过屏幕右侧的 + 来添加列"
|
||||
widgetsIntroduction: "从列菜单中,选择“小工具编辑”来添加小工具"
|
||||
|
@ -1731,7 +1731,9 @@ _deck:
|
||||
popRight: "向右彈出"
|
||||
profile: "個人檔案"
|
||||
newProfile: "新建個人檔案"
|
||||
renameProfile: "重新命名個人檔案"
|
||||
deleteProfile: "刪除個人檔案"
|
||||
nameAlreadyExists: "該個人檔案名已經存在。"
|
||||
introduction: "組合欄位來製作屬於自己的介面吧!"
|
||||
introduction2: "您可以隨時透過按畫面右方的 + 來添加欄位。"
|
||||
widgetsIntroduction: "請從欄位的選單中,選擇「編輯小工具」來添加小工具"
|
||||
|
@ -70,6 +70,14 @@
|
||||
>
|
||||
<i class="ph-caret-down ph-bold ph-lg"></i>
|
||||
</button>
|
||||
<button
|
||||
v-if="deckStore.state.profile !== 'default'"
|
||||
v-tooltip.noDelay.left="i18n.ts._deck.renameProfile"
|
||||
class="_button button"
|
||||
@click="renameProfile"
|
||||
>
|
||||
<i class="ph-pencil ph-bold ph-lg"></i>
|
||||
</button>
|
||||
<button
|
||||
v-if="deckStore.state.profile !== 'default'"
|
||||
v-tooltip.noDelay.left="i18n.ts._deck.deleteProfile"
|
||||
@ -161,6 +169,7 @@ import {
|
||||
addColumn as addColumnToStore,
|
||||
loadDeck,
|
||||
getProfiles,
|
||||
renameProfile as renameProfile_,
|
||||
deleteProfile as deleteProfile_,
|
||||
} from "./deck/deck-store";
|
||||
import DeckColumnCore from "@/ui/deck/column-core.vue";
|
||||
@ -319,6 +328,23 @@ function changeProfile(ev: MouseEvent) {
|
||||
os.popupMenu(items, ev.currentTarget ?? ev.target);
|
||||
}
|
||||
|
||||
async function renameProfile() {
|
||||
const { canceled, result: newProfileName } = await os.inputText({
|
||||
title: i18n.ts._deck.renameProfile,
|
||||
allowEmpty: false,
|
||||
});
|
||||
if (canceled) return;
|
||||
|
||||
const profiles = await getProfiles();
|
||||
if (profiles.includes(newProfileName)) {
|
||||
os.alert({ type: "error", text: i18n.ts._deck.nameAlreadyExists });
|
||||
return;
|
||||
}
|
||||
|
||||
await renameProfile_(deckStore.state.profile, newProfileName);
|
||||
unisonReload();
|
||||
}
|
||||
|
||||
async function deleteProfile() {
|
||||
const { canceled } = await os.confirm({
|
||||
type: "warning",
|
||||
|
@ -115,6 +115,20 @@ export async function deleteProfile(key: string): Promise<any> {
|
||||
});
|
||||
}
|
||||
|
||||
export async function renameProfile(oldKey: string, newKey: string) {
|
||||
if (oldKey === newKey) return;
|
||||
|
||||
await api("i/registry/set", {
|
||||
scope: ["client", "deck", "profiles"],
|
||||
key: newKey,
|
||||
value: { columns: deckStore.state.columns, layout: deckStore.state.layout },
|
||||
});
|
||||
deckStore.set("profile", newKey);
|
||||
saveDeck();
|
||||
|
||||
deleteProfile(oldKey);
|
||||
}
|
||||
|
||||
export function addColumn(column: Column) {
|
||||
if (column.name === undefined) column.name = null;
|
||||
deckStore.push("columns", column);
|
||||
|
Loading…
Reference in New Issue
Block a user