Merge branch 'feature/main-js' of http://192.168.10.110/Autoflow/autoflow-web-console into feature/main-js

main
bjkim 9 months ago
commit 82c5bcf2bf

11
components.d.ts vendored

@ -10,7 +10,10 @@ declare module 'vue' {
export interface GlobalComponents { export interface GlobalComponents {
AppFooter: typeof import('./src/components/AppFooter.vue')['default'] AppFooter: typeof import('./src/components/AppFooter.vue')['default']
CompareComponent: typeof import('./src/components/templates/run/executions/CompareComponent.vue')['default'] CompareComponent: typeof import('./src/components/templates/run/executions/CompareComponent.vue')['default']
copy: typeof import('./src/components/atoms/organisms/TrainingScriptBaseDoalog copy.vue')['default']
DatasetBaseDoalog: typeof import('./src/components/atoms/organisms/DatasetBaseDoalog.vue')['default']
DatasetsBaseDoalog: typeof import('./src/components/atoms/organisms/DatasetsBaseDoalog.vue')['default'] DatasetsBaseDoalog: typeof import('./src/components/atoms/organisms/DatasetsBaseDoalog.vue')['default']
DatesetBaseDoalog: typeof import('./src/components/atoms/organisms/DatesetBaseDoalog.vue')['default']
DeploymentDialog: typeof import('./src/components/atoms/organisms/DeploymentDialog.vue')['default'] DeploymentDialog: typeof import('./src/components/atoms/organisms/DeploymentDialog.vue')['default']
DrawerComponent: typeof import('./src/components/common/DrawerComponent.vue')['default'] DrawerComponent: typeof import('./src/components/common/DrawerComponent.vue')['default']
ExecutionBaseDialog: typeof import('./src/components/atoms/organisms/ExecutionBaseDialog.vue')['default'] ExecutionBaseDialog: typeof import('./src/components/atoms/organisms/ExecutionBaseDialog.vue')['default']
@ -23,17 +26,23 @@ declare module 'vue' {
IconDownloadBtn: typeof import('./src/components/atoms/button/IconDownloadBtn.vue')['default'] IconDownloadBtn: typeof import('./src/components/atoms/button/IconDownloadBtn.vue')['default']
IconInfoBtn: typeof import('./src/components/atoms/button/IconInfoBtn.vue')['default'] IconInfoBtn: typeof import('./src/components/atoms/button/IconInfoBtn.vue')['default']
IconModifyBtn: typeof import('./src/components/atoms/button/IconModifyBtn.vue')['default'] IconModifyBtn: typeof import('./src/components/atoms/button/IconModifyBtn.vue')['default']
IconRunBtn: typeof import('./src/components/atoms/button/IconRunBtn.vue')['default']
IconSettingBtn: typeof import('./src/components/atoms/button/IconSettingBtn.vue')['default'] IconSettingBtn: typeof import('./src/components/atoms/button/IconSettingBtn.vue')['default']
LayoutComponent: typeof import('./src/components/common/LayoutComponent.vue')['default'] LayoutComponent: typeof import('./src/components/common/LayoutComponent.vue')['default']
ListComponent: typeof import('./src/components/home/ListComponent.vue')['default'] ListComponent: typeof import('./src/components/templates/Datasets/ListComponent.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink'] RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView'] RouterView: typeof import('vue-router')['RouterView']
SidebarHeader: typeof import('./src/components/common/SidebarHeader.vue')['default']
StapComfigDialog: typeof import('./src/components/atoms/organisms/StapComfigDialog.vue')['default'] StapComfigDialog: typeof import('./src/components/atoms/organisms/StapComfigDialog.vue')['default']
StepComfigDialog: typeof import('./src/components/atoms/organisms/StepComfigDialog.vue')['default']
TrainingScriptBaseDoalog: typeof import('./src/components/atoms/organisms/TrainingScriptBaseDoalog.vue')['default'] TrainingScriptBaseDoalog: typeof import('./src/components/atoms/organisms/TrainingScriptBaseDoalog.vue')['default']
ViewComponent: typeof import('./src/components/templates/Datasets/ViewComponent.vue')['default'] ViewComponent: typeof import('./src/components/templates/Datasets/ViewComponent.vue')['default']
WorkflowDialog: typeof import('./src/components/atoms/organisms/WorkflowDialog.vue')['default'] WorkflowDialog: typeof import('./src/components/atoms/organisms/WorkflowDialog.vue')['default']
WorkflowsBaseDialog: typeof import('./src/components/atoms/organisms/WorkflowsBaseDialog.vue')['default'] WorkflowsBaseDialog: typeof import('./src/components/atoms/organisms/WorkflowsBaseDialog.vue')['default']
WorkflowsCreateDialog: typeof import('./src/components/atoms/organisms/WorkflowsCreateDialog.vue')['default'] WorkflowsCreateDialog: typeof import('./src/components/atoms/organisms/WorkflowsCreateDialog.vue')['default']
WorkflowsRunDialog: typeof import('./src/components/atoms/organisms/WorkflowsRunDialog.vue')['default']
WorkflowsRunsDialog: typeof import('./src/components/atoms/organisms/WorkflowsRunsDialog.vue')['default']
WorkflowsUploadDialog: typeof import('./src/components/atoms/organisms/WorkflowsUploadDialog.vue')['default'] WorkflowsUploadDialog: typeof import('./src/components/atoms/organisms/WorkflowsUploadDialog.vue')['default']
WorklfowStepBaseDialog: typeof import('./src/components/atoms/organisms/WorklfowStepBaseDialog.vue')['default']
} }
} }

@ -0,0 +1,27 @@
<script setup>
import { defineEmits } from "vue";
const emit = defineEmits(["onClick"]);
const onClick = () => {
emit("onClick");
};
</script>
<template>
<v-tooltip location="bottom" text="실행">
<template v-slot:activator="{ props }">
<v-btn
@click="onClick"
class="ma-1"
icon="mdi-cog-play-outline"
color="success"
density="comfortable"
elevation="0"
size="small"
v-bind="props"
>
</v-btn>
</template>
</v-tooltip>
</template>

@ -0,0 +1,198 @@
<script setup lang="ts">
import { computed, ref, watch, onMounted, onBeforeUnmount } from "vue";
import { storeToRefs } from "pinia";
import { useAutoflowStore } from "@/stores/autoflowStore";
import { AttachmentsService } from "@/components/service/management/attachmentsService";
import type { AxiosError } from "axios";
const props = defineProps<{ editData: any; mode: "create" | "edit" }>();
const emit = defineEmits<{
(e: "close-modal"): void;
(e: "saved", v: any): void;
}>();
const isEdit = computed(() => props.mode === "edit");
const { projectId } = storeToRefs(useAutoflowStore());
const saving = ref(false);
const errorMsg = ref("");
const form = ref({
name: "",
description: "",
file: null as any, // File | File[] | null
});
function hydrateFormFromEdit(d: any) {
if (!d) return;
form.value.name = (d?.name ?? d?.title ?? "") + "";
form.value.description = (d?.description ?? "") + "";
}
onMounted(() => {
if (isEdit.value) hydrateFormFromEdit(props.editData);
});
watch(
() => props.editData,
(v) => {
if (isEdit.value) hydrateFormFromEdit(v);
},
);
const dialogTitle = computed(() =>
isEdit.value ? "Edit Training Script" : "Create Training Script",
);
//
const regUserId = (() => {
try {
const raw = localStorage.getItem("autoflow-auth") || "{}";
const auth = JSON.parse(raw);
return (
auth?.userInfo?.username ??
auth?.userinfo?.username ??
auth?.username ??
auth?.userId ??
""
);
} catch {
return "";
}
})();
//
async function submit() {
errorMsg.value = "";
const title = (form.value.name || "").trim();
const desc = (form.value.description || "").trim();
const fileObj = Array.isArray(form.value.file)
? form.value.file[0]
: form.value.file;
if (!title) return (errorMsg.value = "Training Script Title은 필수입니다.");
if (!regUserId)
return (errorMsg.value = "로그인 사용자 정보를 찾을 수 없습니다.");
try {
saving.value = true;
if (isEdit.value) {
if (!fileObj) return (errorMsg.value = "수정할 새 파일을 선택해주세요.");
const fd = new FormData();
fd.append("title", title);
fd.append("description", desc);
fd.append("regUserId", regUserId);
fd.append("projectId", String(projectId.value));
fd.append("file", fileObj);
const id = props.editData?.id ?? props.editData?.deviceKey;
await AttachmentsService.update(id, fd as any);
} else {
if (!fileObj) return (errorMsg.value = "업로드할 파일을 선택해주세요.");
if (!projectId.value)
return (errorMsg.value = "프로젝트가 선택되지 않았습니다.");
const fd = new FormData();
fd.append("refId", "0");
fd.append("refType", "DATASET");
fd.append("title", title);
fd.append("description", desc);
fd.append("version", "1");
fd.append("regUserId", regUserId);
fd.append("projectId", String(projectId.value));
fd.append("file", fileObj);
await AttachmentsService.upload(fd as any);
}
emit("saved", { ok: true });
emit("close-modal");
} catch (e) {
console.error("[Dataset] 저장 실패:", e as AxiosError);
errorMsg.value = "저장에 실패했습니다. 잠시 후 다시 시도하세요.";
} finally {
saving.value = false;
}
}
function onEsc(e: KeyboardEvent) {
if (e.key === "Escape") emit("close-modal");
}
onMounted(() => window.addEventListener("keydown", onEsc));
onBeforeUnmount(() => window.removeEventListener("keydown", onEsc));
</script>
<template>
<v-card class="rounded-lg overflow-hidden">
<v-card-title
class="text-white font-weight-bold text-h6"
style="background-color: #1976d2"
>
{{ dialogTitle }}
</v-card-title>
<v-card-text class="pa-6">
<v-form @submit.prevent="submit">
<div class="mb-5">
<label class="text-subtitle-2 font-weight-medium mb-1 d-block"
>Training Script Title</label
>
<v-text-field
v-model="form.name"
variant="outlined"
:disabled="saving"
dense
hide-details
required
/>
</div>
<div class="mb-5">
<label class="text-subtitle-2 font-weight-medium mb-1 d-block"
>Description</label
>
<v-text-field
v-model="form.description"
variant="outlined"
:disabled="saving"
dense
hide-details
required
/>
</div>
<div class="mb-5">
<label class="text-subtitle-2 font-weight-medium mb-1 d-block"
>File</label
>
<v-file-input
v-model="form.file"
label="Upload File"
:disabled="saving"
outlined
dense
hide-details
:required="true"
/>
</div>
<div v-if="errorMsg" class="mt-3 text-error">{{ errorMsg }}</div>
</v-form>
</v-card-text>
<v-card-actions class="justify-end" style="padding: 16px 24px">
<v-btn color="success" :loading="saving" @click="submit">
{{ isEdit ? "Update" : "Save" }}
</v-btn>
<v-btn
text
class="white--text"
:disabled="saving"
@click="$emit('close-modal')"
>
Close
</v-btn>
</v-card-actions>
</v-card>
</template>

@ -1,110 +0,0 @@
<script setup lang="ts">
import { computed, ref, watch } from "vue";
const props = defineProps({
editData: Object,
mode: String,
userOption: Array,
});
const emit = defineEmits(["handle-data", "close-modal"]);
const visible = ref(true);
const fileInput = ref<HTMLInputElement | null>(null);
const form = ref({
name: "",
description: "",
file: "",
});
//
const dialogTitle = computed(() => {
if (props.mode === "create") return "Create Dataset";
if (props.mode === "edit") return "Edit Dataset";
return "Clone Execution";
});
const onChooseFile = () => {
fileInput.value?.click();
};
const submit = () => {
emit("handle-data", form.value);
};
</script>
<template>
<v-card class="rounded-lg overflow-hidden">
<!-- 타이틀 영역 -->
<v-card-title
class="text-white font-weight-bold text-h6"
style="background-color: #1976d2"
>
{{ dialogTitle }}
</v-card-title>
<v-card-text class="pa-6">
<v-form @submit.prevent="submit">
<v-row dense class="mb-6">
<v-col cols="6">
<v-subheader class="font-weight-medium white--text mb-2">
Dataset Title
</v-subheader>
<v-text-field
v-model="form.name"
variant="outlined"
dense
hide-details
outlined
style="background: #1e1e1e; color: #fff"
/>
</v-col>
<v-col cols="6">
<v-subheader class="font-weight-medium white--text mb-2">
Dataset Version
</v-subheader>
<v-text-field
variant="outlined"
dense
hide-details
outlined
style="background: #1e1e1e; color: #fff"
/>
</v-col>
</v-row>
<div class="mb-5">
<label class="text-subtitle-2 font-weight-medium mb-1 d-block"
>Description
</label>
<v-text-field
v-model="form.description"
variant="outlined"
dense
hide-details
required
/>
</div>
<div class="mb-5">
<label class="text-subtitle-2 font-weight-medium mb-1 d-block"
>Upload File
</label>
<v-file-input
v-model="form.file"
label="Upload File"
@click:append-outer="onChooseFile"
outlined
dense
hide-details
/>
</div>
</v-form>
</v-card-text>
<v-card-actions class="justify-end" style="padding: 16px 24px">
<v-btn color="success" @click="submit">Save</v-btn>
<v-btn text class="white--text" @click="$emit('close-modal')"
>Close</v-btn
>
</v-card-actions>
</v-card>
</template>

@ -1,29 +1,170 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, watch } from "vue"; import { onBeforeUnmount, onMounted, ref, watch } from "vue";
import { ExperimentService } from "@/components/service/management/ExperimentService";
import { ExperimentCreateDto } from "@/components/models/management/Experiments";
import type { AxiosError } from "axios"; //
const props = defineProps({ type SelectedData = {
editData: Object, name?: string;
mode: String, description?: string;
userOption: Array, username?: string;
}); projectId?: number | null;
};
const props = defineProps<{
editData: SelectedData | null;
mode: "create" | "edit";
}>();
const emit = defineEmits(["handle-data", "close-modal"]); const emit = defineEmits<{
(e: "close-modal"): void;
(e: "saved", v: any): void;
}>();
const visible = ref(true); const saving = ref(false);
const errorMsg = ref("");
const form = ref({ const form = ref({
name: "", name: "",
description: "", description: "",
regUserId: "",
projectId: null as number | null,
}); });
const submit = () => { //
emit("handle-data", form.value); watch(
() => props.editData,
(v) => {
form.value.name = v?.name ?? "";
form.value.description = v?.description ?? "";
form.value.regUserId = v?.username ?? "";
form.value.projectId = v?.projectId ?? null;
},
{ immediate: true },
);
const nowIso = () => new Date().toISOString();
/** ✅ 에러를 사용자 친화적으로 변환 */
function parseApiError(err: unknown): string {
const ax = err as AxiosError<any>;
// /
if (!ax?.response) {
if ((ax as any)?.code === "ECONNABORTED")
return "요청 시간이 초과되었습니다. 잠시 후 다시 시도해 주세요.";
return "네트워크 오류가 발생했습니다. 연결 상태를 확인해 주세요.";
}
const { status, data } = ax.response;
const serverMsg = (
data?.message ||
data?.error ||
data?.detail ||
data?.msg ||
""
).toString();
// (409 )
if (status === 409 || /duplicate|exists|이미.*존재|중복/i.test(serverMsg)) {
return "동일한 이름의 Experiment가 이미 존재합니다. 다른 이름을 사용해 주세요.";
}
// (400/422) -
if (status === 400 || status === 422) {
const fieldErrors =
data?.errors || data?.fieldErrors || data?.validationErrors;
if (Array.isArray(fieldErrors) && fieldErrors.length) {
const f = fieldErrors[0];
if (typeof f === "string") return f;
if (f?.defaultMessage) return f.defaultMessage;
if (f?.message) return f.message;
if (f?.field && f?.error) return `${f.field}: ${f.error}`;
}
if (serverMsg) return serverMsg;
return "입력값이 올바르지 않습니다. 필수 항목을 확인해 주세요.";
}
// /
if (status === 401) return "로그인이 필요합니다.";
if (status === 403) return "이 작업에 대한 권한이 없습니다.";
//
if (status === 404) return "대상을 찾을 수 없습니다.";
// /
if (status === 413) return "요청 용량 제한을 초과했습니다.";
//
if (status >= 500)
return (
serverMsg || "서버 내부 오류가 발생했습니다. 관리자에게 문의해 주세요."
);
return serverMsg || "요청 처리 중 오류가 발생했습니다.";
}
async function submit() {
errorMsg.value = "";
const name = (form.value.name || "").trim();
const description = (form.value.description || "").trim();
const regUserId = (form.value.regUserId || "").trim();
const projectId = Number(form.value.projectId);
if (!name) {
errorMsg.value = "Experiment Name은 필수입니다.";
return;
}
if (!regUserId) {
errorMsg.value = "로그인 사용자(regUserId) 정보를 찾을 수 없습니다.";
return;
}
if (!Number.isFinite(projectId) || projectId <= 0) {
errorMsg.value = "프로젝트가 선택되지 않았습니다.";
return;
}
const now = nowIso();
const payload: ExperimentCreateDto = {
kubeFlowId: null,
mlFlowId: null,
name,
displayName: name,
description,
artifactLocation: null,
lifecycleStage: "active",
storageState: "available",
kubeflowCreatedAt: null,
mlflowCreatedAt: null,
lastUpdateTime: null,
lastRunCreatedAt: null,
regUserId,
projectId,
}; };
try {
saving.value = true;
const res = await ExperimentService.add(payload);
emit("saved", res?.data ?? { ok: true });
emit("close-modal");
} catch (e) {
console.error("[Experiment] 저장 실패:", e);
errorMsg.value = parseApiError(e); //
} finally {
saving.value = false;
}
}
function onEsc(e: KeyboardEvent) {
if (e.key === "Escape") emit("close-modal");
}
onMounted(() => window.addEventListener("keydown", onEsc));
onBeforeUnmount(() => window.removeEventListener("keydown", onEsc));
</script> </script>
<template> <template>
<v-card class="rounded-lg overflow-hidden"> <v-card class="rounded-lg overflow-hidden">
<!-- 타이틀 영역 -->
<v-card-title <v-card-title
class="text-white font-weight-bold text-h6" class="text-white font-weight-bold text-h6"
style="background-color: #1976d2" style="background-color: #1976d2"
@ -40,13 +181,14 @@ const submit = () => {
<v-text-field <v-text-field
v-model="form.name" v-model="form.name"
variant="outlined" variant="outlined"
:disabled="saving"
dense dense
hide-details hide-details
required required
/> />
</div> </div>
<div> <div class="mb-5">
<label class="text-subtitle-2 font-weight-medium mb-1 d-block" <label class="text-subtitle-2 font-weight-medium mb-1 d-block"
>Description</label >Description</label
> >
@ -54,16 +196,29 @@ const submit = () => {
v-model="form.description" v-model="form.description"
variant="outlined" variant="outlined"
rows="3" rows="3"
:disabled="saving"
dense dense
hide-details hide-details
/> />
</div> </div>
<div v-if="errorMsg" class="mt-3 text-error">{{ errorMsg }}</div>
</v-form> </v-form>
</v-card-text> </v-card-text>
<v-card-actions class="justify-end" style="padding: 16px 24px"> <v-card-actions class="justify-end" style="padding: 16px 24px">
<v-btn color="success" @click="submit">Save</v-btn> <v-btn
<v-btn text class="white--text" @click="$emit('close-modal')" color="success"
:loading="saving"
:disabled="saving"
@click="submit"
>Save</v-btn
>
<v-btn
text
class="white--text"
:disabled="saving"
@click="$emit('close-modal')"
>Close</v-btn >Close</v-btn
> >
</v-card-actions> </v-card-actions>

@ -1,99 +0,0 @@
<script setup lang="ts">
import { ref, watch, defineProps, defineEmits } from "vue";
// Props
const props = defineProps<{
modelValue: boolean;
selectedData: { workflow: string; stepName: string } | null;
workflowList: string[];
}>();
// v-model save Emit
const emit = defineEmits<{
(e: "update:modelValue", value: boolean): void;
(e: "save", payload: { workflow: string; stepName: string }): void;
}>();
//
const internalWorkflow = ref(props.selectedData?.workflow || "");
const internalStepName = ref(props.selectedData?.stepName || "");
//
watch(
() => props.modelValue,
(open) => {
if (open && props.selectedData) {
internalWorkflow.value = props.selectedData.workflow;
internalStepName.value = props.selectedData.stepName;
}
},
);
// Save
const onSave = () => {
emit("save", {
workflow: internalWorkflow.value,
stepName: internalStepName.value,
});
emit("update:modelValue", false);
};
// Close
const onClose = () => {
emit("update:modelValue", false);
};
</script>
<template>
<v-card class="rounded-lg overflow-hidden">
<!-- 타이틀 -->
<v-card-title
class="text-white font-weight-bold text-h6"
style="background-color: #1976d2"
>Edit Workflow Step Config</v-card-title
>
<!-- 본문 -->
<v-card-text class="pt-6 px-6 pb-4">
<!-- Select Workflow -->
<v-row class="mb-6" dense>
<v-col cols="12" sm="4">
<div class="font-weight-medium white--text">Select Workflow</div>
</v-col>
<v-col cols="12">
<v-select
v-model="internalWorkflow"
:items="workflowList"
dense
hide-details
placeholder="Select Workflow"
style="background: #1e1e1e; color: #fff"
/>
</v-col>
</v-row>
<!-- Workflow Step Name -->
<v-row class="mb-6" dense>
<v-col cols="12">
<div class="font-weight-medium white--text mb-2">
Workflow Step Name
</div>
<v-text-field
v-model="internalStepName"
dense
hide-details
placeholder="Enter Workflow Step"
style="background: #1e1e1e; color: #fff"
/>
</v-col>
</v-row>
</v-card-text>
<!-- 액션 버튼 -->
<v-card-actions class="justify-end" style="padding: 16px 24px">
<v-btn color="success" @click="onSave">Save</v-btn>
<v-btn text class="white--text" @click="onClose">Close</v-btn>
</v-card-actions>
</v-card>
</template>

@ -1,40 +1,131 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, ref, watch } from "vue"; import { computed, ref, watch, onMounted, onBeforeUnmount } from "vue";
import { storeToRefs } from "pinia";
import { useAutoflowStore } from "@/stores/autoflowStore";
import { AttachmentsService } from "@/components/service/management/attachmentsService";
import type { AxiosError } from "axios";
const props = defineProps({ const props = defineProps<{ editData: any; mode: "create" | "edit" }>();
editData: Object, const emit = defineEmits<{
mode: String, (e: "close-modal"): void;
userOption: Array, (e: "saved", v: any): void;
}); }>();
const emit = defineEmits(["handle-data", "close-modal"]); const isEdit = computed(() => props.mode === "edit");
const { projectId } = storeToRefs(useAutoflowStore());
const saving = ref(false);
const errorMsg = ref("");
const visible = ref(true);
const fileInput = ref<HTMLInputElement | null>(null);
const form = ref({ const form = ref({
name: "", name: "",
description: "", description: "",
file: "", file: null as any,
}); });
// function hydrateFormFromEdit(d: any) {
const dialogTitle = computed(() => { if (!d) return;
if (props.mode === "create") return "Create Training Script"; form.value.name = (d?.name ?? d?.title ?? "") + "";
if (props.mode === "edit") return "Edit Training Script"; form.value.description = (d?.description ?? "") + "";
return "Clone Execution"; }
onMounted(() => {
if (isEdit.value) hydrateFormFromEdit(props.editData);
}); });
watch(
() => props.editData,
(v) => {
if (isEdit.value) hydrateFormFromEdit(v);
},
);
const dialogTitle = computed(() =>
isEdit.value ? "Edit Training Script" : "Create Training Script",
);
//
const regUserId = (() => {
try {
const raw = localStorage.getItem("autoflow-auth") || "{}";
const auth = JSON.parse(raw);
return (
auth?.userInfo?.username ??
auth?.userinfo?.username ??
auth?.username ??
auth?.userId ??
""
);
} catch {
return "";
}
})();
//
async function submit() {
errorMsg.value = "";
const title = (form.value.name || "").trim();
const desc = (form.value.description || "").trim();
const fileObj = Array.isArray(form.value.file)
? form.value.file[0]
: form.value.file;
if (!title) return (errorMsg.value = "Training Script Title은 필수입니다.");
if (!regUserId)
return (errorMsg.value = "로그인 사용자 정보를 찾을 수 없습니다.");
try {
saving.value = true;
if (isEdit.value) {
// : file required
if (!fileObj) return (errorMsg.value = "수정할 새 파일을 선택해주세요.");
const onChooseFile = () => { const fd = new FormData();
fileInput.value?.click(); fd.append("title", title);
}; fd.append("description", desc);
const submit = () => { fd.append("regUserId", regUserId);
emit("handle-data", form.value); fd.append("projectId", String(projectId.value));
}; fd.append("file", fileObj);
const id = props.editData?.id ?? props.editData?.deviceKey;
await AttachmentsService.update(id, fd as any);
} else {
if (!fileObj) return (errorMsg.value = "업로드할 파일을 선택해주세요.");
if (!projectId.value)
return (errorMsg.value = "프로젝트가 선택되지 않았습니다.");
const fd = new FormData();
fd.append("refId", "0");
fd.append("refType", "TRAINING_SCRIPT");
fd.append("title", title);
fd.append("description", desc);
fd.append("version", "1");
fd.append("regUserId", regUserId);
fd.append("projectId", String(projectId.value));
fd.append("file", fileObj);
await AttachmentsService.upload(fd as any);
}
emit("saved", { ok: true });
emit("close-modal");
} catch (e) {
console.error("[Training Script] 저장 실패:", e as AxiosError);
errorMsg.value = "저장에 실패했습니다. 잠시 후 다시 시도하세요.";
} finally {
saving.value = false;
}
}
function onEsc(e: KeyboardEvent) {
if (e.key === "Escape") emit("close-modal");
}
onMounted(() => window.addEventListener("keydown", onEsc));
onBeforeUnmount(() => window.removeEventListener("keydown", onEsc));
</script> </script>
<template> <template>
<v-card class="rounded-lg overflow-hidden"> <v-card class="rounded-lg overflow-hidden">
<!-- 타이틀 영역 -->
<v-card-title <v-card-title
class="text-white font-weight-bold text-h6" class="text-white font-weight-bold text-h6"
style="background-color: #1976d2" style="background-color: #1976d2"
@ -46,49 +137,63 @@ const submit = () => {
<v-form @submit.prevent="submit"> <v-form @submit.prevent="submit">
<div class="mb-5"> <div class="mb-5">
<label class="text-subtitle-2 font-weight-medium mb-1 d-block" <label class="text-subtitle-2 font-weight-medium mb-1 d-block"
>Training Script Title >Training Script Title</label
</label> >
<v-text-field <v-text-field
v-model="form.name" v-model="form.name"
variant="outlined" variant="outlined"
:disabled="saving"
dense dense
hide-details hide-details
required required
/> />
</div> </div>
<div class="mb-5"> <div class="mb-5">
<label class="text-subtitle-2 font-weight-medium mb-1 d-block" <label class="text-subtitle-2 font-weight-medium mb-1 d-block"
>File >Description</label
</label> >
<v-file-input <v-text-field
v-model="form.file" v-model="form.description"
label="Upload File" variant="outlined"
@click:append-outer="onChooseFile" :disabled="saving"
outlined
dense dense
hide-details hide-details
required
/> />
</div> </div>
<div class="mb-5"> <div class="mb-5">
<label class="text-subtitle-2 font-weight-medium mb-1 d-block" <label class="text-subtitle-2 font-weight-medium mb-1 d-block"
>Description >File</label
</label> >
<v-text-field <v-file-input
v-model="form.description" v-model="form.file"
variant="outlined" label="Upload File"
:disabled="saving"
outlined
dense dense
hide-details hide-details
required :required="true"
/> />
</div> </div>
<div v-if="errorMsg" class="mt-3 text-error">{{ errorMsg }}</div>
</v-form> </v-form>
</v-card-text> </v-card-text>
<v-card-actions class="justify-end" style="padding: 16px 24px"> <v-card-actions class="justify-end" style="padding: 16px 24px">
<v-btn color="success" @click="submit">Save</v-btn> <v-btn color="success" :loading="saving" @click="submit">
<v-btn text class="white--text" @click="$emit('close-modal')" {{ isEdit ? "Update" : "Save" }}
>Close</v-btn </v-btn>
<v-btn
text
class="white--text"
:disabled="saving"
@click="$emit('close-modal')"
> >
Close
</v-btn>
</v-card-actions> </v-card-actions>
</v-card> </v-card>
</template> </template>

@ -4,18 +4,22 @@ import IconArrowUp from "@/components/atoms/button/IconArrowUp.vue";
import IconDeleteBtn from "@/components/atoms/button/IconDeleteBtn.vue"; import IconDeleteBtn from "@/components/atoms/button/IconDeleteBtn.vue";
import IconModifyBtn from "@/components/atoms/button/IconModifyBtn.vue"; import IconModifyBtn from "@/components/atoms/button/IconModifyBtn.vue";
import { computed, onBeforeUnmount, onMounted, watch, ref } from "vue"; import { computed, onBeforeUnmount, onMounted, watch, ref } from "vue";
import { AutoflowService } from "@/components/service/management/AutoflowService"; import { WorkflowService } from "@/components/service/management/workflowService";
import { storage } from "@/utils/storage"; import { storage } from "@/utils/storage";
import type { Workflow } from "@/components/models/management/Autoflow"; import type { Workflow } from "@/components/models/management/Workflow";
import { storeToRefs } from "pinia"; import { storeToRefs } from "pinia";
import { useAutoflowStore } from "@/stores/autoflowStore"; import { useAutoflowStore } from "@/stores/autoflowStore";
import { kubeflowService } from "@/components/service/management/kubeflowService";
import {
toKubeflowForm,
type KubeflowUploadDto,
} from "@/components/models/management/Kubeflow";
const { projectId } = storeToRefs(useAutoflowStore()); const { projectId } = storeToRefs(useAutoflowStore());
const props = defineProps<{ const props = defineProps<{
editData?: any; editData: any;
mode?: "create" | "edit"; mode: "create" | "edit";
userOption?: any[];
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
@ -28,6 +32,77 @@ const isEdit = computed(() => props.mode === "edit");
const saving = ref(false); const saving = ref(false);
const errorMsg = ref(""); const errorMsg = ref("");
// ====== KFP & ======
const KFP_NAME_REGEX = /^[a-z0-9]([-a-z0-9\.]*[a-z0-9])?$/; // //.-, /
const sanitizeKfpName = (s: string) => {
let x = (s ?? "").toLowerCase();
x = x.replace(/[\s_]+/g, "-"); // / ->
x = x.replace(/[^a-z0-9.-]/g, ""); // ( )
x = x.replace(/-+/g, "-"); //
x = x.replace(/^[^a-z0-9]+/, ""); //
x = x.replace(/[^a-z0-9]+$/, ""); //
return x;
};
// /
const nameHint = ref(
"허용 문자: 소문자 az, 숫자 09, '-', '.' (시작/끝은 영숫자). 한글/공백/대문자/언더스코어 불가",
);
const nameInvalid = computed(
() => !!form.value.name && !KFP_NAME_REGEX.test(form.value.name),
);
const nameErrorMsg = computed(() =>
nameInvalid.value
? "형식이 올바르지 않습니다. (소문자/숫자, '-', '.', 시작/끝은 영숫자)"
: "",
);
//
function onNameInput(v: string) {
const cleaned = sanitizeKfpName(v || "");
if (cleaned !== v) {
nameHint.value = "허용되지 않는 문자는 자동으로 제거됩니다.";
} else {
nameHint.value =
"허용 문자: 소문자 az, 숫자 09, '-', '.' (시작/끝은 영숫자)";
}
form.value.name = cleaned;
}
function extractApiErrorMessage(err: any): string {
const status = err?.response?.status;
const data = err?.response?.data;
const raw =
(typeof data === "string"
? data
: data?.message || data?.error || data?.detail) ||
err?.message ||
"";
const text = String(raw);
if (
status === 409 ||
/already\s*exists|duplicate|이미 존재|중복/i.test(text)
) {
return "같은 이름의 파이프라인이 이미 존재합니다. 다른 이름으로 등록해주세요.";
}
if (status === 400 && /name|display[_ ]?name|invalid/i.test(text)) {
return "이름(name)이 유효하지 않습니다. 공백/특수문자 여부를 확인해주세요.";
}
if (status === 401 || status === 403) {
return "권한이 없거나 로그인 정보가 만료되었습니다. 다시 로그인 후 시도하세요.";
}
if (status === 413 || /file too large|payload too large|size/i.test(text)) {
return "업로드 파일 용량이 너무 큽니다.";
}
if (status === 500 && /InvalidUrl|Bad authority|host/i.test(text)) {
return "서버 설정 오류로 업로드에 실패했습니다. (관리자에게 KFP URL 설정 점검을 요청하세요)";
}
return text || `요청에 실패했습니다. (HTTP ${status ?? "Error"})`;
}
const steps = ref([ const steps = ref([
{ order: 1, stepName: "Data Load", type: "DataPrep", status: "Configured" }, { order: 1, stepName: "Data Load", type: "DataPrep", status: "Configured" },
{ {
@ -48,15 +123,16 @@ const steps = ref([
const form = ref({ const form = ref({
name: "", name: "",
description: "", description: "",
file: null as File | null,
}); });
/** props.editData -> form 바인딩 */ /** props.editData -> form 바인딩 */
function hydrateFormFromEdit(data: any) { function hydrateFormFromEdit(data: any) {
if (!data) return; if (!data) return;
// , /
form.value.name = data.workflowName ?? data.name ?? ""; form.value.name = data.workflowName ?? data.name ?? "";
form.value.description = data.workflowDescription ?? data.description ?? ""; form.value.description = data.workflowDescription ?? data.description ?? "";
} }
onMounted(() => { onMounted(() => {
if (isEdit.value) hydrateFormFromEdit(props.editData); if (isEdit.value) hydrateFormFromEdit(props.editData);
}); });
@ -66,7 +142,9 @@ watch(
if (isEdit.value) hydrateFormFromEdit(v); if (isEdit.value) hydrateFormFromEdit(v);
}, },
); );
function onDescInput(v: string) {
form.value.description = v ?? "";
}
/** 시간 포맷 */ /** 시간 포맷 */
const nowLocalIso = (): string => { const nowLocalIso = (): string => {
const t = new Date(Date.now() - new Date().getTimezoneOffset() * 60000); const t = new Date(Date.now() - new Date().getTimezoneOffset() * 60000);
@ -75,10 +153,15 @@ const nowLocalIso = (): string => {
async function submit() { async function submit() {
errorMsg.value = ""; errorMsg.value = "";
const name = form.value.name.trim();
if (!name) { // &
errorMsg.value = "Workflow Name은 필수입니다."; form.value.name = sanitizeKfpName(form.value.name);
form.value.description = (form.value.description ?? "").trim();
const name = form.value.name.trim();
if (!name || !KFP_NAME_REGEX.test(name)) {
errorMsg.value =
"Workflow Name 형식이 올바르지 않습니다. (소문자/숫자, '-', '.', 시작/끝은 영숫자)";
return; return;
} }
@ -86,7 +169,6 @@ async function submit() {
const authObj = const authObj =
(typeof storage?.getAuth === "function" ? storage.getAuth() : null) ?? (typeof storage?.getAuth === "function" ? storage.getAuth() : null) ??
JSON.parse(localStorage.getItem("autoflow-auth") || "{}"); JSON.parse(localStorage.getItem("autoflow-auth") || "{}");
const regUserId = const regUserId =
authObj?.userInfo?.username ?? authObj?.userInfo?.username ??
authObj?.userinfo?.username ?? authObj?.userinfo?.username ??
@ -98,48 +180,86 @@ async function submit() {
errorMsg.value = "로그인 사용자 정보를 찾을 수 없습니다."; errorMsg.value = "로그인 사용자 정보를 찾을 수 없습니다.";
return; return;
} }
if (!projectId.value) {
errorMsg.value = "프로젝트가 선택되지 않았습니다.";
return;
}
const now = nowLocalIso(); const now = nowLocalIso();
const payload: Workflow = {
workflowName: name,
workflowDescription: form.value.description?.trim() || "",
uploadYn: "Y",
regUserId,
regDt: now,
modDt: now,
projectId: projectId.value,
};
try { try {
saving.value = true; saving.value = true;
if (isEdit.value) { if (isEdit.value) {
// : id ( deviceKey id ) // ===== =====
const rawId = props.editData?.id ?? props.editData?.deviceKey; const rawId = props.editData?.id ?? props.editData?.deviceKey;
const id = Number(rawId); const id = Number(rawId);
if (!id) { if (!id) {
errorMsg.value = "수정할 ID가 없습니다."; errorMsg.value = "수정할 ID가 없습니다.";
return; return;
} }
const { data } = await AutoflowService.update(id, payload); //
const viewRes = await WorkflowService.view(id);
const current = (viewRes?.data ?? viewRes) || {};
// name/description , null
const updatePayload = cleanUndefined({
id,
name, //
description: form.value.description?.trim() || "", //
// ===== =====
displayName: current.displayName,
namespace: current.namespace,
pipelineId: current.pipelineId,
kubeflowStatus: current.kubeflowStatus,
version: current.version,
regUserId: current.regUserId ?? regUserId,
projectId: current.projectId ?? projectId.value,
regDt: current.regDt,
modDt: now,
});
const { data } = await WorkflowService.update(id, updatePayload);
emit("saved", data); emit("saved", data);
emit("close-modal"); emit("close-modal");
} else { } else {
// // ===== =====
const { data } = await AutoflowService.add(payload); if (!form.value.file) {
errorMsg.value = "업로드할 파일을 선택하세요.";
return;
}
const dto: KubeflowUploadDto = {
name,
display_name: name,
description: form.value.description?.trim() || "",
namespace: "default",
regUserId,
projectId: projectId.value!,
uploadfile: form.value.file,
};
const fd = toKubeflowForm(dto);
const { data } = await kubeflowService.upload(fd);
emit("saved", data); emit("saved", data);
emit("close-modal"); emit("close-modal");
} }
} catch (e) { } catch (e: any) {
console.error("워크플로우 저장 실패:", e); console.error("워크플로우 저장 실패:", e);
errorMsg.value = "저장에 실패했습니다. 잠시 후 다시 시도하세요."; errorMsg.value = extractApiErrorMessage(e);
} finally { } finally {
saving.value = false; saving.value = false;
} }
} }
/** undefined 필드는 제거해서 불필요한 키 전송 방지 */
function cleanUndefined<T extends Record<string, any>>(obj: T): T {
return Object.fromEntries(
Object.entries(obj).filter(([, v]) => v !== undefined),
) as T;
}
/** ESC로 닫기 */ /** ESC로 닫기 */
function onEsc(e: KeyboardEvent) { function onEsc(e: KeyboardEvent) {
if (e.key === "Escape") emit("close-modal"); if (e.key === "Escape") emit("close-modal");
@ -164,114 +284,75 @@ onBeforeUnmount(() => window.removeEventListener("keydown", onEsc));
</div> </div>
<v-form @submit.prevent="submit"> <v-form @submit.prevent="submit">
<!-- Name -->
<div class="mb-5"> <div class="mb-5">
<label class="text-subtitle-2 font-weight-medium mb-1 d-block" <label class="text-subtitle-2 font-weight-medium mb-1 d-block">
>Workflow Name</label Workflow Name
> </label>
<v-text-field <v-text-field
v-model="form.name" v-model="form.name"
variant="outlined" variant="outlined"
:disabled="saving" :disabled="saving"
dense dense
hide-details hide-details="auto"
persistent-hint
:hint="nameHint"
:error="nameInvalid"
:error-messages="nameErrorMsg"
@update:model-value="onNameInput"
required required
/> />
</div> </div>
<div> <!-- Description -->
<label class="text-subtitle-2 font-weight-medium mb-1 d-block" <div class="mb-5">
>Workflow Description</label <label class="text-subtitle-2 font-weight-medium mb-1 d-block">
> Workflow Description
</label>
<v-textarea <v-textarea
v-model="form.description" v-model="form.description"
variant="outlined" variant="outlined"
:disabled="saving" :disabled="saving"
rows="3" rows="3"
dense dense
hide-details hide-details="auto"
persistent-hint
@update:model-value="onDescInput"
/> />
</div> </div>
<div v-if="errorMsg" class="mt-3 text-error">{{ errorMsg }}</div> <!-- Upload File -->
</v-form> <div class="mb-5">
</v-card-text> <label class="text-subtitle-2 font-weight-medium mb-1 d-block">
Upload File
<v-card-text class="pt-6 pb-4 px-6"> </label>
<div class="text-subtitle-1 font-weight-medium mb-4">Workflow Steps</div> <v-file-input
v-model="form.file"
<v-row class="align-center mb-4"> accept=".zip,.tar,.gz,.yaml,.yml"
<v-col cols="auto" show-size
><v-btn color="primary" small :disabled="saving" variant="outlined"
><v-icon left>mdi-plus</v-icon> Add Step</v-btn
></v-col
>
<v-col cols="auto"
><v-btn color="success" small :loading="saving" @click="submit">{{
isEdit ? "Update" : "Save"
}}</v-btn></v-col
>
<v-col cols="auto"
><v-btn
color="grey"
small
:disabled="saving"
@click="$emit('close-modal')"
>Cancel</v-btn
></v-col
>
<v-spacer />
</v-row>
<v-simple-table dense>
<thead>
<tr class="grey lighten-2">
<th class="text-center" style="width: 5%">Order</th>
<th class="text-center">Step Name</th>
<th class="text-center">Component Type</th>
<th class="text-center">Status</th>
<th class="text-center" style="width: 20%">Action</th>
</tr>
</thead>
<tbody>
<tr
v-for="step in steps"
:key="step.order"
style="border: 1px solid #ccc"
>
<td class="text-center">{{ step.order }}</td>
<td class="text-center">{{ step.stepName }}</td>
<td class="d-flex justify-center align-center">
<v-select
v-model="step.type"
:items="['DataPrep', 'Preprocess', 'Train']"
dense dense
hide-details hide-details
style="max-width: 180px" placeholder="파이프라인 파일 선택"
/> />
</td> </div>
<td class="text-center">{{ step.status }}</td>
<td class="text-center"> <div v-if="errorMsg" class="mt-3 text-error">{{ errorMsg }}</div>
<IconArrowUp /> </v-form>
<IconArrowDown />
<IconModifyBtn />
<IconDeleteBtn />
</td>
</tr>
</tbody>
</v-simple-table>
</v-card-text> </v-card-text>
<v-card-actions class="justify-end" style="padding: 16px 24px"> <v-card-actions class="justify-end" style="padding: 16px 24px">
<v-btn color="success" :loading="saving" @click="submit">{{ <v-btn color="success" :loading="saving" @click="submit">
isEdit ? "Update" : "Save" {{ isEdit ? "Update" : "Save" }}
}}</v-btn> </v-btn>
<v-btn <v-btn
text text
class="white--text" class="white--text"
:disabled="saving" :disabled="saving"
@click="$emit('close-modal')" @click="$emit('close-modal')"
>Close</v-btn
> >
Close
</v-btn>
</v-card-actions> </v-card-actions>
</v-card> </v-card>
</template> </template>

@ -0,0 +1,158 @@
<script setup lang="ts">
import { computed, onMounted, onBeforeUnmount, ref, watch } from "vue";
import { kubeflowService } from "@/components/service/management/kubeflowService";
type RunPayload = {
display_name: string;
description?: string;
pipeline_version_reference: { pipeline_id: string };
runtime_config?: { parameters?: Record<string, any> };
service_account?: string;
};
const props = defineProps<{
/** 테이블에서 선택된 파이프라인의 pipelineId */
pipelineId?: string | number | null;
}>();
const emit = defineEmits<{
(e: "close-modal"): void;
(e: "submitted", value: any): void;
}>();
const form = ref({
display_name: "", //
description: "", //
pipeline_id: "", // prop ( )
});
const loading = ref(false);
const errorMsg = ref("");
const isValid = computed(
() => !!form.value.display_name.trim() && !!form.value.pipeline_id.trim(),
);
function initForm() {
form.value.pipeline_id = props.pipelineId ? String(props.pipelineId) : "";
// display_name/description
}
onMounted(initForm);
watch(() => props.pipelineId, initForm);
function onEsc(e: KeyboardEvent) {
if (e.key === "Escape" && !loading.value) emit("close-modal");
}
onMounted(() => window.addEventListener("keydown", onEsc));
onBeforeUnmount(() => window.removeEventListener("keydown", onEsc));
async function submitRun() {
errorMsg.value = "";
if (!isValid.value) {
errorMsg.value = "Run 제목(display_name)과 pipeline_id는 필수입니다.";
return;
}
const payload: RunPayload = {
display_name: form.value.display_name.trim(),
description: form.value.description?.trim(),
pipeline_version_reference: { pipeline_id: form.value.pipeline_id.trim() },
runtime_config: { parameters: {} }, //
service_account: "pipeline-runner",
};
try {
loading.value = true;
const { data } = await kubeflowService.run(payload);
emit("submitted", data);
emit("close-modal");
} catch (e: any) {
console.error("Run 생성 실패:", e);
const msg =
e?.response?.data?.message ||
e?.response?.data?.error ||
e?.message ||
"Run 생성에 실패했습니다.";
errorMsg.value = String(msg);
} finally {
loading.value = false;
}
}
</script>
<template>
<v-card>
<v-card-title
class="text-white font-weight-bold text-h6"
style="background-color: #1976d2"
>
Run Pipeline
</v-card-title>
<v-card-text class="pa-6">
<v-form @submit.prevent="submitRun">
<!-- 제목 -->
<div class="mb-4">
<label class="text-subtitle-2 font-weight-medium mb-1 d-block">
Run Title (display_name)
</label>
<v-text-field
v-model="form.display_name"
variant="outlined"
:disabled="loading"
density="comfortable"
hide-details="auto"
persistent-hint
required
/>
</div>
<!-- 내용 -->
<div class="mb-4">
<label class="text-subtitle-2 font-weight-medium mb-1 d-block">
Run Description
</label>
<v-textarea
v-model="form.description"
variant="outlined"
:disabled="loading"
rows="3"
density="comfortable"
hide-details="auto"
/>
</div>
<!-- pipeline_id -->
<div class="mb-2">
<label class="text-subtitle-2 font-weight-medium mb-1 d-block">
pipeline_id
</label>
<v-text-field
v-model="form.pipeline_id"
variant="outlined"
:disabled="true"
density="comfortable"
hide-details="auto"
required
/>
</div>
<div v-if="errorMsg" class="mt-3 text-error">{{ errorMsg }}</div>
</v-form>
</v-card-text>
<v-card-actions class="justify-end" style="padding: 16px 24px">
<v-btn
color="success"
:loading="loading"
:disabled="!isValid"
@click="submitRun"
>
RUN
</v-btn>
<v-btn text :disabled="loading" @click="$emit('close-modal')"
>CLOSE</v-btn
>
</v-card-actions>
</v-card>
</template>

@ -0,0 +1,249 @@
<script setup lang="ts">
import { computed, onBeforeUnmount, onMounted, ref, watch } from "vue";
import { storage } from "@/utils/storage";
import { storeToRefs } from "pinia";
import { useAutoflowStore } from "@/stores/autoflowStore";
import type { AxiosError } from "axios";
import { WorkflowStepService } from "@/components/service/management/workflowStepService";
import { WorkflowService } from "@/components/service/management/workflowService"; //
const props = defineProps<{ editData: any; mode: "create" | "edit" }>();
const emit = defineEmits<{
(e: "close-modal"): void;
(e: "saved", value: any): void;
}>();
const isEdit = computed(() => props.mode === "edit");
const { projectId } = storeToRefs(useAutoflowStore());
const saving = ref(false);
const errorMsg = ref("");
// ===== =====
const workflowsLoading = ref(false);
const workflowOptions = ref<Array<{ title: string; value: number }>>([]);
const selectedWorkflowId = ref<number | null>(null);
async function fetchWorkflows() {
try {
workflowsLoading.value = true;
// 1) /api/workflows () or 2) search (content)
const res =
(await (WorkflowService as any).list?.()) ??
(await (WorkflowService as any).search?.({ page: 0, size: 1000 }));
const raw = res?.data ?? res;
const list = Array.isArray(raw?.content)
? raw.content
: Array.isArray(raw)
? raw
: [];
const filtered = projectId.value
? list.filter((w: any) => Number(w.projectId) === Number(projectId.value))
: list;
workflowOptions.value = filtered.map((w: any) => ({
title:
(w.workflowName || w.name || `Workflow #${w.id}`) +
(w.version ? ` (v${w.version})` : ""),
value: Number(w.id),
}));
//
if (isEdit.value && selectedWorkflowId.value == null) {
const wid =
props.editData?.workflowStepId ??
props.editData?.workflowId ??
props.editData?.workflow?.id ??
null;
if (wid != null) selectedWorkflowId.value = Number(wid);
}
} catch (e) {
console.error("[Dialog] 워크플로우 목록 조회 실패:", e);
workflowOptions.value = [];
} finally {
workflowsLoading.value = false;
}
}
// ===== =====
type StepStatus = "Running" | "Success" | "Fail";
const form = ref({ stepName: "", status: "Running" as StepStatus });
function hydrateFormFromEdit(data: any) {
if (!data) return;
form.value.stepName = data?.stepName ?? data?.name ?? "";
form.value.status = (data?.status as StepStatus) ?? "Running";
// ( )
const wid =
data?.workflowStepId ?? data?.workflowId ?? data?.workflow?.id ?? null;
selectedWorkflowId.value = wid != null ? Number(wid) : null;
}
onMounted(() => {
if (isEdit.value) hydrateFormFromEdit(props.editData);
fetchWorkflows();
});
watch(
() => props.editData,
(v) => {
if (isEdit.value) hydrateFormFromEdit(v);
},
);
watch(projectId, () => fetchWorkflows());
const nowLocalIso = (): string => {
const t = new Date(Date.now() - new Date().getTimezoneOffset() * 60000);
return t.toISOString().slice(0, 23);
};
const regUserId = (() => {
try {
const authObj =
(typeof storage?.getAuth === "function" ? storage.getAuth() : null) ??
JSON.parse(localStorage.getItem("autoflow-auth") || "{}");
return (
authObj?.userInfo?.username ??
authObj?.userinfo?.username ??
authObj?.username ??
authObj?.userId ??
""
);
} catch {
return "";
}
})();
async function submit() {
errorMsg.value = "";
//
const stepName = form.value.stepName.trim();
if (!stepName) return (errorMsg.value = "Step Name은 필수입니다.");
if (!regUserId)
return (errorMsg.value = "로그인 사용자 정보를 찾을 수 없습니다.");
if (!projectId.value)
return (errorMsg.value = "프로젝트가 선택되지 않았습니다.");
if (!selectedWorkflowId.value)
return (errorMsg.value = "Workflow를 선택해주세요.");
const payload: any = {
stepName,
status: form.value.status,
regUserId,
regDt: nowLocalIso(),
version: 1,
projectId: projectId.value,
workflowStepId: selectedWorkflowId.value,
};
try {
saving.value = true;
if (isEdit.value) {
const rawId = props.editData?.id ?? props.editData?.deviceKey;
const id = Number(rawId);
if (!id) return (errorMsg.value = "수정할 ID가 없습니다.");
const { data } = await WorkflowStepService.update(id, payload);
emit("saved", data);
} else {
const { data } = await WorkflowStepService.add(payload);
emit("saved", data);
}
emit("close-modal");
} catch (e) {
console.error("워크플로우 스텝 저장 실패:", e as AxiosError);
errorMsg.value = "저장에 실패했습니다. 잠시 후 다시 시도하세요.";
} finally {
saving.value = false;
}
}
function onEsc(e: KeyboardEvent) {
if (e.key === "Escape") emit("close-modal");
}
onMounted(() => window.addEventListener("keydown", onEsc));
onBeforeUnmount(() => window.removeEventListener("keydown", onEsc));
</script>
<template>
<v-card>
<v-card-title
class="text-white font-weight-bold text-h6"
style="background-color: #1976d2"
>
{{ isEdit ? "Edit Workflow Step" : "Create Workflow Step" }}
</v-card-title>
<v-card-text class="pa-6">
<div class="text-subtitle-1 font-weight-medium mb-4">
Workflow Step Information
</div>
<v-form @submit.prevent="submit">
<!-- 워크플로우 드롭다운 -->
<div class="mb-5">
<label class="text-subtitle-2 font-weight-medium mb-1 d-block"
>Step Name</label
>
<v-text-field
v-model="form.stepName"
variant="outlined"
:disabled="saving"
dense
hide-details
required
/>
</div>
<div class="mb-5">
<label class="text-subtitle-2 font-weight-medium mb-1 d-block"
>Workflow</label
>
<v-select
v-model="selectedWorkflowId"
:items="workflowOptions"
item-title="title"
item-value="value"
variant="outlined"
:loading="workflowsLoading"
:disabled="saving || workflowsLoading"
dense
hide-details
placeholder="워크플로우를 선택하세요"
/>
</div>
<div class="mb-5">
<label class="text-subtitle-2 font-weight-medium mb-1 d-block"
>Status</label
>
<v-select
v-model="form.status"
:items="['Running', 'Success', 'Fail']"
variant="outlined"
:disabled="saving"
dense
hide-details
/>
</div>
<div v-if="errorMsg" class="mt-3 text-error">{{ errorMsg }}</div>
</v-form>
</v-card-text>
<v-card-actions class="justify-end" style="padding: 16px 24px">
<v-btn color="success" :loading="saving" @click="submit">{{
isEdit ? "Update" : "Save"
}}</v-btn>
<v-btn
text
class="white--text"
:disabled="saving"
@click="$emit('close-modal')"
>Close</v-btn
>
</v-card-actions>
</v-card>
</template>

@ -3,16 +3,21 @@ import { ref, onMounted, computed } from "vue";
import { useRoute, useRouter } from "vue-router"; import { useRoute, useRouter } from "vue-router";
import { menuUtils } from "@/utils/menuUtils"; import { menuUtils } from "@/utils/menuUtils";
import { storage } from "@/utils/storage"; import { storage } from "@/utils/storage";
import logo from "@/assets/iteration (1).png"; import SidebarHeader from "@/components/common/SidebarHeader.vue";
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
const isAdminRoute = computed(() =>
route.matched.some((r) => r.meta?.requiresAdmin),
);
const menuItems = computed(() =>
isAdminRoute.value ? menuUtils.adminMenuItem : menuUtils.menuItem,
);
const isShowAuth = ref(false); const isShowAuth = ref(false);
function readRolesFromStorage(): string[] { function readRolesFromStorage(): string[] {
try { try {
// storage.get(...) ,
const raw = const raw =
storage.get?.("autoflow-auth") ?? storage.get?.("autoflow-auth") ??
localStorage.getItem("autoflow-auth") ?? localStorage.getItem("autoflow-auth") ??
@ -20,8 +25,6 @@ function readRolesFromStorage(): string[] {
const auth = typeof raw === "string" ? JSON.parse(raw) : raw; const auth = typeof raw === "string" ? JSON.parse(raw) : raw;
let roles = auth?.userInfo?.roles ?? auth?.roles ?? []; let roles = auth?.userInfo?.roles ?? auth?.roles ?? [];
// "ROLE_USER,ROLE_ADMIN"
if (typeof roles === "string") { if (typeof roles === "string") {
roles = roles.split(",").map((s: string) => s.trim()); roles = roles.split(",").map((s: string) => s.trim());
} }
@ -33,7 +36,6 @@ function readRolesFromStorage(): string[] {
} }
} }
// ADMIN (ROLE_ADMIN ADMIN )
const isAdmin = computed(() => { const isAdmin = computed(() => {
const roles = readRolesFromStorage(); const roles = readRolesFromStorage();
return roles.some((r) => r === "ROLE_ADMIN" || r === "ADMIN"); return roles.some((r) => r === "ROLE_ADMIN" || r === "ADMIN");
@ -43,10 +45,6 @@ const isLinkActive = (link) => {
return route.path.includes(link); return route.path.includes(link);
}; };
const goMain = () => {
router.push("/home");
};
onMounted(() => { onMounted(() => {
isShowAuth.value = true; isShowAuth.value = true;
//storage.getAuth().auth === "ADMIN"; //storage.getAuth().auth === "ADMIN";
@ -55,19 +53,6 @@ onMounted(() => {
<template> <template>
<v-card flat class="mx-auto"> <v-card flat class="mx-auto">
<v-card
:ripple="false"
flat
class="bg-shades-transparent font-weight-bold d-flex w-100 justify-center text-h5 pa-4 pb-16"
@click="goMain"
>
<div class="d-flex flex-column align-center pt-6">
<v-img :src="logo" width="auto" height="36" class="mb-3" />
<div class="text-subtitle-2 font-weight-medium text-primary">
Autoflow Web Console
</div>
</div>
</v-card>
<v-list nav class="pa-5 pt-0"> <v-list nav class="pa-5 pt-0">
<template <template
v-for="({ title, value, icon, path, depth }, i) in menuUtils.menuItem" v-for="({ title, value, icon, path, depth }, i) in menuUtils.menuItem"
@ -100,7 +85,7 @@ onMounted(() => {
</template> </template>
<template v-else> <template v-else>
<v-list-item <v-list-item
v-if="value !== 'project' || isAdmin" v-if="value !== 'project'"
rounded rounded
:title="title" :title="title"
:value="value" :value="value"

@ -2,89 +2,91 @@
import { useRoute, useRouter } from "vue-router"; import { useRoute, useRouter } from "vue-router";
import { storage } from "@/utils/storage.js"; import { storage } from "@/utils/storage.js";
import DrawerComponent from "@/components/common/DrawerComponent.vue"; import DrawerComponent from "@/components/common/DrawerComponent.vue";
import { ref, watchEffect } from "vue"; import { ref, computed, onMounted, onBeforeUnmount, watch } from "vue";
import Select from "@/views/Select.vue";
import { UserManagerService } from "@/components/service/management/userManagerService"; import { UserManagerService } from "@/components/service/management/userManagerService";
import SidebarHeader from "@/components/common/SidebarHeader.vue";
import { storeToRefs } from "pinia";
import { useAutoflowStore } from "@/stores/autoflowStore";
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
const username = ref(""); const username = ref("");
const projectName = ref(localStorage.getItem("projectName") || "");
const autoflow = useAutoflowStore(); // ----------------------
const showPasswordModal = ref(false); // Admin + Admin
const selectedUserData = ref({}); // ----------------------
const isAdmin = ref(false); //
const adminMode = ref(false); //
const lastNonAdminPath = ref("/home"); //
const menu = ref([]); function computeIsAdmin() {
const projectName = ref(localStorage.getItem("projectName") || ""); try {
const updateUsername = () => { const raw =
// storage : { userInfo: { username, ... }, ... } typeof storage?.getAuth === "function"
const auth = storage.getAuth?.() ?? null; ? storage.getAuth()
username.value = : JSON.parse(localStorage.getItem("autoflow-auth") || "null");
auth?.userInfo?.username ??
auth?.username ?? //
""; //
};
const menuItems = [ const roles = raw?.userInfo?.roles ?? raw?.roles ?? [];
{ const authCd = raw?.userInfo?.authCd ?? raw?.authCd ?? raw?.auth;
title: "Select Project", const inRoles = Array.isArray(roles)
click: () => { ? roles.includes("ROLE_ADMIN")
goSelect(); : roles === "ROLE_ADMIN";
}, isAdmin.value = inRoles || authCd === "ADMIN";
}, } catch {
{ isAdmin.value = false;
title: "Change Password", }
click: () => { }
showPasswordModal.value = true;
},
},
{
title: "Logout",
icon: "mdi-logout",
click: () => {
logOut();
},
},
];
const userMenuItems = [ //
{ function toggleAdmin() {
title: "Select Project", if (!isAdmin.value) return;
}, if (adminMode.value) {
adminMode.value = false;
router.push(lastNonAdminPath.value || "/home");
} else {
adminMode.value = true;
if (!route.meta?.requiresAdmin) router.push("/project");
}
}
// ----------------------
//
// ----------------------
const menu = ref([]);
const menuItems = [
{ title: "Select Project", click: () => goSelect() },
{ {
title: "Change Password", title: "Change Password",
},
{
title: "Logout",
icon: "mdi-logout",
click: () => { click: () => {
logOut(); /* open modal */
}, },
}, },
{ title: "Logout", icon: "mdi-logout", click: () => logOut() },
]; ];
const drawer = ref(null); const drawer = ref(null);
const pageTitle = computed(() => { const pageTitle = computed(() => route.meta.title);
return route.meta.title; const pagePath = computed(() => route.path);
});
const pagePath = computed(() => { // active
return route.path; const isLinkActive = (link) => route.path.includes(link);
});
const refreshProjectName = () => { const settingsLabel = computed(() =>
adminMode.value ? "Back to Console" : "Settings",
);
function updateUsername() {
const auth = storage.getAuth?.() ?? null;
username.value = auth?.userInfo?.username ?? auth?.username ?? "";
}
function refreshProjectName() {
const v = localStorage.getItem("projectName"); const v = localStorage.getItem("projectName");
projectName.value = v ? v : ""; projectName.value = v ? v : "";
}; }
function goSelect() {
const goSelect = () => {
router.push("/select"); router.push("/select");
}; }
function logOut() {
const logOut = () => {
UserManagerService.signOut() UserManagerService.signOut()
.catch(console.error) .catch(console.error)
.finally(() => { .finally(() => {
@ -94,71 +96,122 @@ const logOut = () => {
username.value = ""; username.value = "";
projectName.value = ""; projectName.value = "";
sessionStorage.removeItem("initialRedirectDone"); sessionStorage.removeItem("initialRedirectDone");
adminMode.value = false;
router.push("/login"); router.push("/login");
}); });
}; }
onMounted(() => {
updateUsername();
refreshProjectName();
menu.value = menuItems;
// projectName // storage
window.addEventListener("storage", (e) => { function onStorage(e) {
if (!e.key || e.key === "projectName") refreshProjectName(); if (!e.key || e.key === "projectName") refreshProjectName();
if (!e.key || e.key === "autoflow-auth" || e.key === "auth") if (!e.key || e.key === "autoflow-auth" || e.key === "auth") {
updateUsername(); updateUsername();
}); computeIsAdmin();
}); }
}
const goMain = () => {
router.push("/home");
};
onMounted(() => { //
updateUsername();
// /
window.addEventListener("storage", (e) => {
if (!e.key || e.key === "auth") updateUsername();
});
});
onBeforeUnmount(() => {
window.removeEventListener("storage", updateUsername);
});
watch( watch(
() => route.fullPath, () => route.fullPath,
() => refreshProjectName(), () => {
refreshProjectName();
const isAdminRoute = route.matched.some((r) => r.meta?.requiresAdmin);
if (!isAdminRoute) lastNonAdminPath.value = route.fullPath || "/home";
},
{ immediate: true },
); );
watchEffect(() => {
// const auth = storage.getAuth().auth; onMounted(() => {
// if (auth === "ADMIN") { updateUsername();
computeIsAdmin();
refreshProjectName();
menu.value = menuItems; menu.value = menuItems;
// } else { window.addEventListener("storage", onStorage);
// menu.value = userMenuItems; });
// } onBeforeUnmount(() => {
window.removeEventListener("storage", onStorage);
}); });
</script> </script>
<template> <template>
<v-app> <v-app>
<!-- 사이드바 -->
<v-navigation-drawer <v-navigation-drawer
v-model="drawer" v-model="drawer"
border="0" border="0"
hide-overlay hide-overlay
permanent permanent
v-if="!route.meta.hideSidebar" v-if="!route.meta.hideSidebar"
:rail="false"
> >
<DrawerComponent /> <!-- 헤더 -->
</v-navigation-drawer> <v-card
:ripple="false"
flat
class="bg-shades-transparent d-flex w-100 justify-center text-h5 pa-4 pb-16"
@click="goMain"
>
<SidebarHeader />
</v-card>
<!-- 기본(일반 사용자) 메뉴 -->
<DrawerComponent v-if="!adminMode" />
<!-- 관리자 메뉴: 유저 메뉴와 동일한 /여백/활성 스타일 -->
<template v-else>
<v-card flat class="mx-auto">
<v-list nav class="pa-5 pt-0">
<v-list-item
rounded
title="Projects"
value="projects"
to="/project"
prepend-icon="mdi-briefcase"
:active="isLinkActive('/project')"
:active-color="isLinkActive('/project') ? 'primary' : null"
density="compact"
class="pa-2 rounded-lg"
style="padding-inline-start: 10px"
/>
<v-list-item
rounded
title="Users"
value="users"
to="/users"
prepend-icon="mdi-account-multiple"
:active="isLinkActive('/users')"
:active-color="isLinkActive('/users') ? 'primary' : null"
density="compact"
class="pa-2 rounded-lg"
style="padding-inline-start: 10px"
/>
</v-list>
</v-card>
</template>
</v-navigation-drawer>
<v-app-bar class="bg-shades-transparent" flat> <v-app-bar class="bg-shades-transparent" flat>
<v-spacer></v-spacer> <v-spacer />
<v-menu location="bottom end">
<template v-slot:activator="{ props }"> <v-tooltip v-if="isAdmin" location="bottom" text="Settings">
<v-tooltip location="bottom" text="Settings">
<template #activator="{ props }"> <template #activator="{ props }">
<v-btn icon color="primary" class="mr-3" v-bind="props"> <v-btn
icon
color="primary"
class="mr-3"
v-bind="props"
@click="toggleAdmin"
aria-label="Settings"
>
<v-icon>mdi-cog</v-icon> <v-icon>mdi-cog</v-icon>
</v-btn> </v-btn>
</template> </template>
</v-tooltip> </v-tooltip>
<v-tooltip location="bottom" text="Projact">
<!-- 프로젝트 선택 -->
<v-tooltip location="bottom" text="Project">
<template #activator="{ props }"> <template #activator="{ props }">
<v-btn <v-btn
icon icon
@ -171,12 +224,16 @@ watchEffect(() => {
</v-btn> </v-btn>
</template> </template>
</v-tooltip> </v-tooltip>
<div style="min-width: 180px" class="d-flex flex-column align-end"> <div style="min-width: 180px" class="d-flex flex-column align-end">
<div class="font-weight-black">{{ username || "GUEST" }}</div> <div class="font-weight-black">{{ username || "GUEST" }}</div>
<div class="text-subtitle-2"> <div class="text-subtitle-2">
{{ projectName || "No Project Selected" }} {{ projectName || "No Project Selected" }}
</div> </div>
</div> </div>
<v-menu location="bottom end">
<template #activator="{ props }">
<v-btn icon color="primary" v-bind="props" class="mr-3"> <v-btn icon color="primary" v-bind="props" class="mr-3">
<v-icon>mdi-arrow-down-drop-circle-outline</v-icon> <v-icon>mdi-arrow-down-drop-circle-outline</v-icon>
</v-btn> </v-btn>

@ -0,0 +1,12 @@
<script setup lang="ts">
import logo from "@/assets/iteration (1).png";
</script>
<template>
<div class="d-flex flex-column align-center pt-6">
<v-img :src="logo" width="auto" height="36" class="mb-3" />
<div class="text-subtitle-2 font-weight-medium text-primary">
Autoflow Web Console
</div>
</div>
</template>

@ -0,0 +1,24 @@
export type AttachmentUpload = {
refId?: number | null;
refType: string;
title?: string;
description?: string;
version?: number;
regUserId: string;
projectId: number;
file: File | Blob;
path?: string;
};
export type AttachmentSearch = {
projectId: number;
page?: number;
size?: number;
keyword?: string;
searchType?: "전체" | "제목" | "작성자";
startDate?: string;
endDate?: string;
sortField?: string;
sortDirection?: "ASC" | "DESC";
refType?: "WORKFLOW_STEP" | "DATASET" | "TRAINING_SCRIPT";
};

@ -1,9 +0,0 @@
export interface Workflow {
workflowName: string;
workflowDescription?: string;
uploadYn: "Y" | "N";
regUserId: string;
regDt: string;
modDt: string;
projectId: number;
}

@ -0,0 +1,29 @@
export interface ExperimentCreateDto {
kubeFlowId?: string;
mlFlowId?: string;
name: string;
displayName: string;
description?: string;
artifactLocation?: string;
lifecycleStage?: string;
storageState?: string;
kubeflowCreatedAt?: string;
mlflowCreatedAt?: string;
lastUpdateTime?: string;
lastRunCreatedAt?: string;
regUserId: string;
projectId: number;
}
export type ExperimentSearch = {
projectId: number;
page?: number;
size?: number;
keyword?: string;
searchType?: "전체" | "제목" | "작성자";
startDate?: string;
endDate?: string;
sortField?: string;
sortDirection?: "ASC" | "DESC";
refType?: "WORKFLOW_STEP" | "DATASET" | "TRAINING_SCRIPT";
};

@ -0,0 +1,23 @@
export type KubeflowUploadDto = {
name: string;
display_name?: string;
description?: string;
namespace?: string;
regUserId: string;
projectId: number | string;
uploadfile: File | Blob;
};
export type kubeflow = FormData;
export function toKubeflowForm(dto: KubeflowUploadDto): FormData {
const fd = new FormData();
fd.append("name", dto.name);
fd.append("display_name", dto.display_name || dto.name);
fd.append("description", dto.description || "");
fd.append("namespace", dto.namespace || "default");
fd.append("regUserId", String(dto.regUserId));
fd.append("projectId", String(dto.projectId));
fd.append("uploadfile", dto.uploadfile);
return fd;
}

@ -0,0 +1,21 @@
export interface Workflow {
workflowName: string;
workflowDescription?: string;
uploadYn: "Y" | "N";
regUserId: string;
regDt: string;
modDt: string;
projectId: number;
}
export interface WorkflowSearch {
projectId: number; // ✅ 유일한 필수
page?: number;
size?: number;
keyword?: string;
searchType?: "전체" | "제목" | "작성자";
startDate?: string;
endDate?: string;
sortField?: string;
sortDirection?: "ASC" | "DESC";
}

@ -0,0 +1,21 @@
export type StepStatus = "Running" | "Success" | "Fail";
export interface WorkflowStep {
projectId: number;
stepName: string;
status?: StepStatus;
pipelineId?: number;
startTime?: string;
endTime?: string;
logPath?: string;
version?: string;
files?: Array<{
refType?: "workflow_step";
originalName: string;
storageName: string;
contentType?: string;
size?: number;
storagePath: string;
}>;
}

@ -30,7 +30,7 @@ export interface ProjectAuthority {
permissions: Permission[]; permissions: Permission[];
} }
export interface ProjectSearchParams { export interface ProjectSearch {
page: number; page: number;
size: number; size: number;
keyword: string; keyword: string;

@ -20,6 +20,12 @@ export const request = {
put: (uri: string, param: any): any => { put: (uri: string, param: any): any => {
return axios.put(`${API_URL}${uri}`, param); return axios.put(`${API_URL}${uri}`, param);
}, },
getFile: (uri: string, param: any): any => {
return axios.get(`${API_URL}${uri}`, {
params: param,
responseType: "blob",
});
},
postFile: (uri: string, param: any, attachment: any, progress: any): any => { postFile: (uri: string, param: any, attachment: any, progress: any): any => {
const formData = new FormData(); const formData = new FormData();

@ -1,20 +0,0 @@
import { Workflow } from "@/components/models/management/Autoflow";
import { request } from "@/components/service/index";
export const AutoflowStepService = {
add: (payload: Workflow) => {
return request.post("/api/workflow-steps", payload);
},
getAll: () => {
request.get("/api/workflow-steps", {});
},
delete: (id: Number) => {
return request.delete(`/api/workflow-steps${id}`, {});
},
view: (id: Number) => {
return request.get(`/api/workflow-steps${id}`, {});
},
update: (id: number, payload: Workflow) => {
return request.put(`/api/workflow-steps${id}`, payload);
},
};

@ -0,0 +1,36 @@
import {
AttachmentSearch,
AttachmentUpload,
} from "@/components/models/management/Attachments";
import { request } from "@/components/service/index";
export const AttachmentsService = {
upload: (payload: AttachmentUpload) => {
return request.post("/api/attachments/upload", payload);
},
delete: (id: Number) => {
return request.delete(`/api/attachments/${id}`, {});
},
view: (id: number) => {
return request.get(`/api/attachments/${id}`, {});
},
update: (id: number, payload: AttachmentUpload) => {
return request.put(`/api/attachments/${id}/update`, payload);
},
readTextByPath: (objectName: string) => {
return request.get(
`/api/attachments/readYamlText?objectName=${objectName}`,
{},
);
},
downloadFile: (objectName: string) => {
return request.getFile(
`/api/attachments/download?objectName=${objectName}`,
{},
);
},
search: (payload: AttachmentSearch) => {
return request.get("/api/attachments/search", payload);
},
};

@ -0,0 +1,22 @@
import {
ExperimentCreateDto,
ExperimentSearch,
} from "@/components/models/management/Experiments";
import { request } from "@/components/service/index";
export const ExperimentService = {
add: (payload: ExperimentCreateDto) => {
return request.post("/api/experiments", payload);
},
delete: (id: Number) => {
return request.delete(`/api/experiments/${id}`, {});
},
view: (id: number) => {
return request.get(`/api/experiments/${id}`, {});
},
// update: (id: number, payload: AttachmentUpload) => {
// return request.put(`/api/experiments/${id}`, payload);
// },
search: (payload: ExperimentSearch) => {
return request.get("/api/experiments/search", payload);
},
};

@ -0,0 +1,10 @@
import { kubeflow } from "@/components/models/management/Kubeflow";
import { request } from "@/components/service/index";
export const kubeflowService = {
upload: (payload: kubeflow) => {
return request.post("/pipelines/upload", payload);
},
run: (payload: kubeflow) => {
return request.post("/pipelines/runs", payload);
},
};

@ -26,4 +26,12 @@ export const UserManagerService = {
getUser: (userId: number) => { getUser: (userId: number) => {
return request.get(`/api/auth/users/${userId}`, {}); return request.get(`/api/auth/users/${userId}`, {});
}, },
// 사용자 수정
update: (id: number, payload: User) => {
return request.put(`/api/auth/users/${id}`, payload);
},
// 사용자 삭제
delete: (id: Number) => {
return request.delete(`/api/auth/users/${id}`, {});
},
}; };

@ -1,13 +1,15 @@
import { Workflow } from "@/components/models/management/Autoflow"; import {
Workflow,
WorkflowSearch,
} from "@/components/models/management/Workflow";
import { request } from "@/components/service/index"; import { request } from "@/components/service/index";
export const AutoflowService = { export const WorkflowService = {
add: (payload: Workflow) => { add: (payload: Workflow) => {
return request.post("/api/workflows", payload); return request.post("/api/workflows", payload);
}, },
getAll: () => { getAll: () => {
return request.get("/api/workflows", {}); return request.get("/api/workflows", {});
}, },
delete: (id: Number) => { delete: (id: Number) => {
return request.delete(`/api/workflows/${id}`, {}); return request.delete(`/api/workflows/${id}`, {});
}, },
@ -17,4 +19,7 @@ export const AutoflowService = {
update: (id: number, payload: Workflow) => { update: (id: number, payload: Workflow) => {
return request.put(`/api/workflows/${id}`, payload); return request.put(`/api/workflows/${id}`, payload);
}, },
search: (payload: WorkflowSearch) => {
return request.get("/api/workflows/search", payload);
},
}; };

@ -0,0 +1,23 @@
import { request } from "@/components/service/index";
import { WorkflowStep } from "@/components/models/management/WorkflowStep";
import { WorkflowSearch } from "@/components/models/management/Workflow";
export const WorkflowStepService = {
add: (payload: WorkflowStep) => {
return request.post("/api/workflow-steps", payload);
},
getAll: (params?: Record<string, any>) => {
return request.get("/api/workflow-steps", { params });
},
delete: (id: number) => {
return request.delete(`/api/workflow-steps/${id}`, {});
},
view: (id: number) => {
return request.get(`/api/workflow-steps/${id}`, {});
},
update: (id: number, payload: WorkflowStep) => {
return request.put(`/api/workflow-steps/${id}`, payload);
},
search: (payload: WorkflowSearch) => {
return request.get("/api/workflow-steps/search", payload);
},
};

@ -2,7 +2,7 @@ import { request } from "@/components/service/index";
import { import {
ApiProject, ApiProject,
ProjectAuthority, ProjectAuthority,
ProjectSearchParams, ProjectSearch,
} from "@/components/models/project/Project"; } from "@/components/models/project/Project";
export const ProjectService = { export const ProjectService = {
@ -27,9 +27,9 @@ export const ProjectService = {
return request.post("/api/projects", payload); return request.post("/api/projects", payload);
}, },
// 검색 및 페이지네이션 프로젝트 목록 조회 // 검색 및 페이지네이션 프로젝트 목록 조회
searchProjects: (params: ProjectSearchParams) => searchProjects: (params: ProjectSearch) => {
request.get("/api/projects/search", params), return request.get("/api/projects/search", params);
},
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
// 프로젝트 권한 // 프로젝트 권한
@ -43,4 +43,7 @@ export const ProjectService = {
{}, {},
); );
}, },
userProjectAuthority: (id: number) => {
return request.get(`/api/projects/users/${id}/projects`, {});
},
}; };

@ -2,340 +2,334 @@
import IconDeleteBtn from "@/components/atoms/button/IconDeleteBtn.vue"; import IconDeleteBtn from "@/components/atoms/button/IconDeleteBtn.vue";
import IconModifyBtn from "@/components/atoms/button/IconModifyBtn.vue"; import IconModifyBtn from "@/components/atoms/button/IconModifyBtn.vue";
import IconInfoBtn from "@/components/atoms/button/IconInfoBtn.vue"; import IconInfoBtn from "@/components/atoms/button/IconInfoBtn.vue";
// import FormComponent from "@/components/device/FormComponent.vue"; import { onMounted, ref } from "vue";
import { onMounted, ref, watch } from "vue"; import { storage } from "@/utils/storage";
import ViewComponent from "@/components/templates/Datasets/ViewComponent.vue"; import ViewComponent from "@/components/templates/Datasets/ViewComponent.vue";
import DatasetsBaseDoalog from "@/components/atoms/organisms/DatasetsBaseDoalog.vue"; import DatasetBaseDoalog from "@/components/atoms/organisms/DatasetBaseDoalog.vue";
import WorkflowsUploadDialog from "@/components/atoms/organisms/WorkflowsUploadDialog.vue"; import { AttachmentsService } from "@/components/service/management/attachmentsService";
// const store = commonStore(); import { commonStore } from "@/stores/commonStore";
const store = commonStore();
const openView = ref(false); const openView = ref(false);
const openModify = ref(false); const openModify = ref(false);
const tableHeader = [
{ const username = ref<string>("");
label: "Title",
width: "7%", // ===== /( ) =====
style: "word-break: keep-all;", type SearchType = "전체" | "제목" | "작성자";
},
{
label: "File Name",
width: "7%",
style: "word-break: keep-all;",
},
{
label: "File Path",
width: "7%",
style: "word-break: keep-all;",
},
{
label: "Description",
width: "7%",
style: "word-break: keep-all;",
},
{
label: "Created Data",
width: "7%",
style: "word-break: keep-all;",
},
{
label: "Modified Data",
width: "7%",
style: "word-break: keep-all;",
},
{
label: "Action",
width: "7%",
style: "word-break: keep-all;",
},
];
const searchOptions = [ const searchOptions = [
{ { label: "전체", value: "전체" as SearchType },
searchType: "전체", { label: "제목", value: "제목" as SearchType },
searchText: "", { label: "작성자", value: "작성자" as SearchType },
},
{
searchType: "디바이스 별칭",
searchText: "deviceAlias",
},
{
searchType: "디바이스 키",
searchText: "deviceKey",
},
{
searchType: "사용자",
searchText: "userId",
},
{
searchType: "디바이스 이름",
searchText: "deviceName",
},
{
searchType: "디바이스 모델",
searchText: "deviceModel",
},
{
searchType: "디바이스 OS",
searchText: "deviceOs",
},
]; ];
const SEARCH_TYPE_MAP: Record<SearchType | "", "ALL" | "TITLE" | "AUTHOR"> = {
"": "ALL",
전체: "ALL",
제목: "TITLE",
작성자: "AUTHOR",
};
const pageSizeOptions = [ const pageSizeOptions = [
{ text: "10 페이지", value: 10 }, { text: "10 페이지", value: 10 },
{ text: "50 페이지", value: 50 }, { text: "50 페이지", value: 50 },
{ text: "100 페이지", value: 100 }, { text: "100 페이지", value: 100 },
]; ];
//
const tableHeader = [
{ label: "Title", width: "7%", style: "word-break: keep-all;" },
{ label: "File Name", width: "7%", style: "word-break: keep-all;" },
{ label: "File Path", width: "7%", style: "word-break: keep-all;" },
{ label: "Description", width: "7%", style: "word-break: keep-all;" },
{ label: "Created Data", width: "7%", style: "word-break: keep-all;" },
{ label: "Modified Data", width: "7%", style: "word-break: keep-all;" },
{ label: "Action", width: "7%", style: "word-break: keep-all;" },
];
const data = ref({ const data = ref({
params: { params: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
searchType: "", searchType: "전체" as SearchType,
searchText: "", searchText: "",
}, },
results: [], results: [] as any[],
totalDataLength: 0, totalElements: 0,
pageLength: 0, pageLength: 0,
modalMode: "", modalMode: "" as "create" | "edit" | "setting" | "",
selectedData: null, selectedData: null as any,
allSelected: false, allSelected: false,
selected: [], selected: [] as Array<{ deviceKey: number }>,
isCreateVisible: false, isCreateVisible: false,
isUploadVisible: false, isUploadVisible: false,
isModalVisible: false, isModalVisible: false,
isConfirmDialogVisible: false, isConfirmDialogVisible: false,
userOption: [], userOption: [] as any[],
}); });
const getCodeList = () => { //
// UserService.search(data.value.params).then((d) => { function readUsernameFromStorage(): string {
// if (d.status === 200) { try {
// data.value.userOption = d.data.userList; const raw =
// } storage?.get?.("autoflow-auth") ??
// }); storage?.getAuth?.() ??
localStorage.getItem("autoflow-auth") ??
null;
const auth = typeof raw === "string" ? JSON.parse(raw) : raw;
const u1 = auth?.userInfo?.username;
const u2 = auth?.username;
const u3 = auth?.userInfo?.userName;
const u4 = auth?.userInfo?.email?.split("@")?.[0];
return (u1 || u2 || u3 || u4 || "").toString();
} catch {
return "";
}
}
// ID
const getProjectId = (): number => {
const v = Number(localStorage.getItem("projectId"));
return Number.isFinite(v) ? v : 0;
}; };
const getData = () => { // ( )
const params = { ...data.value.params }; const toRow = (a: any) => ({
if (params.searchType === "" || params.searchText === "") { deviceKey: a.id,
delete params.searchType; id: a.id,
delete params.searchText; title: a.title ?? "",
fileName: a.originalName ?? "",
filePath: a.storagePath ?? "",
description: a.description ?? "",
createdData: String(a.regDt ?? "")
.replace("T", " ")
.slice(0, 19),
modifiedData: "-",
});
const fetchList = async () => {
const projectId = getProjectId();
if (!projectId) {
console.warn("[TrainingScript] projectId 없음 — 프로젝트 먼저 선택");
data.value.results = [];
data.value.totalElements = 0;
data.value.pageLength = 0;
return;
} }
data.value.results = [
{ const { pageNum, pageSize, searchType, searchText } = data.value.params;
title: "배터리 상태 예측 모델 프로젝트",
fileName: "train.py", const mapped = SEARCH_TYPE_MAP[searchType] || "ALL";
filePath: "/kubeflow-users/battery/train.py", const keyword = (searchText || "").trim();
description: "배터리 상태 예측 스크립트", const needLocalFilter = mapped !== "ALL" && keyword.length > 0;
createdData: "2025-04-28 12:01:00",
modifiedData: "2025-04-28 12:01:00", let reqPage = data.value.params.pageNum;
}, let reqSize = data.value.params.pageSize;
{ if (needLocalFilter) {
title: "상태 추적 모델", reqPage = 0;
fileName: "detection.py", reqSize = 1000;
filePath: "/kubeflow-users/status/detection.py", }
description: "상태 추적 스크립트",
createdData: "2025-04-20 12:01:00", const payload = {
modifiedData: "2025-04-28 12:01:00", projectId,
}, page: reqPage,
]; size: reqSize,
data.value.totalDataLength = 5; keyword,
// DeviceService.search(params).then((d) => { searchType: mapped,
// if (d.status === 200) { sortField: "id",
// data.value.results = d.data.deviceList; sortDirection: "DESC",
// data.value.totalDataLength = d.data.totalCount; refType: "DATASET",
// setTimeout(() => {
// setPaginationLength();
// }, 200);
// } else {
// store.setSnackbarMsg({
// text: " ",
// color: "error",
// });
// }
// });
// DeviceService.search().then((d) => {
// data.value.totalDataLength = d.data.totalCount;
// setTimeout(() => {
// setPaginationLength();
// }, 200);
// });
}; };
const setPaginationLength = () => { try {
if (data.value.totalDataLength % data.value.params.pageSize === 0) { const res = await AttachmentsService.search(payload as any);
data.value.pageLength = const result = res?.data ?? res;
data.value.totalDataLength / data.value.params.pageSize; let list = result?.content ?? [];
} else {
data.value.pageLength = Math.ceil( if (needLocalFilter) {
data.value.totalDataLength / data.value.params.pageSize, const kw = keyword.toLowerCase();
if (mapped === "TITLE") {
list = list.filter((x: any) =>
String(x?.title ?? "")
.toLowerCase()
.includes(kw),
);
} else if (mapped === "AUTHOR") {
list = list.filter((x: any) =>
String(x?.regUserId ?? "")
.toLowerCase()
.includes(kw),
); );
} }
};
const saveData = (formData) => { //
if (data.value.modalMode === "create") { const uiSize = data.value.params.pageSize;
// DeviceService.add(formData).then((d) => { const totalElements = list.length;
// if (d.status === 200) { const totalPages = Math.max(1, Math.ceil(totalElements / uiSize));
// data.value.isModalVisible = false; const safePage = Math.min(Math.max(1, pageNum), totalPages);
// store.setSnackbarMsg({ const start = (safePage - 1) * uiSize;
// text: " .", const pageSlice = list.slice(start, start + uiSize);
// result: 200,
// }); data.value.results = pageSlice.map(toRow);
// changePageNum(1); data.value.totalElements = totalElements;
// } else { data.value.pageLength = totalPages;
// store.setSnackbarMsg({ return;
// text: d, }
// result: 500,
// }); data.value.results = (list as any[]).map(toRow);
// } data.value.totalElements = result?.totalElements ?? list.length;
// }); data.value.pageLength = result?.totalPages ?? 1;
} else { } catch (err) {
// DeviceService.update(formData.deviceKey, formData).then((d) => { console.error("[TrainingScript] 조회 에러:", err);
// if (d.status === 200) { data.value.results = [];
// data.value.isModalVisible = false; data.value.totalElements = 0;
// store.setSnackbarMsg({ data.value.pageLength = 1;
// text: " .",
// result: 200,
// });
// changePageNum();
// } else {
// store.setSnackbarMsg({
// text: d,
// result: 500,
// });
// }
// });
} }
}; };
const removeData = (value) => { /** 검색 실행 (페이지 1로 리셋) */
let removeList = value ? value : data.value.selected; const doSearch = () => {
const remove = (code) => { data.value.params.pageNum = 1;
// return DeviceService.delete(code).then((d) => { fetchList();
// if (d.status !== 200) {
// store.setSnackbarMsg({
// text: d,
// result: 500,
// });
// }
// });
}; };
if (removeList.length === 1) { /** 페이지 이동 */
remove(removeList[0].deviceKey).then(() => { const changePageNum = (page: number) => {
// store.setSnackbarMsg({ data.value.params.pageNum = page;
// text: ".", fetchList();
// result: 200, };
// });
changePageNum(); /** 페이지 사이즈 변경 */
data.value.isConfirmDialogVisible = false; const changePageSize = (size: number) => {
data.value.selected = []; data.value.params.pageSize = size;
data.value.allSelected = false; data.value.params.pageNum = 1;
fetchList();
};
// / ( )
const removeData = (value?: Array<{ deviceKey: number }>) => {
const removeList = value ?? data.value.selected;
if (!removeList || removeList.length === 0) return;
const ids = removeList.map((x) => x.deviceKey);
const removeOne = (id: number) =>
AttachmentsService.delete(id).then((res) => {
if (res.status < 200 || res.status >= 300) return Promise.reject(res);
}); });
} else {
Promise.all(removeList.map((item) => remove(item.deviceKey))).finally( const after = () => {
() => { if (
// store.setSnackbarMsg({ ids.length >= data.value.results.length &&
// text: " .", data.value.params.pageNum > 1
// result: 200, ) {
// }); data.value.params.pageNum -= 1;
changePageNum(); }
fetchList();
data.value.isConfirmDialogVisible = false; data.value.isConfirmDialogVisible = false;
data.value.selected = []; data.value.selected = [];
data.value.allSelected = false; data.value.allSelected = false;
},
);
}
}; };
const handleRemoveData = () => { // /
if (data.value.selected.length === 0) { if (ids.length === 1) {
// store.setSnackbarMsg({ removeOne(ids[0])
// text: " . ", .then(() => {
// result: 500, store.setSnackbarMsg({
// }); color: "success",
return; text: "삭제되었습니다.",
} result: 200,
if (data.value.allSelected || data.value.selected.length !== 1) { });
data.value.isConfirmDialogVisible = true; after();
return; })
.catch((err) => {
console.error("삭제 실패:", err);
store.setSnackbarMsg({
color: "warning",
text: "삭제 실패",
result: 500,
});
});
} else {
Promise.all(ids.map(removeOne))
.then(() => {
store.setSnackbarMsg({
color: "success",
text: "모두 삭제되었습니다.",
result: 200,
});
})
.catch((err) => {
console.error("일부 삭제 실패:", err);
store.setSnackbarMsg({
color: "warning",
text: "일부 삭제 실패",
result: 500,
});
})
.finally(after);
} }
//
removeData(undefined);
}; };
const closeDetail = () => { const closeDetail = () => {
openView.value = false; openView.value = false;
}; };
const changePageNum = (page) => {
data.value.params.pageNum = page; const openDetailModal = (selectedItem: any) => {
getData();
};
const openSettingModal = (selectedItem) => {
data.value.selectedData = selectedItem; data.value.selectedData = selectedItem;
data.value.modalMode = "setting";
openView.value = true; openView.value = true;
}; };
const openCreateModal = () => { const openCreateModal = () => {
data.value.selectedData = null;
data.value.modalMode = "create"; data.value.modalMode = "create";
data.value.selectedData = {
username: username.value,
projectId: getProjectId(),
};
data.value.isCreateVisible = true; data.value.isCreateVisible = true;
}; };
const openModifyModal = () => { const openModifyModal = (item: any) => {
data.value.selectedData = null;
data.value.modalMode = "edit"; data.value.modalMode = "edit";
data.value.isUploadVisible = true; data.value.selectedData = {
id: item.deviceKey,
title: item.title,
description: item.description,
};
data.value.isCreateVisible = true;
}; };
const closeCreateModal = () => { const closeCreateModal = () => {
data.value.isModalVisible = false; data.value.isModalVisible = false;
data.value.isCreateVisible = null; data.value.isCreateVisible = false;
data.value.selectedData = null;
}; };
const closeModifyModal = () => { const closeModifyModal = () => {
data.value.isModalVisible = false; data.value.isModalVisible = false;
data.value.isUploadVisible = null; data.value.isUploadVisible = false;
data.value.selectedData = null;
}; };
const getSelectedAllData = () => { const getSelectedAllData = () => {
data.value.selected = data.value.allSelected data.value.selected = data.value.allSelected
? data.value.results.map((item) => { ? data.value.results.map((item: any) => ({ deviceKey: item.deviceKey }))
return {
deviceKey: item.deviceKey,
};
})
: []; : [];
}; };
onMounted(() => { onMounted(() => {
getData(); username.value = readUsernameFromStorage();
getCodeList(); fetchList();
}); });
</script> </script>
<template> <template>
<div class="w-100" v-if="!openView"> <div class="w-100" v-if="!openView">
<!-- <v-dialog v-model="data.isModalVisible" max-width="600" persistent>-->
<!-- <FormComponent-->
<!-- :edit-data="data.selectedData"-->
<!-- :mode="data.modalMode"-->
<!-- @close-modal="closeModal"-->
<!-- @handle-data="saveData"-->
<!-- :user-option="data.userOption"-->
<!-- />-->
<!-- </v-dialog>-->
<!-- <v-dialog v-model="data.isConfirmDialogVisible" persistent max-width="300">-->
<!-- <ConfirmDialogComponent-->
<!-- @cancel="data.isConfirmDialogVisible = false"-->
<!-- @delete="removeData(undefined)"-->
<!-- @init="(data.selected = []), (data.allSelected = false)"-->
<!-- />-->
<!-- </v-dialog>-->
<v-container fluid class="h-100 pa-5 d-flex flex-column align-center"> <v-container fluid class="h-100 pa-5 d-flex flex-column align-center">
<v-card <v-card
flat flat
class="bg-shades-transparent d-flex flex-column align-center justify-center w-100" class="bg-shades-transparent d-flex flex-column align-center justify-center w-100"
> >
<!-- 헤더 -->
<v-card flat class="bg-shades-transparent w-100"> <v-card flat class="bg-shades-transparent w-100">
<v-card-item class="text-h5 font-weight-bold pt-0 pa-5 pl-0"> <v-card-item class="text-h5 font-weight-bold pt-0 pa-5 pl-0">
<div class="d-flex flex-row justify-start align-center"> <div class="d-flex flex-row justify-start align-center">
@ -343,7 +337,9 @@ onMounted(() => {
</div> </div>
</v-card-item> </v-card-item>
</v-card> </v-card>
<v-card flat class="bg-shades-transparent w-100"> <v-card flat class="bg-shades-transparent w-100">
<!-- 검색 영역 -->
<v-card flat class="bg-shades-transparent mb-4"> <v-card flat class="bg-shades-transparent mb-4">
<div class="d-flex justify-center flex-wrap align-center"> <div class="d-flex justify-center flex-wrap align-center">
<v-responsive <v-responsive
@ -356,11 +352,12 @@ onMounted(() => {
label="검색조건" label="검색조건"
density="compact" density="compact"
:items="searchOptions" :items="searchOptions"
item-title="searchType" item-title="label"
item-value="searchText" item-value="value"
hide-details hide-details
></v-select> />
</v-responsive> </v-responsive>
<v-responsive min-width="540" max-width="540"> <v-responsive min-width="540" max-width="540">
<v-text-field <v-text-field
v-model="data.params.searchText" v-model="data.params.searchText"
@ -370,8 +367,8 @@ onMounted(() => {
required required
class="mt-3 mb-3" class="mt-3 mb-3"
hide-details hide-details
@keyup.enter="changePageNum(1)" @keyup.enter="doSearch"
></v-text-field> />
</v-responsive> </v-responsive>
<div class="ml-3"> <div class="ml-3">
@ -379,7 +376,7 @@ onMounted(() => {
size="large" size="large"
color="primary" color="primary"
:rounded="5" :rounded="5"
@click="changePageNum(1)" @click="doSearch"
> >
<v-icon>mdi-magnify</v-icon> <v-icon>mdi-magnify</v-icon>
</v-btn> </v-btn>
@ -387,6 +384,7 @@ onMounted(() => {
</div> </div>
</v-card> </v-card>
<!-- 상단 툴바 -->
<v-sheet <v-sheet
class="bg-shades-transparent d-flex flex-wrap align-center mb-2" class="bg-shades-transparent d-flex flex-wrap align-center mb-2"
> >
@ -394,10 +392,12 @@ onMounted(() => {
<v-sheet <v-sheet
class="d-flex align-center mr-3 mb-2 bg-shades-transparent" class="d-flex align-center mr-3 mb-2 bg-shades-transparent"
> >
<!-- 스크립트의 totalElements 사용 -->
<v-chip color="primary" <v-chip color="primary"
> {{ data.totalDataLength.toLocaleString() }} > {{ data.totalElements.toLocaleString() }}</v-chip
</v-chip> >
</v-sheet> </v-sheet>
<v-sheet class="bg-shades-transparent"> <v-sheet class="bg-shades-transparent">
<v-responsive max-width="140" min-width="140" class="mb-2"> <v-responsive max-width="140" min-width="140" class="mb-2">
<v-select <v-select
@ -409,18 +409,18 @@ onMounted(() => {
variant="outlined" variant="outlined"
color="primary" color="primary"
hide-details hide-details
@update:model-value="changePageNum(1)" @update:model-value="changePageSize"
></v-select> />
</v-responsive> </v-responsive>
</v-sheet> </v-sheet>
</v-sheet> </v-sheet>
<v-sheet class="justify-end mb-2"> <v-sheet class="justify-end mb-2">
<v-btn color="info" @click="openCreateModal" <v-btn color="info" @click="openCreateModal">Add Dataset</v-btn>
>Create Dataset
</v-btn>
</v-sheet> </v-sheet>
</v-sheet> </v-sheet>
<!-- 목록 -->
<v-card class="rounded-lg pa-8"> <v-card class="rounded-lg pa-8">
<v-col cols="12"> <v-col cols="12">
<v-sheet> <v-sheet>
@ -428,8 +428,6 @@ onMounted(() => {
density="comfortable" density="comfortable"
fixed-header fixed-header
height="625" height="625"
col-md-12
col-12
overflow-x-auto overflow-x-auto
> >
<colgroup> <colgroup>
@ -439,18 +437,20 @@ onMounted(() => {
:style="`width:${item.width}`" :style="`width:${item.width}`"
/> />
</colgroup> </colgroup>
<thead> <thead>
<tr> <tr>
<th <th
v-for="(item, i) in tableHeader" v-for="(item, i) in tableHeader"
:key="i" :key="i"
class="text-center font-weight-bold" class="text-center font-weight-bold"
:style="`${item.style}`" :style="item.style"
> >
{{ item.label }} {{ item.label }}
</th> </th>
</tr> </tr>
</thead> </thead>
<tbody class="text-body-2"> <tbody class="text-body-2">
<tr <tr
v-for="(item, i) in data.results" v-for="(item, i) in data.results"
@ -464,8 +464,8 @@ onMounted(() => {
<td>{{ item.createdData }}</td> <td>{{ item.createdData }}</td>
<td>{{ item.modifiedData }}</td> <td>{{ item.modifiedData }}</td>
<td style="white-space: nowrap"> <td style="white-space: nowrap">
<IconInfoBtn @on-click="openSettingModal(item)" /> <IconInfoBtn @on-click="openDetailModal(item)" />
<IconModifyBtn @on-click="openModifyModal()" /> <IconModifyBtn @on-click="openModifyModal(item)" />
<IconDeleteBtn <IconDeleteBtn
@on-click=" @on-click="
removeData([{ deviceKey: item.deviceKey }]) removeData([{ deviceKey: item.deviceKey }])
@ -476,6 +476,7 @@ onMounted(() => {
</tbody> </tbody>
</v-table> </v-table>
</v-sheet> </v-sheet>
<v-card-actions class="text-center mt-8 justify-center"> <v-card-actions class="text-center mt-8 justify-center">
<v-pagination <v-pagination
v-model="data.params.pageNum" v-model="data.params.pageNum"
@ -483,36 +484,33 @@ onMounted(() => {
:total-visible="10" :total-visible="10"
color="primary" color="primary"
rounded="circle" rounded="circle"
@update:model-value="getData" @update:model-value="changePageNum"
></v-pagination> />
</v-card-actions> </v-card-actions>
</v-col> </v-col>
</v-card> </v-card>
</v-card> </v-card>
</v-card> </v-card>
</v-container> </v-container>
<!-- 등록 다이얼로그 -->
<v-dialog v-model="data.isCreateVisible" max-width="600" persistent> <v-dialog v-model="data.isCreateVisible" max-width="600" persistent>
<DatasetsBaseDoalog <DatasetBaseDoalog
:edit-data="data.selectedData" :edit-data="data.selectedData"
:mode="data.modalMode" :mode="data.modalMode"
@close-modal="closeCreateModal" @close-modal="closeCreateModal"
@handle-data="saveData" @saved="fetchList"
:user-option="data.userOption"
/>
</v-dialog>
<v-dialog v-model="data.isUploadVisible" max-width="600" persistent>
<DatasetsBaseDoalog
:edit-data="data.selectedData"
:mode="data.modalMode"
@close-modal="closeModifyModal"
@handle-data="saveData"
:user-option="data.userOption" :user-option="data.userOption"
/> />
</v-dialog> </v-dialog>
</div> </div>
<div class="w-100" v-else> <div class="w-100" v-else>
<ViewComponent @close="closeDetail" /> <ViewComponent
v-if="data.selectedData"
:id="data.selectedData.deviceKey"
@close="closeDetail"
/>
</div> </div>
</template> </template>

@ -1,147 +1,164 @@
<script setup lang="ts"> <script setup lang="ts">
import IconDeleteBtn from "@/components/atoms/button/IconDeleteBtn.vue"; import { ref, computed, onMounted, watch } from "vue";
import IconModifyBtn from "@/components/atoms/button/IconModifyBtn.vue"; import { AttachmentsService } from "@/components/service/management/attachmentsService";
// import FormComponent from "@/components/device/FormComponent.vue"; import { ProjectService } from "@/components/service/project/projectService";
import { onMounted, ref } from "vue"; // id +
// const store = commonStore(); const props = defineProps<{ id: number | string }>();
const emit = defineEmits<{ (e: "close"): void }>();
// -------- state --------
const loading = ref(false);
const detailRaw = ref<any | null>(null);
const experimentInfo = ref({ const experimentInfo = ref({
datasetTitle: "자율주행차량 배터리 상태 예측 모델 구축", datasetTitle: "-",
projectName: "배터리 상태 예측 모델 프로젝트", projectName: "-",
version: "2.0", version: "-",
createdDate: "2025-02-06", createdDate: "-",
createdId: "ADMIN_001", createdId: "-",
modifiedDate: "2025-04-30", modifiedDate: "-",
modifiedId: "USER_002", modifiedId: "-",
description: "날씨, 조도, 도로 상태 등의 주행환경 데이터", description: "-",
fileName: "environment_log.csv", fileName: "-",
fileSize: "58KB", fileSize: "-",
}); });
const data = ref({ const downloadObjectName = computed(() => detailRaw.value?.storagePath || "");
params: { const canDownload = computed(() => !!downloadObjectName.value);
pageNum: 1,
pageSize: 10,
searchType: "",
searchText: "",
},
results: [],
totalDataLength: 0,
pageLength: 0,
modalMode: "",
selectedData: null,
allSelected: false,
selected: [],
isModalVisible: false,
isConfirmDialogVisible: false,
userOption: [],
});
const getCodeList = () => { async function handleDownload() {
// UserService.search(data.value.params).then((d) => { const key = downloadObjectName.value.trim();
// if (d.status === 200) { if (!key) return;
// data.value.userOption = d.data.userList;
// }
// });
};
const setPaginationLength = () => { const res = await AttachmentsService.downloadFile(key);
if (data.value.totalDataLength % data.value.params.pageSize === 0) {
data.value.pageLength = const ct = String(res.headers["content-type"] || "").toLowerCase();
data.value.totalDataLength / data.value.params.pageSize; if (ct.includes("application/json")) {
} else { const text = await (res.data as Blob).text();
data.value.pageLength = Math.ceil( try {
data.value.totalDataLength / data.value.params.pageSize, const json = JSON.parse(text);
); throw new Error(json.message || text);
} catch {
throw new Error(text);
}
} }
};
const saveData = (formData) => { const cd = res.headers["content-disposition"] || "";
if (data.value.modalMode === "create") { let filename: string | undefined;
// DeviceService.add(formData).then((d) => { const mUtf8 = cd.match(/filename\*\s*=\s*UTF-8''([^;]+)/i);
// if (d.status === 200) { const mStd = cd.match(/filename\s*=\s*(?:"([^"]+)"|([^;]+))/i);
// data.value.isModalVisible = false; if (mUtf8?.[1]) {
// store.setSnackbarMsg({ try {
// text: " .", filename = decodeURIComponent(mUtf8[1].trim());
// result: 200, } catch {
// }); filename = mUtf8[1].trim();
// changePageNum(1);
// } else {
// store.setSnackbarMsg({
// text: d,
// result: 500,
// });
// }
// });
} else {
// DeviceService.update(formData.deviceKey, formData).then((d) => {
// if (d.status === 200) {
// data.value.isModalVisible = false;
// store.setSnackbarMsg({
// text: " .",
// result: 200,
// });
// changePageNum();
// } else {
// store.setSnackbarMsg({
// text: d,
// result: 500,
// });
// }
// });
} }
} else if (mStd) {
filename = (mStd[1] || mStd[2])?.trim();
}
// 2) : objectName basename (fallback)
if (!filename) {
// key : "11fc4121-...-mlflow_pipeline.yaml" "dir/subdir/11fc...yaml"
const parts = key.split(/[\\/]/);
filename = parts[parts.length - 1] || "download.bin";
}
const blob = new Blob([res.data]);
const url = URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = url;
a.setAttribute("download", filename);
document.body.appendChild(a);
a.click();
a.remove();
URL.revokeObjectURL(url);
}
// -------- utils --------
const formatIso = (s?: string) =>
s ? String(s).replace("T", " ").slice(0, 19) : "-";
const formatBytes = (b?: number) => {
const n = Number(b);
if (!Number.isFinite(n) || n < 0) return "-";
if (n < 1024) return `${n} B`;
const u = ["KB", "MB", "GB", "TB"];
let i = -1,
v = n;
do {
v /= 1024;
i++;
} while (v >= 1024 && i < u.length - 1);
return `${v.toFixed(1)} ${u[i]}`;
}; };
const removeData = (value) => { //
let removeList = value ? value : data.value.selected; const mapToViewModel = (raw: any) => {
const remove = (code) => { const projectName =
// return DeviceService.delete(code).then((d) => { raw?.projectName ?? raw?.project?.name ?? raw?.prjNm ?? "-";
// if (d.status !== 200) {
// store.setSnackbarMsg({ const size = raw?.fileSize ?? raw?.size ?? raw?.length ?? undefined;
// text: d,
// result: 500, return {
// }); datasetTitle: raw?.title ?? "-",
// } projectName,
// }); version: raw?.version ?? "-",
createdDate: formatIso(raw?.regDt),
createdId: raw?.regUserId ?? "-",
modifiedDate: formatIso(raw?.modDt),
modifiedId: raw?.modUserId ?? "-",
description: raw?.description ?? "-",
fileName: raw?.originalName ?? "-",
fileSize: formatBytes(size),
};
}; };
if (removeList.length === 1) { async function fetchProjectName(projectId?: number) {
remove(removeList[0].deviceKey).then(() => { if (!projectId && projectId !== 0) return;
// store.setSnackbarMsg({ try {
// text: ".", const res = await ProjectService.fetchProjectById(projectId as number);
// result: 200, const prj = res?.data ?? res;
// }); experimentInfo.value.projectName = prj?.prjNm ?? prj?.name ?? "-";
} catch (e) {
console.warn("[Experiment/View] project fetch fail:", e);
}
}
data.value.isConfirmDialogVisible = false; const info = computed(() => mapToViewModel(detailRaw.value || {}));
data.value.selected = [];
data.value.allSelected = false;
});
} else {
Promise.all(removeList.map((item) => remove(item.deviceKey))).finally(
() => {
// store.setSnackbarMsg({
// text: " .",
// result: 200,
// });
data.value.isConfirmDialogVisible = false; async function fetchDetail(id: number | string) {
data.value.selected = []; const idNum = typeof id === "string" ? Number(id) : id;
data.value.allSelected = false; if (!Number.isFinite(idNum as number)) {
}, console.warn("[Datasets/View] invalid id:", id);
); return;
} }
};
const changePageNum = (page) => { loading.value = true;
data.value.params.pageNum = page; try {
}; const res = await AttachmentsService.view(idNum as number);
detailRaw.value = res?.data ?? res;
const emit = defineEmits<{ experimentInfo.value = mapToViewModel(detailRaw.value);
(e: "close"): void; await fetchProjectName(detailRaw.value?.projectId);
}>(); } catch (e) {
console.error("[Datasets/View] fetch detail error:", e);
} finally {
loading.value = false;
}
}
// -------- lifecycle --------
onMounted(() => { onMounted(() => {
getCodeList(); fetchDetail(props.id);
}); });
watch(
() => props.id,
(nv) => {
if (nv !== undefined && nv !== null && nv !== "") fetchDetail(nv);
},
);
</script> </script>
<template> <template>
@ -191,19 +208,6 @@ onMounted(() => {
<v-col cols="3" class="text-h6 font-weight-bold">Created ID </v-col> <v-col cols="3" class="text-h6 font-weight-bold">Created ID </v-col>
<v-col cols="3" class="pa-2">{{ experimentInfo.createdId }}</v-col> <v-col cols="3" class="pa-2">{{ experimentInfo.createdId }}</v-col>
</v-row> </v-row>
<VDivider class="my-2" />
<v-row align="center" class="py-2">
<v-col cols="3" class="text-h6 font-weight-bold"
>Modified Date
</v-col>
<v-col cols="3" class="pa-2">{{
experimentInfo.modifiedDate
}}</v-col>
<v-col cols="3" class="text-h6 font-weight-bold"
>Modified ID
</v-col>
<v-col cols="3" class="pa-2">{{ experimentInfo.modifiedId }}</v-col>
</v-row>
<VDivider class="my-2" /> <VDivider class="my-2" />
@ -217,7 +221,20 @@ onMounted(() => {
<VDivider class="my-2" /> <VDivider class="my-2" />
<v-row align="center" class="py-2"> <v-row align="center" class="py-2">
<v-col cols="3" class="text-h6 font-weight-bold">File</v-col> <v-col cols="3" class="text-h6 font-weight-bold">File</v-col>
<v-col cols="9" class="pa-2">{{ experimentInfo.fileName }}</v-col> <v-col cols="9" class="pa-2 d-flex align-center">
<span class="text-truncate">{{ experimentInfo.fileName }}</span>
<v-btn
icon
variant="text"
size="small"
class="ml-2"
:disabled="!canDownload"
@click="handleDownload"
aria-label="download"
>
<v-icon>mdi-download</v-icon>
</v-btn>
</v-col>
</v-row> </v-row>
</v-card-text> </v-card-text>
<v-sheet class="d-flex justify-end mb-2"> <v-sheet class="d-flex justify-end mb-2">

@ -1,27 +1,41 @@
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, ref } from "vue"; import { onMounted, ref, computed, watch } from "vue";
import Plotly from "plotly.js-dist-min"; import Plotly from "plotly.js-dist-min";
import { WorkflowService } from "@/components/service/management/workflowService";
import { useAutoflowStore } from "@/stores/autoflowStore";
const store = useAutoflowStore();
const currentProjectId = computed(() => store.projectId);
const pieChartRef = ref<HTMLElement | null>(null); const pieChartRef = ref<HTMLElement | null>(null);
const workflows = ref<any[]>([]);
const recentLimit = 10;
onMounted(() => { // ---- kubeflowStatus ( , ) ----
if (pieChartRef.value) { function renderStatusPie() {
Plotly.newPlot( if (!pieChartRef.value) return;
pieChartRef.value,
[ const counts = new Map<string, number>();
{ for (const wf of workflows.value ?? []) {
values: [40, 25, 20, 15], const status =
labels: ["Success", "Pending", "Failed", "Cancelled"], String(wf?.kubeflowStatus ?? wf?.kubeflow_status ?? "Unknown").trim() ||
"Unknown";
counts.set(status, (counts.get(status) || 0) + 1);
}
const labels = Array.from(counts.keys());
const values = Array.from(counts.values());
const trace: Partial<Plotly.PlotData> = {
values: values.length ? values : [1],
labels: labels.length ? labels : ["No Data"],
type: "pie", type: "pie",
marker: {
colors: ["#4caf50", "#ff9800", "#f44336", "#9e9e9e"],
},
textinfo: "label+percent", textinfo: "label+percent",
textfont: { color: "#fff", size: 14 }, textfont: { color: "#fff", size: 14 },
hole: 0.4, hole: 0.4,
}, };
],
{ const layout: Partial<Plotly.Layout> = {
paper_bgcolor: "#1e1e1e", paper_bgcolor: "#1e1e1e",
plot_bgcolor: "#1e1e1e", plot_bgcolor: "#1e1e1e",
showlegend: true, showlegend: true,
@ -33,12 +47,12 @@ onMounted(() => {
y: -0.2, y: -0.2,
}, },
margin: { t: 20, b: 40, l: 0, r: 0 }, margin: { t: 20, b: 40, l: 0, r: 0 },
}, };
{ displayModeBar: false },
); Plotly.react(pieChartRef.value, [trace], layout, { displayModeBar: false });
} }
});
// ---- ( ) ----
const recentRuns = [ const recentRuns = [
{ name: "Model A - v1", status: "success", time: "2025-05-12 09:12" }, { name: "Model A - v1", status: "success", time: "2025-05-12 09:12" },
{ name: "Model B - tuning", status: "success", time: "2025-05-14 08:59" }, { name: "Model B - tuning", status: "success", time: "2025-05-14 08:59" },
@ -52,12 +66,7 @@ const datasetUpdates = [
{ name: "Traffic_log", count: 2 }, { name: "Traffic_log", count: 2 },
{ name: "Traffic_log2", count: 2 }, { name: "Traffic_log2", count: 2 },
]; ];
const dummyWorkflow = [
{ title: "Volcano Test Pipeline", date: "2025-05-13 08:12" },
{ title: "Volcano Test Pipeline", date: "2025-05-13 08:12" },
{ title: "XGBoost Training", date: "2025-05-13 08:12" },
{ title: "Data Preprocess Flow", date: "2025-05-13 08:12" },
];
const tableHeader = [ const tableHeader = [
{ label: "Model Name", width: "10%", style: "word-break: keep-all;" }, { label: "Model Name", width: "10%", style: "word-break: keep-all;" },
{ label: "Version", width: "10%", style: "word-break: keep-all;" }, { label: "Version", width: "10%", style: "word-break: keep-all;" },
@ -93,10 +102,10 @@ const data = ref({
download: "Failed", download: "Failed",
}, },
], ],
allSelected: false, allSelected: false,
selected: [], selected: [],
}); });
const handleRefresh = () => { const handleRefresh = () => {
alert("Refresh 작업 진행중..."); alert("Refresh 작업 진행중...");
}; };
@ -105,6 +114,73 @@ const getSelectedAllData = () => {
? data.value.results.map(({ deviceKey }) => ({ deviceKey })) ? data.value.results.map(({ deviceKey }) => ({ deviceKey }))
: []; : [];
}; };
const getLatestTimestamp = (wf: any): string => wf.modDt;
// "YYYY-MM-DD HH:mm"
const formatToYmdHm = (isoString: string): string => {
if (!isoString) return "-";
const d = new Date(isoString);
const pad = (n: number) => String(n).padStart(2, "0");
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}`;
};
const recentWorkflowList = computed(() => {
return (workflows.value ?? [])
.map((wf: any) => ({
id: wf.id,
title: wf.name,
timestamp: getLatestTimestamp(wf),
}))
.filter((item) => item.title && item.timestamp)
.sort(
(a, b) =>
new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime(),
)
.slice(0, recentLimit);
});
// ---- & ----
async function loadWorkflows() {
try {
const payload = {
page: 0,
size: 1000,
projectId: currentProjectId.value,
sortField: "id",
sortDirection: "DESC",
};
const res = await WorkflowService.search(payload);
const raw = Array.isArray(res?.data?.content)
? res.data.content
: Array.isArray(res?.data)
? res.data
: [];
workflows.value = raw.filter(
(wf: any) =>
String(
wf?.projectId ?? wf?.prjId ?? wf?.project_id ?? wf?.project?.id ?? "",
) === String(currentProjectId.value),
);
renderStatusPie();
} catch (err) {
console.error("GET /api/workflows failed:", err);
workflows.value = [];
renderStatusPie();
}
}
onMounted(async () => {
// ,
renderStatusPie();
await loadWorkflows();
});
//
watch(currentProjectId, () => loadWorkflows());
</script> </script>
<template> <template>
@ -138,15 +214,23 @@ const getSelectedAllData = () => {
</div> </div>
<div style="overflow-y: auto; max-height: 300px; padding: 8px 16px"> <div style="overflow-y: auto; max-height: 300px; padding: 8px 16px">
<v-list density="comfortable" nav> <v-list density="comfortable" nav>
<v-list-item v-for="(item, idx) in dummyWorkflow" :key="idx"> <v-list-item v-for="item in recentWorkflowList" :key="item.id">
<template #title> <template #title>
<div class="d-flex justify-space-between align-center w-100"> <div class="d-flex justify-space-between align-center w-100">
<span class="text-body-2 font-weight-medium">{{ <span class="text-body-2 font-weight-medium">{{
item.title item.title
}}</span> }}</span>
<span class="text-caption text-grey-lighten-1">{{ <span class="text-caption text-grey-lighten-1">
item.date {{ formatToYmdHm(item.timestamp) }}
}}</span> </span>
</div>
</template>
</v-list-item>
<v-list-item v-if="recentWorkflowList.length === 0">
<template #title>
<div class="text-caption text-grey">
최근 등록/수정된 워크플로우가 없습니다.
</div> </div>
</template> </template>
</v-list-item> </v-list-item>

@ -2,20 +2,29 @@
import { ref, onMounted, watch, computed } from "vue"; import { ref, onMounted, watch, computed } from "vue";
import { commonStore } from "@/stores/commonStore"; import { commonStore } from "@/stores/commonStore";
import { storage } from "@/utils/storage.js"; import { storage } from "@/utils/storage.js";
import { ProjectService } from "@/components/service/project/projectService"; import { ProjectService } from "@/components/service/project/projectService";
import { UserManagerService } from "@/components/service/management/userManagerService"; import { UserManagerService } from "@/components/service/management/userManagerService";
import type { Permission } from "@/components/models/project/Project";
import IconDeleteBtn from "@/components/atoms/button/IconDeleteBtn.vue";
import IconModifyBtn from "@/components/atoms/button/IconModifyBtn.vue";
import type {
Permission,
ApiProject,
} from "@/components/models/project/Project";
//
// /
//
const store = commonStore(); const store = commonStore();
type SearchType = "전체" | "제목" | "작성자";
const searchOptions = [
{ label: "전체", value: "전체" as SearchType },
{ label: "제목", value: "제목" as SearchType },
{ label: "작성자", value: "작성자" as SearchType },
];
const SEARCH_TYPE_MAP: Record<SearchType | "", "ALL" | "TITLE" | "AUTHOR"> = {
"": "ALL",
전체: "ALL",
제목: "TITLE",
작성자: "AUTHOR",
};
const DEFAULT_PERMISSIONS: Permission[] = [ const DEFAULT_PERMISSIONS: Permission[] = [
"CREATE", "CREATE",
"READ", "READ",
@ -31,9 +40,6 @@ const refreshRoles = () => {
}; };
const isAdmin = computed(() => roles.value.includes("ROLE_ADMIN")); const isAdmin = computed(() => roles.value.includes("ROLE_ADMIN"));
//
// / (UI )
//
const tableHeader = [ const tableHeader = [
{ label: "No", width: "5%", style: "word-break: keep-all;" }, { label: "No", width: "5%", style: "word-break: keep-all;" },
{ label: "Project Name", width: "20%", style: "word-break: keep-all;" }, { label: "Project Name", width: "20%", style: "word-break: keep-all;" },
@ -43,13 +49,6 @@ const tableHeader = [
{ label: "Action", width: "13%", style: "word-break: keep-all;" }, { label: "Action", width: "13%", style: "word-break: keep-all;" },
]; ];
const searchOptions = [
{ searchType: "전체", searchText: "" },
{ searchType: "프로젝트명", searchText: "prjNm" },
{ searchType: "설명", searchText: "prjDesc" },
{ searchType: "생성자", searchText: "regUserId" },
];
const pageSizeOptions = [ const pageSizeOptions = [
{ text: "10 페이지", value: 10 }, { text: "10 페이지", value: 10 },
{ text: "50 페이지", value: 50 }, { text: "50 페이지", value: 50 },
@ -60,13 +59,23 @@ type Row = {
no: number; no: number;
name: string; name: string;
desc: string; desc: string;
users: string[]; users: string[]; // (= mod_user_nm )
registDt: string; registDt: string;
deviceKey: number; deviceKey: number;
}; };
// reg ( )
const projectRegById = ref<Record<number, { regId?: string; regNm?: string }>>(
{},
);
const data = ref({ const data = ref({
params: { pageNum: 1, pageSize: 10, searchType: "", searchText: "" }, params: {
pageNum: 1,
pageSize: 10,
searchType: "전체" as SearchType,
searchText: "",
},
results: [] as Row[], results: [] as Row[],
totalDataLength: 0, totalDataLength: 0,
pageLength: 0, pageLength: 0,
@ -87,60 +96,157 @@ const splitCsv = (v?: string) =>
.map((s) => s.trim()) .map((s) => s.trim())
.filter(Boolean); .filter(Boolean);
//
/** 사용자 목록 (v-select items) */
//
type UserOption = { id: number | string; username: string }; type UserOption = { id: number | string; username: string };
const userOptions = ref<UserOption[]>([]); const userOptions = ref<UserOption[]>([]);
async function loadUsers() { async function loadUsers() {
const { data } = await UserManagerService.getAll(); const { data } = await UserManagerService.getAll();
const raw = data as Array<{ id: number | string; username: string }>; const raw = data as Array<{ id: number | string; username: string }>;
userOptions.value = raw.map((u) => ({ id: u.id, username: u.username })); userOptions.value = raw.map((u) => ({ id: u.id, username: u.username }));
} }
// // UI (mod_user_nm )
/** 목록 로드: 카드형 로직과 동일한 응답을 테이블 Row로 매핑 */ function toRow(p: any, no: number): Row {
// let displayNm = "";
function toRow(p: any, index: number, offset: number): Row { if (typeof p.modUserNm === "string" && p.modUserNm.length > 0)
displayNm = p.modUserNm;
else if (typeof p.regUserNm === "string") displayNm = p.regUserNm;
// reg
projectRegById.value[p.id] = { regId: p.regUserId, regNm: p.regUserNm };
return { return {
no: offset + index + 1, no,
name: p.prjNm ?? "-", name: p.prjNm,
desc: p.prjDesc ?? "-", desc: p.prjDesc,
users: splitCsv(p.regUserId ?? p.regUserNm), users: splitCsv(displayNm),
registDt: fmtDate(p.regDate ?? p.prjStartDt), registDt: fmtDate(p.prjStartDt), //
deviceKey: p.id, deviceKey: p.id,
}; };
} }
/** ===== 목록 조회 (검색/페이지네이션 포함) ===== */
async function getData() { async function getData() {
const { pageNum, pageSize } = data.value.params; const { pageNum, pageSize, searchType, searchText } = data.value.params;
const startIndex = (pageNum - 1) * pageSize;
const mapped = SEARCH_TYPE_MAP[searchType] || "ALL";
const keyword = (searchText || "").trim();
const res = await ProjectService.search(); const needLocalFilter = mapped !== "ALL" && keyword.length > 0;
const raw = Array.isArray(res.data) ? res.data : (res.data?.content ?? []);
data.value.totalDataLength = Array.isArray(res.data) let reqPage = data.value.params.pageNum;
? raw.length let reqSize = data.value.params.pageSize;
: (res.data?.totalElements ?? raw.length); if (needLocalFilter) {
reqPage = 0;
reqSize = 1000;
}
const payload = {
page: reqPage,
size: reqSize,
keyword,
searchType: mapped,
sortField: "id",
sortDirection: "DESC",
};
try {
const res = await ProjectService.searchProjects(payload as any);
const result = res?.data ?? res;
let list: any[] = result?.content ?? (Array.isArray(result) ? result : []);
//
if (needLocalFilter) {
const kw = keyword.toLowerCase();
if (mapped === "TITLE") {
list = list.filter((x: any) =>
String(x?.prjNm ?? "")
.toLowerCase()
.includes(kw),
);
} else if (mapped === "AUTHOR") {
list = list.filter((x: any) => {
let authorStr = "";
if (typeof x.modUserNm === "string" && x.modUserNm.length > 0)
authorStr = x.modUserNm;
else if (typeof x.regUserNm === "string") authorStr = x.regUserNm;
return authorStr.toLowerCase().includes(kw);
});
}
const uiSize = data.value.params.pageSize;
const totalElements = list.length;
const totalPages = Math.max(1, Math.ceil(totalElements / uiSize));
const safePage = Math.min(Math.max(1, pageNum), totalPages);
const start = (safePage - 1) * uiSize;
const pageSlice = list.slice(start, start + uiSize);
const slice = Array.isArray(res.data) const firstNo = totalElements - start;
? raw.slice(startIndex, startIndex + pageSize)
: raw; // reg
data.value.results = slice.map((p: any, i: number) => projectRegById.value = {};
toRow(p, i, startIndex), data.value.results = pageSlice.map((p: any, i: number) =>
toRow(p, Math.max(1, firstNo - i)),
); );
data.value.totalDataLength = totalElements;
data.value.pageLength = totalPages;
return;
}
const total = data.value.totalDataLength || 0; const totalElements =
typeof result?.totalElements === "number"
? result.totalElements
: (list.length ?? 0);
const serverPage = result?.pageable?.pageNumber;
const serverSize = result?.pageable?.pageSize;
const offset =
typeof result?.pageable?.offset === "number"
? result.pageable.offset
: typeof serverPage === "number" && typeof serverSize === "number"
? serverPage * serverSize
: (pageNum - 1) * pageSize;
const firstNo = totalElements - offset;
// reg
projectRegById.value = {};
data.value.results = list.map((p: any, i: number) =>
toRow(p, Math.max(1, firstNo - i)),
);
data.value.totalDataLength = totalElements;
data.value.pageLength = data.value.pageLength =
total % data.value.params.pageSize === 0 typeof result?.totalPages === "number"
? total / data.value.params.pageSize ? result.totalPages
: Math.ceil(total / data.value.params.pageSize); : Math.max(1, Math.ceil(totalElements / pageSize));
} catch (e) {
console.error("[Project] search error:", e);
data.value.results = [];
data.value.totalDataLength = 0;
data.value.pageLength = 1;
}
}
/** 트리거 */
function doSearch() {
data.value.params.pageNum = 1;
getData();
} }
function changePageSize(size: number) {
data.value.params.pageSize = size;
data.value.params.pageNum = 1;
getData();
}
function changePageNum(page: number) {
data.value.params.pageNum = page;
getData();
}
watch(
() => data.value.params.searchType,
() => doSearch(),
);
// /** ===== 생성/수정 다이얼로그 ===== */
/** 폼 & 권한 부여 & 저장 흐름 (카드형과 동일) */
//
const form = ref({ const form = ref({
prjCd: "", prjCd: "",
prjNm: "", prjNm: "",
@ -156,12 +262,52 @@ const resetForm = () => {
form.value.selectedUsers = []; form.value.selectedUsers = [];
}; };
const buildApiPayload = (): ApiProject => { // payload (mod* )
type NewProjectPayload = {
id: null;
prjCd: string;
prjNm: string;
prjDesc: string;
prjStartDt: string;
prjEndDt: string;
delYn: string;
regDate: string;
regUserId?: string;
regUserNm?: string;
};
// payload (reg* , mod* )
type UpdateProjectPayload = {
id: number;
prjCd: string;
prjNm: string;
prjDesc: string;
prjStartDt: string;
prjEndDt: string;
delYn: string;
regDate: string;
regUserId?: string;
regUserNm?: string;
modDate: string;
modUserId?: string;
modUserNm?: string;
};
function buildCreatePayload(): NewProjectPayload {
const today = new Date().toISOString().slice(0, 10); const today = new Date().toISOString().slice(0, 10);
const nowIso = new Date().toISOString(); const nowIso = new Date().toISOString();
const namesCsv = form.value.selectedUsers.join(",");
const names = form.value.selectedUsers;
const namesCsv = names.join(",");
const idsCsv = names
.map((name) => userOptions.value.find((u) => u.username === name)?.id)
.filter(
(v): v is number | string => v !== undefined && v !== null && v !== "",
)
.map(String)
.join(",");
return { return {
id: data.value.modalMode === "edit" ? editingProjectId.value! : null, id: null,
prjCd: form.value.prjCd, prjCd: form.value.prjCd,
prjNm: form.value.prjNm, prjNm: form.value.prjNm,
prjDesc: form.value.prjDesc, prjDesc: form.value.prjDesc,
@ -169,13 +315,44 @@ const buildApiPayload = (): ApiProject => {
prjEndDt: today, prjEndDt: today,
delYn: "N", delYn: "N",
regDate: nowIso, regDate: nowIso,
regUserId: namesCsv, regUserId: idsCsv,
regUserNm: namesCsv, regUserNm: namesCsv,
};
}
function buildUpdatePayload(): UpdateProjectPayload {
const today = new Date().toISOString().slice(0, 10);
const nowIso = new Date().toISOString();
const names = form.value.selectedUsers;
const namesCsv = names.join(",");
const idsCsv = names
.map((name) => userOptions.value.find((u) => u.username === name)?.id)
.filter(
(v): v is number | string => v !== undefined && v !== null && v !== "",
)
.map(String)
.join(",");
const id = editingProjectId.value!;
const kept = projectRegById.value[id] || {};
return {
id,
prjCd: form.value.prjCd,
prjNm: form.value.prjNm,
prjDesc: form.value.prjDesc,
prjStartDt: today,
prjEndDt: today,
delYn: "N",
regDate: nowIso,
regUserId: kept.regId,
regUserNm: kept.regNm,
modDate: nowIso, modDate: nowIso,
modUserId: namesCsv, modUserId: idsCsv,
modUserNm: namesCsv, modUserNm: namesCsv,
}; };
}; }
async function grantDefaultPermissions(projectId: number, usernames: string[]) { async function grantDefaultPermissions(projectId: number, usernames: string[]) {
if (!usernames?.length) return; if (!usernames?.length) return;
@ -198,13 +375,14 @@ async function grantDefaultPermissions(projectId: number, usernames: string[]) {
async function saveProject() { async function saveProject() {
try { try {
const payload = buildApiPayload();
let projectId: number; let projectId: number;
if (data.value.modalMode === "create") { if (data.value.modalMode === "create") {
const payload = buildCreatePayload();
const res = await ProjectService.add(payload); const res = await ProjectService.add(payload);
projectId = res.data.id; projectId = res.data.id;
} else { } else {
const payload = buildUpdatePayload();
await ProjectService.update(editingProjectId.value!, payload); await ProjectService.update(editingProjectId.value!, payload);
projectId = editingProjectId.value!; projectId = editingProjectId.value!;
} }
@ -217,15 +395,41 @@ async function saveProject() {
} }
} }
// function openCreateModal() {
// data.value.modalMode = "create";
// editingProjectId.value = null;
resetForm();
data.value.isCreateVisible = true;
}
function openEditModal(row: Row) {
data.value.modalMode = "edit";
editingProjectId.value = row.deviceKey;
form.value.prjCd = row.name;
form.value.prjNm = row.name;
form.value.prjDesc = row.desc === "-" ? "" : row.desc;
form.value.selectedUsers = Array.isArray(row.users) ? [...row.users] : [];
//
const known = new Set(userOptions.value.map((u) => u.username));
const missing = form.value.selectedUsers
.filter((u) => !known.has(u))
.map((u) => ({ id: u, username: u }));
if (missing.length) userOptions.value = [...userOptions.value, ...missing];
data.value.isCreateVisible = true;
}
function getSelectedAllData() {
data.value.selected = data.value.allSelected
? data.value.results.map((r) => ({ deviceKey: r.deviceKey }))
: [];
}
async function deleteRows(targetList?: Array<{ deviceKey: number }>) { async function deleteRows(targetList?: Array<{ deviceKey: number }>) {
const removeList = targetList ?? data.value.selected; const removeList = targetList ?? data.value.selected;
if (!removeList?.length) return; if (!removeList?.length) return;
const ids = removeList.map((x) => x.deviceKey); const ids = removeList.map((x) => x.deviceKey);
const remove = (id: number) => const remove = (id: number) =>
ProjectService.delete(id).then((res) => { ProjectService.delete(id).then((res) => {
if (res.status < 200 || res.status >= 300) return Promise.reject(res); if (res.status < 200 || res.status >= 300) return Promise.reject(res);
@ -283,55 +487,6 @@ async function deleteRows(targetList?: Array<{ deviceKey: number }>) {
} }
} }
//
// UI ( / )
//
function getSelectedAllData() {
data.value.selected = data.value.allSelected
? data.value.results.map((r) => ({ deviceKey: r.deviceKey }))
: [];
}
function changePageNum(page: number) {
data.value.params.pageNum = page;
getData();
}
function openCreateModal() {
data.value.modalMode = "create";
editingProjectId.value = null;
resetForm();
data.value.isCreateVisible = true;
}
function openEditModal(row: Row) {
data.value.modalMode = "edit";
editingProjectId.value = row.deviceKey;
form.value.prjCd = row.name;
form.value.prjNm = row.name;
form.value.prjDesc = row.desc === "-" ? "" : row.desc;
form.value.selectedUsers = Array.isArray(row.users) ? [...row.users] : [];
// v-select
const known = new Set(userOptions.value.map((u) => u.username));
const missing = form.value.selectedUsers
.filter((u) => !known.has(u))
.map((u) => ({ id: u, username: u }));
if (missing.length) userOptions.value = [...userOptions.value, ...missing];
data.value.isCreateVisible = true;
}
function openDetailModal(row: Row) {
data.value.selectedData = row;
}
function closeDetail() {
data.value.selectedData = null;
}
//
watch( watch(
() => data.value.isCreateVisible, () => data.value.isCreateVisible,
(now, prev) => { (now, prev) => {
@ -339,9 +494,6 @@ watch(
}, },
); );
//
//
//
onMounted(async () => { onMounted(async () => {
refreshRoles(); refreshRoles();
await Promise.all([loadUsers(), getData()]); await Promise.all([loadUsers(), getData()]);
@ -359,7 +511,7 @@ onMounted(async () => {
<v-card flat class="bg-shades-transparent w-100"> <v-card flat class="bg-shades-transparent w-100">
<v-card-item class="text-h5 font-weight-bold pt-0 pa-5 pl-0"> <v-card-item class="text-h5 font-weight-bold pt-0 pa-5 pl-0">
<div class="d-flex flex-row justify-start align-center"> <div class="d-flex flex-row justify-start align-center">
<div class="text-primary">Project</div> <div class="text-primary">Projects</div>
</div> </div>
</v-card-item> </v-card-item>
</v-card> </v-card>
@ -373,13 +525,14 @@ onMounted(async () => {
min-width="180" min-width="180"
class="mr-3 mt-3 mb-3" class="mr-3 mt-3 mb-3"
> >
<!-- [object Object] 해결 -->
<v-select <v-select
v-model="data.params.searchType" v-model="data.params.searchType"
label="검색조건" label="검색조건"
density="compact" density="compact"
:items="searchOptions" :items="searchOptions"
item-title="searchType" item-title="label"
item-value="searchText" item-value="value"
hide-details hide-details
/> />
</v-responsive> </v-responsive>
@ -393,7 +546,7 @@ onMounted(async () => {
required required
class="mt-3 mb-3" class="mt-3 mb-3"
hide-details hide-details
@keyup.enter="changePageNum(1)" @keyup.enter="doSearch"
/> />
</v-responsive> </v-responsive>
@ -402,7 +555,7 @@ onMounted(async () => {
size="large" size="large"
color="primary" color="primary"
:rounded="5" :rounded="5"
@click="changePageNum(1)" @click="doSearch"
> >
<v-icon>mdi-magnify</v-icon> <v-icon>mdi-magnify</v-icon>
</v-btn> </v-btn>
@ -410,6 +563,7 @@ onMounted(async () => {
</div> </div>
</v-card> </v-card>
<!-- 상단 툴바 -->
<v-sheet <v-sheet
class="bg-shades-transparent d-flex flex-wrap align-center mb-2" class="bg-shades-transparent d-flex flex-wrap align-center mb-2"
> >
@ -421,6 +575,7 @@ onMounted(async () => {
> {{ data.totalDataLength.toLocaleString() }}</v-chip > {{ data.totalDataLength.toLocaleString() }}</v-chip
> >
</v-sheet> </v-sheet>
<v-sheet class="bg-shades-transparent"> <v-sheet class="bg-shades-transparent">
<v-responsive max-width="140" min-width="140" class="mb-2"> <v-responsive max-width="140" min-width="140" class="mb-2">
<v-select <v-select
@ -432,7 +587,7 @@ onMounted(async () => {
variant="outlined" variant="outlined"
color="primary" color="primary"
hide-details hide-details
@update:model-value="changePageNum(1)" @update:model-value="changePageSize"
/> />
</v-responsive> </v-responsive>
</v-sheet> </v-sheet>
@ -502,12 +657,10 @@ onMounted(async () => {
<td>{{ item.no }}</td> <td>{{ item.no }}</td>
<td>{{ item.name }}</td> <td>{{ item.name }}</td>
<!-- Description -->
<td> <td>
<div class="truncate-2">{{ item.desc }}</div> <div class="truncate-2">{{ item.desc }}</div>
</td> </td>
<!-- Select Users -->
<td> <td>
<template v-if="item.users?.length"> <template v-if="item.users?.length">
<v-chip <v-chip
@ -586,10 +739,10 @@ onMounted(async () => {
</v-card-text> </v-card-text>
<v-card-actions> <v-card-actions>
<v-spacer /> <v-spacer />
<v-btn text @click="data.isCreateVisible = false">Cancel</v-btn>
<v-btn color="primary" @click="saveProject"> <v-btn color="primary" @click="saveProject">
{{ data.modalMode === "create" ? "Create" : "Save" }} {{ data.modalMode === "create" ? "Create" : "Save" }}
</v-btn> </v-btn>
<v-btn text @click="data.isCreateVisible = false">Cancel</v-btn>
</v-card-actions> </v-card-actions>
</v-card> </v-card>
</v-dialog> </v-dialog>

@ -1,296 +1,299 @@
<script setup lang="ts"> <script setup lang="ts">
import IconDeleteBtn from "@/components/atoms/button/IconDeleteBtn.vue"; import IconDeleteBtn from "@/components/atoms/button/IconDeleteBtn.vue";
import IconInfoBtn from "@/components/atoms/button/IconInfoBtn.vue"; import IconInfoBtn from "@/components/atoms/button/IconInfoBtn.vue";
import { onMounted, ref, watch } from "vue"; import { onMounted, ref } from "vue";
import { storage } from "@/utils/storage";
import ViewComponent from "@/components/templates/run/experiment/ViewComponent.vue"; import ViewComponent from "@/components/templates/run/experiment/ViewComponent.vue";
import ExperimentCreateDialog from "@/components/atoms/organisms/ExperimentCreateDialog.vue"; import ExperimentCreateDialog from "@/components/atoms/organisms/ExperimentCreateDialog.vue";
import { ExperimentService } from "@/components/service/management/ExperimentService";
import { commonStore } from "@/stores/commonStore";
// const store = commonStore(); const store = commonStore();
const detailDialog = ref(false); const detailDialog = ref(false);
const openView = ref(false); const openView = ref(false);
const username = ref<string>("");
const selectedExperiment = ref<{ const selectedExperiment = ref<{
name: string; name: string;
description: string; description: string;
createdDate: string; createdDate: string;
createdID: string; createdID: string;
deviceKey: number;
} | null>(null); } | null>(null);
// ===== =====
const tableHeader = [ const tableHeader = [
{ { label: "Experiment Name", width: "20%", style: "word-break: keep-all;" },
label: "Experiment Name", { label: "Description", width: "20%", style: "word-break: keep-all;" },
width: "20%", { label: "Created Date", width: "20%", style: "word-break: keep-all;" },
style: "word-break: keep-all;", { label: "Created ID", width: "20%", style: "word-break: keep-all;" },
}, { label: "Action", width: "20%", style: "word-break: keep-all;" },
{
label: "Description",
width: "20%",
style: "word-break: keep-all;",
},
{
label: "Created Date",
width: "20%",
style: "word-break: keep-all;",
},
{
label: "Created ID",
width: "20%",
style: "word-break: keep-all;",
},
{
label: "Action",
width: "20%",
style: "word-break: keep-all;",
},
]; ];
// ===== / (/ '') =====
type SearchType = "전체" | "제목" | "작성자";
const searchOptions = [ const searchOptions = [
{ searchType: "All", searchText: "" }, { label: "전체", value: "전체" as SearchType },
{ searchType: "Experiment Name", searchText: "name" }, { label: "제목", value: "제목" as SearchType },
{ searchType: "Description", searchText: "description" }, { label: "작성자", value: "작성자" as SearchType },
{ searchType: "Created Date", searchText: "createdDate" },
{ searchType: "Created ID", searchText: "createdID" },
]; ];
const SEARCH_TYPE_MAP: Record<SearchType | "", "ALL" | "TITLE" | "AUTHOR"> = {
"": "ALL",
전체: "ALL",
제목: "TITLE",
작성자: "AUTHOR",
};
const pageSizeOptions = [ const pageSizeOptions = [
{ text: "10 페이지", value: 10 }, { text: "10 페이지", value: 10 },
{ text: "50 페이지", value: 50 }, { text: "50 페이지", value: 50 },
{ text: "100 페이지", value: 100 }, { text: "100 페이지", value: 100 },
]; ];
// ===== =====
const data = ref({ const data = ref({
params: { params: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
searchType: "", searchType: "전체" as SearchType,
searchText: "", searchText: "",
}, },
results: [], results: [] as any[],
totalDataLength: 0, totalElements: 0,
pageLength: 0, pageLength: 0,
modalMode: "", modalMode: "" as "create" | "edit" | "",
selectedData: null, selectedData: null as any,
allSelected: false, allSelected: false,
selected: [], selected: [] as any[],
isCreateVisible: false,
isModalVisible: false, isModalVisible: false,
isConfirmDialogVisible: false, isConfirmDialogVisible: false,
userOption: [], userOption: [] as any[],
}); });
const getCodeList = () => { // ===== =====
// UserService.search(data.value.params).then((d) => { function readUsernameFromStorage(): string {
// if (d.status === 200) { try {
// data.value.userOption = d.data.userList; const raw =
// } storage?.get?.("autoflow-auth") ??
// }); storage?.getAuth?.() ??
localStorage.getItem("autoflow-auth") ??
null;
const auth = typeof raw === "string" ? JSON.parse(raw) : raw;
const u1 = auth?.userInfo?.username;
const u2 = auth?.username;
const u3 = auth?.userInfo?.userName;
const u4 = auth?.userInfo?.email?.split?.("@")?.[0];
return (u1 || u2 || u3 || u4 || "").toString();
} catch {
return "";
}
}
const getProjectId = (): number => {
const v = Number(localStorage.getItem("projectId"));
return Number.isFinite(v) ? v : 0;
}; };
const fmtDate = (v?: string) =>
v ? String(v).replace("T", " ").slice(0, 19) : "";
const getData = () => { // Row
const params = { ...data.value.params }; const toRow = (e: any) => ({
if (params.searchType === "" || params.searchText === "") { name: e.displayName,
delete params.searchType; description: e.description,
delete params.searchText; createdDate: fmtDate(e.lastUpdateTime),
deviceKey: e.id,
createdID: e.regUserId,
});
// ===== ( ) =====
const fetchList = async () => {
const projectId = getProjectId();
if (!projectId) {
console.warn("[Experiments] projectId 없음 — 프로젝트 먼저 선택");
data.value.results = [];
data.value.totalElements = 0;
data.value.pageLength = 0;
return;
} }
data.value.results = [
{ const { pageNum, pageSize, searchType, searchText } = data.value.params;
name: "Baseline Model Training", const mapped = SEARCH_TYPE_MAP[searchType] || "ALL";
description: "기본 모델 구조로 학습 성능 측정", const keyword = (searchText || "").trim();
createdDate: "2025-04-28", const needLocalFilter = mapped !== "ALL" && keyword.length > 0;
createdID: "ADMIN_001",
}, let reqPage = data.value.params.pageNum;
{ let reqSize = data.value.params.pageSize;
name: "Batch Size Tuning", if (needLocalFilter) {
description: "배치 사이즈 변경에 따른 학습 성능", // +
createdDate: "2025-04-20", reqPage = 0;
createdID: "ADMIN_001", reqSize = 1000;
}, }
{
name: "Learning Rate Sweep", const payload = {
description: "러닝레이트 변경에 따른 손실 ", projectId,
createdDate: "2025-04-20", page: reqPage,
createdID: "ADMIN_001", size: reqSize,
}, keyword,
{ searchType: mapped,
name: "Optimizer Comparison",
description: "Adam, SGD 등 옵티마이저 종류",
createdDate: "2025-04-20",
createdID: "ADMIN_001",
},
{
name: "Model Architecture A vs B",
description: "서로 다른 모델 구조",
createdDate: "2025-01-28",
createdID: "ADMIN_001",
},
];
data.value.totalDataLength = data.value.results.length;
setPaginationLength();
// DeviceService.search(params).then((d) => {
// if (d.status === 200) {
// data.value.results = d.data.deviceList;
// data.value.totalDataLength = d.data.totalCount;
// setTimeout(() => {
// setPaginationLength();
// }, 200);
// } else {
// store.setSnackbarMsg({
// text: " ",
// color: "error",
// });
// }
// });
// DeviceService.search().then((d) => {
// data.value.totalDataLength = d.data.totalCount;
// setTimeout(() => {
// setPaginationLength();
// }, 200);
// });
}; };
const setPaginationLength = () => { try {
if (data.value.totalDataLength % data.value.params.pageSize === 0) { const res = await ExperimentService.search(payload as any);
data.value.pageLength = const result = res?.data ?? res;
data.value.totalDataLength / data.value.params.pageSize; let list = result?.content ?? [];
} else {
data.value.pageLength = Math.ceil( if (needLocalFilter) {
data.value.totalDataLength / data.value.params.pageSize, const kw = keyword.toLowerCase();
if (mapped === "TITLE") {
list = list.filter((x: any) =>
String(x?.name ?? x?.displayName ?? "")
.toLowerCase()
.includes(kw),
);
} else if (mapped === "AUTHOR") {
list = list.filter((x: any) =>
String(x?.regUserId ?? "")
.toLowerCase()
.includes(kw),
); );
} }
};
const saveData = (formData) => { //
if (data.value.modalMode === "create") { const uiSize = data.value.params.pageSize;
// DeviceService.add(formData).then((d) => { const totalElements = list.length;
// if (d.status === 200) { const totalPages = Math.max(1, Math.ceil(totalElements / uiSize));
// data.value.isModalVisible = false; const safePage = Math.min(Math.max(1, pageNum), totalPages);
// store.setSnackbarMsg({ const start = (safePage - 1) * uiSize;
// text: " .", const pageSlice = list.slice(start, start + uiSize);
// result: 200,
// }); data.value.results = pageSlice.map(toRow);
// changePageNum(1); data.value.totalElements = totalElements;
// } else { data.value.pageLength = totalPages;
// store.setSnackbarMsg({ return;
// text: d, }
// result: 500,
// }); data.value.results = (list as any[]).map(toRow);
// } data.value.totalElements = result?.totalElements ?? list.length;
// }); data.value.pageLength = result?.totalPages ?? 1;
} else { } catch (err) {
// DeviceService.update(formData.deviceKey, formData).then((d) => { console.error("[Experiments] 조회 에러:", err);
// if (d.status === 200) { data.value.results = [];
// data.value.isModalVisible = false; data.value.totalElements = 0;
// store.setSnackbarMsg({ data.value.pageLength = 1;
// text: " .",
// result: 200,
// });
// changePageNum();
// } else {
// store.setSnackbarMsg({
// text: d,
// result: 500,
// });
// }
// });
} }
}; };
const removeData = (value) => { // ===== / =====
let removeList = value ? value : data.value.selected; const doSearch = () => {
const remove = (code) => { data.value.params.pageNum = 1;
// return DeviceService.delete(code).then((d) => { fetchList();
// if (d.status !== 200) { };
// store.setSnackbarMsg({ const changePageNum = (page: number) => {
// text: d, data.value.params.pageNum = page;
// result: 500, fetchList();
// }); };
// } const changePageSize = (size: number) => {
// }); data.value.params.pageSize = size;
data.value.params.pageNum = 1;
fetchList();
}; };
if (removeList.length === 1) { // / ( )
remove(removeList[0].deviceKey).then(() => { const removeData = (value?: Array<{ deviceKey: number }>) => {
// store.setSnackbarMsg({ const removeList = value ?? data.value.selected;
if (!removeList || removeList.length === 0) return;
// text: ".", const ids = removeList.map((x) => x.deviceKey);
// result: 200, const removeOne = (id: number) =>
// }); ExperimentService.delete(id).then((res) => {
changePageNum(); if (res.status < 200 || res.status >= 300) return Promise.reject(res);
data.value.isConfirmDialogVisible = false;
data.value.selected = [];
data.value.allSelected = false;
}); });
} else {
Promise.all(removeList.map((item) => remove(item.deviceKey))).finally( const after = () => {
() => { if (
// store.setSnackbarMsg({ ids.length >= data.value.results.length &&
// text: " .", data.value.params.pageNum > 1
// result: 200, ) {
// }); data.value.params.pageNum -= 1;
changePageNum(); }
fetchList();
data.value.isConfirmDialogVisible = false; data.value.isConfirmDialogVisible = false;
data.value.selected = []; data.value.selected = [];
data.value.allSelected = false; data.value.allSelected = false;
},
);
}
}; };
const handleRemoveData = () => { // /
if (data.value.selected.length === 0) { if (ids.length === 1) {
// store.setSnackbarMsg({ removeOne(ids[0])
// text: " . ", .then(() => {
// result: 500, store.setSnackbarMsg({
// }); color: "success",
return; text: "삭제되었습니다.",
} result: 200,
if (data.value.allSelected || data.value.selected.length !== 1) { });
data.value.isConfirmDialogVisible = true; after();
return; })
.catch((err) => {
console.error("삭제 실패:", err);
store.setSnackbarMsg({
color: "warning",
text: "삭제 실패",
result: 500,
});
});
} else {
Promise.all(ids.map(removeOne))
.then(() => {
store.setSnackbarMsg({
color: "success",
text: "모두 삭제되었습니다.",
result: 200,
});
})
.catch((err) => {
console.error("일부 삭제 실패:", err);
store.setSnackbarMsg({
color: "warning",
text: "일부 삭제 실패",
result: 500,
});
})
.finally(after);
} }
//
removeData(undefined);
};
const changePageNum = (page) => {
data.value.params.pageNum = page;
getData();
}; };
const openDetail = (item: { // ===== & ( ) =====
name: string;
description: string;
createdDate: string;
createdID: string;
}) => {
selectedExperiment.value = item;
openView.value = true;
};
const closeDetail = () => { const closeDetail = () => {
openView.value = false; openView.value = false;
selectedExperiment.value = null; selectedExperiment.value = null;
}; };
const openDetailModal = (selectedItem: any) => {
console.log("[Experiment/List] row clicked:", selectedItem);
if (!selectedItem?.deviceKey) {
console.warn("[Experiment/List] deviceKey 없음!", selectedItem);
}
data.value.selectedData = selectedItem;
openView.value = true;
};
const openCreateModal = () => { const openCreateModal = () => {
data.value.selectedData = null;
data.value.modalMode = "create"; data.value.modalMode = "create";
data.value.isModalVisible = true; data.value.selectedData = {
username: username.value,
projectId: getProjectId(),
};
data.value.isCreateVisible = true;
}; };
const closeModal = () => { const closeModal = () => {
data.value.isModalVisible = false; data.value.isCreateVisible = false;
data.value.selectedData = null; data.value.selectedData = null;
}; };
const getSelectedAllData = () => {
data.value.selected = data.value.allSelected
? data.value.results.map((item) => {
return {
deviceKey: item.deviceKey,
};
})
: [];
};
onMounted(() => { onMounted(() => {
getData(); username.value = readUsernameFromStorage();
getCodeList(); fetchList();
}); });
</script> </script>
@ -308,7 +311,9 @@ onMounted(() => {
</div> </div>
</v-card-item> </v-card-item>
</v-card> </v-card>
<v-card flat class="bg-shades-transparent w-100"> <v-card flat class="bg-shades-transparent w-100">
<!-- 검색 -->
<v-card flat class="bg-shades-transparent mb-4"> <v-card flat class="bg-shades-transparent mb-4">
<div class="d-flex justify-center flex-wrap align-center"> <div class="d-flex justify-center flex-wrap align-center">
<v-responsive <v-responsive
@ -321,11 +326,12 @@ onMounted(() => {
label="검색조건" label="검색조건"
density="compact" density="compact"
:items="searchOptions" :items="searchOptions"
item-title="searchType" item-title="label"
item-value="searchText" item-value="value"
hide-details hide-details
></v-select> />
</v-responsive> </v-responsive>
<v-responsive min-width="540" max-width="540"> <v-responsive min-width="540" max-width="540">
<v-text-field <v-text-field
v-model="data.params.searchText" v-model="data.params.searchText"
@ -335,8 +341,8 @@ onMounted(() => {
required required
class="mt-3 mb-3" class="mt-3 mb-3"
hide-details hide-details
@keyup.enter="changePageNum(1)" @keyup.enter="doSearch"
></v-text-field> />
</v-responsive> </v-responsive>
<div class="ml-3"> <div class="ml-3">
@ -344,7 +350,7 @@ onMounted(() => {
size="large" size="large"
color="primary" color="primary"
:rounded="5" :rounded="5"
@click="changePageNum(1)" @click="doSearch"
> >
<v-icon>mdi-magnify</v-icon> <v-icon>mdi-magnify</v-icon>
</v-btn> </v-btn>
@ -352,6 +358,7 @@ onMounted(() => {
</div> </div>
</v-card> </v-card>
<!-- 상단 툴바 -->
<v-sheet <v-sheet
class="bg-shades-transparent d-flex flex-wrap align-center mb-2" class="bg-shades-transparent d-flex flex-wrap align-center mb-2"
> >
@ -360,8 +367,8 @@ onMounted(() => {
class="d-flex align-center mr-3 mb-2 bg-shades-transparent" class="d-flex align-center mr-3 mb-2 bg-shades-transparent"
> >
<v-chip color="primary" <v-chip color="primary"
> {{ data.totalDataLength.toLocaleString() }} > {{ data.totalElements.toLocaleString() }}</v-chip
</v-chip> >
</v-sheet> </v-sheet>
<v-sheet class="bg-shades-transparent"> <v-sheet class="bg-shades-transparent">
<v-responsive max-width="140" min-width="140" class="mb-2"> <v-responsive max-width="140" min-width="140" class="mb-2">
@ -374,18 +381,20 @@ onMounted(() => {
variant="outlined" variant="outlined"
color="primary" color="primary"
hide-details hide-details
@update:model-value="changePageNum(1)" @update:model-value="changePageSize"
></v-select> />
</v-responsive> </v-responsive>
</v-sheet> </v-sheet>
</v-sheet> </v-sheet>
<v-sheet class="justify-end mb-2"> <v-sheet class="justify-end mb-2">
<v-btn color="primary" @click="openCreateModal" <v-btn color="primary" @click="openCreateModal"
>Create Experiment >Create Experiment</v-btn
</v-btn> >
</v-sheet> </v-sheet>
</v-sheet> </v-sheet>
<!-- 목록 -->
<v-card class="rounded-lg pa-8"> <v-card class="rounded-lg pa-8">
<v-col cols="12"> <v-col cols="12">
<v-sheet> <v-sheet>
@ -393,8 +402,6 @@ onMounted(() => {
density="comfortable" density="comfortable"
fixed-header fixed-header
height="625" height="625"
col-md-12
col-12
overflow-x-auto overflow-x-auto
> >
<colgroup> <colgroup>
@ -406,20 +413,11 @@ onMounted(() => {
</colgroup> </colgroup>
<thead> <thead>
<tr> <tr>
<!-- <th>
<v-checkbox
v-model="data.allSelected"
style="min-width: 36px"
:indeterminate="data.allSelected === true"
hide-details
@change="getSelectedAllData"
></v-checkbox>
</th> -->
<th <th
v-for="(item, i) in tableHeader" v-for="(item, i) in tableHeader"
:key="i" :key="i"
class="text-center font-weight-bold" class="text-center font-weight-bold"
:style="`${item.style}`" :style="item.style"
> >
{{ item.label }} {{ item.label }}
</th> </th>
@ -431,21 +429,12 @@ onMounted(() => {
:key="i" :key="i"
class="text-center" class="text-center"
> >
<!-- <td>
<v-checkbox
v-model="data.selected"
hide-details
:value="{
deviceKey: item.deviceKey,
}"
></v-checkbox>
</td> -->
<td>{{ item.name }}</td> <td>{{ item.name }}</td>
<td>{{ item.description }}</td> <td>{{ item.description }}</td>
<td>{{ item.createdDate }}</td> <td>{{ item.createdDate }}</td>
<td>{{ item.createdID }}</td> <td>{{ item.createdID }}</td>
<td style="white-space: nowrap"> <td style="white-space: nowrap">
<IconInfoBtn @on-click="openDetail(item)" /> <IconInfoBtn @on-click="openDetailModal(item)" />
<IconDeleteBtn <IconDeleteBtn
@on-click=" @on-click="
removeData([{ deviceKey: item.deviceKey }]) removeData([{ deviceKey: item.deviceKey }])
@ -456,6 +445,7 @@ onMounted(() => {
</tbody> </tbody>
</v-table> </v-table>
</v-sheet> </v-sheet>
<v-card-actions class="text-center mt-8 justify-center"> <v-card-actions class="text-center mt-8 justify-center">
<v-pagination <v-pagination
v-model="data.params.pageNum" v-model="data.params.pageNum"
@ -463,26 +453,33 @@ onMounted(() => {
:total-visible="10" :total-visible="10"
color="primary" color="primary"
rounded="circle" rounded="circle"
@update:model-value="getData" @update:model-value="changePageNum"
></v-pagination> />
</v-card-actions> </v-card-actions>
</v-col> </v-col>
</v-card> </v-card>
</v-card> </v-card>
</v-card> </v-card>
</v-container> </v-container>
<v-dialog v-model="data.isModalVisible" max-width="600" persistent>
<!-- 생성 다이얼로그 -->
<v-dialog v-model="data.isCreateVisible" max-width="600" persistent>
<ExperimentCreateDialog <ExperimentCreateDialog
:edit-data="data.selectedData" :edit-data="data.selectedData"
:mode="data.modalMode" :mode="data.modalMode"
@close-modal="closeModal" @close-modal="closeModal"
@handle-data="saveData" @saved="fetchList"
:user-option="data.userOption" @handle-data="() => {}"
/> />
</v-dialog> </v-dialog>
</div> </div>
<div class="w-100" v-else> <div class="w-100" v-else>
<ViewComponent :experiment="selectedExperiment" @close="closeDetail" /> <ViewComponent
v-if="data.selectedData"
:id="data.selectedData.deviceKey"
@close="closeDetail"
/>
</div> </div>
</template> </template>

@ -1,246 +1,78 @@
<script setup lang="ts"> <script setup lang="ts">
import IconDeleteBtn from "@/components/atoms/button/IconDeleteBtn.vue"; import { ref, computed, onMounted, watch } from "vue";
import IconModifyBtn from "@/components/atoms/button/IconModifyBtn.vue"; import { ExperimentService } from "@/components/service/management/ExperimentService";
// import FormComponent from "@/components/device/FormComponent.vue"; import { ProjectService } from "@/components/service/project/projectService"; //
import { onMounted, ref, watch } from "vue";
// const store = commonStore(); const props = defineProps<{ id: number | string }>();
const emit = defineEmits<{ (e: "close"): void }>();
const tableHeader = [ const loading = ref(false);
{ const detailRaw = ref<any | null>(null);
label: "Run Name",
width: "20%",
style: "word-break: keep-all;",
},
{
label: "Status",
width: "20%",
style: "word-break: keep-all;",
},
{
label: "Duration",
width: "20%",
style: "word-break: keep-all;",
},
{
label: "Pipeline",
width: "20%",
style: "word-break: keep-all;",
},
{
label: "Start Time",
width: "20%",
style: "word-break: keep-all;",
},
];
const experimentInfo = ref({ const experimentInfo = ref({
experimentName: "Baseline Model Training", experimentName: "-",
projectName: "배터리 상태 예측 모델 프로젝트", projectName: "-",
createdDate: "2025-02-06", createdDate: "-",
createdId: "ADMIN_001", createdId: "-",
description: "기본 모델 구조로 학습 성능 측정", description: "-",
kubeFlowId: "-",
mlFlowId: "-",
}); });
const data = ref({ const formatIso = (s?: string) =>
params: { s ? String(s).replace("T", " ").slice(0, 19) : "-";
pageNum: 1,
pageSize: 10, const mapToViewModel = (raw: any) => ({
searchType: "", experimentName: raw.displayName ?? raw.name ?? "-",
searchText: "", projectName: "-",
}, createdDate: formatIso(raw.lastUpdateTime),
results: [], createdId: raw.regUserId ?? "-",
totalDataLength: 0, description: raw.description ?? "-",
pageLength: 0, kubeFlowId: raw.kubeFlowId ?? "-",
modalMode: "", mlFlowId: raw.mlFlowId ?? "-",
selectedData: null,
allSelected: false,
selected: [],
isModalVisible: false,
isConfirmDialogVisible: false,
userOption: [],
}); });
const getCodeList = () => { const info = computed(() => mapToViewModel(detailRaw.value || {}));
// UserService.search(data.value.params).then((d) => {
// if (d.status === 200) {
// data.value.userOption = d.data.userList;
// }
// });
};
const getData = () => {
const params = { ...data.value.params };
if (params.searchType === "" || params.searchText === "") {
delete params.searchType;
delete params.searchText;
}
data.value.results = [
{
name: "run-batch32-lr0.001",
status: "Succeeded",
Duration: "0:00:21",
configProgress: "0/2",
Pipeline: "baseline_train_pipeline",
registDt: "2025-06-10T00:00:00Z",
},
{
name: "run-batch64-lr0.001",
status: "Failed",
Duration: "0:00:21",
configProgress: "1/3",
Pipeline: "baseline_train_pipeline",
registDt: "2025-06-09T00:00:00Z",
},
{
name: "run-batch32-lr0.0005",
status: "Succeeded",
Duration: "0:00:21",
configProgress: "0/3",
Pipeline: "baseline_train_pipeline",
registDt: "2025-06-01T00:00:00Z",
},
{
name: "run-batch64-lr0.0005",
status: "Running",
Duration: "0:00:21",
configProgress: "1/3",
Pipeline: "baseline_train_pipeline",
registDt: "2025-05-29T00:00:00Z",
},
{
name: "run-augmented-data",
status: "Succeeded",
Duration: "0:00:21",
configProgress: "0/3",
Pipeline: "baseline_train_pipeline",
registDt: "2025-05-31T00:00:00Z",
},
];
data.value.totalDataLength = 5;
setPaginationLength();
// DeviceService.search(params).then((d) => {
// if (d.status === 200) {
// data.value.results = d.data.deviceList;
// data.value.totalDataLength = d.data.totalCount;
// setTimeout(() => {
// setPaginationLength();
// }, 200);
// } else {
// store.setSnackbarMsg({
// text: " ",
// color: "error",
// });
// }
// });
// DeviceService.search().then((d) => {
// data.value.totalDataLength = d.data.totalCount;
// setTimeout(() => {
// setPaginationLength();
// }, 200);
// });
};
const setPaginationLength = () => { async function fetchProjectName(projectId?: number) {
if (data.value.totalDataLength % data.value.params.pageSize === 0) { if (!projectId && projectId !== 0) return;
data.value.pageLength = try {
data.value.totalDataLength / data.value.params.pageSize; const res = await ProjectService.fetchProjectById(projectId as number);
} else { const prj = res?.data ?? res;
data.value.pageLength = Math.ceil( experimentInfo.value.projectName = prj?.prjNm ?? prj?.name ?? "-";
data.value.totalDataLength / data.value.params.pageSize, } catch (e) {
); console.warn("[Experiment/View] project fetch fail:", e);
} }
};
const saveData = (formData) => {
if (data.value.modalMode === "create") {
// DeviceService.add(formData).then((d) => {
// if (d.status === 200) {
// data.value.isModalVisible = false;
// store.setSnackbarMsg({
// text: " .",
// result: 200,
// });
// changePageNum(1);
// } else {
// store.setSnackbarMsg({
// text: d,
// result: 500,
// });
// }
// });
} else {
// DeviceService.update(formData.deviceKey, formData).then((d) => {
// if (d.status === 200) {
// data.value.isModalVisible = false;
// store.setSnackbarMsg({
// text: " .",
// result: 200,
// });
// changePageNum();
// } else {
// store.setSnackbarMsg({
// text: d,
// result: 500,
// });
// }
// });
} }
};
const removeData = (value) => { async function fetchDetail(id: number | string) {
let removeList = value ? value : data.value.selected; const idNum = typeof id === "string" ? Number(id) : id;
const remove = (code) => { if (!Number.isFinite(idNum as number)) return;
// return DeviceService.delete(code).then((d) => {
// if (d.status !== 200) {
// store.setSnackbarMsg({
// text: d,
// result: 500,
// });
// }
// });
};
if (removeList.length === 1) { loading.value = true;
remove(removeList[0].deviceKey).then(() => { try {
// store.setSnackbarMsg({ const res = await ExperimentService.view(idNum as number);
// text: ".", detailRaw.value = res?.data ?? res;
// result: 200,
// });
changePageNum();
data.value.isConfirmDialogVisible = false;
data.value.selected = [];
data.value.allSelected = false;
});
} else {
Promise.all(removeList.map((item) => remove(item.deviceKey))).finally(
() => {
// store.setSnackbarMsg({
// text: " .",
// result: 200,
// });
changePageNum();
data.value.isConfirmDialogVisible = false;
data.value.selected = [];
data.value.allSelected = false;
},
);
}
};
const changePageNum = (page) => { const vm = mapToViewModel(detailRaw.value);
data.value.params.pageNum = page; experimentInfo.value = { ...experimentInfo.value, ...vm };
getData();
};
const emit = defineEmits<{ //
(e: "close"): void; await fetchProjectName(detailRaw.value?.projectId);
}>(); } catch (e) {
console.error("[Experiment/View] fetch detail error:", e);
} finally {
loading.value = false;
}
}
onMounted(() => { onMounted(() => fetchDetail(props.id));
getData(); watch(
getCodeList(); () => props.id,
}); (nv) => {
if (nv !== undefined && nv !== null && nv !== "") fetchDetail(nv);
},
);
</script> </script>
<template> <template>
@ -257,7 +89,10 @@ onMounted(() => {
</v-card-item> </v-card-item>
</v-card> </v-card>
<v-card flat class="bordered-box mb-6 w-100 rounded-lg pa-8"> <v-card
flat
class="bordered-box mb-6 w-100 rounded-lg pa-8 position-relative"
>
<v-card-title class="grey lighten-4 py-2 px-4"> <v-card-title class="grey lighten-4 py-2 px-4">
<span class="font-weight-bold">Experiment Information</span> <span class="font-weight-bold">Experiment Information</span>
</v-card-title> </v-card-title>
@ -287,14 +122,23 @@ onMounted(() => {
<!-- Created Date / ID --> <!-- Created Date / ID -->
<v-row align="center" class="py-2"> <v-row align="center" class="py-2">
<v-col cols="3" class="text-h6 font-weight-bold">Created ID</v-col>
<v-col cols="3" class="pa-2">{{ experimentInfo.createdId }}</v-col>
<v-col cols="3" class="text-h6 font-weight-bold" <v-col cols="3" class="text-h6 font-weight-bold"
>Created Date</v-col >Created Date</v-col
> >
<v-col cols="3" class="pa-2">{{ <v-col cols="3" class="pa-2">{{
experimentInfo.createdDate experimentInfo.createdDate
}}</v-col> }}</v-col>
<v-col cols="3" class="text-h6 font-weight-bold">Created ID</v-col> </v-row>
<v-col cols="3" class="pa-2">{{ experimentInfo.createdId }}</v-col> <VDivider class="my-2" />
<!-- Kubeflow / MLflow ID -->
<v-row align="center" class="py-2">
<v-col cols="3" class="text-h6 font-weight-bold">Kubeflow ID</v-col>
<v-col cols="3" class="pa-2">{{ experimentInfo.kubeFlowId }}</v-col>
<v-col cols="3" class="text-h6 font-weight-bold">MLflow ID</v-col>
<v-col cols="3" class="pa-2">{{ experimentInfo.mlFlowId }}</v-col>
</v-row> </v-row>
<VDivider class="my-2" /> <VDivider class="my-2" />
@ -306,100 +150,20 @@ onMounted(() => {
}}</v-col> }}</v-col>
</v-row> </v-row>
</v-card-text> </v-card-text>
</v-card>
<v-card flat class="bg-shades-transparent w-100"> <v-overlay
<v-card class="rounded-lg pa-8"> :model-value="loading"
<v-card-title class="grey lighten-4 py-2 px-4"> contained
<span class="font-weight-bold">Runs</span> persistent
</v-card-title> class="align-center justify-center"
<v-col cols="12">
<v-sheet>
<v-table
density="comfortable"
fixed-header
height="300"
col-md-12
col-12
overflow-x-auto
>
<colgroup>
<col
v-for="(item, i) in tableHeader"
:key="i"
:style="`width:${item.width}`"
/>
</colgroup>
<thead>
<tr>
<th
v-for="(item, i) in tableHeader"
:key="i"
class="text-center font-weight-bold"
:style="`${item.style}`"
>
{{ item.label }}
</th>
</tr>
</thead>
<tbody class="text-body-2">
<tr
v-for="(item, i) in data.results"
:key="i"
class="text-center"
> >
<td>{{ item.name }}</td> <v-progress-circular indeterminate size="48" />
<td>{{ item.status }}</td> </v-overlay>
<td>{{ item.Duration }}</td>
<td>{{ item.Pipeline }}</td>
<td>{{ item.registDt }}</td>
</tr>
</tbody>
</v-table>
</v-sheet>
<v-card-actions class="text-center mt-8 justify-center">
<v-pagination
v-model="data.params.pageNum"
:length="data.pageLength"
:total-visible="10"
color="primary"
rounded="circle"
@update:model-value="getData"
></v-pagination>
</v-card-actions>
</v-col>
<v-sheet class="d-flex justify-end mb-2"> <v-sheet class="d-flex justify-end mb-2">
<v-btn color="primary" @click="emit('close')">Back to List</v-btn> <v-btn color="primary" @click="emit('close')">Back to List</v-btn>
</v-sheet> </v-sheet>
</v-card> </v-card>
</v-card> </v-card>
</v-card>
</v-container> </v-container>
</template> </template>
<style scoped>
.v-card-text {
width: 100% !important;
border-collapse: collapse;
/* 전체 테이블 1px 테두리 */
}
.v-card-text th {
font-size: 20px;
min-width: 400px;
border: 1px solid rgba(255, 255, 255, 0.12);
background-color: rgba(255, 255, 255, 0.05);
font-weight: 600;
text-align: center;
white-space: nowrap;
}
.v-card-text td {
font-size: 16px;
min-width: 600px;
padding: 12px 16px;
text-align: left;
border: 1px solid rgba(255, 255, 255, 0.12);
}
.v-card-text tr:nth-child(odd) {
background-color: rgba(255, 255, 255, 0.02);
}
</style>

@ -1,16 +1,20 @@
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, ref, watch } from "vue";
import { commonStore } from "@/stores/commonStore";
import IconDeleteBtn from "@/components/atoms/button/IconDeleteBtn.vue"; import IconDeleteBtn from "@/components/atoms/button/IconDeleteBtn.vue";
import IconModifyBtn from "@/components/atoms/button/IconModifyBtn.vue"; import IconModifyBtn from "@/components/atoms/button/IconModifyBtn.vue";
import IconInfoBtn from "@/components/atoms/button/IconInfoBtn.vue"; import IconInfoBtn from "@/components/atoms/button/IconInfoBtn.vue";
// import FormComponent from "@/components/device/FormComponent.vue";
import { onMounted, ref, watch } from "vue";
import ViewComponent from "@/components/templates/stepconfig/ViewComponent.vue"; import ViewComponent from "@/components/templates/stepconfig/ViewComponent.vue";
import StapComfigDialog from "@/components/atoms/organisms/StapComfigDialog.vue"; import StapComfigDialog from "@/components/atoms/organisms/WorklfowStepBaseDialog.vue";
import { AutoflowStepService } from "@/components/service/management/AutoflowStepService";
// const store = commonStore();
import { WorkflowStepService } from "@/components/service/management/workflowStepService";
import type { WorkflowStep } from "@/components/models/management/WorkflowStep";
const store = commonStore();
const openView = ref(false); const openView = ref(false);
const openModify = ref(false); type SearchType = "전체" | "제목" | "작성자";
const tableHeader = [ const tableHeader = [
{ label: "No", width: "5%", style: "word-break: keep-all;" }, { label: "No", width: "5%", style: "word-break: keep-all;" },
{ label: "Step Name", width: "15%", style: "word-break: keep-all;" }, { label: "Step Name", width: "15%", style: "word-break: keep-all;" },
@ -25,308 +29,281 @@ const tableHeader = [
]; ];
const searchOptions = [ const searchOptions = [
{ searchType: "전체", searchText: "" }, { label: "전체", value: "전체" as SearchType },
{ searchType: "디바이스 별칭", searchText: "deviceAlias" }, { label: "제목", value: "제목" as SearchType },
{ searchType: "디바이스 키", searchText: "deviceKey" }, { label: "작성자", value: "작성자" as SearchType },
{ searchType: "사용자", searchText: "userId" },
{ searchType: "디바이스 이름", searchText: "deviceName" },
{ searchType: "디바이스 모델", searchText: "deviceModel" },
{ searchType: "디바이스 OS", searchText: "deviceOs" },
]; ];
const SEARCH_TYPE_MAP: Record<SearchType | "", "ALL" | "TITLE" | "AUTHOR"> = {
"": "ALL",
전체: "ALL",
제목: "TITLE",
작성자: "AUTHOR",
};
const pageSizeOptions = [ const pageSizeOptions = [
{ text: "10 페이지", value: 10 }, { text: "10 페이지", value: 10 },
{ text: "50 페이지", value: 50 }, { text: "50 페이지", value: 50 },
{ text: "100 페이지", value: 100 }, { text: "100 페이지", value: 100 },
]; ];
const workflowList = ["pipeline-a", "pipeline-b", "pipeline-c"];
const data = ref({ const data = ref({
params: { params: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
searchType: "", searchType: "전체" as SearchType,
searchText: "", searchText: "",
}, },
results: [], results: [] as any[],
totalDataLength: 0, totalElements: 0,
pageLength: 0, pageLength: 0,
modalMode: "", modalMode: "" as "create" | "edit" | "",
selectedData: null, selectedData: null as any,
isStepVisible: false,
allSelected: false, allSelected: false,
selected: [], selected: [] as Array<{ deviceKey: number }>,
isModalVisible: false,
isConfirmDialogVisible: false, isConfirmDialogVisible: false,
userOption: [],
}); });
const getCodeList = () => { const toRow = (s: any, no: number) => ({
// UserService.search(data.value.params).then((d) => { no,
// if (d.status === 200) { stepName: s.stepName,
// data.value.userOption = d.data.userList; type: s.stepType,
// } dataset: s.datasetName,
// }); script: s.scriptName,
hyperParameters: s.hyperParams,
resource: s.resource,
status: String(s.status).toLowerCase() === "success" ? "success" : "warning",
workflow: s.workflowName,
workflowId: s.workflowStepId,
deviceKey: s.id,
});
const fetchList = async () => {
const projectId = Number(localStorage.getItem("projectId"));
if (!projectId) {
console.warn("[WorkflowSteps] projectId 없음 — 프로젝트 먼저 선택");
data.value.results = [];
data.value.totalElements = 0;
data.value.pageLength = 0;
return;
}
const { pageNum, pageSize, searchType, searchText } = data.value.params;
const mapped = SEARCH_TYPE_MAP[searchType] || "ALL";
const keyword = (searchText || "").trim();
const needLocalFilter = mapped !== "ALL" && keyword.length > 0;
let reqPage = data.value.params.pageNum;
let reqSize = data.value.params.pageSize;
if (needLocalFilter) {
reqPage = 0;
reqSize = 1000;
}
const payload = {
projectId,
page: reqPage,
size: reqSize,
keyword,
searchType: mapped,
}; };
const getData = () => { WorkflowStepService.search(payload)
// : No 7 1 .then((res: any) => {
data.value.results = [ if (res.status !== 200) return;
{
no: 7, const result = res.data;
stepName: "Data Ingest", let list = result?.content ?? [];
type: "Preprocessing",
dataset: "raw_data", if (needLocalFilter) {
script: "ingest.py", const kw = keyword.toLowerCase();
hyperParameters: "-",
resource: "CPU:1, MEM:2Gi", if (mapped === "TITLE") {
status: "success", list = list.filter((w: any) =>
workflow: "pipeline-a", String(w?.workflowName ?? "")
deviceKey: 7, .toLowerCase()
}, .includes(kw),
{ );
no: 6, } else if (mapped === "AUTHOR") {
stepName: "Data Preprocess", list = list.filter((w: any) =>
type: "Preprocessing", String(w?.regUserId ?? "")
dataset: "raw_data", .toLowerCase()
script: "preprocess.py", .includes(kw),
hyperParameters: "normalize=True",
resource: "CPU:2, MEM:4Gi",
status: "success",
workflow: "pipeline-a",
deviceKey: 6,
},
{
no: 5,
stepName: "Model Training",
type: "Training",
dataset: "processed_data",
script: "train.py",
hyperParameters: "lr=0.01, epochs=10",
resource: "GPU:1, MEM:8Gi",
status: "warning",
workflow: "pipeline-a",
deviceKey: 5,
},
{
no: 4,
stepName: "Model Evaluation",
type: "Evaluation",
dataset: "test_data",
script: "evaluate.py",
hyperParameters: "-",
resource: "CPU:1, MEM:4Gi",
status: "success",
workflow: "pipeline-a",
deviceKey: 4,
},
{
no: 3,
stepName: "Model Validation",
type: "Validation",
dataset: "test_data",
script: "validate.py",
hyperParameters: "metrics=['accuracy']",
resource: "CPU:1, MEM:4Gi",
status: "success",
workflow: "pipeline-a",
deviceKey: 3,
},
{
no: 2,
stepName: "Package Model",
type: "Packaging",
dataset: "trained_model",
script: "package.py",
hyperParameters: "format='tar.gz'",
resource: "CPU:1, MEM:2Gi",
status: "success",
workflow: "pipeline-a",
deviceKey: 2,
},
{
no: 1,
stepName: "Deploy",
type: "Deployment",
dataset: "package",
script: "deploy.py",
hyperParameters: "env='prod'",
resource: "CPU:1, MEM:2Gi",
status: "success",
workflow: "pipeline-a",
deviceKey: 1,
},
];
data.value.totalDataLength = data.value.results.length;
//
if (data.value.totalDataLength % data.value.params.pageSize === 0) {
data.value.pageLength =
data.value.totalDataLength / data.value.params.pageSize;
} else {
data.value.pageLength = Math.ceil(
data.value.totalDataLength / data.value.params.pageSize,
); );
} }
};
const setPaginationLength = () => { const uiSize = data.value.params.pageSize;
if (data.value.totalDataLength % data.value.params.pageSize === 0) { const totalElements = list.length;
data.value.pageLength = const totalPages = Math.max(1, Math.ceil(totalElements / uiSize));
data.value.totalDataLength / data.value.params.pageSize; const safePage = Math.min(Math.max(1, pageNum), totalPages);
} else { const start = (safePage - 1) * uiSize;
data.value.pageLength = Math.ceil( const pageSlice = list.slice(start, start + uiSize);
data.value.totalDataLength / data.value.params.pageSize,
// ()
const firstNo = totalElements - start;
data.value.results = pageSlice.map((w: any, i: number) =>
toRow(w, firstNo - i),
); );
data.value.totalElements = totalElements;
data.value.pageLength = totalPages;
return;
} }
const totalElements = result.totalElements;
const totalPages = result.totalPages;
const serverPage = result.pageable.pageNumber;
const serverSize = result.pageable.pageSize;
const offset =
typeof result.pageable.offset === "number"
? result.pageable.offset
: serverPage * serverSize;
const firstNo = totalElements - offset;
data.value.results = list.map((w: any, i: number) =>
toRow(w, firstNo - i),
);
data.value.totalElements = totalElements;
data.value.pageLength = totalPages;
})
.catch((err: any) => console.error("워크플로우 조회 에러:", err));
}; };
const saveData = (formData) => { /** 검색 실행 (페이지 1로 리셋) */
if (data.value.modalMode === "create") { const doSearch = () => {
// DeviceService.add(formData).then((d) => { data.value.params.pageNum = 1;
// if (d.status === 200) { fetchList();
// data.value.isModalVisible = false;
// store.setSnackbarMsg({
// text: " .",
// result: 200,
// });
// changePageNum(1);
// } else {
// store.setSnackbarMsg({
// text: d,
// result: 500,
// });
// }
// });
} else {
// DeviceService.update(formData.deviceKey, formData).then((d) => {
// if (d.status === 200) {
// data.value.isModalVisible = false;
// store.setSnackbarMsg({
// text: " .",
// result: 200,
// });
// changePageNum();
// } else {
// store.setSnackbarMsg({
// text: d,
// result: 500,
// });
// }
// });
}
}; };
const removeData = (value) => { /** 페이지 이동 */
let removeList = value ? value : data.value.selected; const changePageNum = (page: number) => {
const remove = (code) => { data.value.params.pageNum = page;
// return DeviceService.delete(code).then((d) => { fetchList();
// if (d.status !== 200) {
// store.setSnackbarMsg({
// text: d,
// result: 500,
// });
// }
// });
}; };
if (removeList.length === 1) { /** 페이지 사이즈 변경 */
remove(removeList[0].deviceKey).then(() => { const changePageSize = (size: number) => {
// store.setSnackbarMsg({ data.value.params.pageSize = size;
// text: ".", data.value.params.pageNum = 1;
// result: 200, fetchList();
// }); };
changePageNum();
const saveStep = async (payload: WorkflowStep) => {
try {
const { data: saved } = await WorkflowStepService.add(payload);
await fetchList();
} catch (e) {
console.error("[STEP SAVE FAIL]", e);
} finally {
data.value.isStepVisible = false;
}
};
const removeData = (value?: Array<{ deviceKey: number }>) => {
const removeList = value ?? data.value.selected;
if (!removeList || removeList.length === 0) return;
const ids = removeList.map((x) => x.deviceKey);
const removeOne = (id: number) =>
WorkflowStepService.delete(id).then((res) => {
if (res.status < 200 || res.status >= 300) return Promise.reject(res);
});
const after = () => {
if (
ids.length >= data.value.results.length &&
data.value.params.pageNum > 1
) {
data.value.params.pageNum -= 1;
}
fetchList();
data.value.isConfirmDialogVisible = false; data.value.isConfirmDialogVisible = false;
data.value.selected = []; data.value.selected = [];
data.value.allSelected = false; data.value.allSelected = false;
};
// /
if (ids.length === 1) {
removeOne(ids[0])
.then(() => {
store.setSnackbarMsg({
color: "success",
text: "삭제되었습니다.",
result: 200,
});
after();
})
.catch((err) => {
console.error("삭제 실패:", err);
store.setSnackbarMsg({
color: "warning",
text: "삭제 실패",
result: 500,
});
}); });
} else { } else {
Promise.all(removeList.map((item) => remove(item.deviceKey))).finally( Promise.all(ids.map(removeOne))
() => { .then(() => {
// store.setSnackbarMsg({ store.setSnackbarMsg({
// text: " .", color: "success",
// result: 200, text: "모두 삭제되었습니다.",
// }); result: 200,
changePageNum(); });
data.value.isConfirmDialogVisible = false; })
data.value.selected = []; .catch((err) => {
data.value.allSelected = false; console.error("일부 삭제 실패:", err);
}, store.setSnackbarMsg({
); color: "warning",
text: "일부 삭제 실패",
result: 500,
});
})
.finally(after);
} }
}; };
const handleRemoveData = () => { const getSelectedAllData = () => {
if (data.value.selected.length === 0) { data.value.selected = data.value.allSelected
// store.setSnackbarMsg({ ? data.value.results.map((item: any) => ({ deviceKey: item.deviceKey }))
// text: " . ", : [];
// result: 500, };
// });
return; const openDetailModal = (selectedItem: any) => {
} data.value.selectedData = selectedItem;
if (data.value.allSelected || data.value.selected.length !== 1) { openView.value = true;
data.value.isConfirmDialogVisible = true;
return;
}
//
removeData(undefined);
}; };
const closeDetail = () => { const closeDetail = () => {
openView.value = false; openView.value = false;
}; };
const changePageNum = (page) => { const openCreateModal = () => {
data.value.params.pageNum = page; data.value.selectedData = null;
getData(); data.value.modalMode = "create";
}; data.value.isStepVisible = true;
const openDetailModal = (selectedItem) => {
data.value.selectedData = selectedItem;
openView.value = true;
}; };
const handleSave = ({ const openModifyModal = (item: any) => {
workflow,
stepName,
}: {
workflow: string;
stepName: string;
}) => {
if (data.value.selectedData) {
data.value.selectedData.workflow = workflow;
data.value.selectedData.stepName = stepName;
}
};
const openModifyModal = (item: { workflow: string; stepName: string }) => {
data.value.selectedData = { data.value.selectedData = {
workflow: item.workflow, id: item.deviceKey,
stepName: item.stepName, stepName: item.stepName,
status: item.status,
workflowStepId: item.workflowId,
}; };
openModify.value = true; data.value.modalMode = "edit";
}; data.value.isStepVisible = true;
const openCreateModal = () => {
data.value.selectedData = null;
data.value.modalMode = "create";
data.value.isModalVisible = true;
}; };
const closeModal = () => { const closeModal = () => {
data.value.isModalVisible = false; data.value.isStepVisible = false;
data.value.selectedData = null; data.value.selectedData = null;
}; };
const getSelectedAllData = () => { /** 모달 닫히면 목록 새로고침하고 싶으면 아래 watch 사용 */
data.value.selected = data.value.allSelected // watch(() => data.value.isStepVisible, (now, prev) => {
? data.value.results.map((item) => { // if (prev && !now) fetchList();
return { // });
deviceKey: item.deviceKey,
};
})
: [];
};
onMounted(() => { onMounted(() => {
getData(); fetchList();
getCodeList();
}); });
</script> </script>
@ -344,6 +321,8 @@ onMounted(() => {
</div> </div>
</v-card-item> </v-card-item>
</v-card> </v-card>
<!-- 상단 검색 (워크플로우 화면과 동일 UX) -->
<v-card flat class="bg-shades-transparent w-100"> <v-card flat class="bg-shades-transparent w-100">
<v-card flat class="bg-shades-transparent mb-4"> <v-card flat class="bg-shades-transparent mb-4">
<div class="d-flex justify-center flex-wrap align-center"> <div class="d-flex justify-center flex-wrap align-center">
@ -357,11 +336,13 @@ onMounted(() => {
label="검색조건" label="검색조건"
density="compact" density="compact"
:items="searchOptions" :items="searchOptions"
item-title="searchType" item-title="label"
item-value="searchText" item-value="value"
hide-details hide-details
></v-select> @update:model-value="doSearch"
/>
</v-responsive> </v-responsive>
<v-responsive min-width="540" max-width="540"> <v-responsive min-width="540" max-width="540">
<v-text-field <v-text-field
v-model="data.params.searchText" v-model="data.params.searchText"
@ -371,8 +352,8 @@ onMounted(() => {
required required
class="mt-3 mb-3" class="mt-3 mb-3"
hide-details hide-details
@keyup.enter="changePageNum(1)" @keyup.enter="doSearch"
></v-text-field> />
</v-responsive> </v-responsive>
<div class="ml-3"> <div class="ml-3">
@ -380,7 +361,7 @@ onMounted(() => {
size="large" size="large"
color="primary" color="primary"
:rounded="5" :rounded="5"
@click="changePageNum(1)" @click="doSearch"
> >
<v-icon>mdi-magnify</v-icon> <v-icon>mdi-magnify</v-icon>
</v-btn> </v-btn>
@ -388,6 +369,7 @@ onMounted(() => {
</div> </div>
</v-card> </v-card>
<!-- 개수 / 페이지사이즈 / 생성 버튼 -->
<v-sheet <v-sheet
class="bg-shades-transparent d-flex flex-wrap align-center mb-2" class="bg-shades-transparent d-flex flex-wrap align-center mb-2"
> >
@ -396,9 +378,10 @@ onMounted(() => {
class="d-flex align-center mr-3 mb-2 bg-shades-transparent" class="d-flex align-center mr-3 mb-2 bg-shades-transparent"
> >
<v-chip color="primary" <v-chip color="primary"
> {{ data.totalDataLength.toLocaleString() }} > {{ data.totalElements.toLocaleString() }}</v-chip
</v-chip> >
</v-sheet> </v-sheet>
<v-sheet class="bg-shades-transparent"> <v-sheet class="bg-shades-transparent">
<v-responsive max-width="140" min-width="140" class="mb-2"> <v-responsive max-width="140" min-width="140" class="mb-2">
<v-select <v-select
@ -410,13 +393,20 @@ onMounted(() => {
variant="outlined" variant="outlined"
color="primary" color="primary"
hide-details hide-details
@update:model-value="changePageNum(1)" @update:model-value="changePageSize"
></v-select> />
</v-responsive> </v-responsive>
</v-sheet> </v-sheet>
</v-sheet> </v-sheet>
<v-sheet class="justify-end mb-2">
<v-btn color="info" @click="openCreateModal"
>Create Workflow Step</v-btn
>
</v-sheet>
</v-sheet> </v-sheet>
<!-- 테이블 -->
<v-card class="rounded-lg pa-8"> <v-card class="rounded-lg pa-8">
<v-col cols="12"> <v-col cols="12">
<v-sheet> <v-sheet>
@ -436,6 +426,7 @@ onMounted(() => {
:style="`width:${item.width}`" :style="`width:${item.width}`"
/> />
</colgroup> </colgroup>
<thead> <thead>
<tr> <tr>
<th> <th>
@ -445,7 +436,7 @@ onMounted(() => {
:indeterminate="data.allSelected === true" :indeterminate="data.allSelected === true"
hide-details hide-details
@change="getSelectedAllData" @change="getSelectedAllData"
></v-checkbox> />
</th> </th>
<th <th
v-for="(item, i) in tableHeader" v-for="(item, i) in tableHeader"
@ -457,6 +448,7 @@ onMounted(() => {
</th> </th>
</tr> </tr>
</thead> </thead>
<tbody class="text-body-2"> <tbody class="text-body-2">
<tr <tr
v-for="item in data.results" v-for="item in data.results"
@ -485,16 +477,12 @@ onMounted(() => {
> >
mdi-checkbox-marked-circle mdi-checkbox-marked-circle
</v-icon> </v-icon>
<v-icon v-else color="warning"> <v-icon v-else color="warning">mdi-alert-circle</v-icon>
mdi-alert-circle
</v-icon>
</td> </td>
<td>{{ item.workflow }}</td> <td>{{ item.workflow }}</td>
<td style="white-space: nowrap"> <td style="white-space: nowrap">
<IconInfoBtn @on-click="openDetailModal(item)" /> <IconInfoBtn @on-click="openDetailModal(item)" />
<IconModifyBtn @on-click="openModifyModal(item)" /> <IconModifyBtn @on-click="openModifyModal(item)" />
<!-- <IconModifyBtn @on-click="openModify = true" /> -->
<IconDeleteBtn <IconDeleteBtn
@on-click=" @on-click="
removeData([{ deviceKey: item.deviceKey }]) removeData([{ deviceKey: item.deviceKey }])
@ -505,6 +493,8 @@ onMounted(() => {
</tbody> </tbody>
</v-table> </v-table>
</v-sheet> </v-sheet>
<!-- 페이지네이션 -->
<v-card-actions class="text-center mt-8 justify-center"> <v-card-actions class="text-center mt-8 justify-center">
<v-pagination <v-pagination
v-model="data.params.pageNum" v-model="data.params.pageNum"
@ -512,8 +502,8 @@ onMounted(() => {
:total-visible="10" :total-visible="10"
color="primary" color="primary"
rounded="circle" rounded="circle"
@update:model-value="getData" @update:model-value="changePageNum"
></v-pagination> />
</v-card-actions> </v-card-actions>
</v-col> </v-col>
</v-card> </v-card>
@ -521,15 +511,23 @@ onMounted(() => {
</v-card> </v-card>
</v-container> </v-container>
</div> </div>
<!-- 상세 보기 -->
<div class="w-100" v-else> <div class="w-100" v-else>
<ViewComponent @close="closeDetail" /> <ViewComponent
v-if="data.selectedData"
:id="data.selectedData.deviceKey"
@close="closeDetail"
/>
</div> </div>
<v-dialog v-model="openModify" max-width="600px">
<!-- 생성/수정 모달 -->
<v-dialog v-model="data.isStepVisible" max-width="760" persistent>
<StapComfigDialog <StapComfigDialog
v-model="openModify" :editData="data.selectedData"
:selectedData="data.selectedData" :mode="data.modalMode"
:workflowList="workflowList" @saved="saveStep"
@save="handleSave" @close-modal="closeModal"
/> />
</v-dialog> </v-dialog>
</template> </template>

@ -1,3 +1,98 @@
<script setup lang="ts">
import { defineProps, onMounted, watch, ref, computed } from "vue";
import { WorkflowStepService } from "@/components/service/management/workflowStepService";
import { WorkflowService } from "@/components/service/management/workflowService"; //
const props = defineProps<{ id: number | string }>();
const emit = defineEmits<{ (e: "close"): void }>();
const loading = ref(false);
const detailRaw = ref<any | null>(null);
//
const workflowName = ref<string>("-");
const formatIso = (s?: string) => (s ? s.replace("T", " ").slice(0, 19) : "-");
const mapToViewModel = (raw: any) => ({
stepName: raw?.stepName ?? raw?.name ?? "-",
// , computed workflowName ref
workflowName: raw?.workflowName ?? raw?.pipelineName ?? "-",
createdDate: formatIso(raw?.regDttm ?? raw?.regDt ?? raw?.createdAt),
createdId: raw?.regUserId ?? raw?.createdBy ?? "-",
});
const info = computed(() => ({
...mapToViewModel(detailRaw.value || {}),
workflowName: workflowName.value, //
}));
// id
async function resolveWorkflowName(raw: any) {
// 1)
const direct =
raw?.workflowName ||
raw?.pipelineName ||
raw?.workflow?.workflowName ||
raw?.workflow?.name;
if (direct) {
workflowName.value = direct;
return;
}
// 2) FK id ( )
const wfId =
raw?.workflowStepId ?? //
raw?.workflowId ??
raw?.workflow?.id ??
null;
if (!wfId) {
workflowName.value = "-";
return;
}
try {
const res = await WorkflowService.view(Number(wfId));
const w = res?.data ?? res;
workflowName.value = w?.workflowName || w?.name || `#${wfId}`;
} catch (e) {
console.warn("[ViewComponent] workflow fetch failed:", e);
workflowName.value = `#${wfId}`; // id
}
}
async function fetchDetail(id: number | string) {
const idNum = typeof id === "string" ? Number(id) : id;
if (!Number.isFinite(idNum as number)) return;
loading.value = true;
try {
const res = await WorkflowStepService.view(idNum as number);
const raw = res?.data ?? res;
detailRaw.value = raw;
//
await resolveWorkflowName(raw);
console.log("[ViewComponent] raw:", raw);
console.log("[ViewComponent] info:", info.value);
} catch (e) {
console.error("[ViewComponent] fetch detail error:", e);
} finally {
loading.value = false;
}
}
onMounted(() => fetchDetail(props.id));
watch(
() => props.id,
(now) => {
if (now !== undefined && now !== null && now !== "") fetchDetail(now);
},
);
</script>
<template> <template>
<v-container fluid class="h-100 pa-5 d-flex flex-column align-center"> <v-container fluid class="h-100 pa-5 d-flex flex-column align-center">
<!-- 상단 타이틀 --> <!-- 상단 타이틀 -->
@ -17,22 +112,27 @@
<v-card-text class="py-4"> <v-card-text class="py-4">
<v-row align="center" class="mb-2"> <v-row align="center" class="mb-2">
<v-col cols="3" class="font-weight-bold">Workflow Step Name</v-col> <v-col cols="3" class="font-weight-bold">Workflow Step Name</v-col>
<v-col cols="3">Train Model</v-col> <v-col cols="3">{{ info.stepName }}</v-col>
<v-col cols="3" class="font-weight-bold">Workflow Name</v-col> <v-col cols="3" class="font-weight-bold">Workflow Name</v-col>
<v-col cols="3">sentiment-analysis</v-col> <v-col cols="3">{{ info.workflowName }}</v-col>
</v-row> </v-row>
<v-divider /> <v-divider />
<v-row align="center" class="mt-2"> <v-row align="center" class="mt-2">
<v-col cols="3" class="font-weight-bold">Created Date</v-col> <v-col cols="3" class="font-weight-bold">Created Date</v-col>
<v-col cols="3">2025-02-06</v-col> <v-col cols="3">{{ info.createdDate }}</v-col>
<v-col cols="3" class="font-weight-bold">Created ID</v-col> <v-col cols="3" class="font-weight-bold">Created ID</v-col>
<v-col cols="3">ADMIN_001</v-col> <v-col cols="3">{{ info.createdId }}</v-col>
</v-row> </v-row>
</v-card-text> </v-card-text>
<v-sheet class="d-flex justify-end mt-4">
<v-btn color="primary" @click="emit('close')">Back to List</v-btn>
</v-sheet>
</v-card> </v-card>
<!-- Dataset --> <!-- Dataset -->
<v-card flat class="bordered-box mb-6 w-100 rounded-lg pa-6" elevation="2"> <!-- <v-card flat class="bordered-box mb-6 w-100 rounded-lg pa-6" elevation="2">
<v-card-title class="grey lighten-4 py-2 px-4"> <v-card-title class="grey lighten-4 py-2 px-4">
<span class="font-weight-bold">Dataset</span> <span class="font-weight-bold">Dataset</span>
</v-card-title> </v-card-title>
@ -44,10 +144,10 @@
<v-col cols="3">v2.0</v-col> <v-col cols="3">v2.0</v-col>
</v-row> </v-row>
</v-card-text> </v-card-text>
</v-card> </v-card> -->
<!-- Training Script --> <!-- Training Script -->
<v-card flat class="bordered-box mb-6 w-100 rounded-lg pa-6" elevation="2"> <!-- <v-card flat class="bordered-box mb-6 w-100 rounded-lg pa-6" elevation="2">
<v-card-title class="grey lighten-4 py-2 px-4"> <v-card-title class="grey lighten-4 py-2 px-4">
<span class="font-weight-bold">Training Script</span> <span class="font-weight-bold">Training Script</span>
</v-card-title> </v-card-title>
@ -64,10 +164,10 @@
</v-col> </v-col>
</v-row> </v-row>
</v-card-text> </v-card-text>
</v-card> </v-card> -->
<!-- Hyperparameters --> <!-- Hyperparameters -->
<v-card flat class="bordered-box mb-6 w-100 rounded-lg pa-6" elevation="2"> <!-- <v-card flat class="bordered-box mb-6 w-100 rounded-lg pa-6" elevation="2">
<v-card-title class="grey lighten-4 py-2 px-4"> <v-card-title class="grey lighten-4 py-2 px-4">
<span class="font-weight-bold">Hyperparameters</span> <span class="font-weight-bold">Hyperparameters</span>
</v-card-title> </v-card-title>
@ -86,10 +186,10 @@
<v-col cols="3">20</v-col> <v-col cols="3">20</v-col>
</v-row> </v-row>
</v-card-text> </v-card-text>
</v-card> </v-card> -->
<!-- Resource & Scheduling --> <!-- Resource & Scheduling -->
<v-card flat class="bordered-box mb-6 w-100 rounded-lg pa-6" elevation="2"> <!-- <v-card flat class="bordered-box mb-6 w-100 rounded-lg pa-6" elevation="2">
<v-card-title class="grey lighten-4 py-2 px-4"> <v-card-title class="grey lighten-4 py-2 px-4">
<span class="font-weight-bold">Resource & Scheduling</span> <span class="font-weight-bold">Resource & Scheduling</span>
</v-card-title> </v-card-title>
@ -106,10 +206,10 @@
<v-col cols="9">1 (NVIDIA A100)</v-col> <v-col cols="9">1 (NVIDIA A100)</v-col>
</v-row> </v-row>
</v-card-text> </v-card-text>
</v-card> </v-card> -->
<!-- Docker image --> <!-- Docker image -->
<v-card flat class="bordered-box mb-6 w-100 rounded-lg pa-6" elevation="2"> <!-- <v-card flat class="bordered-box mb-6 w-100 rounded-lg pa-6" elevation="2">
<v-card-title class="grey lighten-4 py-2 px-4"> <v-card-title class="grey lighten-4 py-2 px-4">
<span class="font-weight-bold">Docker image</span> <span class="font-weight-bold">Docker image</span>
</v-card-title> </v-card-title>
@ -118,18 +218,9 @@
kubeflownotebookswg/jupyter-pytorch-cuda-full:v1.9.2 kubeflownotebookswg/jupyter-pytorch-cuda-full:v1.9.2
</v-sheet> </v-sheet>
</v-card-text> </v-card-text>
<v-sheet class="d-flex justify-end mt-4">
<v-btn color="primary" @click="emit('close')">Back to List</v-btn> </v-card> -->
</v-sheet>
</v-card>
</v-container> </v-container>
</template> </template>
<script setup lang="ts">
import { defineEmits } from "vue";
const emit = defineEmits<{
(e: "close"): void;
}>();
</script>
<style scoped></style> <style scoped></style>

@ -2,340 +2,334 @@
import IconDeleteBtn from "@/components/atoms/button/IconDeleteBtn.vue"; import IconDeleteBtn from "@/components/atoms/button/IconDeleteBtn.vue";
import IconModifyBtn from "@/components/atoms/button/IconModifyBtn.vue"; import IconModifyBtn from "@/components/atoms/button/IconModifyBtn.vue";
import IconInfoBtn from "@/components/atoms/button/IconInfoBtn.vue"; import IconInfoBtn from "@/components/atoms/button/IconInfoBtn.vue";
// import FormComponent from "@/components/device/FormComponent.vue"; import { onMounted, ref } from "vue";
import { onMounted, ref, watch } from "vue"; import { storage } from "@/utils/storage";
import ViewComponent from "@/components/templates/trainingscript/ViewComponent.vue"; import ViewComponent from "@/components/templates/trainingscript/ViewComponent.vue";
import TrainingScriptBaseDoalog from "@/components/atoms/organisms/TrainingScriptBaseDoalog.vue"; import TrainingScriptBaseDoalog from "@/components/atoms/organisms/TrainingScriptBaseDoalog.vue";
import WorkflowsUploadDialog from "@/components/atoms/organisms/WorkflowsUploadDialog.vue"; import { AttachmentsService } from "@/components/service/management/attachmentsService";
// const store = commonStore(); import { commonStore } from "@/stores/commonStore";
const store = commonStore();
const openView = ref(false); const openView = ref(false);
const openModify = ref(false); const openModify = ref(false);
const tableHeader = [
{ const username = ref<string>("");
label: "Title",
width: "7%", type SearchType = "전체" | "제목" | "작성자";
style: "word-break: keep-all;",
},
{
label: "File Name",
width: "7%",
style: "word-break: keep-all;",
},
{
label: "File Path",
width: "7%",
style: "word-break: keep-all;",
},
{
label: "Description",
width: "7%",
style: "word-break: keep-all;",
},
{
label: "Created Data",
width: "7%",
style: "word-break: keep-all;",
},
{
label: "Modified Data",
width: "7%",
style: "word-break: keep-all;",
},
{
label: "Action",
width: "7%",
style: "word-break: keep-all;",
},
];
const searchOptions = [ const searchOptions = [
{ { label: "전체", value: "전체" as SearchType },
searchType: "전체", { label: "제목", value: "제목" as SearchType },
searchText: "", { label: "작성자", value: "작성자" as SearchType },
},
{
searchType: "디바이스 별칭",
searchText: "deviceAlias",
},
{
searchType: "디바이스 키",
searchText: "deviceKey",
},
{
searchType: "사용자",
searchText: "userId",
},
{
searchType: "디바이스 이름",
searchText: "deviceName",
},
{
searchType: "디바이스 모델",
searchText: "deviceModel",
},
{
searchType: "디바이스 OS",
searchText: "deviceOs",
},
]; ];
const SEARCH_TYPE_MAP: Record<SearchType | "", "ALL" | "TITLE" | "AUTHOR"> = {
"": "ALL",
전체: "ALL",
제목: "TITLE",
작성자: "AUTHOR",
};
const pageSizeOptions = [ const pageSizeOptions = [
{ text: "10 페이지", value: 10 }, { text: "10 페이지", value: 10 },
{ text: "50 페이지", value: 50 }, { text: "50 페이지", value: 50 },
{ text: "100 페이지", value: 100 }, { text: "100 페이지", value: 100 },
]; ];
//
const tableHeader = [
{ label: "Title", width: "7%", style: "word-break: keep-all;" },
{ label: "File Name", width: "7%", style: "word-break: keep-all;" },
{ label: "File Path", width: "7%", style: "word-break: keep-all;" },
{ label: "Description", width: "7%", style: "word-break: keep-all;" },
{ label: "Created Data", width: "7%", style: "word-break: keep-all;" },
{ label: "Modified Data", width: "7%", style: "word-break: keep-all;" },
{ label: "Action", width: "7%", style: "word-break: keep-all;" },
];
const data = ref({ const data = ref({
params: { params: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
searchType: "", searchType: "전체" as SearchType,
searchText: "", searchText: "",
}, },
results: [], results: [] as any[],
totalDataLength: 0, totalElements: 0,
pageLength: 0, pageLength: 0,
modalMode: "", modalMode: "" as "create" | "edit" | "setting" | "",
selectedData: null, selectedData: null as any,
allSelected: false, allSelected: false,
selected: [], selected: [] as Array<{ deviceKey: number }>,
isCreateVisible: false, isCreateVisible: false,
isUploadVisible: false, isUploadVisible: false,
isModalVisible: false, isModalVisible: false,
isConfirmDialogVisible: false, isConfirmDialogVisible: false,
userOption: [], userOption: [] as any[],
}); });
const getCodeList = () => { //
// UserService.search(data.value.params).then((d) => { function readUsernameFromStorage(): string {
// if (d.status === 200) { try {
// data.value.userOption = d.data.userList; const raw =
// } storage?.get?.("autoflow-auth") ??
// }); storage?.getAuth?.() ??
localStorage.getItem("autoflow-auth") ??
null;
const auth = typeof raw === "string" ? JSON.parse(raw) : raw;
const u1 = auth?.userInfo?.username;
return u1.toString();
} catch {
return "";
}
}
// ID
const getProjectId = (): number => {
const v = Number(localStorage.getItem("projectId"));
return Number.isFinite(v) ? v : 0;
}; };
const getData = () => { const fmtDate = (v?: string) =>
const params = { ...data.value.params }; v ? String(v).replace("T", " ").slice(0, 19) : "";
if (params.searchType === "" || params.searchText === "") {
delete params.searchType; // ( )
delete params.searchText; const toRow = (a: any) => ({
deviceKey: a.id,
id: a.id,
title: a.title ?? "",
fileName: a.originalName ?? "",
filePath: a.storagePath ?? "",
description: a.description ?? "",
createdData: fmtDate(a.regDt),
modifiedData: "-",
});
const fetchList = async () => {
const projectId = Number(localStorage.getItem("projectId"));
if (!projectId) {
console.warn("[TrainingScript] projectId 없음 — 프로젝트 먼저 선택");
data.value.results = [];
data.value.totalElements = 0;
data.value.pageLength = 0;
return;
} }
data.value.results = [
{ const { pageNum, pageSize, searchType, searchText } = data.value.params;
title: "배터리 상태 예측 모델 프로젝트",
fileName: "train.py", const mapped = SEARCH_TYPE_MAP[searchType] || "ALL";
filePath: "/kubeflow-users/battery/train.py", const keyword = (searchText || "").trim();
description: "배터리 상태 예측 스크립트", const needLocalFilter = mapped !== "ALL" && keyword.length > 0;
createdData: "2025-04-28 12:01:00",
modifiedData: "2025-04-28 12:01:00", let reqPage = data.value.params.pageNum;
}, let reqSize = data.value.params.pageSize;
{ if (needLocalFilter) {
title: "상태 추적 모델", reqPage = 0;
fileName: "detection.py", reqSize = 1000;
filePath: "/kubeflow-users/status/detection.py", }
description: "상태 추적 스크립트",
createdData: "2025-04-20 12:01:00", const payload = {
modifiedData: "2025-04-28 12:01:00", projectId,
}, page: reqPage,
]; size: reqSize,
data.value.totalDataLength = 5; keyword,
// DeviceService.search(params).then((d) => { searchType: mapped,
// if (d.status === 200) { sortField: "id",
// data.value.results = d.data.deviceList; sortDirection: "DESC",
// data.value.totalDataLength = d.data.totalCount; refType: "TRAINING_SCRIPT",
// setTimeout(() => {
// setPaginationLength();
// }, 200);
// } else {
// store.setSnackbarMsg({
// text: " ",
// color: "error",
// });
// }
// });
// DeviceService.search().then((d) => {
// data.value.totalDataLength = d.data.totalCount;
// setTimeout(() => {
// setPaginationLength();
// }, 200);
// });
}; };
const setPaginationLength = () => { try {
if (data.value.totalDataLength % data.value.params.pageSize === 0) { const res = await AttachmentsService.search(payload as any);
data.value.pageLength = const result = res?.data ?? res;
data.value.totalDataLength / data.value.params.pageSize; let list = result?.content ?? [];
} else {
data.value.pageLength = Math.ceil( if (needLocalFilter) {
data.value.totalDataLength / data.value.params.pageSize, const kw = keyword.toLowerCase();
if (mapped === "TITLE") {
list = list.filter((x: any) =>
String(x?.title ?? "")
.toLowerCase()
.includes(kw),
);
} else if (mapped === "AUTHOR") {
list = list.filter((x: any) =>
String(x?.regUserId ?? "")
.toLowerCase()
.includes(kw),
); );
} }
};
const saveData = (formData) => { //
if (data.value.modalMode === "create") { const uiSize = data.value.params.pageSize;
// DeviceService.add(formData).then((d) => { const totalElements = list.length;
// if (d.status === 200) { const totalPages = Math.max(1, Math.ceil(totalElements / uiSize));
// data.value.isModalVisible = false; const safePage = Math.min(Math.max(1, pageNum), totalPages);
// store.setSnackbarMsg({ const start = (safePage - 1) * uiSize;
// text: " .", const pageSlice = list.slice(start, start + uiSize);
// result: 200,
// }); data.value.results = pageSlice.map(toRow);
// changePageNum(1); data.value.totalElements = totalElements;
// } else { data.value.pageLength = totalPages;
// store.setSnackbarMsg({ return;
// text: d, }
// result: 500,
// }); //
// } data.value.results = (list as any[]).map(toRow);
// }); data.value.totalElements = result?.totalElements ?? list.length;
} else { data.value.pageLength = result?.totalPages ?? 1;
// DeviceService.update(formData.deviceKey, formData).then((d) => { } catch (err) {
// if (d.status === 200) { console.error("[TrainingScript] 조회 에러:", err);
// data.value.isModalVisible = false; data.value.results = [];
// store.setSnackbarMsg({ data.value.totalElements = 0;
// text: " .", data.value.pageLength = 1;
// result: 200,
// });
// changePageNum();
// } else {
// store.setSnackbarMsg({
// text: d,
// result: 500,
// });
// }
// });
} }
}; };
const removeData = (value) => { /** 검색 실행 (페이지 1로 리셋) */
let removeList = value ? value : data.value.selected; const doSearch = () => {
const remove = (code) => { data.value.params.pageNum = 1;
// return DeviceService.delete(code).then((d) => { fetchList();
// if (d.status !== 200) {
// store.setSnackbarMsg({
// text: d,
// result: 500,
// });
// }
// });
}; };
if (removeList.length === 1) { /** 페이지 이동 */
remove(removeList[0].deviceKey).then(() => { const changePageNum = (page: number) => {
// store.setSnackbarMsg({ data.value.params.pageNum = page;
// text: ".", fetchList();
// result: 200, };
// });
changePageNum(); /** 페이지 사이즈 변경 */
data.value.isConfirmDialogVisible = false; const changePageSize = (size: number) => {
data.value.selected = []; data.value.params.pageSize = size;
data.value.allSelected = false; data.value.params.pageNum = 1;
fetchList();
};
// / ( )
const removeData = (value?: Array<{ deviceKey: number }>) => {
const removeList = value ?? data.value.selected;
if (!removeList || removeList.length === 0) return;
const ids = removeList.map((x) => x.deviceKey);
const removeOne = (id: number) =>
AttachmentsService.delete(id).then((res) => {
if (res.status < 200 || res.status >= 300) return Promise.reject(res);
}); });
} else {
Promise.all(removeList.map((item) => remove(item.deviceKey))).finally( const after = () => {
() => { if (
// store.setSnackbarMsg({ ids.length >= data.value.results.length &&
// text: " .", data.value.params.pageNum > 1
// result: 200, ) {
// }); data.value.params.pageNum -= 1;
changePageNum(); }
fetchList();
data.value.isConfirmDialogVisible = false; data.value.isConfirmDialogVisible = false;
data.value.selected = []; data.value.selected = [];
data.value.allSelected = false; data.value.allSelected = false;
},
);
}
}; };
const handleRemoveData = () => { // /
if (data.value.selected.length === 0) { if (ids.length === 1) {
// store.setSnackbarMsg({ removeOne(ids[0])
// text: " . ", .then(() => {
// result: 500, store.setSnackbarMsg({
// }); color: "success",
return; text: "삭제되었습니다.",
} result: 200,
if (data.value.allSelected || data.value.selected.length !== 1) { });
data.value.isConfirmDialogVisible = true; after();
return; })
.catch((err) => {
console.error("삭제 실패:", err);
store.setSnackbarMsg({
color: "warning",
text: "삭제 실패",
result: 500,
});
});
} else {
Promise.all(ids.map(removeOne))
.then(() => {
store.setSnackbarMsg({
color: "success",
text: "모두 삭제되었습니다.",
result: 200,
});
})
.catch((err) => {
console.error("일부 삭제 실패:", err);
store.setSnackbarMsg({
color: "warning",
text: "일부 삭제 실패",
result: 500,
});
})
.finally(after);
} }
//
removeData(undefined);
}; };
const closeDetail = () => { const closeDetail = () => {
openView.value = false; openView.value = false;
}; };
const changePageNum = (page) => {
data.value.params.pageNum = page; const openDetailModal = (selectedItem: any) => {
getData();
};
const openSettingModal = (selectedItem) => {
data.value.selectedData = selectedItem; data.value.selectedData = selectedItem;
data.value.modalMode = "setting";
openView.value = true; openView.value = true;
}; };
const openCreateModal = () => { const openCreateModal = () => {
data.value.selectedData = null;
data.value.modalMode = "create"; data.value.modalMode = "create";
data.value.selectedData = {
username: username.value,
projectId: getProjectId(),
};
data.value.isCreateVisible = true; data.value.isCreateVisible = true;
}; };
const openModifyModal = () => { const openModifyModal = (item: any) => {
data.value.selectedData = null;
data.value.modalMode = "edit"; data.value.modalMode = "edit";
data.value.isUploadVisible = true; data.value.selectedData = {
id: item.deviceKey,
title: item.title,
description: item.description,
};
data.value.isCreateVisible = true;
}; };
const closeCreateModal = () => { const closeCreateModal = () => {
data.value.isModalVisible = false; data.value.isModalVisible = false;
data.value.isCreateVisible = null; data.value.isCreateVisible = false;
data.value.selectedData = null;
}; };
const closeModifyModal = () => { const closeModifyModal = () => {
data.value.isModalVisible = false; data.value.isModalVisible = false;
data.value.isUploadVisible = null; data.value.isUploadVisible = false;
data.value.selectedData = null;
}; };
const getSelectedAllData = () => { const getSelectedAllData = () => {
data.value.selected = data.value.allSelected data.value.selected = data.value.allSelected
? data.value.results.map((item) => { ? data.value.results.map((item: any) => ({ deviceKey: item.deviceKey }))
return {
deviceKey: item.deviceKey,
};
})
: []; : [];
}; };
onMounted(() => { onMounted(() => {
getData(); username.value = readUsernameFromStorage();
getCodeList(); fetchList();
}); });
</script> </script>
<template> <template>
<div class="w-100" v-if="!openView"> <div class="w-100" v-if="!openView">
<!-- <v-dialog v-model="data.isModalVisible" max-width="600" persistent>-->
<!-- <FormComponent-->
<!-- :edit-data="data.selectedData"-->
<!-- :mode="data.modalMode"-->
<!-- @close-modal="closeModal"-->
<!-- @handle-data="saveData"-->
<!-- :user-option="data.userOption"-->
<!-- />-->
<!-- </v-dialog>-->
<!-- <v-dialog v-model="data.isConfirmDialogVisible" persistent max-width="300">-->
<!-- <ConfirmDialogComponent-->
<!-- @cancel="data.isConfirmDialogVisible = false"-->
<!-- @delete="removeData(undefined)"-->
<!-- @init="(data.selected = []), (data.allSelected = false)"-->
<!-- />-->
<!-- </v-dialog>-->
<v-container fluid class="h-100 pa-5 d-flex flex-column align-center"> <v-container fluid class="h-100 pa-5 d-flex flex-column align-center">
<v-card <v-card
flat flat
class="bg-shades-transparent d-flex flex-column align-center justify-center w-100" class="bg-shades-transparent d-flex flex-column align-center justify-center w-100"
> >
<!-- 헤더 -->
<v-card flat class="bg-shades-transparent w-100"> <v-card flat class="bg-shades-transparent w-100">
<v-card-item class="text-h5 font-weight-bold pt-0 pa-5 pl-0"> <v-card-item class="text-h5 font-weight-bold pt-0 pa-5 pl-0">
<div class="d-flex flex-row justify-start align-center"> <div class="d-flex flex-row justify-start align-center">
@ -343,7 +337,9 @@ onMounted(() => {
</div> </div>
</v-card-item> </v-card-item>
</v-card> </v-card>
<v-card flat class="bg-shades-transparent w-100"> <v-card flat class="bg-shades-transparent w-100">
<!-- 검색 영역 -->
<v-card flat class="bg-shades-transparent mb-4"> <v-card flat class="bg-shades-transparent mb-4">
<div class="d-flex justify-center flex-wrap align-center"> <div class="d-flex justify-center flex-wrap align-center">
<v-responsive <v-responsive
@ -356,11 +352,12 @@ onMounted(() => {
label="검색조건" label="검색조건"
density="compact" density="compact"
:items="searchOptions" :items="searchOptions"
item-title="searchType" item-title="label"
item-value="searchText" item-value="value"
hide-details hide-details
></v-select> />
</v-responsive> </v-responsive>
<v-responsive min-width="540" max-width="540"> <v-responsive min-width="540" max-width="540">
<v-text-field <v-text-field
v-model="data.params.searchText" v-model="data.params.searchText"
@ -370,8 +367,8 @@ onMounted(() => {
required required
class="mt-3 mb-3" class="mt-3 mb-3"
hide-details hide-details
@keyup.enter="changePageNum(1)" @keyup.enter="doSearch"
></v-text-field> />
</v-responsive> </v-responsive>
<div class="ml-3"> <div class="ml-3">
@ -379,7 +376,7 @@ onMounted(() => {
size="large" size="large"
color="primary" color="primary"
:rounded="5" :rounded="5"
@click="changePageNum(1)" @click="doSearch"
> >
<v-icon>mdi-magnify</v-icon> <v-icon>mdi-magnify</v-icon>
</v-btn> </v-btn>
@ -387,6 +384,7 @@ onMounted(() => {
</div> </div>
</v-card> </v-card>
<!-- 상단 툴바 -->
<v-sheet <v-sheet
class="bg-shades-transparent d-flex flex-wrap align-center mb-2" class="bg-shades-transparent d-flex flex-wrap align-center mb-2"
> >
@ -394,10 +392,12 @@ onMounted(() => {
<v-sheet <v-sheet
class="d-flex align-center mr-3 mb-2 bg-shades-transparent" class="d-flex align-center mr-3 mb-2 bg-shades-transparent"
> >
<!-- 스크립트의 totalElements 사용 -->
<v-chip color="primary" <v-chip color="primary"
> {{ data.totalDataLength.toLocaleString() }} > {{ data.totalElements.toLocaleString() }}</v-chip
</v-chip> >
</v-sheet> </v-sheet>
<v-sheet class="bg-shades-transparent"> <v-sheet class="bg-shades-transparent">
<v-responsive max-width="140" min-width="140" class="mb-2"> <v-responsive max-width="140" min-width="140" class="mb-2">
<v-select <v-select
@ -409,18 +409,18 @@ onMounted(() => {
variant="outlined" variant="outlined"
color="primary" color="primary"
hide-details hide-details
@update:model-value="changePageNum(1)" @update:model-value="changePageSize"
></v-select> />
</v-responsive> </v-responsive>
</v-sheet> </v-sheet>
</v-sheet> </v-sheet>
<v-sheet class="justify-end mb-2"> <v-sheet class="justify-end mb-2">
<v-btn color="info" @click="openCreateModal" <v-btn color="info" @click="openCreateModal">Create Script</v-btn>
>Create Script
</v-btn>
</v-sheet> </v-sheet>
</v-sheet> </v-sheet>
<!-- 목록 -->
<v-card class="rounded-lg pa-8"> <v-card class="rounded-lg pa-8">
<v-col cols="12"> <v-col cols="12">
<v-sheet> <v-sheet>
@ -428,8 +428,6 @@ onMounted(() => {
density="comfortable" density="comfortable"
fixed-header fixed-header
height="625" height="625"
col-md-12
col-12
overflow-x-auto overflow-x-auto
> >
<colgroup> <colgroup>
@ -439,18 +437,20 @@ onMounted(() => {
:style="`width:${item.width}`" :style="`width:${item.width}`"
/> />
</colgroup> </colgroup>
<thead> <thead>
<tr> <tr>
<th <th
v-for="(item, i) in tableHeader" v-for="(item, i) in tableHeader"
:key="i" :key="i"
class="text-center font-weight-bold" class="text-center font-weight-bold"
:style="`${item.style}`" :style="item.style"
> >
{{ item.label }} {{ item.label }}
</th> </th>
</tr> </tr>
</thead> </thead>
<tbody class="text-body-2"> <tbody class="text-body-2">
<tr <tr
v-for="(item, i) in data.results" v-for="(item, i) in data.results"
@ -464,8 +464,8 @@ onMounted(() => {
<td>{{ item.createdData }}</td> <td>{{ item.createdData }}</td>
<td>{{ item.modifiedData }}</td> <td>{{ item.modifiedData }}</td>
<td style="white-space: nowrap"> <td style="white-space: nowrap">
<IconInfoBtn @on-click="openSettingModal(item)" /> <IconInfoBtn @on-click="openDetailModal(item)" />
<IconModifyBtn @on-click="openModifyModal()" /> <IconModifyBtn @on-click="openModifyModal(item)" />
<IconDeleteBtn <IconDeleteBtn
@on-click=" @on-click="
removeData([{ deviceKey: item.deviceKey }]) removeData([{ deviceKey: item.deviceKey }])
@ -476,6 +476,7 @@ onMounted(() => {
</tbody> </tbody>
</v-table> </v-table>
</v-sheet> </v-sheet>
<v-card-actions class="text-center mt-8 justify-center"> <v-card-actions class="text-center mt-8 justify-center">
<v-pagination <v-pagination
v-model="data.params.pageNum" v-model="data.params.pageNum"
@ -483,36 +484,33 @@ onMounted(() => {
:total-visible="10" :total-visible="10"
color="primary" color="primary"
rounded="circle" rounded="circle"
@update:model-value="getData" @update:model-value="changePageNum"
></v-pagination> />
</v-card-actions> </v-card-actions>
</v-col> </v-col>
</v-card> </v-card>
</v-card> </v-card>
</v-card> </v-card>
</v-container> </v-container>
<!-- 등록 다이얼로그 -->
<v-dialog v-model="data.isCreateVisible" max-width="600" persistent> <v-dialog v-model="data.isCreateVisible" max-width="600" persistent>
<TrainingScriptBaseDoalog <TrainingScriptBaseDoalog
:edit-data="data.selectedData" :edit-data="data.selectedData"
:mode="data.modalMode" :mode="data.modalMode"
@close-modal="closeCreateModal" @close-modal="closeCreateModal"
@handle-data="saveData" @saved="fetchList"
:user-option="data.userOption"
/>
</v-dialog>
<v-dialog v-model="data.isUploadVisible" max-width="600" persistent>
<TrainingScriptBaseDoalog
:edit-data="data.selectedData"
:mode="data.modalMode"
@close-modal="closeModifyModal"
@handle-data="saveData"
:user-option="data.userOption" :user-option="data.userOption"
/> />
</v-dialog> </v-dialog>
</div> </div>
<div class="w-100" v-else> <div class="w-100" v-else>
<ViewComponent @close="closeDetail" /> <ViewComponent
v-if="data.selectedData"
:id="data.selectedData.deviceKey"
@close="closeDetail"
/>
</div> </div>
</template> </template>

@ -1,188 +1,113 @@
<script setup lang="ts"> <script setup lang="ts">
import IconDeleteBtn from "@/components/atoms/button/IconDeleteBtn.vue"; import {
import IconModifyBtn from "@/components/atoms/button/IconModifyBtn.vue"; defineProps,
// import FormComponent from "@/components/device/FormComponent.vue"; defineEmits,
import { onBeforeUnmount, onMounted, ref, watch } from "vue"; ref,
computed,
onMounted,
watch,
onBeforeUnmount,
} from "vue";
import * as monaco from "monaco-editor"; import * as monaco from "monaco-editor";
import "monaco-editor/min/vs/editor/editor.main.css"; import "monaco-editor/min/vs/editor/editor.main.css";
// const store = commonStore(); import { AttachmentsService } from "@/components/service/management/attachmentsService";
const editorRef = ref<HTMLDivElement | null>(null);
let editorInstance: monaco.editor.IStandaloneCodeEditor | null = null;
const experimentInfo = ref({
modelName: "ImageClassifier",
projectName: "배터리 상태 예측 모델 프로젝트",
experimentName: "Baseline Model Training",
executionName: "run-batch32-lr0.001",
deployDate: "2025-02-06",
createdId: "ADMIN_001",
description: "기본 모델 구조로 학습 성능 측정",
});
const yamlContent = `import argparse const props = defineProps<{ id: number | string }>();
import torch const emit = defineEmits<{ (e: "close"): void }>();
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import DataLoader, TensorDataset
import os
class SimpleNet(nn.Module):
def __init__(self, input_dim, hidden_dim, output_dim):
super(SimpleNet, self).__init__()
self.fc1 = nn.Linear(input_dim, hidden_dim)
self.relu = nn.ReLU()
`;
const data = ref({ const loading = ref(false);
params: { const detailRaw = ref<any | null>(null);
pageNum: 1,
pageSize: 10,
searchType: "",
searchText: "",
},
results: [],
totalDataLength: 0,
pageLength: 0,
modalMode: "",
selectedData: null,
allSelected: false,
selected: [],
isModalVisible: false,
isConfirmDialogVisible: false,
userOption: [],
});
const getCodeList = () => { const editorRef = ref<HTMLDivElement | null>(null);
// UserService.search(data.value.params).then((d) => { let editorInstance: monaco.editor.IStandaloneCodeEditor | null = null;
// if (d.status === 200) {
// data.value.userOption = d.data.userList;
// }
// });
};
const setPaginationLength = () => { const formatIso = (s?: string) =>
if (data.value.totalDataLength % data.value.params.pageSize === 0) { s ? String(s).replace("T", " ").slice(0, 19) : "-";
data.value.pageLength =
data.value.totalDataLength / data.value.params.pageSize; const mapToViewModel = (raw: any) => ({
} else { title: raw?.title ?? "-",
data.value.pageLength = Math.ceil( fileName: raw?.originalName ?? "-",
data.value.totalDataLength / data.value.params.pageSize, filePath: raw?.storagePath ?? "-",
); createdDate: formatIso(raw?.regDt),
} modifiedDate: "-",
}; createdId: raw?.regUserId ?? "-",
description: raw?.description ?? "-",
});
const info = computed(() => mapToViewModel(detailRaw.value || {}));
const saveData = (formData) => { function ensureEditor() {
if (data.value.modalMode === "create") { if (editorInstance || !editorRef.value) return;
// DeviceService.add(formData).then((d) => { editorInstance = monaco.editor.create(editorRef.value, {
// if (d.status === 200) { value: "",
// data.value.isModalVisible = false; language: "plaintext",
// store.setSnackbarMsg({ theme: "vs-dark",
// text: " .", readOnly: true,
// result: 200, automaticLayout: true,
// }); minimap: { enabled: false },
// changePageNum(1); lineNumbers: "on",
// } else { });
// store.setSnackbarMsg({
// text: d,
// result: 500,
// });
// }
// });
} else {
// DeviceService.update(formData.deviceKey, formData).then((d) => {
// if (d.status === 200) {
// data.value.isModalVisible = false;
// store.setSnackbarMsg({
// text: " .",
// result: 200,
// });
// changePageNum();
// } else {
// store.setSnackbarMsg({
// text: d,
// result: 500,
// });
// }
// });
} }
};
const removeData = (value) => { async function loadPreviewFromStoragePath(objectName?: string) {
let removeList = value ? value : data.value.selected; const key = (objectName || "").trim();
const remove = (code) => { if (!key) return;
// return DeviceService.delete(code).then((d) => {
// if (d.status !== 200) {
// store.setSnackbarMsg({
// text: d,
// result: 500,
// });
// }
// });
};
if (removeList.length === 1) { // ( )
remove(removeList[0].deviceKey).then(() => { const res = await AttachmentsService.readTextByPath(key);
// store.setSnackbarMsg({
// text: ".",
// result: 200,
// });
data.value.isConfirmDialogVisible = false; const text =
data.value.selected = []; typeof res?.data === "string" ? res.data : String(res?.data ?? "");
data.value.allSelected = false;
});
} else {
Promise.all(removeList.map((item) => remove(item.deviceKey))).finally(
() => {
// store.setSnackbarMsg({
// text: " .",
// result: 200,
// });
data.value.isConfirmDialogVisible = false; ensureEditor();
data.value.selected = []; editorInstance?.setValue(text || "# (empty)");
data.value.allSelected = false;
},
);
} }
};
const changePageNum = (page) => { /** 상세 조회 후 storagePath로 프리뷰 호출 */
data.value.params.pageNum = page; async function fetchDetail(id: number | string) {
}; const idNum = typeof id === "string" ? Number(id) : id;
if (!Number.isFinite(idNum as number)) return;
loading.value = true;
try {
const res = await AttachmentsService.view(idNum as number);
detailRaw.value = res?.data ?? res;
ensureEditor();
editorInstance?.setValue(
"# Preview (loading...)\n" +
`# title: ${info.value.title}\n` +
`# file : ${info.value.fileName}\n`,
);
const emit = defineEmits<{ await loadPreviewFromStoragePath(
(e: "close"): void; detailRaw.value?.storagePath || detailRaw.value?.storedName,
}>(); );
} catch (e) {
console.error("[TrainingScript View] fetch detail error:", e);
} finally {
loading.value = false;
}
}
onMounted(() => { onMounted(() => {
getCodeList(); ensureEditor();
if (editorRef.value) { fetchDetail(props.id);
editorInstance = monaco.editor.create(editorRef.value, {
value: yamlContent,
language: "yaml",
theme: "vs-dark",
readOnly: true,
automaticLayout: true,
minimap: { enabled: false },
lineNumbers: "on",
});
}
}); });
watch(
() => props.id,
(now) => {
if (now !== undefined && now !== null && now !== "") fetchDetail(now);
},
);
onBeforeUnmount(() => { onBeforeUnmount(() => {
if (editorInstance) { editorInstance?.dispose();
editorInstance.dispose();
editorInstance = null; editorInstance = null;
}
}); });
</script> </script>
<template> <template>
<v-container fluid class="h-100 pa-5 d-flex flex-column align-center"> <v-container fluid class="h-100 pa-5 d-flex flex-column align-center">
<v-card <v-card flat class="bg-shades-transparent w-100 mb-6">
flat
class="bg-shades-transparent d-flex flex-column justify-center w-100"
>
<v-card flat class="bg-shades-transparent w-100">
<v-card-item class="text-h5 font-weight-bold pt-0 pa-5 pl-0"> <v-card-item class="text-h5 font-weight-bold pt-0 pa-5 pl-0">
<div class="d-flex flex-row justify-start align-center"> <div class="d-flex flex-row justify-start align-center">
<div class="text-primary">View Details</div> <div class="text-primary">View Details</div>
@ -196,96 +121,62 @@ onBeforeUnmount(() => {
</v-card-title> </v-card-title>
<v-card-text class="px-6 pb-6 pt-4"> <v-card-text class="px-6 pb-6 pt-4">
<!-- Experiment Name -->
<v-row align="center" class="py-2"> <v-row align="center" class="py-2">
<v-col cols="3" class="text-h6 font-weight-bold" <v-col cols="3" class="text-h6 font-weight-bold"
>Training Script Title >Training Script Title</v-col
</v-col> >
<v-col cols="9" class="pa-2">{{ experimentInfo.modelName }}</v-col> <v-col cols="9" class="pa-2">{{ info.title }}</v-col>
</v-row> </v-row>
<VDivider class="my-2" /> <v-divider class="my-2" />
<!-- Project Name -->
<v-row align="center" class="py-2"> <v-row align="center" class="py-2">
<v-col cols="3" class="text-h6 font-weight-bold">File Name</v-col> <v-col cols="3" class="text-h6 font-weight-bold">File Name</v-col>
<v-col cols="9" class="pa-2">{{ <v-col cols="9" class="pa-2">{{ info.fileName }}</v-col>
experimentInfo.projectName
}}</v-col>
</v-row> </v-row>
<VDivider class="my-2" /> <v-divider class="my-2" />
<v-row align="center" class="py-2"> <v-row align="center" class="py-2">
<v-col cols="3" class="text-h6 font-weight-bold">File Path</v-col> <v-col cols="3" class="text-h6 font-weight-bold">File Path</v-col>
<v-col cols="9" class="pa-2">{{ <v-col cols="9" class="pa-2" style="word-break: break-all">{{
experimentInfo.experimentName info.filePath
}}</v-col> }}</v-col>
</v-row> </v-row>
<VDivider class="my-2" /> <v-divider class="my-2" />
<!-- Created Date / ID -->
<v-row align="center" class="py-2"> <v-row align="center" class="py-2">
<v-col cols="3" class="text-h6 font-weight-bold" <v-col cols="3" class="text-h6 font-weight-bold">Created Date</v-col>
>Created Date <v-col cols="3" class="pa-2">{{ info.createdDate }}</v-col>
</v-col> <v-col cols="3" class="text-h6 font-weight-bold">Modified Date</v-col>
<v-col cols="3" class="pa-2">{{ experimentInfo.deployDate }}</v-col> <v-col cols="3" class="pa-2">{{ info.modifiedDate }}</v-col>
<v-col cols="3" class="text-h6 font-weight-bold"
>Modified Date
</v-col>
<v-col cols="3" class="pa-2">{{ experimentInfo.createdId }}</v-col>
</v-row> </v-row>
<VDivider class="my-2" /> <v-divider class="my-2" />
<v-row align="center" class="py-2">
<!-- Description --> <v-col cols="3" class="text-h6 font-weight-bold">Created ID</v-col>
<v-col cols="9" class="pa-2">{{ info.createdId }}</v-col>
</v-row>
<v-divider class="my-2" />
<v-row align="center" class="py-2"> <v-row align="center" class="py-2">
<v-col cols="3" class="text-h6 font-weight-bold">Description</v-col> <v-col cols="3" class="text-h6 font-weight-bold">Description</v-col>
<v-col cols="9" class="pa-2">{{ <v-col cols="9" class="pa-2">{{ info.description }}</v-col>
experimentInfo.description
}}</v-col>
</v-row> </v-row>
</v-card-text> </v-card-text>
</v-card> </v-card>
<!-- 미리보기 -->
<v-card flat class="bordered-box mb-6 w-100 rounded-lg pa-8"> <v-card flat class="bordered-box mb-6 w-100 rounded-lg pa-8">
<v-card-title class="grey lighten-4 py-2 px-4"> <v-card-title class="grey lighten-4 py-2 px-4">
<span class="font-weight-bold">Training Script Preview</span> <span class="font-weight-bold">Training Script Preview</span>
</v-card-title> </v-card-title>
<v-card-text class="px-6 pb-6 pt-4"> <v-card-text class="px-6 pb-6 pt-4">
<div ref="editorRef" class="editor-container"></div <div ref="editorRef" class="editor-container"></div>
></v-card-text> </v-card-text>
<v-sheet class="d-flex justify-end mb-2"> <v-sheet class="d-flex justify-end mb-2">
<v-btn color="primary" @click="emit('close')">Back to List</v-btn> <v-btn color="primary" @click="emit('close')">Back to List</v-btn>
</v-sheet> </v-sheet>
</v-card> </v-card>
</v-card>
</v-container> </v-container>
</template> </template>
<style scoped> <style scoped>
.editor-container { .editor-container {
width: 100%; width: 100%;
height: 400px; /* 원하시는 높이로 설정하세요 */ height: 400px;
}
.v-card-text {
width: 100% !important;
border-collapse: collapse;
/* 전체 테이블 1px 테두리 */
}
.v-card-text th {
font-size: 20px;
min-width: 400px;
border: 1px solid rgba(255, 255, 255, 0.12);
background-color: rgba(255, 255, 255, 0.05);
font-weight: 600;
text-align: center;
white-space: nowrap;
}
.v-card-text td {
font-size: 16px;
min-width: 600px;
padding: 12px 16px;
text-align: left;
border: 1px solid rgba(255, 255, 255, 0.12);
}
.v-card-text tr:nth-child(odd) {
background-color: rgba(255, 255, 255, 0.02);
} }
</style> </style>

@ -0,0 +1,669 @@
<script setup lang="ts">
import { ref, onMounted, watch, computed } from "vue";
import { commonStore } from "@/stores/commonStore";
import { storage } from "@/utils/storage.js";
import { ProjectService } from "@/components/service/project/projectService";
import { UserManagerService } from "@/components/service/management/userManagerService";
import IconDeleteBtn from "@/components/atoms/button/IconDeleteBtn.vue";
import IconModifyBtn from "@/components/atoms/button/IconModifyBtn.vue";
/** ---------- 상수/상태 ---------- */
const store = commonStore();
const roleOptions = ["ROLE_USER", "ROLE_MODERATOR", "ROLE_ADMIN"] as const;
type SearchType = "전체" | "제목" | "작성자";
const searchOptions = [
{ label: "전체", value: "전체" as SearchType },
{ label: "제목", value: "제목" as SearchType },
{ label: "작성자", value: "작성자" as SearchType },
];
const SEARCH_TYPE_MAP: Record<SearchType | "", "ALL" | "TITLE" | "AUTHOR"> = {
"": "ALL",
전체: "ALL",
제목: "TITLE",
작성자: "AUTHOR",
};
const fmtDate = (v?: string) => (v ? v.replace("T", " ").slice(0, 19) : "-");
const splitCsv = (v?: string) =>
String(v ?? "")
.split(",")
.map((s) => s.trim())
.filter(Boolean);
/** 로그인한 사용자의 권한 (필요 시) */
const roles = ref<string[]>([]);
const refreshRoles = () => {
const auth = storage.getAuth?.() ?? storage.get?.("vpp-Auth") ?? null;
const r = auth?.userInfo?.roles ?? auth?.roles ?? [];
roles.value = Array.isArray(r) ? r : [];
};
const isAdmin = computed(() => roles.value.includes("ROLE_ADMIN"));
/** 테이블 정의 */
const tableHeader = [
{ label: "No", width: "6%", style: "word-break: keep-all;" },
{ label: "Username", width: "10%", style: "word-break: keep-all;" },
{ label: "Email", width: "20%", style: "word-break: keep-all;" },
{ label: "Roles", width: "27%", style: "word-break: keep-all;" },
{ label: "Projects", width: "27%", style: "word-break: keep-all;" },
{ label: "Action", width: "10%", style: "word-break: keep-all;" },
];
const pageSizeOptions = [
{ text: "10 페이지", value: 10 },
{ text: "50 페이지", value: 50 },
{ text: "100 페이지", value: 100 },
];
/** ---------- 타입 ---------- */
type Row = {
no: number;
name: string; // username
desc: string; // email
users: string[]; // roles
projects: string[]; // project names
registDt: string;
deviceKey: number; // user id
};
type SelectedUser = {
id: number;
username: string;
email: string;
role: string; //
} | null;
/** ---------- 상태 ---------- */
const data = ref({
params: {
pageNum: 1,
pageSize: 10,
searchType: "전체" as SearchType,
searchText: "",
},
results: [] as Row[],
totalDataLength: 0,
pageLength: 0,
modalMode: "" as "create" | "edit" | "",
selectedData: null as SelectedUser,
allSelected: false,
selected: [] as Array<{ deviceKey: number }>,
isCreateVisible: false,
isConfirmDialogVisible: false,
});
/** 사용자 폼: Roles 단일 선택 */
const userForm = ref({
username: "",
email: "",
password: "",
roles: "" as (typeof roleOptions)[number] | "", //
});
const resetUserForm = () => {
userForm.value = { username: "", email: "", password: "", roles: "" };
};
/** ---------- 목록/검색 ---------- */
function toRow(u: any, no: number, projectNames: string[] = []): Row {
const rolesArr = Array.isArray(u?.roles)
? u.roles
: typeof u?.roles === "string"
? splitCsv(u.roles)
: [];
return {
no,
name: u?.username ?? u?.name ?? "-",
desc: u?.email ?? "-", //
users: rolesArr,
projects: projectNames,
registDt: fmtDate(u?.createdAt ?? u?.regDate),
deviceKey: Number(u?.id),
};
}
async function getData() {
const { pageNum, pageSize, searchType, searchText } = data.value.params;
const mapped = SEARCH_TYPE_MAP[searchType] || "ALL";
const keyword = (searchText || "").trim().toLowerCase();
try {
// 1)
const res = await UserManagerService.getAll();
let list: any[] = Array.isArray(res?.data) ? res.data : [];
// 2)
if (keyword) {
list = list.filter((u) => {
const username = String(u?.username ?? u?.name ?? "").toLowerCase();
const email = String(u?.email ?? "").toLowerCase();
const rolesStr = Array.isArray(u?.roles)
? u.roles.join(",").toLowerCase()
: String(u?.roles ?? "").toLowerCase();
if (mapped === "TITLE") return username.includes(keyword);
if (mapped === "AUTHOR")
return email.includes(keyword) || rolesStr.includes(keyword);
return (
username.includes(keyword) ||
email.includes(keyword) ||
rolesStr.includes(keyword)
);
});
}
// 3) &
list.sort((a, b) => (Number(b?.id) || 0) - (Number(a?.id) || 0));
const totalElements = list.length;
const totalPages = Math.max(1, Math.ceil(totalElements / pageSize));
const safePage = Math.min(Math.max(1, pageNum), totalPages);
const start = (safePage - 1) * pageSize;
const pageSlice = list.slice(start, start + pageSize);
const firstNo = totalElements - start;
// 4)
data.value.results = pageSlice.map((u: any, i: number) =>
toRow(u, Math.max(1, firstNo - i), []),
);
data.value.totalDataLength = totalElements;
data.value.pageLength = totalPages;
const projectLists = await Promise.all(
pageSlice.map((u) =>
ProjectService.userProjectAuthority(Number(u?.id))
.then((r: any) => (Array.isArray(r?.data) ? r.data : []))
.catch(() => []),
),
);
data.value.results = pageSlice.map((u: any, i: number) => {
const projs = projectLists[i] || [];
const names = projs
.map((p: any) => String(p?.projectName ?? ""))
.filter(Boolean);
return toRow(u, Math.max(1, firstNo - i), names);
});
} catch (e) {
console.error("[Users] fetch error:", e);
data.value.results = [];
data.value.totalDataLength = 0;
data.value.pageLength = 1;
}
}
/** ---------- 페이지/검색 트리거 ---------- */
function doSearch() {
data.value.params.pageNum = 1;
getData();
}
function changePageSize(size: number) {
data.value.params.pageSize = size;
data.value.params.pageNum = 1;
getData();
}
function changePageNum(page: number) {
data.value.params.pageNum = page;
getData();
}
watch(
() => data.value.params.searchType,
() => doSearch(),
);
/** ---------- 모달 열기/닫기 (워크플로우 패턴) ---------- */
const openCreateModal = () => {
data.value.selectedData = null;
data.value.modalMode = "create";
resetUserForm();
data.value.isCreateVisible = true;
};
const openModifyModal = (row: Row) => {
data.value.selectedData = {
id: row.deviceKey,
username: row.name,
email: row.desc === "-" ? "" : row.desc,
role: row.users?.[0] || "",
};
data.value.modalMode = "edit";
//
userForm.value.username = row.name || "";
userForm.value.email = row.desc === "-" ? "" : row.desc || "";
userForm.value.password = ""; //
userForm.value.roles = (row.users?.[0] as any) || "";
data.value.isCreateVisible = true;
};
const closeCreateModal = () => {
data.value.isCreateVisible = false;
};
/** 모달 열림/닫힘 감시 → 닫힐 때 목록 갱신 */
watch(
() => data.value.isCreateVisible,
(now, prev) => {
if (prev && !now) getData();
},
);
/** ---------- 저장(생성/수정) ---------- */
async function saveUser() {
try {
const username = userForm.value.username.trim();
const password = (userForm.value.password || "").trim();
const email = (userForm.value.email || "").trim();
const roleOne = userForm.value.roles || "";
if (!username || (data.value.modalMode === "create" && !password)) {
return store.setSnackbarMsg?.({
color: "warning",
text: "Username은 필수이며, 생성 시 Password도 필요합니다.",
result: 400,
});
}
const payload: any = {
username,
email,
role: roleOne ? [roleOne] : undefined, //
};
if (password) payload.password = password; //
if (data.value.modalMode === "create") {
await UserManagerService.signUp(payload);
store.setSnackbarMsg?.({
color: "success",
text: "계정이 생성되었습니다.",
result: 200,
});
} else {
const id = Number(data.value.selectedData?.id);
if (!id) {
return store.setSnackbarMsg?.({
color: "warning",
text: "수정할 사용자 ID가 없습니다.",
result: 400,
});
}
// update(id, body) .
await UserManagerService.update(id, payload);
store.setSnackbarMsg?.({
color: "success",
text: "수정되었습니다.",
result: 200,
});
}
await getData();
data.value.isCreateVisible = false;
} catch (e: any) {
console.error("[User] save error:", e?.response?.data || e);
store.setSnackbarMsg?.({
color: "warning",
text:
e?.response?.data?.message || e?.response?.data?.error || "요청 실패",
result: e?.response?.status || 500,
});
}
}
/** ---------- 삭제 ---------- */
function getSelectedAllData() {
data.value.selected = data.value.allSelected
? data.value.results.map((r) => ({ deviceKey: r.deviceKey }))
: [];
}
async function deleteRows(targetList?: Array<{ deviceKey: number }>) {
const removeList = targetList ?? data.value.selected;
if (!removeList?.length) return;
const ids = removeList.map((x) => x.deviceKey);
const remove = (id: number) =>
UserManagerService.delete(id).then((res) => {
if (res.status < 200 || res.status >= 300) return Promise.reject(res);
});
const after = async () => {
if (
ids.length >= data.value.results.length &&
data.value.params.pageNum > 1
) {
data.value.params.pageNum -= 1;
}
await getData();
data.value.isConfirmDialogVisible = false;
data.value.selected = [];
data.value.allSelected = false;
};
if (ids.length === 1) {
try {
await remove(ids[0]);
store.setSnackbarMsg?.({
color: "success",
text: "삭제되었습니다.",
result: 200,
});
} catch (err) {
store.setSnackbarMsg?.({
color: "warning",
text: "삭제 실패",
result: 500,
});
console.error(err);
} finally {
after();
}
} else {
Promise.all(ids.map(remove))
.then(() =>
store.setSnackbarMsg?.({
color: "success",
text: "모두 삭제되었습니다.",
result: 200,
}),
)
.catch((err) => {
store.setSnackbarMsg?.({
color: "warning",
text: "일부 삭제 실패",
result: 500,
});
console.error(err);
})
.finally(after);
}
}
/** ---------- 마운트 ---------- */
onMounted(async () => {
refreshRoles();
await getData();
});
</script>
<template>
<div class="w-100">
<v-container fluid class="h-100 pa-5 d-flex flex-column align-center">
<v-card
flat
class="bg-shades-transparent d-flex flex-column align-center justify-center w-100"
>
<!-- 헤더 -->
<v-card flat class="bg-shades-transparent w-100">
<v-card-item class="text-h5 font-weight-bold pt-0 pa-5 pl-0">
<div class="d-flex flex-row justify-start align-center">
<div class="text-primary">Users</div>
</div>
</v-card-item>
</v-card>
<!-- 검색/페이지 -->
<v-card flat class="bg-shades-transparent w-100">
<v-card flat class="bg-shades-transparent mb-4">
<div class="d-flex justify-center flex-wrap align-center">
<v-responsive
max-width="180"
min-width="180"
class="mr-3 mt-3 mb-3"
>
<v-select
v-model="data.params.searchType"
label="검색조건"
density="compact"
:items="searchOptions"
item-title="label"
item-value="value"
hide-details
/>
</v-responsive>
<v-responsive min-width="540" max-width="540">
<v-text-field
v-model="data.params.searchText"
label="검색어"
density="compact"
clearable
required
class="mt-3 mb-3"
hide-details
@keyup.enter="doSearch"
/>
</v-responsive>
<div class="ml-3">
<v-btn
size="large"
color="primary"
:rounded="5"
@click="doSearch"
>
<v-icon>mdi-magnify</v-icon>
</v-btn>
</div>
</div>
</v-card>
<!-- 상단 툴바 -->
<v-sheet
class="bg-shades-transparent d-flex flex-wrap align-center mb-2"
>
<v-sheet class="d-flex flex-wrap me-auto bg-shades-transparent">
<v-sheet
class="d-flex align-center mr-3 mb-2 bg-shades-transparent"
>
<v-chip color="primary"
> {{ data.totalDataLength.toLocaleString() }}</v-chip
>
</v-sheet>
<v-sheet class="bg-shades-transparent">
<v-responsive max-width="140" min-width="140" class="mb-2">
<v-select
v-model="data.params.pageSize"
density="compact"
:items="pageSizeOptions"
item-title="text"
item-value="value"
variant="outlined"
color="primary"
hide-details
@update:model-value="changePageSize"
/>
</v-responsive>
</v-sheet>
</v-sheet>
<v-sheet class="justify-end mb-2">
<v-btn color="info" @click="openCreateModal">Create User</v-btn>
</v-sheet>
</v-sheet>
<!-- 테이블 -->
<v-card class="rounded-lg pa-8">
<v-col cols="12">
<v-sheet>
<v-table
density="comfortable"
fixed-header
height="625"
overflow-x-auto
>
<colgroup>
<col style="width: 5%" />
<col
v-for="(item, i) in tableHeader"
:key="i"
:style="`width:${item.width}`"
/>
</colgroup>
<thead>
<tr>
<th>
<v-checkbox
v-model="data.allSelected"
style="min-width: 36px"
:indeterminate="data.allSelected === true"
hide-details
@change="getSelectedAllData"
/>
</th>
<th
v-for="(item, i) in tableHeader"
:key="i"
class="text-center font-weight-bold"
:style="`${item.style}`"
>
{{ item.label }}
</th>
</tr>
</thead>
<tbody class="text-body-2">
<tr
v-for="(item, i) in data.results"
:key="i"
class="text-center"
>
<td>
<v-checkbox
v-model="data.selected"
hide-details
:value="{ deviceKey: item.deviceKey }"
/>
</td>
<td>{{ item.no }}</td>
<td>{{ item.name }}</td>
<td>
<div class="truncate-2">{{ item.desc || "-" }}</div>
</td>
<td>
<template v-if="item.users?.length">
<v-chip
v-for="u in item.users"
:key="u"
size="small"
class="ma-1"
color="blue-lighten-2"
text-color="white"
>
{{ u }}
</v-chip>
</template>
<span v-else>-</span>
</td>
<td>
<template v-if="item.projects?.length">
<v-chip
v-for="p in item.projects"
:key="p"
size="small"
class="ma-1"
color="purple-lighten-2"
text-color="white"
>
{{ p }}
</v-chip>
</template>
<span v-else>-</span>
</td>
<td style="white-space: nowrap">
<IconModifyBtn @on-click="openModifyModal(item)" />
<IconDeleteBtn
@on-click="
deleteRows([{ deviceKey: item.deviceKey }])
"
/>
</td>
</tr>
</tbody>
</v-table>
</v-sheet>
<v-card-actions class="text-center mt-8 justify-center">
<v-pagination
v-model="data.params.pageNum"
:length="data.pageLength"
:total-visible="10"
color="primary"
rounded="circle"
@update:model-value="changePageNum"
/>
</v-card-actions>
</v-col>
</v-card>
</v-card>
</v-card>
</v-container>
<!-- 생성/수정 모달 -->
<v-dialog
v-model="data.isCreateVisible"
max-width="560"
:persistent="false"
:close-on-esc="true"
>
<v-card>
<v-card-title class="headline">
{{ data.modalMode === "create" ? "Create User" : "Modify User" }}
</v-card-title>
<v-card-text>
<v-form>
<v-text-field
label="Username"
v-model="userForm.username"
:disabled="data.modalMode === 'edit'"
required
/>
<v-text-field
label="Email"
type="email"
v-model="userForm.email"
autocomplete="off"
/>
<v-text-field
label="Password"
type="password"
v-model="userForm.password"
:required="data.modalMode === 'create'"
autocomplete="new-password"
/>
<v-select
label="Roles"
v-model="userForm.roles"
:items="roleOptions"
:multiple="false"
clearable
chips
/>
</v-form>
</v-card-text>
<v-card-actions>
<v-spacer />
<v-btn color="primary" @click="saveUser">
{{ data.modalMode === "create" ? "Create" : "Save" }}
</v-btn>
<v-btn text @click="closeCreateModal">Cancel</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</div>
</template>
<style scoped></style>

@ -1,89 +1,42 @@
<script setup lang="ts"> <script setup lang="ts">
import IconDeleteBtn from "@/components/atoms/button/IconDeleteBtn.vue";
import IconModifyBtn from "@/components/atoms/button/IconModifyBtn.vue";
import IconSettingBtn from "@/components/atoms/button/IconSettingBtn.vue";
// import FormComponent from "@/components/device/FormComponent.vue";
import { onMounted, ref, watch } from "vue"; import { onMounted, ref, watch } from "vue";
import dayjs from "dayjs";
import utc from "dayjs/plugin/utc";
import tz from "dayjs/plugin/timezone";
import { commonStore } from "@/stores/commonStore";
import { WorkflowService } from "@/components/service/management/workflowService";
import ViewComponent from "@/components/templates/workflow/ViewComponent.vue"; import ViewComponent from "@/components/templates/workflow/ViewComponent.vue";
import WorkflowsBaseDialog from "@/components/atoms/organisms/WorkflowsBaseDialog.vue"; import WorkflowsBaseDialog from "@/components/atoms/organisms/WorkflowsBaseDialog.vue";
import WorkflowsUploadDialog from "@/components/atoms/organisms/WorkflowsUploadDialog.vue"; import WorkflowsUploadDialog from "@/components/atoms/organisms/WorkflowsUploadDialog.vue";
import { AutoflowService } from "@/components/service/management/AutoflowService"; import WorkflowsRunDialog from "@/components/atoms/organisms/WorkflowsRunDialog.vue";
import { commonStore } from "@/stores/commonStore";
import IconInfoBtn from "@/components/atoms/button/IconInfoBtn.vue"; import IconInfoBtn from "@/components/atoms/button/IconInfoBtn.vue";
import dayjs from "dayjs"; import IconDeleteBtn from "@/components/atoms/button/IconDeleteBtn.vue";
import utc from "dayjs/plugin/utc"; import IconRunBtn from "@/components/atoms/button/IconRunBtn.vue";
import tz from "dayjs/plugin/timezone"; dayjs.extend(utc);
dayjs.extend(tz);
const KST = "Asia/Seoul";
const store = commonStore(); const store = commonStore();
const openView = ref(false); const openView = ref(false);
const tableHeader = [ type SearchType = "전체" | "제목" | "작성자";
{
label: "No",
width: "5%",
style: "word-break: keep-all;",
},
{
label: "Workflow Name",
width: "7%",
style: "word-break: keep-all;",
},
{ const isRunVisible = ref(false);
label: "Step Count", const selectedRun = ref<any | null>(null);
width: "7%",
style: "word-break: keep-all;",
},
{
label: "Config Progress",
width: "7%",
style: "word-break: keep-all;",
},
{
label: "Kubeflow Status",
width: "7%",
style: "word-break: keep-all;",
},
{
label: "Created DateTime",
width: "7%",
style: "word-break: keep-all;",
},
{
label: "Action",
width: "7%",
style: "word-break: keep-all;",
},
];
const tableHeader = [
{ label: "No", width: "5%", style: "word-break: keep-all;" },
{ label: "Workflow Name", width: "18%", style: "word-break: keep-all;" },
{ label: "Description", width: "28%", style: "word-break: keep-all;" },
{ label: "Version", width: "10%", style: "word-break: keep-all;" },
{ label: "Kubeflow Status", width: "12%", style: "word-break: keep-all;" },
{ label: "Created DateTime", width: "15%", style: "word-break: keep-all;" },
{ label: "Action", width: "12%", style: "word-break: keep-all;" },
];
const searchOptions = [ const searchOptions = [
{ { label: "전체", value: "전체" as SearchType },
searchType: "전체", { label: "제목", value: "제목" as SearchType },
searchText: "", { label: "사용자", value: "작성자" as SearchType },
},
{
searchType: "디바이스 별칭",
searchText: "deviceAlias",
},
{
searchType: "디바이스 키",
searchText: "deviceKey",
},
{
searchType: "사용자",
searchText: "userId",
},
{
searchType: "디바이스 이름",
searchText: "deviceName",
},
{
searchType: "디바이스 모델",
searchText: "deviceModel",
},
{
searchType: "디바이스 OS",
searchText: "deviceOs",
},
]; ];
const pageSizeOptions = [ const pageSizeOptions = [
@ -92,188 +45,166 @@ const pageSizeOptions = [
{ text: "100 페이지", value: 100 }, { text: "100 페이지", value: 100 },
]; ];
const SEARCH_TYPE_MAP: Record<SearchType | "", "ALL" | "TITLE" | "AUTHOR"> = {
"": "ALL",
전체: "ALL",
제목: "TITLE",
작성자: "AUTHOR",
};
const data = ref({ const data = ref({
params: { params: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
searchType: "", searchType: "전체" as SearchType,
searchText: "", searchText: "",
}, },
results: [], results: [] as any[],
totalDataLength: 0, totalElements: 0,
pageLength: 0, pageLength: 0,
modalMode: "", modalMode: "" as "create" | "edit" | "upload" | "",
selectedData: null, selectedData: null as any,
allSelected: false, allSelected: false,
selected: [], selected: [] as Array<{ deviceKey: number }>,
isCreateVisible: false, isCreateVisible: false,
isUploadVisible: false, isUploadVisible: false,
isModalVisible: false, isModalVisible: false,
isConfirmDialogVisible: false, isConfirmDialogVisible: false,
userOption: [], userOption: [] as any[],
}); });
dayjs.extend(utc);
dayjs.extend(tz);
const KST = "Asia/Seoul";
const formatDateTime = ( const formatDateTime = (
v?: string | number | Date, v?: string | number | Date,
fmt = "YYYY-MM-DD HH:mm:ss", fmt = "YYYY-MM-DD HH:mm:ss",
) => (v ? dayjs(v).tz(KST).format(fmt) : ""); ) => (v ? dayjs(v).tz(KST).format(fmt) : "");
const getCodeList = () => { const toRow = (w: any, no: number) => ({
// UserService.search(data.value.params).then((d) => { no,
// if (d.status === 200) { name: w.name,
// data.value.userOption = d.data.userList; description: w.description,
// } version: w.version,
// }); kubeflowStatus: w.kubeflowStatus,
}; registDt: w.regDt,
deviceKey: w.id,
const toRow = (workflow: any, index: number, offset: number) => ({ pipelineId: w.pipelineId ?? w.pipeline_id ?? "",
no: offset + index + 1,
name: workflow.workflowName,
description: workflow.workflowDescription,
version: workflow.version,
stepCount: workflow.stepCount,
configProgress: workflow.configProgress,
kubeflowStatus: workflow.kubeflowStatus,
registDt: workflow.regDt,
deviceKey: workflow.id,
}); });
const getData = () => { const fetchList = () => {
const params = data.value.params; const projectId = Number(localStorage.getItem("projectId"));
const pageNum = params.pageNum; if (!projectId) {
const pageSize = params.pageSize; console.warn("[Workflows] projectId 없음 — 프로젝트 먼저 선택");
const startIndex = (pageNum - 1) * pageSize; data.value.results = [];
data.value.totalElements = 0;
data.value.pageLength = 0;
return;
}
const { pageNum, searchText, searchType } = data.value.params;
AutoflowService.getAll() //
.then((res) => { const mapped = SEARCH_TYPE_MAP[searchType] || "ALL";
if (res.status !== 200) { const keyword = (searchText || "").trim();
console.error("워크플로우 조회 실패:", res); const needLocalFilter = mapped !== "ALL" && keyword.length > 0;
return; let reqPage = data.value.params.pageNum;
let reqSize = data.value.params.pageSize;
if (needLocalFilter) {
reqPage = 0;
reqSize = 1000;
} }
const payload = {
projectId,
page: reqPage,
size: reqSize,
keyword,
searchType: mapped,
};
WorkflowService.search(payload)
.then((res: any) => {
if (res.status !== 200) return;
const result = res.data; const result = res.data;
console.log(result); let list = result?.content ?? [];
const rawList = Array.isArray(result) ? result : (result.content ?? []);
const totalCount = Array.isArray(result)
? rawList.length
: (result.totalElements ?? rawList.length);
const currentPageList = Array.isArray(result)
? rawList.slice(startIndex, startIndex + pageSize)
: rawList;
data.value.results = currentPageList.map((w: any, i: number) =>
toRow(w, i, startIndex),
);
data.value.totalDataLength = totalCount;
setPaginationLength(); if (needLocalFilter) {
}) const kw = keyword.toLowerCase();
.catch((err) => {
console.error("워크플로우 조회 에러:", err);
});
};
const setPaginationLength = () => {
const total = data.value.totalDataLength || 0;
const pageSize = data.value.params.pageSize || 10;
data.value.pageLength =
total % pageSize === 0 ? total / pageSize : Math.ceil(total / pageSize);
};
const saveData = (formData: any) => { if (mapped === "TITLE") {
if (data.value.modalMode === "create") { list = list.filter((w: any) =>
AutoflowService.add(formData) String(w?.name ?? "")
.then((res) => { .toLowerCase()
if (res.status === 200 || res.status === 201) { .includes(kw),
data.value.isCreateVisible = false; );
store.setSnackbarMsg({ } else if (mapped === "AUTHOR") {
text: "등록 되었습니다.", list = list.filter((w: any) =>
result: 200, String(w?.regUserId ?? "")
color: "success", .toLowerCase()
}); .includes(kw),
changePageNum(1); // );
} else {
store.setSnackbarMsg({
text: "등록 실패",
result: 500,
color: "warning",
});
} }
})
.catch((err) => { const uiSize = data.value.params.pageSize;
console.error("등록 에러:", err); const totalElements = list.length;
store.setSnackbarMsg({ const totalPages = Math.max(1, Math.ceil(totalElements / uiSize));
text: "등록 중 오류가 발생했습니다.", const safePage = Math.min(Math.max(1, pageNum), totalPages);
result: 500, const start = (safePage - 1) * uiSize;
color: "error", const pageSlice = list.slice(start, start + uiSize);
});
}) // ()
.finally(() => { const firstNo = totalElements - start;
getData();
}); data.value.results = pageSlice.map((w: any, i: number) =>
} else { toRow(w, firstNo - i),
// );
const id = data.value.totalElements = totalElements;
Number(formData?.id) ?? data.value.pageLength = totalPages;
Number(formData?.deviceKey) ??
Number(data.value.selectedData?.deviceKey) ??
Number(data.value.selectedData?.id);
if (!id) {
store.setSnackbarMsg({
text: "수정할 ID가 없습니다.",
result: 500,
color: "error",
});
return; return;
} }
AutoflowService.update(id, formData) const totalElements = result.totalElements;
.then((res) => { const totalPages = result.totalPages;
if (res.status === 200) { const serverPage = result.pageable.pageNumber;
data.value.isCreateVisible = false; const serverSize = result.pageable.pageSize;
store.setSnackbarMsg({ const offset =
text: "수정 되었습니다.", typeof result.pageable.offset === "number"
result: 200, ? result.pageable.offset
color: "success", : serverPage * serverSize;
}); const firstNo = totalElements - offset;
changePageNum(data.value.params.pageNum); //
} else { data.value.results = list.map((w: any, i: number) =>
store.setSnackbarMsg({ toRow(w, firstNo - i),
text: "수정 실패", );
result: 500, data.value.totalElements = totalElements;
color: "warning", data.value.pageLength = totalPages;
});
}
})
.catch((err) => {
console.error("수정 에러:", err);
store.setSnackbarMsg({
text: "수정 중 오류가 발생했습니다.",
result: 500,
color: "error",
});
}) })
.finally(() => { .catch((err: any) => console.error("워크플로우 조회 에러:", err));
getData(); // };
});
} const doSearch = () => {
data.value.params.pageNum = 1;
fetchList();
};
const changePageNum = (page: number) => {
data.value.params.pageNum = page;
fetchList();
}; };
const removeData = (value) => { const changePageSize = (size: number) => {
data.value.params.pageSize = size;
data.value.params.pageNum = 1;
fetchList();
};
const removeData = (value?: Array<{ deviceKey: number }>) => {
const removeList = value ?? data.value.selected; const removeList = value ?? data.value.selected;
if (!removeList || removeList.length === 0) return; if (!removeList || removeList.length === 0) return;
const ids = removeList.map((x) => x.deviceKey); const ids = removeList.map((x) => x.deviceKey);
const remove = (id: number) =>
const remove = (id) => WorkflowService.delete(id).then((res) => {
AutoflowService.delete(id).then((res) => { if (res.status < 200 || res.status >= 300) return Promise.reject(res);
if (res.status < 200 || res.status >= 300) {
return Promise.reject(res);
}
}); });
const after = () => { const after = () => {
@ -283,12 +214,12 @@ const removeData = (value) => {
) { ) {
data.value.params.pageNum -= 1; data.value.params.pageNum -= 1;
} }
getData(); fetchList();
data.value.isConfirmDialogVisible = false; data.value.isConfirmDialogVisible = false;
data.value.selected = []; data.value.selected = [];
data.value.allSelected = false; data.value.allSelected = false;
}; };
console.log(ids.length);
if (ids.length === 1) { if (ids.length === 1) {
remove(ids[0]) remove(ids[0])
@ -330,39 +261,39 @@ const removeData = (value) => {
}; };
const handleRemoveData = () => { const handleRemoveData = () => {
if (data.value.selected.length === 0) { if (data.value.selected.length === 0) return;
// store.setSnackbarMsg({
// text: " . ",
// result: 500,
// });
return;
}
if (data.value.allSelected || data.value.selected.length !== 1) { if (data.value.allSelected || data.value.selected.length !== 1) {
data.value.isConfirmDialogVisible = true; data.value.isConfirmDialogVisible = true;
return; return;
} }
// removeData();
removeData(undefined);
}; };
const closeDetail = () => {
openView.value = false; const getSelectedAllData = () => {
}; data.value.selected = data.value.allSelected
const changePageNum = (page) => { ? data.value.results.map((item) => ({ deviceKey: item.deviceKey }))
data.value.params.pageNum = page; : [];
getData();
}; };
const openDetailModal = (selectedItem) => {
const openDetailModal = (selectedItem: any) => {
data.value.selectedData = selectedItem; data.value.selectedData = selectedItem;
openView.value = true; openView.value = true;
}; };
const closeDetail = () => (openView.value = false);
const closeRunModal = () => (isRunVisible.value = false);
const openRunModal = (item: any) => {
selectedRun.value = item;
isRunVisible.value = true;
};
const openModifyModal = (item: any) => { const openModifyModal = (item: any) => {
console.log("[openModifyModal] row =", item);
data.value.selectedData = { data.value.selectedData = {
id: item.deviceKey, id: item.deviceKey,
workflowName: item.name, workflowName: item.name,
workflowDescription: item.description, workflowDescription: item.description,
}; };
data.value.modalMode = "edit"; data.value.modalMode = "edit";
data.value.isCreateVisible = true; data.value.isCreateVisible = true;
}; };
@ -378,40 +309,33 @@ const openUploadModal = () => {
data.value.modalMode = "upload"; data.value.modalMode = "upload";
data.value.isUploadVisible = true; data.value.isUploadVisible = true;
}; };
const closeCreateModal = () => { const closeCreateModal = () => {
data.value.isModalVisible = false; data.value.isModalVisible = false;
data.value.isCreateVisible = false; data.value.isCreateVisible = false;
}; };
const closeUploadModal = () => { const closeUploadModal = () => {
data.value.isModalVisible = false; data.value.isModalVisible = false;
data.value.isUploadVisible = false; data.value.isUploadVisible = false;
}; };
const getSelectedAllData = () => {
data.value.selected = data.value.allSelected
? data.value.results.map((item) => {
return {
deviceKey: item.deviceKey,
};
})
: [];
};
watch( watch(
() => data.value.isCreateVisible, () => data.value.isCreateVisible,
(now, prev) => { (now, prev) => {
if (prev && !now) getData(); if (prev && !now) fetchList();
}, },
); );
watch( watch(
() => data.value.isUploadVisible, () => data.value.isUploadVisible,
(now, prev) => { (now, prev) => {
if (prev && !now) getData(); if (prev && !now) fetchList();
}, },
); );
onMounted(() => { onMounted(() => {
getData(); fetchList();
getCodeList();
}); });
</script> </script>
@ -442,10 +366,11 @@ onMounted(() => {
label="검색조건" label="검색조건"
density="compact" density="compact"
:items="searchOptions" :items="searchOptions"
item-title="searchType" item-title="label"
item-value="searchText" item-value="value"
hide-details hide-details
></v-select> @update:model-value="doSearch"
/>
</v-responsive> </v-responsive>
<v-responsive min-width="540" max-width="540"> <v-responsive min-width="540" max-width="540">
<v-text-field <v-text-field
@ -456,7 +381,7 @@ onMounted(() => {
required required
class="mt-3 mb-3" class="mt-3 mb-3"
hide-details hide-details
@keyup.enter="changePageNum(1)" @keyup.enter="doSearch"
></v-text-field> ></v-text-field>
</v-responsive> </v-responsive>
@ -465,7 +390,7 @@ onMounted(() => {
size="large" size="large"
color="primary" color="primary"
:rounded="5" :rounded="5"
@click="changePageNum(1)" @click="doSearch"
> >
<v-icon> mdi-magnify</v-icon> <v-icon> mdi-magnify</v-icon>
</v-btn> </v-btn>
@ -481,8 +406,8 @@ onMounted(() => {
class="d-flex align-center mr-3 mb-2 bg-shades-transparent" class="d-flex align-center mr-3 mb-2 bg-shades-transparent"
> >
<v-chip color="primary" <v-chip color="primary"
> {{ data.totalDataLength.toLocaleString() }} > {{ data.totalElements.toLocaleString() }}</v-chip
</v-chip> >
</v-sheet> </v-sheet>
<v-sheet class="bg-shades-transparent"> <v-sheet class="bg-shades-transparent">
<v-responsive max-width="140" min-width="140" class="mb-2"> <v-responsive max-width="140" min-width="140" class="mb-2">
@ -495,7 +420,7 @@ onMounted(() => {
variant="outlined" variant="outlined"
color="primary" color="primary"
hide-details hide-details
@update:model-value="changePageNum(1)" @update:model-value="changePageSize"
></v-select> ></v-select>
</v-responsive> </v-responsive>
</v-sheet> </v-sheet>
@ -567,14 +492,14 @@ onMounted(() => {
</td> </td>
<td>{{ item.no }}</td> <td>{{ item.no }}</td>
<td>{{ item.name }}</td> <td>{{ item.name }}</td>
<td>{{ item.stepCount }}</td> <td>{{ item.description }}</td>
<td>{{ item.configProgress }}</td> <td>{{ item.version }}</td>
<td>{{ item.kubeflowStatus }}</td> <td>{{ item.kubeflowStatus }}</td>
<td>{{ formatDateTime(item.registDt) }}</td> <td>{{ formatDateTime(item.registDt) }}</td>
<td style="white-space: nowrap"> <td style="white-space: nowrap">
<IconRunBtn @on-click="openRunModal(item)" />
<IconInfoBtn @on-click="openDetailModal(item)" /> <IconInfoBtn @on-click="openDetailModal(item)" />
<!-- <IconSettingBtn /> --> <!-- <IconModifyBtn @on-click="openModifyModal(item)" /> -->
<IconModifyBtn @on-click="openModifyModal(item)" />
<IconDeleteBtn <IconDeleteBtn
@on-click=" @on-click="
removeData([{ deviceKey: item.deviceKey }]) removeData([{ deviceKey: item.deviceKey }])
@ -606,8 +531,6 @@ onMounted(() => {
:edit-data="data.selectedData" :edit-data="data.selectedData"
:mode="data.modalMode" :mode="data.modalMode"
@close-modal="closeCreateModal" @close-modal="closeCreateModal"
@handle-data="saveData"
:user-option="data.userOption"
/> />
</v-dialog> </v-dialog>
<v-dialog v-model="data.isUploadVisible" max-width="800" persistent> <v-dialog v-model="data.isUploadVisible" max-width="800" persistent>
@ -615,8 +538,14 @@ onMounted(() => {
:edit-data="data.selectedData" :edit-data="data.selectedData"
:mode="data.modalMode" :mode="data.modalMode"
@close-modal="closeUploadModal" @close-modal="closeUploadModal"
@handle-data="saveData" />
:user-option="data.userOption" </v-dialog>
<v-dialog v-model="isRunVisible" max-width="600" persistent>
<WorkflowsRunDialog
:pipeline-id="selectedRun?.pipelineId"
:display-name="`Run of ${selectedRun?.name ?? 'Pipeline'} (${new Date().toLocaleString()})`"
:description="selectedRun?.description || ''"
@close-modal="closeRunModal"
/> />
</v-dialog> </v-dialog>
</div> </div>

@ -2,7 +2,7 @@
import { onMounted, ref, watch, onBeforeUnmount } from "vue"; import { onMounted, ref, watch, onBeforeUnmount } from "vue";
import * as monaco from "monaco-editor"; import * as monaco from "monaco-editor";
import "monaco-editor/min/vs/editor/editor.main.css"; import "monaco-editor/min/vs/editor/editor.main.css";
import { AutoflowService } from "@/components/service/management/AutoflowService"; import { WorkflowService } from "@/components/service/management/workflowService";
type TabKey = "details" | "yaml"; type TabKey = "details" | "yaml";
@ -10,32 +10,22 @@ const props = defineProps<{ id: number | string }>();
const emit = defineEmits<{ (e: "close"): void }>(); const emit = defineEmits<{ (e: "close"): void }>();
const activeTab = ref<TabKey>("details"); const activeTab = ref<TabKey>("details");
// ----- Monaco Editor -----
const editorRef = ref<HTMLDivElement | null>(null); const editorRef = ref<HTMLDivElement | null>(null);
let editorInstance: monaco.editor.IStandaloneCodeEditor | null = null; let editorInstance: monaco.editor.IStandaloneCodeEditor | null = null;
// ( )
const detail = ref({ const detail = ref({
workflowName: "", name: "",
version: "", version: "",
workflowDescription: "", description: "",
createdDate: "", kubeflowStatus: "",
createdId: "", namespace: "",
pipelineId: "",
regDt: "",
}); });
const stepHeaders = [
{ title: "Order", key: "order", width: "10%", align: "center" },
{ title: "Step Name", key: "name", width: "40%", align: "center" },
{
title: "Component Type",
key: "componentType",
width: "30%",
align: "center",
},
{ title: "Status", key: "status", width: "20%", align: "center" },
];
const steps = ref<
Array<{ order: number; name: string; componentType: string; status: string }>
>([]);
const defaultYaml = `# YAML not provided by server const defaultYaml = `# YAML not provided by server
apiVersion: argoproj.io/v1alpha1 apiVersion: argoproj.io/v1alpha1
kind: Workflow kind: Workflow
@ -51,30 +41,32 @@ spec:
args: ["echo hello"] args: ["echo hello"]
`; `;
/** ===== 상세 조회 ===== */ // (ISO/T )
function formatDateTime(raw?: string): string {
if (!raw) return "-";
const s = String(raw).replace("T", " ");
const m = s.match(/^(\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2})/);
return m ? m[1] : s.slice(0, 19);
}
// ===== =====
async function fetchDetail(id: number | string) { async function fetchDetail(id: number | string) {
try { try {
const res = await AutoflowService.view(Number(id)); const res = await WorkflowService.view(Number(id));
const d = res.data; const d = res?.data ?? {};
detail.value.workflowName = d.workflowName || ""; // (/)
detail.value.version = String(d.version || 1); detail.value = {
detail.value.workflowDescription = d.workflowDescription || ""; name: d.name ?? d.workflowName ?? "",
detail.value.createdDate = d.regDt || d.regDate || "-"; version: String(d.version ?? ""),
detail.value.createdId = d.regUserId || "-"; description: d.description ?? d.workflowDescription ?? "",
kubeflowStatus: d.kubeflow_status ?? d.kubeflowStatus ?? "",
if (Array.isArray(d.steps)) { namespace: d.namespace ?? "",
steps.value = d.steps.map((s: any, idx: number) => ({ pipelineId: d.pipeline_id ?? d.pipelineId ?? "",
order: idx + 1, regDt: formatDateTime(d.reg_dt ?? d.regDt ?? d.regDate),
name: s.stepName || s.name || `Step ${idx + 1}`, };
componentType: s.componentType || s.type || "-",
status: s.status || "Not Configured",
}));
} else {
steps.value = [];
}
// YAML ( ) // YAML ( , )
const yamlFromServer = const yamlFromServer =
d.workflowYaml || d.workflowYaml ||
d.yaml || d.yaml ||
@ -86,11 +78,11 @@ async function fetchDetail(id: number | string) {
editorInstance.setValue(yamlFromServer || defaultYaml); editorInstance.setValue(yamlFromServer || defaultYaml);
} }
} catch (e) { } catch (e) {
console.error("[Child] view API failed:", e); console.error("[Workflow Detail] view API failed:", e);
} }
} }
/** ===== 마운트 & 변경 감지 ===== */ // ===== & =====
onMounted(() => { onMounted(() => {
if (editorRef.value) { if (editorRef.value) {
editorInstance = monaco.editor.create(editorRef.value, { editorInstance = monaco.editor.create(editorRef.value, {
@ -105,7 +97,6 @@ onMounted(() => {
} }
}); });
// props.id
watch( watch(
() => props.id, () => props.id,
(val) => { (val) => {
@ -122,6 +113,22 @@ onBeforeUnmount(() => {
editorInstance = null; editorInstance = null;
} }
}); });
// ===== ( ) Step =====
const stepHeaders = [
{ title: "Order", key: "order", width: "10%", align: "center" },
{ title: "Step Name", key: "name", width: "40%", align: "center" },
{
title: "Component Type",
key: "componentType",
width: "30%",
align: "center",
},
{ title: "Status", key: "status", width: "20%", align: "center" },
];
const steps = ref<
Array<{ order: number; name: string; componentType: string; status: string }>
>([]);
</script> </script>
<template> <template>
@ -156,37 +163,67 @@ onBeforeUnmount(() => {
<v-card-title class="grey lighten-4 py-2 px-4"> <v-card-title class="grey lighten-4 py-2 px-4">
<span class="font-weight-bold">Workflow Information</span> <span class="font-weight-bold">Workflow Information</span>
</v-card-title> </v-card-title>
<v-card-text class="px-6 pb-6 pt-4"> <v-card-text class="px-6 pb-6 pt-4">
<v-row align="center" class="py-2"> <v-row align="center" class="py-2">
<v-col cols="3" class="text-h6 font-weight-bold" <v-col cols="3" class="text-h6 font-weight-bold"
>Workflow Name</v-col >Workflow Name</v-col
> >
<v-col cols="3">{{ detail.workflowName }}</v-col> <v-col cols="3">{{ detail.name || "-" }}</v-col>
<v-col cols="3" class="text-h6 font-weight-bold">Version</v-col> <v-col cols="3" class="text-h6 font-weight-bold">Version</v-col>
<v-col cols="3">{{ detail.version }}</v-col> <v-col cols="3">{{ detail.version || "-" }}</v-col>
</v-row> </v-row>
<v-divider class="my-2" /> <v-divider class="my-2" />
<v-row align="center" class="py-2"> <v-row align="center" class="py-2">
<v-col cols="3" class="text-h6 font-weight-bold" <v-col cols="3" class="text-h6 font-weight-bold"
>Workflow Description</v-col >Workflow Description</v-col
> >
<v-col cols="9">{{ detail.workflowDescription }}</v-col> <v-col cols="9">{{ detail.description || "-" }}</v-col>
</v-row> </v-row>
<v-divider class="my-2" /> <v-divider class="my-2" />
<v-row align="center" class="py-2"> <v-row align="center" class="py-2">
<v-col cols="3" class="text-h6 font-weight-bold" <v-col cols="3" class="text-h6 font-weight-bold"
>Created Date</v-col >Kubeflow Status</v-col
> >
<v-col cols="3">{{ detail.createdDate }}</v-col> <v-col cols="3">{{ detail.kubeflowStatus || "-" }}</v-col>
<v-col cols="3" class="text-h6 font-weight-bold">Namespace</v-col>
<v-col cols="3">{{ detail.namespace || "-" }}</v-col>
</v-row>
<v-divider class="my-2" />
<v-row align="center" class="py-2">
<v-col cols="3" class="text-h6 font-weight-bold" <v-col cols="3" class="text-h6 font-weight-bold"
>Created ID</v-col >Pipeline ID</v-col
> >
<v-col cols="3">{{ detail.createdId }}</v-col> <v-col cols="9" class="text-truncate">{{
detail.pipelineId || "-"
}}</v-col>
</v-row>
<v-divider class="my-2" />
<v-row align="center" class="py-2">
<v-col cols="3" class="text-h6 font-weight-bold"
>Created Date</v-col
>
<v-col cols="9">{{ detail.regDt || "-" }}</v-col>
</v-row> </v-row>
</v-card-text> </v-card-text>
<v-sheet class="d-flex justify-end mt-4">
<v-btn class="back-to-list" color="primary" @click="emit('close')">
Back to List
</v-btn>
</v-sheet>
</v-card> </v-card>
<!-- Steps --> <!--
==================== [나중에 사용할 Step Overview 섹션] ====================
<v-card <v-card
flat flat
class="bordered-box mb-6 w-100 rounded-lg pa-8" class="bordered-box mb-6 w-100 rounded-lg pa-8"
@ -209,11 +246,7 @@ onBeforeUnmount(() => {
<template #item.order="{ index }">{{ index + 1 }}</template> <template #item.order="{ index }">{{ index + 1 }}</template>
<template #item.status="{ item }"> <template #item.status="{ item }">
<v-chip <v-chip
:color=" :color="({ Configured: 'success', 'Not Configured': 'warning' } as any)[item.status] || 'default'"
{ Configured: 'success', 'Not Configured': 'warning' }[
item.status
] || 'default'
"
small small
dark dark
> >
@ -221,13 +254,9 @@ onBeforeUnmount(() => {
</v-chip> </v-chip>
</template> </template>
</v-data-table> </v-data-table>
<v-sheet class="d-flex justify-end mt-4">
<v-btn class="back-to-list" color="primary" @click="emit('close')"
>Back to List</v-btn
>
</v-sheet>
</v-card> </v-card>
========================================================================
-->
</template> </template>
<!-- YAML --> <!-- YAML -->
@ -253,10 +282,14 @@ onBeforeUnmount(() => {
min-height: 500px; min-height: 500px;
padding-bottom: 84px; padding-bottom: 84px;
} }
.back-to-list { .back-to-list {
position: absolute; position: absolute;
right: 24px; right: 24px;
bottom: 24px; bottom: 24px;
} }
.text-truncate {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
</style> </style>

@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import ListComponent from "@/components/home/ListComponent.vue"; import ListComponent from "@/components/templates/home/ListComponent.vue";
</script> </script>
<template> <template>

@ -1,5 +1,5 @@
<script setup> <script setup>
import ListComponent from "@/components/templates/Project/ListComponent.vue"; import ListComponent from "@/components/templates/projects/ListComponent.vue";
</script> </script>
<template> <template>

@ -8,12 +8,12 @@ import logo2 from "@/assets/workflow.png";
import { UserManagerService } from "@/components/service/management/userManagerService"; import { UserManagerService } from "@/components/service/management/userManagerService";
const router = useRouter(); const router = useRouter();
const ROLE_ITEMS = ["ROLE_USER", "ROLE_MODERATOR", "ROLE_ADMIN"];
const data = ref({ const data = ref({
form: false, form: false,
username: "", username: "",
email: "", email: "",
role: [], role: ROLE_ITEMS[0],
password: "", password: "",
loading: false, loading: false,
snackbar: false, snackbar: false,
@ -35,7 +35,7 @@ const resetLogin = () => {
const resetSignup = () => { const resetSignup = () => {
data.value.username = ""; data.value.username = "";
data.value.email = ""; data.value.email = "";
data.value.role = []; data.value.role = "";
data.value.password = ""; data.value.password = "";
data.value.loading = false; data.value.loading = false;
}; };
@ -44,7 +44,7 @@ const signUp = () => {
const payload = { const payload = {
username: data.value.username, username: data.value.username,
email: data.value.email, email: data.value.email,
role: data.value.role, role: data.value.role ? [data.value.role] : [],
password: data.value.password, password: data.value.password,
}; };
console.log("회원가입 호출 payload:", payload); console.log("회원가입 호출 payload:", payload);
@ -112,8 +112,8 @@ const signUp = () => {
></v-text-field> ></v-text-field>
<v-select <v-select
v-model="data.role" v-model="data.role"
:items="['ROLE_USER', 'ROLE_MODERATOR', 'ROLE_ADMIN']" :items="ROLE_ITEMS"
multiple :rules="[(v) => !!v || '역할을 선택해주세요.']"
variant="outlined" variant="outlined"
placeholder="Role" placeholder="Role"
class="mb-2" class="mb-2"

@ -0,0 +1,9 @@
<script setup>
import ListComponent from "@/components/templates/users/ListComponent.vue";
</script>
<template>
<ListComponent />
</template>
<style scoped lang="sass"></style>

@ -5,141 +5,114 @@ const rootPath = import.meta.env.VITE_ROOT_PATH;
const routes = [ const routes = [
{ {
path: `/`, path: "/",
component: () => import("@/layouts/default.vue"), component: () => import("@/layouts/default.vue"),
redirect: { name: "login" }, redirect: { name: "login" },
children: [ children: [
/** ■ 공용(일반 사용자) 라우트 */
{ {
name: "main", name: "main",
path: `/main`, path: "/main",
meta: { meta: { title: "", requiresAuth: false },
title: "",
requiresAuth: false,
},
component: () => import("@/pages/MainView.vue"), component: () => import("@/pages/MainView.vue"),
}, },
{ {
name: "select", name: "select",
path: `/select`, path: "/select",
meta: { meta: { title: "select", requiresAuth: false, hideSidebar: true },
title: "select",
requiresAuth: false,
hideSidebar: true,
},
component: () => import("@/views/Select.vue"), component: () => import("@/views/Select.vue"),
}, },
{
name: "project",
path: `/project`,
meta: {
title: "Project",
requiresAuth: false,
},
component: () => import("@/pages/ProjectView.vue"),
},
{ {
name: "home", name: "home",
path: `/home`, path: "/home",
meta: { meta: { title: "Home", requiresAuth: false },
title: "Home",
requiresAuth: false,
},
component: () => import("@/pages/HomeView.vue"), component: () => import("@/pages/HomeView.vue"),
}, },
{ {
name: "workflows", name: "workflows",
path: `/workflows`, path: "/workflows",
meta: { meta: { title: "Workflows", requiresAuth: false },
title: "Workflows",
requiresAuth: false,
},
component: () => import("@/pages/WorkflowView.vue"), component: () => import("@/pages/WorkflowView.vue"),
}, },
{ {
name: "workflow-step-config", name: "workflow-step-config",
path: `/workflow-step-config`, path: "/workflow-step-config",
meta: { meta: { title: "Workflow Step Config", requiresAuth: false },
title: "Workflow Step Config",
requiresAuth: false,
},
component: () => import("@/pages/WorkflowStepConfigView.vue"), component: () => import("@/pages/WorkflowStepConfigView.vue"),
}, },
{ {
name: "run", name: "run",
path: `/run/experiment`, path: "/run/experiment",
meta: { meta: { title: "Run", requiresAuth: false },
title: "Run",
requiresAuth: false,
},
redirect: { name: "experiment" }, redirect: { name: "experiment" },
children: [ children: [
{ {
name: "experiment", name: "experiment",
path: `/run/experiment`, path: "/run/experiment",
meta: { meta: { title: "Experiment", requiresAuth: false },
title: "Experiment",
requiresAuth: false,
},
component: () => import("@/pages/ExperimentView.vue"), component: () => import("@/pages/ExperimentView.vue"),
}, },
{ {
name: "Executions", name: "Executions",
path: `/run/executions`, path: "/run/executions",
meta: { meta: { title: "Executions", requiresAuth: false },
title: "Executions",
requiresAuth: false,
},
component: () => import("@/pages/ExecutionsView.vue"), component: () => import("@/pages/ExecutionsView.vue"),
}, },
], ],
}, },
{ {
name: "deployment", name: "deployment",
path: `/deployment`, path: "/deployment",
meta: { meta: { title: "Deployment", requiresAuth: false },
title: "Deployment",
requiresAuth: false,
},
component: () => import("@/pages/DeploymentView.vue"), component: () => import("@/pages/DeploymentView.vue"),
}, },
{ {
name: "training-script", name: "training-script",
path: `/training-script`, path: "/training-script",
meta: { meta: { title: "Training Script", requiresAuth: true },
title: "Training Script",
requiresAuth: true,
},
component: () => import("@/pages/TrainingScriptView.vue"), component: () => import("@/pages/TrainingScriptView.vue"),
}, },
{ {
name: "datasets", name: "datasets",
path: `/datasets`, path: "/datasets",
meta: { meta: { title: "Datasets", requiresAuth: true },
title: "Datasets",
requiresAuth: true,
},
component: () => import("@/pages/DatasetView.vue"), component: () => import("@/pages/DatasetView.vue"),
}, },
],
},
{ {
name: "login", name: "project",
path: `/login`, path: "/project",
meta: { meta: {
title: "로그인", title: "Projects",
requiresAuth: false, requiresAuth: false,
requiresAdmin: true,
}, },
component: () => import("@/pages/LoginView.vue"), component: () => import("@/pages/ProjectView.vue"),
}, },
{ {
name: "signup", name: "users",
path: `/signup`, path: "/users",
meta: { meta: {
title: "회원가입", title: "Users",
requiresAuth: false, requiresAuth: false,
requiresAdmin: true,
},
component: () => import("@/pages/UsersView.vue"),
}, },
],
},
/** ■ 인증(로그인/회원가입) */
{
name: "login",
path: "/login",
meta: { title: "로그인", requiresAuth: false },
component: () => import("@/pages/LoginView.vue"),
},
{
name: "signup",
path: "/signup",
meta: { title: "회원가입", requiresAuth: false },
component: () => import("@/pages/SignupView.vue"), component: () => import("@/pages/SignupView.vue"),
}, },
]; ];
@ -172,6 +145,29 @@ router.beforeEach((to) => {
return { name: "select", replace: true, query: { redirect: to.fullPath } }; return { name: "select", replace: true, query: { redirect: to.fullPath } };
} }
if (to.matched.some((r) => r.meta?.requiresAdmin)) {
try {
const raw =
typeof storage?.getAuth === "function"
? storage.getAuth()
: JSON.parse(localStorage.getItem("autoflow-auth") || "null");
const roles = raw?.userInfo?.roles ?? raw?.roles ?? [];
const authCd = raw?.userInfo?.authCd ?? raw?.authCd ?? raw?.auth;
const isAdmin =
(Array.isArray(roles)
? roles.includes("ROLE_ADMIN")
: roles === "ROLE_ADMIN") || authCd === "ADMIN";
if (!isAdmin) {
return { name: "home", replace: true };
}
} catch {
return { name: "home", replace: true };
}
}
return true; return true;
}); });

@ -6,24 +6,18 @@ export const menuUtils = {
value: "home", value: "home",
icon: "mdi-monitor-multiple", icon: "mdi-monitor-multiple",
}, },
{
title: "Project",
path: "/project",
value: "project",
icon: "mdi-folder-cog-outline",
},
{ {
title: "Workflows", title: "Workflows",
path: "/workflows", path: "/workflows",
value: "workflows", value: "workflows",
icon: "mdi-code-braces", icon: "mdi-code-braces",
}, },
{ // {
title: "Workflow Step Config", // title: "Workflow Step Config",
path: "/workflow-step-config", // path: "/workflow-step-config",
value: "workflow-step-config", // value: "workflow-step-config",
icon: "mdi-hammer-wrench", // icon: "mdi-hammer-wrench",
}, // },
{ {
title: "Run", title: "Run",
path: "/run", path: "/run",

@ -5,7 +5,6 @@ import { useAutoflowStore } from "@/stores/autoflowStore";
import type { import type {
UiProject, UiProject,
ApiProject,
Permission, Permission,
} from "@/components/models/project/Project"; } from "@/components/models/project/Project";
import { ProjectService } from "@/components/service/project/projectService"; import { ProjectService } from "@/components/service/project/projectService";
@ -31,6 +30,11 @@ const menuX = ref(0);
const menuY = ref(0); const menuY = ref(0);
const selectedIndex = ref<number | null>(null); const selectedIndex = ref<number | null>(null);
// id (reg) ( , / X)
const projectRegById = ref<Record<number, { regId?: string; regNm?: string }>>(
{},
);
const projects = ref<UiProject[]>([]); const projects = ref<UiProject[]>([]);
type UserOption = { id: number | string; username: string }; type UserOption = { id: number | string; username: string };
const userOptions = ref<UserOption[]>([]); const userOptions = ref<UserOption[]>([]);
@ -43,7 +47,8 @@ const form = ref({
prjDesc: "", prjDesc: "",
selectedUsers: [] as string[], selectedUsers: [] as string[],
}); });
/** ===== 서버 응답 타입 ===== */
/** ===== 롤 ===== */
const roles = ref<string[]>([]); const roles = ref<string[]>([]);
const refreshRoles = () => { const refreshRoles = () => {
const auth = storage.getAuth?.() ?? storage.get?.("vpp-Auth") ?? null; const auth = storage.getAuth?.() ?? storage.get?.("vpp-Auth") ?? null;
@ -52,27 +57,93 @@ const refreshRoles = () => {
}; };
const isAdmin = computed(() => roles.value.includes("ROLE_ADMIN")); const isAdmin = computed(() => roles.value.includes("ROLE_ADMIN"));
/** ===== 페이지네이션 상태 ===== */
const pager = ref({ pageNum: 1, pageSize: 8, total: 0, pageLength: 1 });
const pagedProjects = computed(() => {
const total = projects.value.length;
pager.value.total = total;
pager.value.pageLength = Math.max(1, Math.ceil(total / pager.value.pageSize));
if (pager.value.pageNum > pager.value.pageLength)
pager.value.pageNum = pager.value.pageLength;
if (pager.value.pageNum < 1) pager.value.pageNum = 1;
const start = (pager.value.pageNum - 1) * pager.value.pageSize;
return projects.value.slice(start, start + pager.value.pageSize);
});
const changePageNum = (page: number) => {
pager.value.pageNum = page;
};
const changePageSize = (size: number) => {
pager.value.pageSize = size;
pager.value.pageNum = 1;
};
/** ===== 서버 응답 타입 ===== */ /** ===== 서버 응답 타입 ===== */
interface ProjectSearchResponseItem { interface ProjectSearchResponseItem {
id: number; id: number;
prjNm: string; prjNm: string;
prjDesc: string; prjDesc: string;
prjStartDt?: string; prjStartDt?: string;
regUserId?: string; // "" ( username) regUserId?: string;
regUserNm?: string;
modUserId?: string;
modUserNm?: string;
} }
interface UserResponseItem { interface UserResponseItem {
id: number | string; id: number | string;
username: string; username: string;
} }
/** ===== 페이로드 타입(서비스 시그니처를 못 바꾼다는 가정에서 지역 타입 분리) ===== */
// mod*
type NewProjectPayload = {
id: null;
prjCd: string;
prjNm: string;
prjDesc: string;
prjStartDt: string;
prjEndDt: string;
delYn: string;
regDate: string;
regUserId?: string;
regUserNm?: string;
};
// reg* , mod*
type UpdateProjectPayload = {
id: number;
prjCd: string;
prjNm: string;
prjDesc: string;
prjStartDt: string;
prjEndDt: string;
delYn: string;
regDate: string;
regUserId?: string;
regUserNm?: string;
modDate: string;
modUserId?: string;
modUserNm?: string;
};
/** ===== 유틸 ===== */ /** ===== 유틸 ===== */
const buildApiProjectPayload = (): ApiProject => { function buildCreatePayload(): NewProjectPayload {
const today = new Date().toISOString().slice(0, 10); const today = new Date().toISOString().slice(0, 10);
const nowIso = new Date().toISOString(); const nowIso = new Date().toISOString();
const namesCsv = form.value.selectedUsers.join(",");
const names = form.value.selectedUsers;
const namesCsv = names.join(",");
const idsCsv = names
.map((name) => userOptions.value.find((u) => u.username === name)?.id)
.filter(
(v): v is number | string => v !== undefined && v !== null && v !== "",
)
.map(String)
.join(","); // "6,5"
// mod* ()
return { return {
id: modalMode.value === "edit" ? editingProjectId.value! : null, id: null,
prjCd: form.value.prjCd, prjCd: form.value.prjCd,
prjNm: form.value.prjNm, prjNm: form.value.prjNm,
prjDesc: form.value.prjDesc, prjDesc: form.value.prjDesc,
@ -80,13 +151,50 @@ const buildApiProjectPayload = (): ApiProject => {
prjEndDt: today, prjEndDt: today,
delYn: "N", delYn: "N",
regDate: nowIso, regDate: nowIso,
regUserId: namesCsv, regUserId: idsCsv,
regUserNm: namesCsv, regUserNm: namesCsv,
};
}
function buildUpdatePayload(): UpdateProjectPayload {
const today = new Date().toISOString().slice(0, 10);
const nowIso = new Date().toISOString();
const names = form.value.selectedUsers;
const namesCsv = names.join(",");
const idsCsv = names
.map((name) => userOptions.value.find((u) => u.username === name)?.id)
.filter(
(v): v is number | string => v !== undefined && v !== null && v !== "",
)
.map(String)
.join(",");
const id = editingProjectId.value!;
const kept = projectRegById.value[id] || {};
// reg* DB , mod*
return {
id,
prjCd: form.value.prjCd,
prjNm: form.value.prjNm,
prjDesc: form.value.prjDesc,
prjStartDt: today,
prjEndDt: today,
delYn: "N",
regDate: nowIso,
regUserId: kept.regId,
regUserNm: kept.regNm,
modDate: nowIso, modDate: nowIso,
modUserId: namesCsv, modUserId: idsCsv,
modUserNm: namesCsv, modUserNm: namesCsv,
}; };
}; }
const fillerCount = computed(() =>
Math.max(0, pager.value.pageSize - pagedProjects.value.length),
);
const fillers = computed(() => Array.from({ length: fillerCount.value }));
const resetForm = () => { const resetForm = () => {
form.value.prjCd = `PRJ${Date.now()}`; form.value.prjCd = `PRJ${Date.now()}`;
@ -99,13 +207,33 @@ const loadProjects = async () => {
try { try {
const { data } = await ProjectService.search(); const { data } = await ProjectService.search();
const rawList = data as ProjectSearchResponseItem[]; const rawList = data as ProjectSearchResponseItem[];
projects.value = rawList.map((p) => ({
const sorted = [...rawList].sort((a, b) => (b.id ?? 0) - (a.id ?? 0));
projectRegById.value = {};
projects.value = sorted.map((p) => {
// reg ( reg* )
projectRegById.value[p.id] = { regId: p.regUserId, regNm: p.regUserNm };
// / mod_user_nm , reg_user_nm
const displayNm =
p.modUserNm && p.modUserNm.length > 0 ? p.modUserNm : p.regUserNm || "";
return {
id: p.id, id: p.id,
title: p.prjNm, title: p.prjNm,
creator: p.regUserId ?? "", creator: displayNm, // v-select v-model
date: p.prjStartDt ?? "", date: p.prjStartDt, // fallback
description: p.prjDesc, description: p.prjDesc,
})); };
});
if (
pager.value.pageNum >
Math.max(1, Math.ceil(projects.value.length / pager.value.pageSize))
) {
pager.value.pageNum = 1;
}
} catch (e) { } catch (e) {
console.error("프로젝트 조회 실패:", e); console.error("프로젝트 조회 실패:", e);
} }
@ -136,30 +264,27 @@ const closeDialog = () => {
}; };
const selectProject = (index: number) => { const selectProject = (index: number) => {
const selected = projects.value[index]; const selected = pagedProjects.value[index];
autoflowStore.setProjectId(selected.id); autoflowStore.setProjectId(selected.id);
autoflowStore.setProjectName(selected.title); autoflowStore.setProjectName(selected.title);
router.push("/home"); router.push("/home");
}; };
/** ===== 프로젝트 저장 & 권한 부여 ===== */
const grantDefaultPermissions = async ( const grantDefaultPermissions = async (
projectId: number, projectId: number,
usernames: string[], usernames: string[],
) => { ) => {
if (!usernames?.length) return; if (!usernames?.length) return;
const nameSet = new Set(usernames); const nameSet = new Set(usernames);
const numericIds = userOptions.value const numericIds = userOptions.value
.filter((u) => nameSet.has(u.username)) .filter((u) => nameSet.has(u.username))
.map((u) => Number(u.id)) .map((u) => Number(u.id))
.filter((n) => Number.isFinite(n)); .filter((n) => Number.isFinite(n));
await Promise.all( await Promise.all(
numericIds.map((uid) => numericIds.map((uid) =>
ProjectService.projectAuthority(projectId, { ProjectService.projectAuthority(projectId, {
projectId, projectId,
userId: uid, // number userId: uid,
permissions: DEFAULT_PERMISSIONS, permissions: DEFAULT_PERMISSIONS,
}), }),
), ),
@ -171,20 +296,17 @@ const saveProject = async () => {
alert("권한이 없습니다. (ROLE_ADMIN 전용)"); alert("권한이 없습니다. (ROLE_ADMIN 전용)");
return; return;
} }
const payload = buildApiProjectPayload();
try { try {
let projectId: number; let projectId: number;
if (modalMode.value === "create") { if (modalMode.value === "create") {
const createRes = await ProjectService.add(payload); const createPayload = buildCreatePayload(); // mod*
const createRes = await ProjectService.add(createPayload); //
projectId = createRes.data.id; projectId = createRes.data.id;
} else { } else {
await ProjectService.update(editingProjectId.value!, payload); const updatePayload = buildUpdatePayload(); // reg* , mod*
await ProjectService.update(editingProjectId.value!, updatePayload); // non-null
projectId = editingProjectId.value!; projectId = editingProjectId.value!;
} }
await grantDefaultPermissions(projectId, form.value.selectedUsers); await grantDefaultPermissions(projectId, form.value.selectedUsers);
await loadProjects(); await loadProjects();
closeDialog(); closeDialog();
@ -197,8 +319,7 @@ const saveProject = async () => {
const deleteProject = async () => { const deleteProject = async () => {
try { try {
if (selectedIndex.value === null) return; if (selectedIndex.value === null) return;
const target = projects.value[selectedIndex.value]; const target = pagedProjects.value[selectedIndex.value];
await ProjectService.delete(target.id); await ProjectService.delete(target.id);
await loadProjects(); await loadProjects();
} catch (e: any) { } catch (e: any) {
@ -209,43 +330,6 @@ const deleteProject = async () => {
} }
}; };
//
// const deleteProject = async (): Promise<void> => {
// try {
// if (selectedIndex.value === null) return;
// const target = projects.value[selectedIndex.value];
// const projectId = target.id;
// // 1) username
// const usernames = (target.creator || "")
// .split(",")
// .map((s) => s.trim())
// .filter(Boolean);
// // 2) username -> userId
// if (usernames.length) {
// const ids = userOptions.value
// .filter((u) => usernames.includes(u.username))
// .map((u) => u.id);
// // 3) /
// await Promise.all(
// ids.map((uid) => ProjectService.deleteProjectAuthority(projectId, uid)),
// );
// }
// // 4)
// await ProjectService.delete(projectId);
// await loadProjects();
// } catch (e: any) {
// console.error(" :", e?.response?.status, e?.response?.data || e);
// alert(" : " + (e?.response?.data?.message || e.message || ""));
// } finally {
// contextMenu.value = false;
// }
// };
const onAddProject = () => { const onAddProject = () => {
if (!isAdmin.value) { if (!isAdmin.value) {
alert("권한이 없습니다. (ROLE_ADMIN 전용)"); alert("권한이 없습니다. (ROLE_ADMIN 전용)");
@ -260,19 +344,19 @@ const onAddProject = () => {
const modifyProject = () => { const modifyProject = () => {
contextMenu.value = false; contextMenu.value = false;
if (selectedIndex.value === null) return; if (selectedIndex.value === null) return;
const selected = pagedProjects.value[selectedIndex.value];
const selected = projects.value[selectedIndex.value];
modalMode.value = "edit"; modalMode.value = "edit";
editingProjectId.value = selected.id; editingProjectId.value = selected.id;
form.value.prjCd = selected.title; form.value.prjCd = selected.title;
form.value.prjNm = selected.title; form.value.prjNm = selected.title;
form.value.prjDesc = selected.description; form.value.prjDesc = selected.description;
// creator reg_user_nm . []
form.value.selectedUsers = form.value.selectedUsers =
selected.creator typeof selected.creator === "string" && selected.creator.length
?.split(",") ? selected.creator.split(",").map((s) => s.trim())
.map((s) => s.trim()) : [];
.filter(Boolean) ?? [];
dialog.value = true; dialog.value = true;
}; };
@ -301,7 +385,6 @@ onBeforeUnmount(() => {
</v-col> </v-col>
<v-col cols="auto"> <v-col cols="auto">
<!-- ADMIN만 노출 -->
<v-btn <v-btn
v-show="isAdmin" v-show="isAdmin"
color="secondary" color="secondary"
@ -315,10 +398,13 @@ onBeforeUnmount(() => {
</v-col> </v-col>
</v-row> </v-row>
<!-- 카드 그리드: 현재 페이지 데이터만 렌더 -->
<v-row dense> <v-row dense>
<!-- 실제 카드 -->
<v-col <v-col
v-for="(project, index) in projects" v-for="(project, index) in pagedProjects"
:key="index" :key="project.id"
cols="12" cols="12"
sm="6" sm="6"
md="6" md="6"
@ -326,7 +412,7 @@ onBeforeUnmount(() => {
class="d-flex" class="d-flex"
> >
<v-card <v-card
class="pa-4 flex-grow-1 d-flex flex-column" class="project-card pa-4 flex-grow-1 d-flex flex-column"
color="primary" color="primary"
variant="elevated" variant="elevated"
elevation="6" elevation="6"
@ -354,8 +440,46 @@ onBeforeUnmount(() => {
</v-card-text> </v-card-text>
</v-card> </v-card>
</v-col> </v-col>
<!-- 플레이스홀더(보이지 않지만 자리 차지) -->
<v-col
v-for="(_, i) in fillers"
:key="'filler-' + i"
cols="12"
sm="6"
md="6"
lg="6"
class="d-flex"
>
<v-card
class="project-card pa-4 flex-grow-1"
style="visibility: hidden; pointer-events: none"
rounded="lg"
>
&nbsp;
</v-card>
</v-col>
</v-row>
<!-- 하단 페이지네이션 영역 -->
<v-row class="mt-6" align="center" justify="center">
<v-col
cols="12"
class="d-flex justify-center align-center"
style="gap: 16px"
>
<v-pagination
v-model="pager.pageNum"
:length="pager.pageLength"
:total-visible="7"
color="primary"
rounded="circle"
@update:model-value="changePageNum"
/>
</v-col>
</v-row> </v-row>
<!-- 컨텍스트 메뉴/다이얼로그 기존 그대로 -->
<v-menu <v-menu
v-model="contextMenu" v-model="contextMenu"
absolute absolute
@ -407,14 +531,18 @@ onBeforeUnmount(() => {
<v-card-actions> <v-card-actions>
<v-spacer /> <v-spacer />
<v-btn text @click="closeDialog">Cancel</v-btn>
<v-btn color="primary" @click="saveProject"> <v-btn color="primary" @click="saveProject">
{{ modalMode === "create" ? "Create" : "Save" }} {{ modalMode === "create" ? "Create" : "Save" }}
</v-btn> </v-btn>
<v-btn text @click="closeDialog">Cancel</v-btn>
</v-card-actions> </v-card-actions>
</v-card> </v-card>
</v-dialog> </v-dialog>
</v-container> </v-container>
</template> </template>
<style scoped></style> <style scoped>
.project-card {
min-height: 140px;
}
</style>

1
typed-router.d.ts vendored

@ -29,6 +29,7 @@ declare module 'vue-router/auto-routes' {
'/ProjectView': RouteRecordInfo<'/ProjectView', '/ProjectView', Record<never, never>, Record<never, never>>, '/ProjectView': RouteRecordInfo<'/ProjectView', '/ProjectView', Record<never, never>, Record<never, never>>,
'/SignupView': RouteRecordInfo<'/SignupView', '/SignupView', Record<never, never>, Record<never, never>>, '/SignupView': RouteRecordInfo<'/SignupView', '/SignupView', Record<never, never>, Record<never, never>>,
'/TrainingScriptView': RouteRecordInfo<'/TrainingScriptView', '/TrainingScriptView', Record<never, never>, Record<never, never>>, '/TrainingScriptView': RouteRecordInfo<'/TrainingScriptView', '/TrainingScriptView', Record<never, never>, Record<never, never>>,
'/UsersView': RouteRecordInfo<'/UsersView', '/UsersView', Record<never, never>, Record<never, never>>,
'/WorkflowStepConfigView': RouteRecordInfo<'/WorkflowStepConfigView', '/WorkflowStepConfigView', Record<never, never>, Record<never, never>>, '/WorkflowStepConfigView': RouteRecordInfo<'/WorkflowStepConfigView', '/WorkflowStepConfigView', Record<never, never>, Record<never, never>>,
'/WorkflowView': RouteRecordInfo<'/WorkflowView', '/WorkflowView', Record<never, never>, Record<never, never>>, '/WorkflowView': RouteRecordInfo<'/WorkflowView', '/WorkflowView', Record<never, never>, Record<never, never>>,
} }

Loading…
Cancel
Save