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 {
AppFooter: typeof import('./src/components/AppFooter.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']
DatesetBaseDoalog: typeof import('./src/components/atoms/organisms/DatesetBaseDoalog.vue')['default']
DeploymentDialog: typeof import('./src/components/atoms/organisms/DeploymentDialog.vue')['default']
DrawerComponent: typeof import('./src/components/common/DrawerComponent.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']
IconInfoBtn: typeof import('./src/components/atoms/button/IconInfoBtn.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']
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']
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']
StepComfigDialog: typeof import('./src/components/atoms/organisms/StepComfigDialog.vue')['default']
TrainingScriptBaseDoalog: typeof import('./src/components/atoms/organisms/TrainingScriptBaseDoalog.vue')['default']
ViewComponent: typeof import('./src/components/templates/Datasets/ViewComponent.vue')['default']
WorkflowDialog: typeof import('./src/components/atoms/organisms/WorkflowDialog.vue')['default']
WorkflowsBaseDialog: typeof import('./src/components/atoms/organisms/WorkflowsBaseDialog.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']
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">
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({
editData: Object,
mode: String,
userOption: Array,
});
type SelectedData = {
name?: string;
description?: string;
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({
name: "",
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>
<template>
<v-card class="rounded-lg overflow-hidden">
<!-- 타이틀 영역 -->
<v-card-title
class="text-white font-weight-bold text-h6"
style="background-color: #1976d2"
@ -40,13 +181,14 @@ const submit = () => {
<v-text-field
v-model="form.name"
variant="outlined"
:disabled="saving"
dense
hide-details
required
/>
</div>
<div>
<div class="mb-5">
<label class="text-subtitle-2 font-weight-medium mb-1 d-block"
>Description</label
>
@ -54,16 +196,29 @@ const submit = () => {
v-model="form.description"
variant="outlined"
rows="3"
: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" @click="submit">Save</v-btn>
<v-btn text class="white--text" @click="$emit('close-modal')"
<v-btn
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
>
</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">
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({
editData: Object,
mode: String,
userOption: Array,
});
const props = defineProps<{ editData: any; mode: "create" | "edit" }>();
const emit = defineEmits<{
(e: "close-modal"): void;
(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({
name: "",
description: "",
file: "",
file: null as any,
});
//
const dialogTitle = computed(() => {
if (props.mode === "create") return "Create Training Script";
if (props.mode === "edit") return "Edit Training Script";
return "Clone Execution";
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) {
// : file required
if (!fileObj) return (errorMsg.value = "수정할 새 파일을 선택해주세요.");
const onChooseFile = () => {
fileInput.value?.click();
};
const submit = () => {
emit("handle-data", form.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", "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>
<template>
<v-card class="rounded-lg overflow-hidden">
<!-- 타이틀 영역 -->
<v-card-title
class="text-white font-weight-bold text-h6"
style="background-color: #1976d2"
@ -46,49 +137,63 @@ const submit = () => {
<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>
>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"
>File
</label>
<v-file-input
v-model="form.file"
label="Upload File"
@click:append-outer="onChooseFile"
outlined
>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"
>Description
</label>
<v-text-field
v-model="form.description"
variant="outlined"
>File</label
>
<v-file-input
v-model="form.file"
label="Upload File"
:disabled="saving"
outlined
dense
hide-details
required
: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" @click="submit">Save</v-btn>
<v-btn text class="white--text" @click="$emit('close-modal')"
>Close</v-btn
<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>

@ -4,18 +4,22 @@ import IconArrowUp from "@/components/atoms/button/IconArrowUp.vue";
import IconDeleteBtn from "@/components/atoms/button/IconDeleteBtn.vue";
import IconModifyBtn from "@/components/atoms/button/IconModifyBtn.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 type { Workflow } from "@/components/models/management/Autoflow";
import type { Workflow } from "@/components/models/management/Workflow";
import { storeToRefs } from "pinia";
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 props = defineProps<{
editData?: any;
mode?: "create" | "edit";
userOption?: any[];
editData: any;
mode: "create" | "edit";
}>();
const emit = defineEmits<{
@ -28,6 +32,77 @@ const isEdit = computed(() => props.mode === "edit");
const saving = ref(false);
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([
{ order: 1, stepName: "Data Load", type: "DataPrep", status: "Configured" },
{
@ -48,15 +123,16 @@ const steps = ref([
const form = ref({
name: "",
description: "",
file: null as File | null,
});
/** props.editData -> form 바인딩 */
function hydrateFormFromEdit(data: any) {
if (!data) return;
// , /
form.value.name = data.workflowName ?? data.name ?? "";
form.value.description = data.workflowDescription ?? data.description ?? "";
}
onMounted(() => {
if (isEdit.value) hydrateFormFromEdit(props.editData);
});
@ -66,7 +142,9 @@ watch(
if (isEdit.value) hydrateFormFromEdit(v);
},
);
function onDescInput(v: string) {
form.value.description = v ?? "";
}
/** 시간 포맷 */
const nowLocalIso = (): string => {
const t = new Date(Date.now() - new Date().getTimezoneOffset() * 60000);
@ -75,10 +153,15 @@ const nowLocalIso = (): string => {
async function submit() {
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;
}
@ -86,7 +169,6 @@ async function submit() {
const authObj =
(typeof storage?.getAuth === "function" ? storage.getAuth() : null) ??
JSON.parse(localStorage.getItem("autoflow-auth") || "{}");
const regUserId =
authObj?.userInfo?.username ??
authObj?.userinfo?.username ??
@ -98,48 +180,86 @@ async function submit() {
errorMsg.value = "로그인 사용자 정보를 찾을 수 없습니다.";
return;
}
if (!projectId.value) {
errorMsg.value = "프로젝트가 선택되지 않았습니다.";
return;
}
const now = nowLocalIso();
const payload: Workflow = {
workflowName: name,
workflowDescription: form.value.description?.trim() || "",
uploadYn: "Y",
regUserId,
regDt: now,
modDt: now,
projectId: projectId.value,
};
try {
saving.value = true;
if (isEdit.value) {
// : id ( deviceKey id )
// ===== =====
const rawId = props.editData?.id ?? props.editData?.deviceKey;
const id = Number(rawId);
if (!id) {
errorMsg.value = "수정할 ID가 없습니다.";
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("close-modal");
} 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("close-modal");
}
} catch (e) {
} catch (e: any) {
console.error("워크플로우 저장 실패:", e);
errorMsg.value = "저장에 실패했습니다. 잠시 후 다시 시도하세요.";
errorMsg.value = extractApiErrorMessage(e);
} finally {
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로 닫기 */
function onEsc(e: KeyboardEvent) {
if (e.key === "Escape") emit("close-modal");
@ -164,114 +284,75 @@ onBeforeUnmount(() => window.removeEventListener("keydown", onEsc));
</div>
<v-form @submit.prevent="submit">
<!-- Name -->
<div class="mb-5">
<label class="text-subtitle-2 font-weight-medium mb-1 d-block"
>Workflow Name</label
>
<label class="text-subtitle-2 font-weight-medium mb-1 d-block">
Workflow Name
</label>
<v-text-field
v-model="form.name"
variant="outlined"
:disabled="saving"
dense
hide-details
hide-details="auto"
persistent-hint
:hint="nameHint"
:error="nameInvalid"
:error-messages="nameErrorMsg"
@update:model-value="onNameInput"
required
/>
</div>
<div>
<label class="text-subtitle-2 font-weight-medium mb-1 d-block"
>Workflow Description</label
>
<!-- Description -->
<div class="mb-5">
<label class="text-subtitle-2 font-weight-medium mb-1 d-block">
Workflow Description
</label>
<v-textarea
v-model="form.description"
variant="outlined"
:disabled="saving"
rows="3"
dense
hide-details
hide-details="auto"
persistent-hint
@update:model-value="onDescInput"
/>
</div>
<div v-if="errorMsg" class="mt-3 text-error">{{ errorMsg }}</div>
</v-form>
</v-card-text>
<v-card-text class="pt-6 pb-4 px-6">
<div class="text-subtitle-1 font-weight-medium mb-4">Workflow Steps</div>
<v-row class="align-center mb-4">
<v-col cols="auto"
><v-btn color="primary" small :disabled="saving"
><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']"
<!-- Upload File -->
<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"
accept=".zip,.tar,.gz,.yaml,.yml"
show-size
variant="outlined"
dense
hide-details
style="max-width: 180px"
placeholder="파이프라인 파일 선택"
/>
</td>
<td class="text-center">{{ step.status }}</td>
<td class="text-center">
<IconArrowUp />
<IconArrowDown />
<IconModifyBtn />
<IconDeleteBtn />
</td>
</tr>
</tbody>
</v-simple-table>
</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 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
>
Close
</v-btn>
</v-card-actions>
</v-card>
</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 { menuUtils } from "@/utils/menuUtils";
import { storage } from "@/utils/storage";
import logo from "@/assets/iteration (1).png";
import SidebarHeader from "@/components/common/SidebarHeader.vue";
const route = useRoute();
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);
function readRolesFromStorage(): string[] {
try {
// storage.get(...) ,
const raw =
storage.get?.("autoflow-auth") ??
localStorage.getItem("autoflow-auth") ??
@ -20,8 +25,6 @@ function readRolesFromStorage(): string[] {
const auth = typeof raw === "string" ? JSON.parse(raw) : raw;
let roles = auth?.userInfo?.roles ?? auth?.roles ?? [];
// "ROLE_USER,ROLE_ADMIN"
if (typeof roles === "string") {
roles = roles.split(",").map((s: string) => s.trim());
}
@ -33,7 +36,6 @@ function readRolesFromStorage(): string[] {
}
}
// ADMIN (ROLE_ADMIN ADMIN )
const isAdmin = computed(() => {
const roles = readRolesFromStorage();
return roles.some((r) => r === "ROLE_ADMIN" || r === "ADMIN");
@ -43,10 +45,6 @@ const isLinkActive = (link) => {
return route.path.includes(link);
};
const goMain = () => {
router.push("/home");
};
onMounted(() => {
isShowAuth.value = true;
//storage.getAuth().auth === "ADMIN";
@ -55,19 +53,6 @@ onMounted(() => {
<template>
<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">
<template
v-for="({ title, value, icon, path, depth }, i) in menuUtils.menuItem"
@ -100,7 +85,7 @@ onMounted(() => {
</template>
<template v-else>
<v-list-item
v-if="value !== 'project' || isAdmin"
v-if="value !== 'project'"
rounded
:title="title"
:value="value"

@ -2,89 +2,91 @@
import { useRoute, useRouter } from "vue-router";
import { storage } from "@/utils/storage.js";
import DrawerComponent from "@/components/common/DrawerComponent.vue";
import { ref, watchEffect } from "vue";
import Select from "@/views/Select.vue";
import { ref, computed, onMounted, onBeforeUnmount, watch } from "vue";
import { UserManagerService } from "@/components/service/management/userManagerService";
import { storeToRefs } from "pinia";
import { useAutoflowStore } from "@/stores/autoflowStore";
import SidebarHeader from "@/components/common/SidebarHeader.vue";
const route = useRoute();
const router = useRouter();
const username = ref("");
const projectName = ref(localStorage.getItem("projectName") || "");
const autoflow = useAutoflowStore();
const showPasswordModal = ref(false);
const selectedUserData = ref({});
// ----------------------
// Admin + Admin
// ----------------------
const isAdmin = ref(false); //
const adminMode = ref(false); //
const lastNonAdminPath = ref("/home"); //
const menu = ref([]);
const projectName = ref(localStorage.getItem("projectName") || "");
const updateUsername = () => {
// storage : { userInfo: { username, ... }, ... }
const auth = storage.getAuth?.() ?? null;
username.value =
auth?.userInfo?.username ??
auth?.username ?? //
""; //
};
function computeIsAdmin() {
try {
const raw =
typeof storage?.getAuth === "function"
? storage.getAuth()
: JSON.parse(localStorage.getItem("autoflow-auth") || "null");
const menuItems = [
{
title: "Select Project",
click: () => {
goSelect();
},
},
{
title: "Change Password",
click: () => {
showPasswordModal.value = true;
},
},
{
title: "Logout",
icon: "mdi-logout",
click: () => {
logOut();
},
},
];
const roles = raw?.userInfo?.roles ?? raw?.roles ?? [];
const authCd = raw?.userInfo?.authCd ?? raw?.authCd ?? raw?.auth;
const inRoles = Array.isArray(roles)
? roles.includes("ROLE_ADMIN")
: roles === "ROLE_ADMIN";
isAdmin.value = inRoles || authCd === "ADMIN";
} catch {
isAdmin.value = false;
}
}
const userMenuItems = [
{
title: "Select Project",
},
//
function toggleAdmin() {
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: "Logout",
icon: "mdi-logout",
click: () => {
logOut();
/* open modal */
},
},
{ title: "Logout", icon: "mdi-logout", click: () => logOut() },
];
const drawer = ref(null);
const pageTitle = computed(() => {
return route.meta.title;
});
const pageTitle = computed(() => route.meta.title);
const pagePath = computed(() => route.path);
const pagePath = computed(() => {
return route.path;
});
// active
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");
projectName.value = v ? v : "";
};
const goSelect = () => {
}
function goSelect() {
router.push("/select");
};
const logOut = () => {
}
function logOut() {
UserManagerService.signOut()
.catch(console.error)
.finally(() => {
@ -94,71 +96,122 @@ const logOut = () => {
username.value = "";
projectName.value = "";
sessionStorage.removeItem("initialRedirectDone");
adminMode.value = false;
router.push("/login");
});
};
onMounted(() => {
updateUsername();
refreshProjectName();
menu.value = menuItems;
}
// projectName
window.addEventListener("storage", (e) => {
// storage
function onStorage(e) {
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();
});
});
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(
() => 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;
// if (auth === "ADMIN") {
onMounted(() => {
updateUsername();
computeIsAdmin();
refreshProjectName();
menu.value = menuItems;
// } else {
// menu.value = userMenuItems;
// }
window.addEventListener("storage", onStorage);
});
onBeforeUnmount(() => {
window.removeEventListener("storage", onStorage);
});
</script>
<template>
<v-app>
<!-- 사이드바 -->
<v-navigation-drawer
v-model="drawer"
border="0"
hide-overlay
permanent
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-spacer></v-spacer>
<v-menu location="bottom end">
<template v-slot:activator="{ props }">
<v-tooltip location="bottom" text="Settings">
<v-spacer />
<v-tooltip v-if="isAdmin" location="bottom" text="Settings">
<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-btn>
</template>
</v-tooltip>
<v-tooltip location="bottom" text="Projact">
<!-- 프로젝트 선택 -->
<v-tooltip location="bottom" text="Project">
<template #activator="{ props }">
<v-btn
icon
@ -171,12 +224,16 @@ watchEffect(() => {
</v-btn>
</template>
</v-tooltip>
<div style="min-width: 180px" class="d-flex flex-column align-end">
<div class="font-weight-black">{{ username || "GUEST" }}</div>
<div class="text-subtitle-2">
{{ projectName || "No Project Selected" }}
</div>
</div>
<v-menu location="bottom end">
<template #activator="{ props }">
<v-btn icon color="primary" v-bind="props" class="mr-3">
<v-icon>mdi-arrow-down-drop-circle-outline</v-icon>
</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[];
}
export interface ProjectSearchParams {
export interface ProjectSearch {
page: number;
size: number;
keyword: string;

@ -20,6 +20,12 @@ export const request = {
put: (uri: string, param: any): any => {
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 => {
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) => {
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";
export const AutoflowService = {
export const WorkflowService = {
add: (payload: Workflow) => {
return request.post("/api/workflows", payload);
},
getAll: () => {
return request.get("/api/workflows", {});
},
delete: (id: Number) => {
return request.delete(`/api/workflows/${id}`, {});
},
@ -17,4 +19,7 @@ export const AutoflowService = {
update: (id: number, payload: Workflow) => {
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 {
ApiProject,
ProjectAuthority,
ProjectSearchParams,
ProjectSearch,
} from "@/components/models/project/Project";
export const ProjectService = {
@ -27,9 +27,9 @@ export const ProjectService = {
return request.post("/api/projects", payload);
},
// 검색 및 페이지네이션 프로젝트 목록 조회
searchProjects: (params: ProjectSearchParams) =>
request.get("/api/projects/search", params),
searchProjects: (params: ProjectSearch) => {
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 IconModifyBtn from "@/components/atoms/button/IconModifyBtn.vue";
import IconInfoBtn from "@/components/atoms/button/IconInfoBtn.vue";
// import FormComponent from "@/components/device/FormComponent.vue";
import { onMounted, ref, watch } from "vue";
import { onMounted, ref } from "vue";
import { storage } from "@/utils/storage";
import ViewComponent from "@/components/templates/Datasets/ViewComponent.vue";
import DatasetsBaseDoalog from "@/components/atoms/organisms/DatasetsBaseDoalog.vue";
import WorkflowsUploadDialog from "@/components/atoms/organisms/WorkflowsUploadDialog.vue";
// const store = commonStore();
import DatasetBaseDoalog from "@/components/atoms/organisms/DatasetBaseDoalog.vue";
import { AttachmentsService } from "@/components/service/management/attachmentsService";
import { commonStore } from "@/stores/commonStore";
const store = commonStore();
const openView = ref(false);
const openModify = ref(false);
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 username = ref<string>("");
// ===== /( ) =====
type SearchType = "전체" | "제목" | "작성자";
const searchOptions = [
{
searchType: "전체",
searchText: "",
},
{
searchType: "디바이스 별칭",
searchText: "deviceAlias",
},
{
searchType: "디바이스 키",
searchText: "deviceKey",
},
{
searchType: "사용자",
searchText: "userId",
},
{
searchType: "디바이스 이름",
searchText: "deviceName",
},
{
searchType: "디바이스 모델",
searchText: "deviceModel",
},
{
searchType: "디바이스 OS",
searchText: "deviceOs",
},
{ 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 pageSizeOptions = [
{ text: "10 페이지", value: 10 },
{ text: "50 페이지", value: 50 },
{ 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({
params: {
pageNum: 1,
pageSize: 10,
searchType: "",
searchType: "전체" as SearchType,
searchText: "",
},
results: [],
totalDataLength: 0,
results: [] as any[],
totalElements: 0,
pageLength: 0,
modalMode: "",
selectedData: null,
modalMode: "" as "create" | "edit" | "setting" | "",
selectedData: null as any,
allSelected: false,
selected: [],
selected: [] as Array<{ deviceKey: number }>,
isCreateVisible: false,
isUploadVisible: false,
isModalVisible: false,
isConfirmDialogVisible: false,
userOption: [],
userOption: [] as any[],
});
const getCodeList = () => {
// UserService.search(data.value.params).then((d) => {
// if (d.status === 200) {
// data.value.userOption = d.data.userList;
// }
// });
//
function readUsernameFromStorage(): string {
try {
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 };
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: 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 = [
{
title: "배터리 상태 예측 모델 프로젝트",
fileName: "train.py",
filePath: "/kubeflow-users/battery/train.py",
description: "배터리 상태 예측 스크립트",
createdData: "2025-04-28 12:01:00",
modifiedData: "2025-04-28 12:01:00",
},
{
title: "상태 추적 모델",
fileName: "detection.py",
filePath: "/kubeflow-users/status/detection.py",
description: "상태 추적 스크립트",
createdData: "2025-04-20 12:01:00",
modifiedData: "2025-04-28 12:01:00",
},
];
data.value.totalDataLength = 5;
// 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 = () => {
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 { 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,
sortField: "id",
sortDirection: "DESC",
refType: "DATASET",
};
try {
const res = await AttachmentsService.search(payload as any);
const result = res?.data ?? res;
let list = result?.content ?? [];
if (needLocalFilter) {
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") {
// 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 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);
data.value.results = pageSlice.map(toRow);
data.value.totalElements = totalElements;
data.value.pageLength = totalPages;
return;
}
data.value.results = (list as any[]).map(toRow);
data.value.totalElements = result?.totalElements ?? list.length;
data.value.pageLength = result?.totalPages ?? 1;
} catch (err) {
console.error("[TrainingScript] 조회 에러:", err);
data.value.results = [];
data.value.totalElements = 0;
data.value.pageLength = 1;
}
};
const removeData = (value) => {
let removeList = value ? value : data.value.selected;
const remove = (code) => {
// return DeviceService.delete(code).then((d) => {
// if (d.status !== 200) {
// store.setSnackbarMsg({
// text: d,
// result: 500,
// });
// }
// });
};
/** 검색 실행 (페이지 1로 리셋) */
const doSearch = () => {
data.value.params.pageNum = 1;
fetchList();
};
/** 페이지 이동 */
const changePageNum = (page: number) => {
data.value.params.pageNum = page;
fetchList();
};
/** 페이지 사이즈 변경 */
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;
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);
});
if (removeList.length === 1) {
remove(removeList[0].deviceKey).then(() => {
// store.setSnackbarMsg({
// text: ".",
// result: 200,
// });
changePageNum();
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.selected = [];
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 {
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;
},
);
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);
}
};
const handleRemoveData = () => {
if (data.value.selected.length === 0) {
// store.setSnackbarMsg({
// text: " . ",
// result: 500,
// });
return;
}
if (data.value.allSelected || data.value.selected.length !== 1) {
data.value.isConfirmDialogVisible = true;
return;
}
//
removeData(undefined);
};
const closeDetail = () => {
openView.value = false;
};
const changePageNum = (page) => {
data.value.params.pageNum = page;
getData();
};
const openSettingModal = (selectedItem) => {
const openDetailModal = (selectedItem: any) => {
data.value.selectedData = selectedItem;
data.value.modalMode = "setting";
openView.value = true;
};
const openCreateModal = () => {
data.value.selectedData = null;
data.value.modalMode = "create";
data.value.selectedData = {
username: username.value,
projectId: getProjectId(),
};
data.value.isCreateVisible = true;
};
const openModifyModal = () => {
data.value.selectedData = null;
const openModifyModal = (item: any) => {
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 = () => {
data.value.isModalVisible = false;
data.value.isCreateVisible = null;
data.value.isCreateVisible = false;
data.value.selectedData = null;
};
const closeModifyModal = () => {
data.value.isModalVisible = false;
data.value.isUploadVisible = null;
data.value.isUploadVisible = false;
data.value.selectedData = null;
};
const getSelectedAllData = () => {
data.value.selected = data.value.allSelected
? data.value.results.map((item) => {
return {
deviceKey: item.deviceKey,
};
})
? data.value.results.map((item: any) => ({ deviceKey: item.deviceKey }))
: [];
};
onMounted(() => {
getData();
getCodeList();
username.value = readUsernameFromStorage();
fetchList();
});
</script>
<template>
<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-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">
@ -343,7 +337,9 @@ onMounted(() => {
</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
@ -356,11 +352,12 @@ onMounted(() => {
label="검색조건"
density="compact"
:items="searchOptions"
item-title="searchType"
item-value="searchText"
item-title="label"
item-value="value"
hide-details
></v-select>
/>
</v-responsive>
<v-responsive min-width="540" max-width="540">
<v-text-field
v-model="data.params.searchText"
@ -370,8 +367,8 @@ onMounted(() => {
required
class="mt-3 mb-3"
hide-details
@keyup.enter="changePageNum(1)"
></v-text-field>
@keyup.enter="doSearch"
/>
</v-responsive>
<div class="ml-3">
@ -379,14 +376,15 @@ onMounted(() => {
size="large"
color="primary"
:rounded="5"
@click="changePageNum(1)"
@click="doSearch"
>
<v-icon> mdi-magnify</v-icon>
<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"
>
@ -394,10 +392,12 @@ onMounted(() => {
<v-sheet
class="d-flex align-center mr-3 mb-2 bg-shades-transparent"
>
<!-- 스크립트의 totalElements 사용 -->
<v-chip color="primary"
> {{ data.totalDataLength.toLocaleString() }}
</v-chip>
> {{ data.totalElements.toLocaleString() }}</v-chip
>
</v-sheet>
<v-sheet class="bg-shades-transparent">
<v-responsive max-width="140" min-width="140" class="mb-2">
<v-select
@ -409,18 +409,18 @@ onMounted(() => {
variant="outlined"
color="primary"
hide-details
@update:model-value="changePageNum(1)"
></v-select>
@update:model-value="changePageSize"
/>
</v-responsive>
</v-sheet>
</v-sheet>
<v-sheet class="justify-end mb-2">
<v-btn color="info" @click="openCreateModal"
>Create Dataset
</v-btn>
<v-btn color="info" @click="openCreateModal">Add Dataset</v-btn>
</v-sheet>
</v-sheet>
<!-- 목록 -->
<v-card class="rounded-lg pa-8">
<v-col cols="12">
<v-sheet>
@ -428,8 +428,6 @@ onMounted(() => {
density="comfortable"
fixed-header
height="625"
col-md-12
col-12
overflow-x-auto
>
<colgroup>
@ -439,18 +437,20 @@ onMounted(() => {
: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}`"
:style="item.style"
>
{{ item.label }}
</th>
</tr>
</thead>
<tbody class="text-body-2">
<tr
v-for="(item, i) in data.results"
@ -464,8 +464,8 @@ onMounted(() => {
<td>{{ item.createdData }}</td>
<td>{{ item.modifiedData }}</td>
<td style="white-space: nowrap">
<IconInfoBtn @on-click="openSettingModal(item)" />
<IconModifyBtn @on-click="openModifyModal()" />
<IconInfoBtn @on-click="openDetailModal(item)" />
<IconModifyBtn @on-click="openModifyModal(item)" />
<IconDeleteBtn
@on-click="
removeData([{ deviceKey: item.deviceKey }])
@ -476,6 +476,7 @@ onMounted(() => {
</tbody>
</v-table>
</v-sheet>
<v-card-actions class="text-center mt-8 justify-center">
<v-pagination
v-model="data.params.pageNum"
@ -483,36 +484,33 @@ onMounted(() => {
:total-visible="10"
color="primary"
rounded="circle"
@update:model-value="getData"
></v-pagination>
@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="600" persistent>
<DatasetsBaseDoalog
<DatasetBaseDoalog
:edit-data="data.selectedData"
:mode="data.modalMode"
@close-modal="closeCreateModal"
@handle-data="saveData"
: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"
@saved="fetchList"
:user-option="data.userOption"
/>
</v-dialog>
</div>
<div class="w-100" v-else>
<ViewComponent @close="closeDetail" />
<ViewComponent
v-if="data.selectedData"
:id="data.selectedData.deviceKey"
@close="closeDetail"
/>
</div>
</template>

@ -1,147 +1,164 @@
<script setup lang="ts">
import IconDeleteBtn from "@/components/atoms/button/IconDeleteBtn.vue";
import IconModifyBtn from "@/components/atoms/button/IconModifyBtn.vue";
// import FormComponent from "@/components/device/FormComponent.vue";
import { onMounted, ref } from "vue";
// const store = commonStore();
import { ref, computed, onMounted, watch } from "vue";
import { AttachmentsService } from "@/components/service/management/attachmentsService";
import { ProjectService } from "@/components/service/project/projectService";
// id +
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({
datasetTitle: "자율주행차량 배터리 상태 예측 모델 구축",
projectName: "배터리 상태 예측 모델 프로젝트",
version: "2.0",
createdDate: "2025-02-06",
createdId: "ADMIN_001",
modifiedDate: "2025-04-30",
modifiedId: "USER_002",
description: "날씨, 조도, 도로 상태 등의 주행환경 데이터",
fileName: "environment_log.csv",
fileSize: "58KB",
datasetTitle: "-",
projectName: "-",
version: "-",
createdDate: "-",
createdId: "-",
modifiedDate: "-",
modifiedId: "-",
description: "-",
fileName: "-",
fileSize: "-",
});
const data = ref({
params: {
pageNum: 1,
pageSize: 10,
searchType: "",
searchText: "",
},
results: [],
totalDataLength: 0,
pageLength: 0,
modalMode: "",
selectedData: null,
allSelected: false,
selected: [],
isModalVisible: false,
isConfirmDialogVisible: false,
userOption: [],
});
const downloadObjectName = computed(() => detailRaw.value?.storagePath || "");
const canDownload = computed(() => !!downloadObjectName.value);
const getCodeList = () => {
// UserService.search(data.value.params).then((d) => {
// if (d.status === 200) {
// data.value.userOption = d.data.userList;
// }
// });
};
async function handleDownload() {
const key = downloadObjectName.value.trim();
if (!key) return;
const setPaginationLength = () => {
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 res = await AttachmentsService.downloadFile(key);
const ct = String(res.headers["content-type"] || "").toLowerCase();
if (ct.includes("application/json")) {
const text = await (res.data as Blob).text();
try {
const json = JSON.parse(text);
throw new Error(json.message || text);
} catch {
throw new Error(text);
}
}
};
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 cd = res.headers["content-disposition"] || "";
let filename: string | undefined;
const mUtf8 = cd.match(/filename\*\s*=\s*UTF-8''([^;]+)/i);
const mStd = cd.match(/filename\s*=\s*(?:"([^"]+)"|([^;]+))/i);
if (mUtf8?.[1]) {
try {
filename = decodeURIComponent(mUtf8[1].trim());
} catch {
filename = mUtf8[1].trim();
}
} 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 remove = (code) => {
// return DeviceService.delete(code).then((d) => {
// if (d.status !== 200) {
// store.setSnackbarMsg({
// text: d,
// result: 500,
// });
// }
// });
//
const mapToViewModel = (raw: any) => {
const projectName =
raw?.projectName ?? raw?.project?.name ?? raw?.prjNm ?? "-";
const size = raw?.fileSize ?? raw?.size ?? raw?.length ?? undefined;
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) {
remove(removeList[0].deviceKey).then(() => {
// store.setSnackbarMsg({
// text: ".",
// result: 200,
// });
async function fetchProjectName(projectId?: number) {
if (!projectId && projectId !== 0) return;
try {
const res = await ProjectService.fetchProjectById(projectId as number);
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;
data.value.selected = [];
data.value.allSelected = false;
});
} else {
Promise.all(removeList.map((item) => remove(item.deviceKey))).finally(
() => {
// store.setSnackbarMsg({
// text: " .",
// result: 200,
// });
const info = computed(() => mapToViewModel(detailRaw.value || {}));
data.value.isConfirmDialogVisible = false;
data.value.selected = [];
data.value.allSelected = false;
},
);
async function fetchDetail(id: number | string) {
const idNum = typeof id === "string" ? Number(id) : id;
if (!Number.isFinite(idNum as number)) {
console.warn("[Datasets/View] invalid id:", id);
return;
}
};
const changePageNum = (page) => {
data.value.params.pageNum = page;
};
loading.value = true;
try {
const res = await AttachmentsService.view(idNum as number);
detailRaw.value = res?.data ?? res;
const emit = defineEmits<{
(e: "close"): void;
}>();
experimentInfo.value = mapToViewModel(detailRaw.value);
await fetchProjectName(detailRaw.value?.projectId);
} catch (e) {
console.error("[Datasets/View] fetch detail error:", e);
} finally {
loading.value = false;
}
}
// -------- lifecycle --------
onMounted(() => {
getCodeList();
fetchDetail(props.id);
});
watch(
() => props.id,
(nv) => {
if (nv !== undefined && nv !== null && nv !== "") fetchDetail(nv);
},
);
</script>
<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="pa-2">{{ experimentInfo.createdId }}</v-col>
</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" />
@ -217,7 +221,20 @@ onMounted(() => {
<VDivider class="my-2" />
<v-row align="center" class="py-2">
<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-card-text>
<v-sheet class="d-flex justify-end mb-2">

@ -1,27 +1,41 @@
<script setup lang="ts">
import { onMounted, ref } from "vue";
import { onMounted, ref, computed, watch } from "vue";
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 workflows = ref<any[]>([]);
const recentLimit = 10;
onMounted(() => {
if (pieChartRef.value) {
Plotly.newPlot(
pieChartRef.value,
[
{
values: [40, 25, 20, 15],
labels: ["Success", "Pending", "Failed", "Cancelled"],
// ---- kubeflowStatus ( , ) ----
function renderStatusPie() {
if (!pieChartRef.value) return;
const counts = new Map<string, number>();
for (const wf of workflows.value ?? []) {
const status =
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",
marker: {
colors: ["#4caf50", "#ff9800", "#f44336", "#9e9e9e"],
},
textinfo: "label+percent",
textfont: { color: "#fff", size: 14 },
hole: 0.4,
},
],
{
};
const layout: Partial<Plotly.Layout> = {
paper_bgcolor: "#1e1e1e",
plot_bgcolor: "#1e1e1e",
showlegend: true,
@ -33,12 +47,12 @@ onMounted(() => {
y: -0.2,
},
margin: { t: 20, b: 40, l: 0, r: 0 },
},
{ displayModeBar: false },
);
}
});
};
Plotly.react(pieChartRef.value, [trace], layout, { displayModeBar: false });
}
// ---- ( ) ----
const recentRuns = [
{ name: "Model A - v1", status: "success", time: "2025-05-12 09:12" },
{ 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_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 = [
{ label: "Model Name", 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",
},
],
allSelected: false,
selected: [],
});
const handleRefresh = () => {
alert("Refresh 작업 진행중...");
};
@ -105,6 +114,73 @@ const getSelectedAllData = () => {
? 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>
<template>
@ -138,15 +214,23 @@ const getSelectedAllData = () => {
</div>
<div style="overflow-y: auto; max-height: 300px; padding: 8px 16px">
<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>
<div class="d-flex justify-space-between align-center w-100">
<span class="text-body-2 font-weight-medium">{{
item.title
}}</span>
<span class="text-caption text-grey-lighten-1">{{
item.date
}}</span>
<span class="text-caption text-grey-lighten-1">
{{ formatToYmdHm(item.timestamp) }}
</span>
</div>
</template>
</v-list-item>
<v-list-item v-if="recentWorkflowList.length === 0">
<template #title>
<div class="text-caption text-grey">
최근 등록/수정된 워크플로우가 없습니다.
</div>
</template>
</v-list-item>

@ -2,20 +2,29 @@
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 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();
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[] = [
"CREATE",
"READ",
@ -31,9 +40,6 @@ const refreshRoles = () => {
};
const isAdmin = computed(() => roles.value.includes("ROLE_ADMIN"));
//
// / (UI )
//
const tableHeader = [
{ label: "No", width: "5%", 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;" },
];
const searchOptions = [
{ searchType: "전체", searchText: "" },
{ searchType: "프로젝트명", searchText: "prjNm" },
{ searchType: "설명", searchText: "prjDesc" },
{ searchType: "생성자", searchText: "regUserId" },
];
const pageSizeOptions = [
{ text: "10 페이지", value: 10 },
{ text: "50 페이지", value: 50 },
@ -60,13 +59,23 @@ type Row = {
no: number;
name: string;
desc: string;
users: string[];
users: string[]; // (= mod_user_nm )
registDt: string;
deviceKey: number;
};
// reg ( )
const projectRegById = ref<Record<number, { regId?: string; regNm?: string }>>(
{},
);
const data = ref({
params: { pageNum: 1, pageSize: 10, searchType: "", searchText: "" },
params: {
pageNum: 1,
pageSize: 10,
searchType: "전체" as SearchType,
searchText: "",
},
results: [] as Row[],
totalDataLength: 0,
pageLength: 0,
@ -87,60 +96,157 @@ const splitCsv = (v?: string) =>
.map((s) => s.trim())
.filter(Boolean);
//
/** 사용자 목록 (v-select items) */
//
type UserOption = { id: number | string; username: string };
const userOptions = ref<UserOption[]>([]);
async function loadUsers() {
const { data } = await UserManagerService.getAll();
const raw = data as Array<{ id: number | string; username: string }>;
userOptions.value = raw.map((u) => ({ id: u.id, username: u.username }));
}
//
/** 목록 로드: 카드형 로직과 동일한 응답을 테이블 Row로 매핑 */
//
function toRow(p: any, index: number, offset: number): Row {
// UI (mod_user_nm )
function toRow(p: any, no: number): Row {
let displayNm = "";
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 {
no: offset + index + 1,
name: p.prjNm ?? "-",
desc: p.prjDesc ?? "-",
users: splitCsv(p.regUserId ?? p.regUserNm),
registDt: fmtDate(p.regDate ?? p.prjStartDt),
no,
name: p.prjNm,
desc: p.prjDesc,
users: splitCsv(displayNm),
registDt: fmtDate(p.prjStartDt), //
deviceKey: p.id,
};
}
/** ===== 목록 조회 (검색/페이지네이션 포함) ===== */
async function getData() {
const { pageNum, pageSize } = data.value.params;
const startIndex = (pageNum - 1) * pageSize;
const { pageNum, pageSize, searchType, searchText } = data.value.params;
const mapped = SEARCH_TYPE_MAP[searchType] || "ALL";
const keyword = (searchText || "").trim();
const res = await ProjectService.search();
const raw = Array.isArray(res.data) ? res.data : (res.data?.content ?? []);
const needLocalFilter = mapped !== "ALL" && keyword.length > 0;
data.value.totalDataLength = Array.isArray(res.data)
? raw.length
: (res.data?.totalElements ?? raw.length);
let reqPage = data.value.params.pageNum;
let reqSize = data.value.params.pageSize;
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)
? raw.slice(startIndex, startIndex + pageSize)
: raw;
data.value.results = slice.map((p: any, i: number) =>
toRow(p, i, startIndex),
const firstNo = totalElements - start;
// reg
projectRegById.value = {};
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 =
total % data.value.params.pageSize === 0
? total / data.value.params.pageSize
: Math.ceil(total / data.value.params.pageSize);
typeof result?.totalPages === "number"
? result.totalPages
: 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({
prjCd: "",
prjNm: "",
@ -156,12 +262,52 @@ const resetForm = () => {
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 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 {
id: data.value.modalMode === "edit" ? editingProjectId.value! : null,
id: null,
prjCd: form.value.prjCd,
prjNm: form.value.prjNm,
prjDesc: form.value.prjDesc,
@ -169,13 +315,44 @@ const buildApiPayload = (): ApiProject => {
prjEndDt: today,
delYn: "N",
regDate: nowIso,
regUserId: namesCsv,
regUserId: idsCsv,
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,
modUserId: namesCsv,
modUserId: idsCsv,
modUserNm: namesCsv,
};
};
}
async function grantDefaultPermissions(projectId: number, usernames: string[]) {
if (!usernames?.length) return;
@ -198,13 +375,14 @@ async function grantDefaultPermissions(projectId: number, usernames: string[]) {
async function saveProject() {
try {
const payload = buildApiPayload();
let projectId: number;
if (data.value.modalMode === "create") {
const payload = buildCreatePayload();
const res = await ProjectService.add(payload);
projectId = res.data.id;
} else {
const payload = buildUpdatePayload();
await ProjectService.update(editingProjectId.value!, payload);
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 }>) {
const removeList = targetList ?? data.value.selected;
if (!removeList?.length) return;
const ids = removeList.map((x) => x.deviceKey);
const remove = (id: number) =>
ProjectService.delete(id).then((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(
() => data.value.isCreateVisible,
(now, prev) => {
@ -339,9 +494,6 @@ watch(
},
);
//
//
//
onMounted(async () => {
refreshRoles();
await Promise.all([loadUsers(), getData()]);
@ -359,7 +511,7 @@ onMounted(async () => {
<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">Project</div>
<div class="text-primary">Projects</div>
</div>
</v-card-item>
</v-card>
@ -373,13 +525,14 @@ onMounted(async () => {
min-width="180"
class="mr-3 mt-3 mb-3"
>
<!-- [object Object] 해결 -->
<v-select
v-model="data.params.searchType"
label="검색조건"
density="compact"
:items="searchOptions"
item-title="searchType"
item-value="searchText"
item-title="label"
item-value="value"
hide-details
/>
</v-responsive>
@ -393,7 +546,7 @@ onMounted(async () => {
required
class="mt-3 mb-3"
hide-details
@keyup.enter="changePageNum(1)"
@keyup.enter="doSearch"
/>
</v-responsive>
@ -402,7 +555,7 @@ onMounted(async () => {
size="large"
color="primary"
:rounded="5"
@click="changePageNum(1)"
@click="doSearch"
>
<v-icon>mdi-magnify</v-icon>
</v-btn>
@ -410,6 +563,7 @@ onMounted(async () => {
</div>
</v-card>
<!-- 상단 툴바 -->
<v-sheet
class="bg-shades-transparent d-flex flex-wrap align-center mb-2"
>
@ -421,6 +575,7 @@ onMounted(async () => {
> {{ 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
@ -432,7 +587,7 @@ onMounted(async () => {
variant="outlined"
color="primary"
hide-details
@update:model-value="changePageNum(1)"
@update:model-value="changePageSize"
/>
</v-responsive>
</v-sheet>
@ -502,12 +657,10 @@ onMounted(async () => {
<td>{{ item.no }}</td>
<td>{{ item.name }}</td>
<!-- Description -->
<td>
<div class="truncate-2">{{ item.desc }}</div>
</td>
<!-- Select Users -->
<td>
<template v-if="item.users?.length">
<v-chip
@ -586,10 +739,10 @@ onMounted(async () => {
</v-card-text>
<v-card-actions>
<v-spacer />
<v-btn text @click="data.isCreateVisible = false">Cancel</v-btn>
<v-btn color="primary" @click="saveProject">
{{ data.modalMode === "create" ? "Create" : "Save" }}
</v-btn>
<v-btn text @click="data.isCreateVisible = false">Cancel</v-btn>
</v-card-actions>
</v-card>
</v-dialog>

@ -1,296 +1,299 @@
<script setup lang="ts">
import IconDeleteBtn from "@/components/atoms/button/IconDeleteBtn.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 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 openView = ref(false);
const username = ref<string>("");
const selectedExperiment = ref<{
name: string;
description: string;
createdDate: string;
createdID: string;
deviceKey: number;
} | null>(null);
// ===== =====
const tableHeader = [
{
label: "Experiment Name",
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;",
},
{ label: "Experiment Name", 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 = [
{ searchType: "All", searchText: "" },
{ searchType: "Experiment Name", searchText: "name" },
{ searchType: "Description", searchText: "description" },
{ searchType: "Created Date", searchText: "createdDate" },
{ searchType: "Created ID", searchText: "createdID" },
{ 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 pageSizeOptions = [
{ text: "10 페이지", value: 10 },
{ text: "50 페이지", value: 50 },
{ text: "100 페이지", value: 100 },
];
// ===== =====
const data = ref({
params: {
pageNum: 1,
pageSize: 10,
searchType: "",
searchType: "전체" as SearchType,
searchText: "",
},
results: [],
totalDataLength: 0,
results: [] as any[],
totalElements: 0,
pageLength: 0,
modalMode: "",
selectedData: null,
modalMode: "" as "create" | "edit" | "",
selectedData: null as any,
allSelected: false,
selected: [],
selected: [] as any[],
isCreateVisible: false,
isModalVisible: false,
isConfirmDialogVisible: false,
userOption: [],
userOption: [] as any[],
});
const getCodeList = () => {
// 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;
// ===== =====
function readUsernameFromStorage(): string {
try {
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 "";
}
data.value.results = [
{
name: "Baseline Model Training",
description: "기본 모델 구조로 학습 성능 측정",
createdDate: "2025-04-28",
createdID: "ADMIN_001",
},
{
name: "Batch Size Tuning",
description: "배치 사이즈 변경에 따른 학습 성능",
createdDate: "2025-04-20",
createdID: "ADMIN_001",
},
{
name: "Learning Rate Sweep",
description: "러닝레이트 변경에 따른 손실 ",
createdDate: "2025-04-20",
createdID: "ADMIN_001",
},
{
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 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 setPaginationLength = () => {
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,
);
// Row
const toRow = (e: any) => ({
name: e.displayName,
description: e.description,
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;
}
};
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 { 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 removeData = (value) => {
let removeList = value ? value : data.value.selected;
const remove = (code) => {
// return DeviceService.delete(code).then((d) => {
// if (d.status !== 200) {
// store.setSnackbarMsg({
// text: d,
// result: 500,
// });
// }
// });
const payload = {
projectId,
page: reqPage,
size: reqSize,
keyword,
searchType: mapped,
};
if (removeList.length === 1) {
remove(removeList[0].deviceKey).then(() => {
// store.setSnackbarMsg({
try {
const res = await ExperimentService.search(payload as any);
const result = res?.data ?? res;
let list = result?.content ?? [];
// text: ".",
// 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;
},
if (needLocalFilter) {
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 handleRemoveData = () => {
if (data.value.selected.length === 0) {
// store.setSnackbarMsg({
// text: " . ",
// result: 500,
// });
//
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);
data.value.results = pageSlice.map(toRow);
data.value.totalElements = totalElements;
data.value.pageLength = totalPages;
return;
}
if (data.value.allSelected || data.value.selected.length !== 1) {
data.value.isConfirmDialogVisible = true;
return;
data.value.results = (list as any[]).map(toRow);
data.value.totalElements = result?.totalElements ?? list.length;
data.value.pageLength = result?.totalPages ?? 1;
} catch (err) {
console.error("[Experiments] 조회 에러:", err);
data.value.results = [];
data.value.totalElements = 0;
data.value.pageLength = 1;
}
//
removeData(undefined);
};
const changePageNum = (page) => {
// ===== / =====
const doSearch = () => {
data.value.params.pageNum = 1;
fetchList();
};
const changePageNum = (page: number) => {
data.value.params.pageNum = page;
getData();
fetchList();
};
const changePageSize = (size: number) => {
data.value.params.pageSize = size;
data.value.params.pageNum = 1;
fetchList();
};
const openDetail = (item: {
name: string;
description: string;
createdDate: string;
createdID: string;
}) => {
selectedExperiment.value = item;
openView.value = true;
// / ( )
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) =>
ExperimentService.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.selected = [];
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 {
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);
}
};
// ===== & ( ) =====
const closeDetail = () => {
openView.value = false;
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 = () => {
data.value.selectedData = null;
data.value.modalMode = "create";
data.value.isModalVisible = true;
data.value.selectedData = {
username: username.value,
projectId: getProjectId(),
};
data.value.isCreateVisible = true;
};
const closeModal = () => {
data.value.isModalVisible = false;
data.value.isCreateVisible = false;
data.value.selectedData = null;
};
const getSelectedAllData = () => {
data.value.selected = data.value.allSelected
? data.value.results.map((item) => {
return {
deviceKey: item.deviceKey,
};
})
: [];
};
onMounted(() => {
getData();
getCodeList();
username.value = readUsernameFromStorage();
fetchList();
});
</script>
@ -308,7 +311,9 @@ onMounted(() => {
</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
@ -321,11 +326,12 @@ onMounted(() => {
label="검색조건"
density="compact"
:items="searchOptions"
item-title="searchType"
item-value="searchText"
item-title="label"
item-value="value"
hide-details
></v-select>
/>
</v-responsive>
<v-responsive min-width="540" max-width="540">
<v-text-field
v-model="data.params.searchText"
@ -335,8 +341,8 @@ onMounted(() => {
required
class="mt-3 mb-3"
hide-details
@keyup.enter="changePageNum(1)"
></v-text-field>
@keyup.enter="doSearch"
/>
</v-responsive>
<div class="ml-3">
@ -344,14 +350,15 @@ onMounted(() => {
size="large"
color="primary"
:rounded="5"
@click="changePageNum(1)"
@click="doSearch"
>
<v-icon> mdi-magnify</v-icon>
<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"
>
@ -360,8 +367,8 @@ onMounted(() => {
class="d-flex align-center mr-3 mb-2 bg-shades-transparent"
>
<v-chip color="primary"
> {{ data.totalDataLength.toLocaleString() }}
</v-chip>
> {{ data.totalElements.toLocaleString() }}</v-chip
>
</v-sheet>
<v-sheet class="bg-shades-transparent">
<v-responsive max-width="140" min-width="140" class="mb-2">
@ -374,18 +381,20 @@ onMounted(() => {
variant="outlined"
color="primary"
hide-details
@update:model-value="changePageNum(1)"
></v-select>
@update:model-value="changePageSize"
/>
</v-responsive>
</v-sheet>
</v-sheet>
<v-sheet class="justify-end mb-2">
<v-btn color="primary" @click="openCreateModal"
>Create Experiment
</v-btn>
>Create Experiment</v-btn
>
</v-sheet>
</v-sheet>
<!-- 목록 -->
<v-card class="rounded-lg pa-8">
<v-col cols="12">
<v-sheet>
@ -393,8 +402,6 @@ onMounted(() => {
density="comfortable"
fixed-header
height="625"
col-md-12
col-12
overflow-x-auto
>
<colgroup>
@ -406,20 +413,11 @@ onMounted(() => {
</colgroup>
<thead>
<tr>
<!-- <th>
<v-checkbox
v-model="data.allSelected"
style="min-width: 36px"
:indeterminate="data.allSelected === true"
hide-details
@change="getSelectedAllData"
></v-checkbox>
</th> -->
<th
v-for="(item, i) in tableHeader"
:key="i"
class="text-center font-weight-bold"
:style="`${item.style}`"
:style="item.style"
>
{{ item.label }}
</th>
@ -431,21 +429,12 @@ onMounted(() => {
:key="i"
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.description }}</td>
<td>{{ item.createdDate }}</td>
<td>{{ item.createdID }}</td>
<td style="white-space: nowrap">
<IconInfoBtn @on-click="openDetail(item)" />
<IconInfoBtn @on-click="openDetailModal(item)" />
<IconDeleteBtn
@on-click="
removeData([{ deviceKey: item.deviceKey }])
@ -456,6 +445,7 @@ onMounted(() => {
</tbody>
</v-table>
</v-sheet>
<v-card-actions class="text-center mt-8 justify-center">
<v-pagination
v-model="data.params.pageNum"
@ -463,26 +453,33 @@ onMounted(() => {
:total-visible="10"
color="primary"
rounded="circle"
@update:model-value="getData"
></v-pagination>
@update:model-value="changePageNum"
/>
</v-card-actions>
</v-col>
</v-card>
</v-card>
</v-card>
</v-container>
<v-dialog v-model="data.isModalVisible" max-width="600" persistent>
<!-- 생성 다이얼로그 -->
<v-dialog v-model="data.isCreateVisible" max-width="600" persistent>
<ExperimentCreateDialog
:edit-data="data.selectedData"
:mode="data.modalMode"
@close-modal="closeModal"
@handle-data="saveData"
:user-option="data.userOption"
@saved="fetchList"
@handle-data="() => {}"
/>
</v-dialog>
</div>
<div class="w-100" v-else>
<ViewComponent :experiment="selectedExperiment" @close="closeDetail" />
<ViewComponent
v-if="data.selectedData"
:id="data.selectedData.deviceKey"
@close="closeDetail"
/>
</div>
</template>

@ -1,246 +1,78 @@
<script setup lang="ts">
import IconDeleteBtn from "@/components/atoms/button/IconDeleteBtn.vue";
import IconModifyBtn from "@/components/atoms/button/IconModifyBtn.vue";
// import FormComponent from "@/components/device/FormComponent.vue";
import { onMounted, ref, watch } from "vue";
import { ref, computed, onMounted, watch } from "vue";
import { ExperimentService } from "@/components/service/management/ExperimentService";
import { ProjectService } from "@/components/service/project/projectService"; //
// const store = commonStore();
const props = defineProps<{ id: number | string }>();
const emit = defineEmits<{ (e: "close"): void }>();
const tableHeader = [
{
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 loading = ref(false);
const detailRaw = ref<any | null>(null);
const experimentInfo = ref({
experimentName: "Baseline Model Training",
projectName: "배터리 상태 예측 모델 프로젝트",
createdDate: "2025-02-06",
createdId: "ADMIN_001",
description: "기본 모델 구조로 학습 성능 측정",
experimentName: "-",
projectName: "-",
createdDate: "-",
createdId: "-",
description: "-",
kubeFlowId: "-",
mlFlowId: "-",
});
const data = ref({
params: {
pageNum: 1,
pageSize: 10,
searchType: "",
searchText: "",
},
results: [],
totalDataLength: 0,
pageLength: 0,
modalMode: "",
selectedData: null,
allSelected: false,
selected: [],
isModalVisible: false,
isConfirmDialogVisible: false,
userOption: [],
const formatIso = (s?: string) =>
s ? String(s).replace("T", " ").slice(0, 19) : "-";
const mapToViewModel = (raw: any) => ({
experimentName: raw.displayName ?? raw.name ?? "-",
projectName: "-",
createdDate: formatIso(raw.lastUpdateTime),
createdId: raw.regUserId ?? "-",
description: raw.description ?? "-",
kubeFlowId: raw.kubeFlowId ?? "-",
mlFlowId: raw.mlFlowId ?? "-",
});
const getCodeList = () => {
// UserService.search(data.value.params).then((d) => {
// if (d.status === 200) {
// data.value.userOption = d.data.userList;
// }
// });
};
const info = computed(() => mapToViewModel(detailRaw.value || {}));
const getData = () => {
const params = { ...data.value.params };
if (params.searchType === "" || params.searchText === "") {
delete params.searchType;
delete params.searchText;
async function fetchProjectName(projectId?: number) {
if (!projectId && projectId !== 0) return;
try {
const res = await ProjectService.fetchProjectById(projectId as number);
const prj = res?.data ?? res;
experimentInfo.value.projectName = prj?.prjNm ?? prj?.name ?? "-";
} catch (e) {
console.warn("[Experiment/View] project fetch fail:", e);
}
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 = () => {
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,
);
}
};
async function fetchDetail(id: number | string) {
const idNum = typeof id === "string" ? Number(id) : id;
if (!Number.isFinite(idNum as number)) return;
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,
// });
// }
// });
}
};
loading.value = true;
try {
const res = await ExperimentService.view(idNum as number);
detailRaw.value = res?.data ?? res;
const removeData = (value) => {
let removeList = value ? value : data.value.selected;
const remove = (code) => {
// return DeviceService.delete(code).then((d) => {
// if (d.status !== 200) {
// store.setSnackbarMsg({
// text: d,
// result: 500,
// });
// }
// });
};
const vm = mapToViewModel(detailRaw.value);
experimentInfo.value = { ...experimentInfo.value, ...vm };
if (removeList.length === 1) {
remove(removeList[0].deviceKey).then(() => {
// store.setSnackbarMsg({
// text: ".",
// 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;
},
);
//
await fetchProjectName(detailRaw.value?.projectId);
} catch (e) {
console.error("[Experiment/View] fetch detail error:", e);
} finally {
loading.value = false;
}
};
const changePageNum = (page) => {
data.value.params.pageNum = page;
getData();
};
const emit = defineEmits<{
(e: "close"): void;
}>();
}
onMounted(() => {
getData();
getCodeList();
});
onMounted(() => fetchDetail(props.id));
watch(
() => props.id,
(nv) => {
if (nv !== undefined && nv !== null && nv !== "") fetchDetail(nv);
},
);
</script>
<template>
@ -257,7 +89,10 @@ onMounted(() => {
</v-card-item>
</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">
<span class="font-weight-bold">Experiment Information</span>
</v-card-title>
@ -287,14 +122,23 @@ onMounted(() => {
<!-- Created Date / ID -->
<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"
>Created Date</v-col
>
<v-col cols="3" class="pa-2">{{
experimentInfo.createdDate
}}</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-row>
<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>
<VDivider class="my-2" />
@ -306,100 +150,20 @@ onMounted(() => {
}}</v-col>
</v-row>
</v-card-text>
</v-card>
<v-card flat class="bg-shades-transparent w-100">
<v-card class="rounded-lg pa-8">
<v-card-title class="grey lighten-4 py-2 px-4">
<span class="font-weight-bold">Runs</span>
</v-card-title>
<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"
<v-overlay
:model-value="loading"
contained
persistent
class="align-center justify-center"
>
<td>{{ item.name }}</td>
<td>{{ item.status }}</td>
<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-progress-circular indeterminate size="48" />
</v-overlay>
<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-card>
</v-card>
</v-card>
</v-container>
</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">
import { onMounted, ref, watch } from "vue";
import { commonStore } from "@/stores/commonStore";
import IconDeleteBtn from "@/components/atoms/button/IconDeleteBtn.vue";
import IconModifyBtn from "@/components/atoms/button/IconModifyBtn.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 StapComfigDialog from "@/components/atoms/organisms/StapComfigDialog.vue";
import { AutoflowStepService } from "@/components/service/management/AutoflowStepService";
// const store = commonStore();
import StapComfigDialog from "@/components/atoms/organisms/WorklfowStepBaseDialog.vue";
import { WorkflowStepService } from "@/components/service/management/workflowStepService";
import type { WorkflowStep } from "@/components/models/management/WorkflowStep";
const store = commonStore();
const openView = ref(false);
const openModify = ref(false);
type SearchType = "전체" | "제목" | "작성자";
const tableHeader = [
{ label: "No", width: "5%", style: "word-break: keep-all;" },
{ label: "Step Name", width: "15%", style: "word-break: keep-all;" },
@ -25,308 +29,281 @@ const tableHeader = [
];
const searchOptions = [
{ searchType: "전체", searchText: "" },
{ searchType: "디바이스 별칭", searchText: "deviceAlias" },
{ searchType: "디바이스 키", searchText: "deviceKey" },
{ searchType: "사용자", searchText: "userId" },
{ searchType: "디바이스 이름", searchText: "deviceName" },
{ searchType: "디바이스 모델", searchText: "deviceModel" },
{ searchType: "디바이스 OS", searchText: "deviceOs" },
{ 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 pageSizeOptions = [
{ text: "10 페이지", value: 10 },
{ text: "50 페이지", value: 50 },
{ text: "100 페이지", value: 100 },
];
const workflowList = ["pipeline-a", "pipeline-b", "pipeline-c"];
const data = ref({
params: {
pageNum: 1,
pageSize: 10,
searchType: "",
searchType: "전체" as SearchType,
searchText: "",
},
results: [],
totalDataLength: 0,
results: [] as any[],
totalElements: 0,
pageLength: 0,
modalMode: "",
selectedData: null,
modalMode: "" as "create" | "edit" | "",
selectedData: null as any,
isStepVisible: false,
allSelected: false,
selected: [],
isModalVisible: false,
selected: [] as Array<{ deviceKey: number }>,
isConfirmDialogVisible: false,
userOption: [],
});
const getCodeList = () => {
// UserService.search(data.value.params).then((d) => {
// if (d.status === 200) {
// data.value.userOption = d.data.userList;
// }
// });
};
const toRow = (s: any, no: number) => ({
no,
stepName: s.stepName,
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 getData = () => {
// : No 7 1
data.value.results = [
{
no: 7,
stepName: "Data Ingest",
type: "Preprocessing",
dataset: "raw_data",
script: "ingest.py",
hyperParameters: "-",
resource: "CPU:1, MEM:2Gi",
status: "success",
workflow: "pipeline-a",
deviceKey: 7,
},
{
no: 6,
stepName: "Data Preprocess",
type: "Preprocessing",
dataset: "raw_data",
script: "preprocess.py",
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 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,
};
WorkflowStepService.search(payload)
.then((res: any) => {
if (res.status !== 200) return;
const result = res.data;
let list = result?.content ?? [];
if (needLocalFilter) {
const kw = keyword.toLowerCase();
if (mapped === "TITLE") {
list = list.filter((w: any) =>
String(w?.workflowName ?? "")
.toLowerCase()
.includes(kw),
);
} else if (mapped === "AUTHOR") {
list = list.filter((w: any) =>
String(w?.regUserId ?? "")
.toLowerCase()
.includes(kw),
);
}
};
const setPaginationLength = () => {
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 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 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) => {
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,
// });
// }
// });
/** 검색 실행 (페이지 1로 리셋) */
const doSearch = () => {
data.value.params.pageNum = 1;
fetchList();
};
/** 페이지 이동 */
const changePageNum = (page: number) => {
data.value.params.pageNum = page;
fetchList();
};
/** 페이지 사이즈 변경 */
const changePageSize = (size: number) => {
data.value.params.pageSize = size;
data.value.params.pageNum = 1;
fetchList();
};
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) => {
let removeList = value ? value : data.value.selected;
const remove = (code) => {
// return DeviceService.delete(code).then((d) => {
// if (d.status !== 200) {
// store.setSnackbarMsg({
// text: d,
// result: 500,
// });
// }
// });
};
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;
}
if (removeList.length === 1) {
remove(removeList[0].deviceKey).then(() => {
// store.setSnackbarMsg({
// text: ".",
// result: 200,
// });
changePageNum();
fetchList();
data.value.isConfirmDialogVisible = false;
data.value.selected = [];
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 {
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;
},
);
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);
}
};
const handleRemoveData = () => {
if (data.value.selected.length === 0) {
// store.setSnackbarMsg({
// text: " . ",
// result: 500,
// });
return;
}
if (data.value.allSelected || data.value.selected.length !== 1) {
data.value.isConfirmDialogVisible = true;
return;
}
//
removeData(undefined);
const getSelectedAllData = () => {
data.value.selected = data.value.allSelected
? data.value.results.map((item: any) => ({ deviceKey: item.deviceKey }))
: [];
};
const openDetailModal = (selectedItem: any) => {
data.value.selectedData = selectedItem;
openView.value = true;
};
const closeDetail = () => {
openView.value = false;
};
const changePageNum = (page) => {
data.value.params.pageNum = page;
getData();
};
const openDetailModal = (selectedItem) => {
data.value.selectedData = selectedItem;
openView.value = true;
const openCreateModal = () => {
data.value.selectedData = null;
data.value.modalMode = "create";
data.value.isStepVisible = true;
};
const handleSave = ({
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 }) => {
const openModifyModal = (item: any) => {
data.value.selectedData = {
workflow: item.workflow,
id: item.deviceKey,
stepName: item.stepName,
status: item.status,
workflowStepId: item.workflowId,
};
openModify.value = true;
};
const openCreateModal = () => {
data.value.selectedData = null;
data.value.modalMode = "create";
data.value.isModalVisible = true;
data.value.modalMode = "edit";
data.value.isStepVisible = true;
};
const closeModal = () => {
data.value.isModalVisible = false;
data.value.isStepVisible = false;
data.value.selectedData = null;
};
const getSelectedAllData = () => {
data.value.selected = data.value.allSelected
? data.value.results.map((item) => {
return {
deviceKey: item.deviceKey,
};
})
: [];
};
/** 모달 닫히면 목록 새로고침하고 싶으면 아래 watch 사용 */
// watch(() => data.value.isStepVisible, (now, prev) => {
// if (prev && !now) fetchList();
// });
onMounted(() => {
getData();
getCodeList();
fetchList();
});
</script>
@ -344,6 +321,8 @@ onMounted(() => {
</div>
</v-card-item>
</v-card>
<!-- 상단 검색 (워크플로우 화면과 동일 UX) -->
<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">
@ -357,11 +336,13 @@ onMounted(() => {
label="검색조건"
density="compact"
:items="searchOptions"
item-title="searchType"
item-value="searchText"
item-title="label"
item-value="value"
hide-details
></v-select>
@update:model-value="doSearch"
/>
</v-responsive>
<v-responsive min-width="540" max-width="540">
<v-text-field
v-model="data.params.searchText"
@ -371,8 +352,8 @@ onMounted(() => {
required
class="mt-3 mb-3"
hide-details
@keyup.enter="changePageNum(1)"
></v-text-field>
@keyup.enter="doSearch"
/>
</v-responsive>
<div class="ml-3">
@ -380,14 +361,15 @@ onMounted(() => {
size="large"
color="primary"
:rounded="5"
@click="changePageNum(1)"
@click="doSearch"
>
<v-icon> mdi-magnify</v-icon>
<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"
>
@ -396,9 +378,10 @@ onMounted(() => {
class="d-flex align-center mr-3 mb-2 bg-shades-transparent"
>
<v-chip color="primary"
> {{ data.totalDataLength.toLocaleString() }}
</v-chip>
> {{ data.totalElements.toLocaleString() }}</v-chip
>
</v-sheet>
<v-sheet class="bg-shades-transparent">
<v-responsive max-width="140" min-width="140" class="mb-2">
<v-select
@ -410,13 +393,20 @@ onMounted(() => {
variant="outlined"
color="primary"
hide-details
@update:model-value="changePageNum(1)"
></v-select>
@update:model-value="changePageSize"
/>
</v-responsive>
</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-card class="rounded-lg pa-8">
<v-col cols="12">
<v-sheet>
@ -436,6 +426,7 @@ onMounted(() => {
:style="`width:${item.width}`"
/>
</colgroup>
<thead>
<tr>
<th>
@ -445,7 +436,7 @@ onMounted(() => {
:indeterminate="data.allSelected === true"
hide-details
@change="getSelectedAllData"
></v-checkbox>
/>
</th>
<th
v-for="(item, i) in tableHeader"
@ -457,6 +448,7 @@ onMounted(() => {
</th>
</tr>
</thead>
<tbody class="text-body-2">
<tr
v-for="item in data.results"
@ -485,16 +477,12 @@ onMounted(() => {
>
mdi-checkbox-marked-circle
</v-icon>
<v-icon v-else color="warning">
mdi-alert-circle
</v-icon>
<v-icon v-else color="warning">mdi-alert-circle</v-icon>
</td>
<td>{{ item.workflow }}</td>
<td style="white-space: nowrap">
<IconInfoBtn @on-click="openDetailModal(item)" />
<IconModifyBtn @on-click="openModifyModal(item)" />
<!-- <IconModifyBtn @on-click="openModify = true" /> -->
<IconDeleteBtn
@on-click="
removeData([{ deviceKey: item.deviceKey }])
@ -505,6 +493,8 @@ onMounted(() => {
</tbody>
</v-table>
</v-sheet>
<!-- 페이지네이션 -->
<v-card-actions class="text-center mt-8 justify-center">
<v-pagination
v-model="data.params.pageNum"
@ -512,8 +502,8 @@ onMounted(() => {
:total-visible="10"
color="primary"
rounded="circle"
@update:model-value="getData"
></v-pagination>
@update:model-value="changePageNum"
/>
</v-card-actions>
</v-col>
</v-card>
@ -521,15 +511,23 @@ onMounted(() => {
</v-card>
</v-container>
</div>
<!-- 상세 보기 -->
<div class="w-100" v-else>
<ViewComponent @close="closeDetail" />
<ViewComponent
v-if="data.selectedData"
:id="data.selectedData.deviceKey"
@close="closeDetail"
/>
</div>
<v-dialog v-model="openModify" max-width="600px">
<!-- 생성/수정 모달 -->
<v-dialog v-model="data.isStepVisible" max-width="760" persistent>
<StapComfigDialog
v-model="openModify"
:selectedData="data.selectedData"
:workflowList="workflowList"
@save="handleSave"
:editData="data.selectedData"
:mode="data.modalMode"
@saved="saveStep"
@close-modal="closeModal"
/>
</v-dialog>
</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>
<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-row align="center" class="mb-2">
<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">sentiment-analysis</v-col>
<v-col cols="3">{{ info.workflowName }}</v-col>
</v-row>
<v-divider />
<v-row align="center" class="mt-2">
<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">ADMIN_001</v-col>
<v-col cols="3">{{ info.createdId }}</v-col>
</v-row>
</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>
<!-- 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">
<span class="font-weight-bold">Dataset</span>
</v-card-title>
@ -44,10 +144,10 @@
<v-col cols="3">v2.0</v-col>
</v-row>
</v-card-text>
</v-card>
</v-card> -->
<!-- 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">
<span class="font-weight-bold">Training Script</span>
</v-card-title>
@ -64,10 +164,10 @@
</v-col>
</v-row>
</v-card-text>
</v-card>
</v-card> -->
<!-- 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">
<span class="font-weight-bold">Hyperparameters</span>
</v-card-title>
@ -86,10 +186,10 @@
<v-col cols="3">20</v-col>
</v-row>
</v-card-text>
</v-card>
</v-card> -->
<!-- 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">
<span class="font-weight-bold">Resource & Scheduling</span>
</v-card-title>
@ -106,10 +206,10 @@
<v-col cols="9">1 (NVIDIA A100)</v-col>
</v-row>
</v-card-text>
</v-card>
</v-card> -->
<!-- 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">
<span class="font-weight-bold">Docker image</span>
</v-card-title>
@ -118,18 +218,9 @@
kubeflownotebookswg/jupyter-pytorch-cuda-full:v1.9.2
</v-sheet>
</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> -->
</v-container>
</template>
<script setup lang="ts">
import { defineEmits } from "vue";
const emit = defineEmits<{
(e: "close"): void;
}>();
</script>
<style scoped></style>

@ -2,340 +2,334 @@
import IconDeleteBtn from "@/components/atoms/button/IconDeleteBtn.vue";
import IconModifyBtn from "@/components/atoms/button/IconModifyBtn.vue";
import IconInfoBtn from "@/components/atoms/button/IconInfoBtn.vue";
// import FormComponent from "@/components/device/FormComponent.vue";
import { onMounted, ref, watch } from "vue";
import { onMounted, ref } from "vue";
import { storage } from "@/utils/storage";
import ViewComponent from "@/components/templates/trainingscript/ViewComponent.vue";
import TrainingScriptBaseDoalog from "@/components/atoms/organisms/TrainingScriptBaseDoalog.vue";
import WorkflowsUploadDialog from "@/components/atoms/organisms/WorkflowsUploadDialog.vue";
// const store = commonStore();
import { AttachmentsService } from "@/components/service/management/attachmentsService";
import { commonStore } from "@/stores/commonStore";
const store = commonStore();
const openView = ref(false);
const openModify = ref(false);
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 username = ref<string>("");
type SearchType = "전체" | "제목" | "작성자";
const searchOptions = [
{
searchType: "전체",
searchText: "",
},
{
searchType: "디바이스 별칭",
searchText: "deviceAlias",
},
{
searchType: "디바이스 키",
searchText: "deviceKey",
},
{
searchType: "사용자",
searchText: "userId",
},
{
searchType: "디바이스 이름",
searchText: "deviceName",
},
{
searchType: "디바이스 모델",
searchText: "deviceModel",
},
{
searchType: "디바이스 OS",
searchText: "deviceOs",
},
{ 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 pageSizeOptions = [
{ text: "10 페이지", value: 10 },
{ text: "50 페이지", value: 50 },
{ 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({
params: {
pageNum: 1,
pageSize: 10,
searchType: "",
searchType: "전체" as SearchType,
searchText: "",
},
results: [],
totalDataLength: 0,
results: [] as any[],
totalElements: 0,
pageLength: 0,
modalMode: "",
selectedData: null,
modalMode: "" as "create" | "edit" | "setting" | "",
selectedData: null as any,
allSelected: false,
selected: [],
selected: [] as Array<{ deviceKey: number }>,
isCreateVisible: false,
isUploadVisible: false,
isModalVisible: false,
isConfirmDialogVisible: false,
userOption: [],
userOption: [] as any[],
});
const getCodeList = () => {
// UserService.search(data.value.params).then((d) => {
// if (d.status === 200) {
// data.value.userOption = d.data.userList;
// }
// });
};
//
function readUsernameFromStorage(): string {
try {
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 getData = () => {
const params = { ...data.value.params };
if (params.searchType === "" || params.searchText === "") {
delete params.searchType;
delete params.searchText;
return u1.toString();
} catch {
return "";
}
data.value.results = [
{
title: "배터리 상태 예측 모델 프로젝트",
fileName: "train.py",
filePath: "/kubeflow-users/battery/train.py",
description: "배터리 상태 예측 스크립트",
createdData: "2025-04-28 12:01:00",
modifiedData: "2025-04-28 12:01:00",
},
{
title: "상태 추적 모델",
fileName: "detection.py",
filePath: "/kubeflow-users/status/detection.py",
description: "상태 추적 스크립트",
createdData: "2025-04-20 12:01:00",
modifiedData: "2025-04-28 12:01:00",
},
];
data.value.totalDataLength = 5;
// 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);
// });
}
// ID
const getProjectId = (): number => {
const v = Number(localStorage.getItem("projectId"));
return Number.isFinite(v) ? v : 0;
};
const setPaginationLength = () => {
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 fmtDate = (v?: string) =>
v ? String(v).replace("T", " ").slice(0, 19) : "";
// ( )
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;
}
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,
sortField: "id",
sortDirection: "DESC",
refType: "TRAINING_SCRIPT",
};
try {
const res = await AttachmentsService.search(payload as any);
const result = res?.data ?? res;
let list = result?.content ?? [];
if (needLocalFilter) {
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") {
// 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 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);
data.value.results = pageSlice.map(toRow);
data.value.totalElements = totalElements;
data.value.pageLength = totalPages;
return;
}
//
data.value.results = (list as any[]).map(toRow);
data.value.totalElements = result?.totalElements ?? list.length;
data.value.pageLength = result?.totalPages ?? 1;
} catch (err) {
console.error("[TrainingScript] 조회 에러:", err);
data.value.results = [];
data.value.totalElements = 0;
data.value.pageLength = 1;
}
};
const removeData = (value) => {
let removeList = value ? value : data.value.selected;
const remove = (code) => {
// return DeviceService.delete(code).then((d) => {
// if (d.status !== 200) {
// store.setSnackbarMsg({
// text: d,
// result: 500,
// });
// }
// });
};
/** 검색 실행 (페이지 1로 리셋) */
const doSearch = () => {
data.value.params.pageNum = 1;
fetchList();
};
if (removeList.length === 1) {
remove(removeList[0].deviceKey).then(() => {
// store.setSnackbarMsg({
// text: ".",
// result: 200,
// });
changePageNum();
/** 페이지 이동 */
const changePageNum = (page: number) => {
data.value.params.pageNum = page;
fetchList();
};
/** 페이지 사이즈 변경 */
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;
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);
});
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.selected = [];
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 {
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;
},
);
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);
}
};
const handleRemoveData = () => {
if (data.value.selected.length === 0) {
// store.setSnackbarMsg({
// text: " . ",
// result: 500,
// });
return;
}
if (data.value.allSelected || data.value.selected.length !== 1) {
data.value.isConfirmDialogVisible = true;
return;
}
//
removeData(undefined);
};
const closeDetail = () => {
openView.value = false;
};
const changePageNum = (page) => {
data.value.params.pageNum = page;
getData();
};
const openSettingModal = (selectedItem) => {
const openDetailModal = (selectedItem: any) => {
data.value.selectedData = selectedItem;
data.value.modalMode = "setting";
openView.value = true;
};
const openCreateModal = () => {
data.value.selectedData = null;
data.value.modalMode = "create";
data.value.selectedData = {
username: username.value,
projectId: getProjectId(),
};
data.value.isCreateVisible = true;
};
const openModifyModal = () => {
data.value.selectedData = null;
const openModifyModal = (item: any) => {
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 = () => {
data.value.isModalVisible = false;
data.value.isCreateVisible = null;
data.value.isCreateVisible = false;
data.value.selectedData = null;
};
const closeModifyModal = () => {
data.value.isModalVisible = false;
data.value.isUploadVisible = null;
data.value.isUploadVisible = false;
data.value.selectedData = null;
};
const getSelectedAllData = () => {
data.value.selected = data.value.allSelected
? data.value.results.map((item) => {
return {
deviceKey: item.deviceKey,
};
})
? data.value.results.map((item: any) => ({ deviceKey: item.deviceKey }))
: [];
};
onMounted(() => {
getData();
getCodeList();
username.value = readUsernameFromStorage();
fetchList();
});
</script>
<template>
<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-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">
@ -343,7 +337,9 @@ onMounted(() => {
</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
@ -356,11 +352,12 @@ onMounted(() => {
label="검색조건"
density="compact"
:items="searchOptions"
item-title="searchType"
item-value="searchText"
item-title="label"
item-value="value"
hide-details
></v-select>
/>
</v-responsive>
<v-responsive min-width="540" max-width="540">
<v-text-field
v-model="data.params.searchText"
@ -370,8 +367,8 @@ onMounted(() => {
required
class="mt-3 mb-3"
hide-details
@keyup.enter="changePageNum(1)"
></v-text-field>
@keyup.enter="doSearch"
/>
</v-responsive>
<div class="ml-3">
@ -379,14 +376,15 @@ onMounted(() => {
size="large"
color="primary"
:rounded="5"
@click="changePageNum(1)"
@click="doSearch"
>
<v-icon> mdi-magnify</v-icon>
<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"
>
@ -394,10 +392,12 @@ onMounted(() => {
<v-sheet
class="d-flex align-center mr-3 mb-2 bg-shades-transparent"
>
<!-- 스크립트의 totalElements 사용 -->
<v-chip color="primary"
> {{ data.totalDataLength.toLocaleString() }}
</v-chip>
> {{ data.totalElements.toLocaleString() }}</v-chip
>
</v-sheet>
<v-sheet class="bg-shades-transparent">
<v-responsive max-width="140" min-width="140" class="mb-2">
<v-select
@ -409,18 +409,18 @@ onMounted(() => {
variant="outlined"
color="primary"
hide-details
@update:model-value="changePageNum(1)"
></v-select>
@update:model-value="changePageSize"
/>
</v-responsive>
</v-sheet>
</v-sheet>
<v-sheet class="justify-end mb-2">
<v-btn color="info" @click="openCreateModal"
>Create Script
</v-btn>
<v-btn color="info" @click="openCreateModal">Create Script</v-btn>
</v-sheet>
</v-sheet>
<!-- 목록 -->
<v-card class="rounded-lg pa-8">
<v-col cols="12">
<v-sheet>
@ -428,8 +428,6 @@ onMounted(() => {
density="comfortable"
fixed-header
height="625"
col-md-12
col-12
overflow-x-auto
>
<colgroup>
@ -439,18 +437,20 @@ onMounted(() => {
: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}`"
:style="item.style"
>
{{ item.label }}
</th>
</tr>
</thead>
<tbody class="text-body-2">
<tr
v-for="(item, i) in data.results"
@ -464,8 +464,8 @@ onMounted(() => {
<td>{{ item.createdData }}</td>
<td>{{ item.modifiedData }}</td>
<td style="white-space: nowrap">
<IconInfoBtn @on-click="openSettingModal(item)" />
<IconModifyBtn @on-click="openModifyModal()" />
<IconInfoBtn @on-click="openDetailModal(item)" />
<IconModifyBtn @on-click="openModifyModal(item)" />
<IconDeleteBtn
@on-click="
removeData([{ deviceKey: item.deviceKey }])
@ -476,6 +476,7 @@ onMounted(() => {
</tbody>
</v-table>
</v-sheet>
<v-card-actions class="text-center mt-8 justify-center">
<v-pagination
v-model="data.params.pageNum"
@ -483,36 +484,33 @@ onMounted(() => {
:total-visible="10"
color="primary"
rounded="circle"
@update:model-value="getData"
></v-pagination>
@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="600" persistent>
<TrainingScriptBaseDoalog
:edit-data="data.selectedData"
:mode="data.modalMode"
@close-modal="closeCreateModal"
@handle-data="saveData"
: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"
@saved="fetchList"
:user-option="data.userOption"
/>
</v-dialog>
</div>
<div class="w-100" v-else>
<ViewComponent @close="closeDetail" />
<ViewComponent
v-if="data.selectedData"
:id="data.selectedData.deviceKey"
@close="closeDetail"
/>
</div>
</template>

@ -1,188 +1,113 @@
<script setup lang="ts">
import IconDeleteBtn from "@/components/atoms/button/IconDeleteBtn.vue";
import IconModifyBtn from "@/components/atoms/button/IconModifyBtn.vue";
// import FormComponent from "@/components/device/FormComponent.vue";
import { onBeforeUnmount, onMounted, ref, watch } from "vue";
import {
defineProps,
defineEmits,
ref,
computed,
onMounted,
watch,
onBeforeUnmount,
} from "vue";
import * as monaco from "monaco-editor";
import "monaco-editor/min/vs/editor/editor.main.css";
// const store = commonStore();
import { AttachmentsService } from "@/components/service/management/attachmentsService";
const props = defineProps<{ id: number | string }>();
const emit = defineEmits<{ (e: "close"): void }>();
const loading = ref(false);
const detailRaw = ref<any | null>(null);
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
import torch
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({
params: {
pageNum: 1,
pageSize: 10,
searchType: "",
searchText: "",
},
results: [],
totalDataLength: 0,
pageLength: 0,
modalMode: "",
selectedData: null,
allSelected: false,
selected: [],
isModalVisible: false,
isConfirmDialogVisible: false,
userOption: [],
const formatIso = (s?: string) =>
s ? String(s).replace("T", " ").slice(0, 19) : "-";
const mapToViewModel = (raw: any) => ({
title: raw?.title ?? "-",
fileName: raw?.originalName ?? "-",
filePath: raw?.storagePath ?? "-",
createdDate: formatIso(raw?.regDt),
modifiedDate: "-",
createdId: raw?.regUserId ?? "-",
description: raw?.description ?? "-",
});
const info = computed(() => mapToViewModel(detailRaw.value || {}));
const getCodeList = () => {
// UserService.search(data.value.params).then((d) => {
// if (d.status === 200) {
// data.value.userOption = d.data.userList;
// }
// });
};
function ensureEditor() {
if (editorInstance || !editorRef.value) return;
editorInstance = monaco.editor.create(editorRef.value, {
value: "",
language: "plaintext",
theme: "vs-dark",
readOnly: true,
automaticLayout: true,
minimap: { enabled: false },
lineNumbers: "on",
});
}
const setPaginationLength = () => {
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,
);
}
};
async function loadPreviewFromStoragePath(objectName?: string) {
const key = (objectName || "").trim();
if (!key) return;
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 res = await AttachmentsService.readTextByPath(key);
const removeData = (value) => {
let removeList = value ? value : data.value.selected;
const remove = (code) => {
// return DeviceService.delete(code).then((d) => {
// if (d.status !== 200) {
// store.setSnackbarMsg({
// text: d,
// result: 500,
// });
// }
// });
};
const text =
typeof res?.data === "string" ? res.data : String(res?.data ?? "");
if (removeList.length === 1) {
remove(removeList[0].deviceKey).then(() => {
// store.setSnackbarMsg({
// text: ".",
// result: 200,
// });
ensureEditor();
editorInstance?.setValue(text || "# (empty)");
}
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,
// });
/** 상세 조회 후 storagePath로 프리뷰 호출 */
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`,
);
data.value.isConfirmDialogVisible = false;
data.value.selected = [];
data.value.allSelected = false;
},
await loadPreviewFromStoragePath(
detailRaw.value?.storagePath || detailRaw.value?.storedName,
);
} catch (e) {
console.error("[TrainingScript View] fetch detail error:", e);
} finally {
loading.value = false;
}
};
const changePageNum = (page) => {
data.value.params.pageNum = page;
};
const emit = defineEmits<{
(e: "close"): void;
}>();
}
onMounted(() => {
getCodeList();
if (editorRef.value) {
editorInstance = monaco.editor.create(editorRef.value, {
value: yamlContent,
language: "yaml",
theme: "vs-dark",
readOnly: true,
automaticLayout: true,
minimap: { enabled: false },
lineNumbers: "on",
});
}
ensureEditor();
fetchDetail(props.id);
});
watch(
() => props.id,
(now) => {
if (now !== undefined && now !== null && now !== "") fetchDetail(now);
},
);
onBeforeUnmount(() => {
if (editorInstance) {
editorInstance.dispose();
editorInstance?.dispose();
editorInstance = null;
}
});
</script>
<template>
<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 justify-center w-100"
>
<v-card flat class="bg-shades-transparent w-100">
<v-card flat class="bg-shades-transparent w-100 mb-6">
<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">View Details</div>
@ -192,100 +117,66 @@ onBeforeUnmount(() => {
<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">
<span class="font-weight-bold">Training Script Information </span>
<span class="font-weight-bold">Training Script Information</span>
</v-card-title>
<v-card-text class="px-6 pb-6 pt-4">
<!-- Experiment Name -->
<v-row align="center" class="py-2">
<v-col cols="3" class="text-h6 font-weight-bold"
>Training Script Title
</v-col>
<v-col cols="9" class="pa-2">{{ experimentInfo.modelName }}</v-col>
>Training Script Title</v-col
>
<v-col cols="9" class="pa-2">{{ info.title }}</v-col>
</v-row>
<VDivider class="my-2" />
<!-- Project Name -->
<v-divider class="my-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="9" class="pa-2">{{
experimentInfo.projectName
}}</v-col>
<v-col cols="3" class="text-h6 font-weight-bold">File Name</v-col>
<v-col cols="9" class="pa-2">{{ info.fileName }}</v-col>
</v-row>
<VDivider class="my-2" />
<v-divider class="my-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="9" class="pa-2">{{
experimentInfo.experimentName
<v-col cols="3" class="text-h6 font-weight-bold">File Path</v-col>
<v-col cols="9" class="pa-2" style="word-break: break-all">{{
info.filePath
}}</v-col>
</v-row>
<VDivider class="my-2" />
<!-- Created Date / ID -->
<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="3" class="pa-2">{{ experimentInfo.deployDate }}</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-col cols="3" class="text-h6 font-weight-bold">Created Date</v-col>
<v-col cols="3" class="pa-2">{{ info.createdDate }}</v-col>
<v-col cols="3" class="text-h6 font-weight-bold">Modified Date</v-col>
<v-col cols="3" class="pa-2">{{ info.modifiedDate }}</v-col>
</v-row>
<VDivider class="my-2" />
<!-- Description -->
<v-divider class="my-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="9" class="pa-2">{{ info.createdId }}</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">Description</v-col>
<v-col cols="9" class="pa-2">{{
experimentInfo.description
}}</v-col>
<v-col cols="9" class="pa-2">{{ info.description }}</v-col>
</v-row>
</v-card-text>
</v-card>
<!-- 미리보기 -->
<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">
<span class="font-weight-bold">Training Script Preview </span>
<span class="font-weight-bold">Training Script Preview</span>
</v-card-title>
<v-card-text class="px-6 pb-6 pt-4">
<div ref="editorRef" class="editor-container"></div
></v-card-text>
<div ref="editorRef" class="editor-container"></div>
</v-card-text>
<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-card>
</v-card>
</v-container>
</template>
<style scoped>
.editor-container {
width: 100%;
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);
height: 400px;
}
</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">
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 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 WorkflowsBaseDialog from "@/components/atoms/organisms/WorkflowsBaseDialog.vue";
import WorkflowsUploadDialog from "@/components/atoms/organisms/WorkflowsUploadDialog.vue";
import { AutoflowService } from "@/components/service/management/AutoflowService";
import { commonStore } from "@/stores/commonStore";
import WorkflowsRunDialog from "@/components/atoms/organisms/WorkflowsRunDialog.vue";
import IconInfoBtn from "@/components/atoms/button/IconInfoBtn.vue";
import dayjs from "dayjs";
import utc from "dayjs/plugin/utc";
import tz from "dayjs/plugin/timezone";
import IconDeleteBtn from "@/components/atoms/button/IconDeleteBtn.vue";
import IconRunBtn from "@/components/atoms/button/IconRunBtn.vue";
dayjs.extend(utc);
dayjs.extend(tz);
const KST = "Asia/Seoul";
const store = commonStore();
const openView = ref(false);
const tableHeader = [
{
label: "No",
width: "5%",
style: "word-break: keep-all;",
},
{
label: "Workflow Name",
width: "7%",
style: "word-break: keep-all;",
},
type SearchType = "전체" | "제목" | "작성자";
{
label: "Step Count",
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 isRunVisible = ref(false);
const selectedRun = ref<any | null>(null);
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 = [
{
searchType: "전체",
searchText: "",
},
{
searchType: "디바이스 별칭",
searchText: "deviceAlias",
},
{
searchType: "디바이스 키",
searchText: "deviceKey",
},
{
searchType: "사용자",
searchText: "userId",
},
{
searchType: "디바이스 이름",
searchText: "deviceName",
},
{
searchType: "디바이스 모델",
searchText: "deviceModel",
},
{
searchType: "디바이스 OS",
searchText: "deviceOs",
},
{ label: "전체", value: "전체" as SearchType },
{ label: "제목", value: "제목" as SearchType },
{ label: "사용자", value: "작성자" as SearchType },
];
const pageSizeOptions = [
@ -92,188 +45,166 @@ const pageSizeOptions = [
{ text: "100 페이지", value: 100 },
];
const SEARCH_TYPE_MAP: Record<SearchType | "", "ALL" | "TITLE" | "AUTHOR"> = {
"": "ALL",
전체: "ALL",
제목: "TITLE",
작성자: "AUTHOR",
};
const data = ref({
params: {
pageNum: 1,
pageSize: 10,
searchType: "",
searchType: "전체" as SearchType,
searchText: "",
},
results: [],
totalDataLength: 0,
results: [] as any[],
totalElements: 0,
pageLength: 0,
modalMode: "",
selectedData: null,
modalMode: "" as "create" | "edit" | "upload" | "",
selectedData: null as any,
allSelected: false,
selected: [],
selected: [] as Array<{ deviceKey: number }>,
isCreateVisible: false,
isUploadVisible: false,
isModalVisible: false,
isConfirmDialogVisible: false,
userOption: [],
userOption: [] as any[],
});
dayjs.extend(utc);
dayjs.extend(tz);
const KST = "Asia/Seoul";
const formatDateTime = (
v?: string | number | Date,
fmt = "YYYY-MM-DD HH:mm:ss",
) => (v ? dayjs(v).tz(KST).format(fmt) : "");
const getCodeList = () => {
// UserService.search(data.value.params).then((d) => {
// if (d.status === 200) {
// data.value.userOption = d.data.userList;
// }
// });
};
const toRow = (workflow: any, index: number, offset: number) => ({
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 toRow = (w: any, no: number) => ({
no,
name: w.name,
description: w.description,
version: w.version,
kubeflowStatus: w.kubeflowStatus,
registDt: w.regDt,
deviceKey: w.id,
pipelineId: w.pipelineId ?? w.pipeline_id ?? "",
});
const getData = () => {
const params = data.value.params;
const pageNum = params.pageNum;
const pageSize = params.pageSize;
const startIndex = (pageNum - 1) * pageSize;
const fetchList = () => {
const projectId = Number(localStorage.getItem("projectId"));
if (!projectId) {
console.warn("[Workflows] projectId 없음 — 프로젝트 먼저 선택");
data.value.results = [];
data.value.totalElements = 0;
data.value.pageLength = 0;
return;
}
const { pageNum, searchText, searchType } = data.value.params;
AutoflowService.getAll()
.then((res) => {
if (res.status !== 200) {
console.error("워크플로우 조회 실패:", res);
//
const mapped = SEARCH_TYPE_MAP[searchType] || "ALL";
const keyword = (searchText || "").trim();
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;
console.log(result);
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;
let list = result?.content ?? [];
setPaginationLength();
})
.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);
};
if (needLocalFilter) {
const kw = keyword.toLowerCase();
const saveData = (formData: any) => {
if (data.value.modalMode === "create") {
AutoflowService.add(formData)
.then((res) => {
if (res.status === 200 || res.status === 201) {
data.value.isCreateVisible = false;
store.setSnackbarMsg({
text: "등록 되었습니다.",
result: 200,
color: "success",
});
changePageNum(1); //
} else {
store.setSnackbarMsg({
text: "등록 실패",
result: 500,
color: "warning",
});
if (mapped === "TITLE") {
list = list.filter((w: any) =>
String(w?.name ?? "")
.toLowerCase()
.includes(kw),
);
} else if (mapped === "AUTHOR") {
list = list.filter((w: any) =>
String(w?.regUserId ?? "")
.toLowerCase()
.includes(kw),
);
}
})
.catch((err) => {
console.error("등록 에러:", err);
store.setSnackbarMsg({
text: "등록 중 오류가 발생했습니다.",
result: 500,
color: "error",
});
})
.finally(() => {
getData();
});
} else {
//
const id =
Number(formData?.id) ??
Number(formData?.deviceKey) ??
Number(data.value.selectedData?.deviceKey) ??
Number(data.value.selectedData?.id);
if (!id) {
store.setSnackbarMsg({
text: "수정할 ID가 없습니다.",
result: 500,
color: "error",
});
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 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;
}
AutoflowService.update(id, formData)
.then((res) => {
if (res.status === 200) {
data.value.isCreateVisible = false;
store.setSnackbarMsg({
text: "수정 되었습니다.",
result: 200,
color: "success",
});
changePageNum(data.value.params.pageNum); //
} else {
store.setSnackbarMsg({
text: "수정 실패",
result: 500,
color: "warning",
});
}
})
.catch((err) => {
console.error("수정 에러:", err);
store.setSnackbarMsg({
text: "수정 중 오류가 발생했습니다.",
result: 500,
color: "error",
});
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;
})
.finally(() => {
getData(); //
});
}
.catch((err: any) => console.error("워크플로우 조회 에러:", err));
};
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;
if (!removeList || removeList.length === 0) return;
const ids = removeList.map((x) => x.deviceKey);
const remove = (id) =>
AutoflowService.delete(id).then((res) => {
if (res.status < 200 || res.status >= 300) {
return Promise.reject(res);
}
const remove = (id: number) =>
WorkflowService.delete(id).then((res) => {
if (res.status < 200 || res.status >= 300) return Promise.reject(res);
});
const after = () => {
@ -283,12 +214,12 @@ const removeData = (value) => {
) {
data.value.params.pageNum -= 1;
}
getData();
fetchList();
data.value.isConfirmDialogVisible = false;
data.value.selected = [];
data.value.allSelected = false;
};
console.log(ids.length);
if (ids.length === 1) {
remove(ids[0])
@ -330,39 +261,39 @@ const removeData = (value) => {
};
const handleRemoveData = () => {
if (data.value.selected.length === 0) {
// store.setSnackbarMsg({
// text: " . ",
// result: 500,
// });
return;
}
if (data.value.selected.length === 0) return;
if (data.value.allSelected || data.value.selected.length !== 1) {
data.value.isConfirmDialogVisible = true;
return;
}
//
removeData(undefined);
removeData();
};
const closeDetail = () => {
openView.value = false;
};
const changePageNum = (page) => {
data.value.params.pageNum = page;
getData();
const getSelectedAllData = () => {
data.value.selected = data.value.allSelected
? data.value.results.map((item) => ({ deviceKey: item.deviceKey }))
: [];
};
const openDetailModal = (selectedItem) => {
const openDetailModal = (selectedItem: any) => {
data.value.selectedData = selectedItem;
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) => {
console.log("[openModifyModal] row =", item);
data.value.selectedData = {
id: item.deviceKey,
workflowName: item.name,
workflowDescription: item.description,
};
data.value.modalMode = "edit";
data.value.isCreateVisible = true;
};
@ -378,40 +309,33 @@ const openUploadModal = () => {
data.value.modalMode = "upload";
data.value.isUploadVisible = true;
};
const closeCreateModal = () => {
data.value.isModalVisible = false;
data.value.isCreateVisible = false;
};
const closeUploadModal = () => {
data.value.isModalVisible = false;
data.value.isUploadVisible = false;
};
const getSelectedAllData = () => {
data.value.selected = data.value.allSelected
? data.value.results.map((item) => {
return {
deviceKey: item.deviceKey,
};
})
: [];
};
watch(
() => data.value.isCreateVisible,
(now, prev) => {
if (prev && !now) getData();
if (prev && !now) fetchList();
},
);
watch(
() => data.value.isUploadVisible,
(now, prev) => {
if (prev && !now) getData();
if (prev && !now) fetchList();
},
);
onMounted(() => {
getData();
getCodeList();
fetchList();
});
</script>
@ -442,10 +366,11 @@ onMounted(() => {
label="검색조건"
density="compact"
:items="searchOptions"
item-title="searchType"
item-value="searchText"
item-title="label"
item-value="value"
hide-details
></v-select>
@update:model-value="doSearch"
/>
</v-responsive>
<v-responsive min-width="540" max-width="540">
<v-text-field
@ -456,7 +381,7 @@ onMounted(() => {
required
class="mt-3 mb-3"
hide-details
@keyup.enter="changePageNum(1)"
@keyup.enter="doSearch"
></v-text-field>
</v-responsive>
@ -465,7 +390,7 @@ onMounted(() => {
size="large"
color="primary"
:rounded="5"
@click="changePageNum(1)"
@click="doSearch"
>
<v-icon> mdi-magnify</v-icon>
</v-btn>
@ -481,8 +406,8 @@ onMounted(() => {
class="d-flex align-center mr-3 mb-2 bg-shades-transparent"
>
<v-chip color="primary"
> {{ data.totalDataLength.toLocaleString() }}
</v-chip>
> {{ data.totalElements.toLocaleString() }}</v-chip
>
</v-sheet>
<v-sheet class="bg-shades-transparent">
<v-responsive max-width="140" min-width="140" class="mb-2">
@ -495,7 +420,7 @@ onMounted(() => {
variant="outlined"
color="primary"
hide-details
@update:model-value="changePageNum(1)"
@update:model-value="changePageSize"
></v-select>
</v-responsive>
</v-sheet>
@ -567,14 +492,14 @@ onMounted(() => {
</td>
<td>{{ item.no }}</td>
<td>{{ item.name }}</td>
<td>{{ item.stepCount }}</td>
<td>{{ item.configProgress }}</td>
<td>{{ item.description }}</td>
<td>{{ item.version }}</td>
<td>{{ item.kubeflowStatus }}</td>
<td>{{ formatDateTime(item.registDt) }}</td>
<td style="white-space: nowrap">
<IconRunBtn @on-click="openRunModal(item)" />
<IconInfoBtn @on-click="openDetailModal(item)" />
<!-- <IconSettingBtn /> -->
<IconModifyBtn @on-click="openModifyModal(item)" />
<!-- <IconModifyBtn @on-click="openModifyModal(item)" /> -->
<IconDeleteBtn
@on-click="
removeData([{ deviceKey: item.deviceKey }])
@ -606,8 +531,6 @@ onMounted(() => {
:edit-data="data.selectedData"
:mode="data.modalMode"
@close-modal="closeCreateModal"
@handle-data="saveData"
:user-option="data.userOption"
/>
</v-dialog>
<v-dialog v-model="data.isUploadVisible" max-width="800" persistent>
@ -615,8 +538,14 @@ onMounted(() => {
:edit-data="data.selectedData"
:mode="data.modalMode"
@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>
</div>

@ -2,7 +2,7 @@
import { onMounted, ref, watch, onBeforeUnmount } from "vue";
import * as monaco from "monaco-editor";
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";
@ -10,32 +10,22 @@ const props = defineProps<{ id: number | string }>();
const emit = defineEmits<{ (e: "close"): void }>();
const activeTab = ref<TabKey>("details");
// ----- Monaco Editor -----
const editorRef = ref<HTMLDivElement | null>(null);
let editorInstance: monaco.editor.IStandaloneCodeEditor | null = null;
// ( )
const detail = ref({
workflowName: "",
name: "",
version: "",
workflowDescription: "",
createdDate: "",
createdId: "",
description: "",
kubeflowStatus: "",
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
apiVersion: argoproj.io/v1alpha1
kind: Workflow
@ -51,30 +41,32 @@ spec:
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) {
try {
const res = await AutoflowService.view(Number(id));
const d = res.data;
const res = await WorkflowService.view(Number(id));
const d = res?.data ?? {};
detail.value.workflowName = d.workflowName || "";
detail.value.version = String(d.version || 1);
detail.value.workflowDescription = d.workflowDescription || "";
detail.value.createdDate = d.regDt || d.regDate || "-";
detail.value.createdId = d.regUserId || "-";
if (Array.isArray(d.steps)) {
steps.value = d.steps.map((s: any, idx: number) => ({
order: idx + 1,
name: s.stepName || s.name || `Step ${idx + 1}`,
componentType: s.componentType || s.type || "-",
status: s.status || "Not Configured",
}));
} else {
steps.value = [];
}
// (/)
detail.value = {
name: d.name ?? d.workflowName ?? "",
version: String(d.version ?? ""),
description: d.description ?? d.workflowDescription ?? "",
kubeflowStatus: d.kubeflow_status ?? d.kubeflowStatus ?? "",
namespace: d.namespace ?? "",
pipelineId: d.pipeline_id ?? d.pipelineId ?? "",
regDt: formatDateTime(d.reg_dt ?? d.regDt ?? d.regDate),
};
// YAML ( )
// YAML ( , )
const yamlFromServer =
d.workflowYaml ||
d.yaml ||
@ -86,11 +78,11 @@ async function fetchDetail(id: number | string) {
editorInstance.setValue(yamlFromServer || defaultYaml);
}
} catch (e) {
console.error("[Child] view API failed:", e);
console.error("[Workflow Detail] view API failed:", e);
}
}
/** ===== 마운트 & 변경 감지 ===== */
// ===== & =====
onMounted(() => {
if (editorRef.value) {
editorInstance = monaco.editor.create(editorRef.value, {
@ -105,7 +97,6 @@ onMounted(() => {
}
});
// props.id
watch(
() => props.id,
(val) => {
@ -122,6 +113,22 @@ onBeforeUnmount(() => {
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>
<template>
@ -156,37 +163,67 @@ onBeforeUnmount(() => {
<v-card-title class="grey lighten-4 py-2 px-4">
<span class="font-weight-bold">Workflow Information</span>
</v-card-title>
<v-card-text class="px-6 pb-6 pt-4">
<v-row align="center" class="py-2">
<v-col cols="3" class="text-h6 font-weight-bold"
>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">{{ detail.version }}</v-col>
<v-col cols="3">{{ detail.version || "-" }}</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"
>Workflow Description</v-col
>
<v-col cols="9">{{ detail.workflowDescription }}</v-col>
<v-col cols="9">{{ detail.description || "-" }}</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
>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"
>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-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>
<!-- Steps -->
<!--
==================== [나중에 사용할 Step Overview 섹션] ====================
<v-card
flat
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.status="{ item }">
<v-chip
:color="
{ Configured: 'success', 'Not Configured': 'warning' }[
item.status
] || 'default'
"
:color="({ Configured: 'success', 'Not Configured': 'warning' } as any)[item.status] || 'default'"
small
dark
>
@ -221,13 +254,9 @@ onBeforeUnmount(() => {
</v-chip>
</template>
</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>
========================================================================
-->
</template>
<!-- YAML -->
@ -253,10 +282,14 @@ onBeforeUnmount(() => {
min-height: 500px;
padding-bottom: 84px;
}
.back-to-list {
position: absolute;
right: 24px;
bottom: 24px;
}
.text-truncate {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
</style>

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

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

@ -8,12 +8,12 @@ import logo2 from "@/assets/workflow.png";
import { UserManagerService } from "@/components/service/management/userManagerService";
const router = useRouter();
const ROLE_ITEMS = ["ROLE_USER", "ROLE_MODERATOR", "ROLE_ADMIN"];
const data = ref({
form: false,
username: "",
email: "",
role: [],
role: ROLE_ITEMS[0],
password: "",
loading: false,
snackbar: false,
@ -35,7 +35,7 @@ const resetLogin = () => {
const resetSignup = () => {
data.value.username = "";
data.value.email = "";
data.value.role = [];
data.value.role = "";
data.value.password = "";
data.value.loading = false;
};
@ -44,7 +44,7 @@ const signUp = () => {
const payload = {
username: data.value.username,
email: data.value.email,
role: data.value.role,
role: data.value.role ? [data.value.role] : [],
password: data.value.password,
};
console.log("회원가입 호출 payload:", payload);
@ -112,8 +112,8 @@ const signUp = () => {
></v-text-field>
<v-select
v-model="data.role"
:items="['ROLE_USER', 'ROLE_MODERATOR', 'ROLE_ADMIN']"
multiple
:items="ROLE_ITEMS"
:rules="[(v) => !!v || '역할을 선택해주세요.']"
variant="outlined"
placeholder="Role"
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 = [
{
path: `/`,
path: "/",
component: () => import("@/layouts/default.vue"),
redirect: { name: "login" },
children: [
/** ■ 공용(일반 사용자) 라우트 */
{
name: "main",
path: `/main`,
meta: {
title: "",
requiresAuth: false,
},
path: "/main",
meta: { title: "", requiresAuth: false },
component: () => import("@/pages/MainView.vue"),
},
{
name: "select",
path: `/select`,
meta: {
title: "select",
requiresAuth: false,
hideSidebar: true,
},
path: "/select",
meta: { title: "select", requiresAuth: false, hideSidebar: true },
component: () => import("@/views/Select.vue"),
},
{
name: "project",
path: `/project`,
meta: {
title: "Project",
requiresAuth: false,
},
component: () => import("@/pages/ProjectView.vue"),
},
{
name: "home",
path: `/home`,
meta: {
title: "Home",
requiresAuth: false,
},
path: "/home",
meta: { title: "Home", requiresAuth: false },
component: () => import("@/pages/HomeView.vue"),
},
{
name: "workflows",
path: `/workflows`,
meta: {
title: "Workflows",
requiresAuth: false,
},
path: "/workflows",
meta: { title: "Workflows", requiresAuth: false },
component: () => import("@/pages/WorkflowView.vue"),
},
{
name: "workflow-step-config",
path: `/workflow-step-config`,
meta: {
title: "Workflow Step Config",
requiresAuth: false,
},
path: "/workflow-step-config",
meta: { title: "Workflow Step Config", requiresAuth: false },
component: () => import("@/pages/WorkflowStepConfigView.vue"),
},
{
name: "run",
path: `/run/experiment`,
meta: {
title: "Run",
requiresAuth: false,
},
path: "/run/experiment",
meta: { title: "Run", requiresAuth: false },
redirect: { name: "experiment" },
children: [
{
name: "experiment",
path: `/run/experiment`,
meta: {
title: "Experiment",
requiresAuth: false,
},
path: "/run/experiment",
meta: { title: "Experiment", requiresAuth: false },
component: () => import("@/pages/ExperimentView.vue"),
},
{
name: "Executions",
path: `/run/executions`,
meta: {
title: "Executions",
requiresAuth: false,
},
path: "/run/executions",
meta: { title: "Executions", requiresAuth: false },
component: () => import("@/pages/ExecutionsView.vue"),
},
],
},
{
name: "deployment",
path: `/deployment`,
meta: {
title: "Deployment",
requiresAuth: false,
},
path: "/deployment",
meta: { title: "Deployment", requiresAuth: false },
component: () => import("@/pages/DeploymentView.vue"),
},
{
name: "training-script",
path: `/training-script`,
meta: {
title: "Training Script",
requiresAuth: true,
},
path: "/training-script",
meta: { title: "Training Script", requiresAuth: true },
component: () => import("@/pages/TrainingScriptView.vue"),
},
{
name: "datasets",
path: `/datasets`,
meta: {
title: "Datasets",
requiresAuth: true,
},
path: "/datasets",
meta: { title: "Datasets", requiresAuth: true },
component: () => import("@/pages/DatasetView.vue"),
},
],
},
{
name: "login",
path: `/login`,
name: "project",
path: "/project",
meta: {
title: "로그인",
title: "Projects",
requiresAuth: false,
requiresAdmin: true,
},
component: () => import("@/pages/LoginView.vue"),
component: () => import("@/pages/ProjectView.vue"),
},
{
name: "signup",
path: `/signup`,
name: "users",
path: "/users",
meta: {
title: "회원가입",
title: "Users",
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"),
},
];
@ -172,6 +145,29 @@ router.beforeEach((to) => {
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;
});

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

@ -5,7 +5,6 @@ import { useAutoflowStore } from "@/stores/autoflowStore";
import type {
UiProject,
ApiProject,
Permission,
} from "@/components/models/project/Project";
import { ProjectService } from "@/components/service/project/projectService";
@ -31,6 +30,11 @@ const menuX = ref(0);
const menuY = ref(0);
const selectedIndex = ref<number | null>(null);
// id (reg) ( , / X)
const projectRegById = ref<Record<number, { regId?: string; regNm?: string }>>(
{},
);
const projects = ref<UiProject[]>([]);
type UserOption = { id: number | string; username: string };
const userOptions = ref<UserOption[]>([]);
@ -43,7 +47,8 @@ const form = ref({
prjDesc: "",
selectedUsers: [] as string[],
});
/** ===== 서버 응답 타입 ===== */
/** ===== 롤 ===== */
const roles = ref<string[]>([]);
const refreshRoles = () => {
const auth = storage.getAuth?.() ?? storage.get?.("vpp-Auth") ?? null;
@ -52,27 +57,93 @@ const refreshRoles = () => {
};
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 {
id: number;
prjNm: string;
prjDesc: string;
prjStartDt?: string;
regUserId?: string; // "" ( username)
regUserId?: string;
regUserNm?: string;
modUserId?: string;
modUserNm?: string;
}
interface UserResponseItem {
id: number | 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 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 {
id: modalMode.value === "edit" ? editingProjectId.value! : null,
id: null,
prjCd: form.value.prjCd,
prjNm: form.value.prjNm,
prjDesc: form.value.prjDesc,
@ -80,13 +151,50 @@ const buildApiProjectPayload = (): ApiProject => {
prjEndDt: today,
delYn: "N",
regDate: nowIso,
regUserId: namesCsv,
regUserId: idsCsv,
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,
modUserId: namesCsv,
modUserId: idsCsv,
modUserNm: namesCsv,
};
};
}
const fillerCount = computed(() =>
Math.max(0, pager.value.pageSize - pagedProjects.value.length),
);
const fillers = computed(() => Array.from({ length: fillerCount.value }));
const resetForm = () => {
form.value.prjCd = `PRJ${Date.now()}`;
@ -99,13 +207,33 @@ const loadProjects = async () => {
try {
const { data } = await ProjectService.search();
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,
title: p.prjNm,
creator: p.regUserId ?? "",
date: p.prjStartDt ?? "",
creator: displayNm, // v-select v-model
date: p.prjStartDt, // fallback
description: p.prjDesc,
}));
};
});
if (
pager.value.pageNum >
Math.max(1, Math.ceil(projects.value.length / pager.value.pageSize))
) {
pager.value.pageNum = 1;
}
} catch (e) {
console.error("프로젝트 조회 실패:", e);
}
@ -136,30 +264,27 @@ const closeDialog = () => {
};
const selectProject = (index: number) => {
const selected = projects.value[index];
const selected = pagedProjects.value[index];
autoflowStore.setProjectId(selected.id);
autoflowStore.setProjectName(selected.title);
router.push("/home");
};
/** ===== 프로젝트 저장 & 권한 부여 ===== */
const grantDefaultPermissions = async (
projectId: number,
usernames: string[],
) => {
if (!usernames?.length) return;
const nameSet = new Set(usernames);
const numericIds = userOptions.value
.filter((u) => nameSet.has(u.username))
.map((u) => Number(u.id))
.filter((n) => Number.isFinite(n));
await Promise.all(
numericIds.map((uid) =>
ProjectService.projectAuthority(projectId, {
projectId,
userId: uid, // number
userId: uid,
permissions: DEFAULT_PERMISSIONS,
}),
),
@ -171,20 +296,17 @@ const saveProject = async () => {
alert("권한이 없습니다. (ROLE_ADMIN 전용)");
return;
}
const payload = buildApiProjectPayload();
try {
let projectId: number;
if (modalMode.value === "create") {
const createRes = await ProjectService.add(payload);
const createPayload = buildCreatePayload(); // mod*
const createRes = await ProjectService.add(createPayload); //
projectId = createRes.data.id;
} else {
await ProjectService.update(editingProjectId.value!, payload);
const updatePayload = buildUpdatePayload(); // reg* , mod*
await ProjectService.update(editingProjectId.value!, updatePayload); // non-null
projectId = editingProjectId.value!;
}
await grantDefaultPermissions(projectId, form.value.selectedUsers);
await loadProjects();
closeDialog();
@ -197,8 +319,7 @@ const saveProject = async () => {
const deleteProject = async () => {
try {
if (selectedIndex.value === null) return;
const target = projects.value[selectedIndex.value];
const target = pagedProjects.value[selectedIndex.value];
await ProjectService.delete(target.id);
await loadProjects();
} 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 = () => {
if (!isAdmin.value) {
alert("권한이 없습니다. (ROLE_ADMIN 전용)");
@ -260,19 +344,19 @@ const onAddProject = () => {
const modifyProject = () => {
contextMenu.value = false;
if (selectedIndex.value === null) return;
const selected = pagedProjects.value[selectedIndex.value];
const selected = projects.value[selectedIndex.value];
modalMode.value = "edit";
editingProjectId.value = selected.id;
form.value.prjCd = selected.title;
form.value.prjNm = selected.title;
form.value.prjDesc = selected.description;
// creator reg_user_nm . []
form.value.selectedUsers =
selected.creator
?.split(",")
.map((s) => s.trim())
.filter(Boolean) ?? [];
typeof selected.creator === "string" && selected.creator.length
? selected.creator.split(",").map((s) => s.trim())
: [];
dialog.value = true;
};
@ -301,7 +385,6 @@ onBeforeUnmount(() => {
</v-col>
<v-col cols="auto">
<!-- ADMIN만 노출 -->
<v-btn
v-show="isAdmin"
color="secondary"
@ -315,10 +398,13 @@ onBeforeUnmount(() => {
</v-col>
</v-row>
<!-- 카드 그리드: 현재 페이지 데이터만 렌더 -->
<v-row dense>
<!-- 실제 카드 -->
<v-col
v-for="(project, index) in projects"
:key="index"
v-for="(project, index) in pagedProjects"
:key="project.id"
cols="12"
sm="6"
md="6"
@ -326,7 +412,7 @@ onBeforeUnmount(() => {
class="d-flex"
>
<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"
variant="elevated"
elevation="6"
@ -354,8 +440,46 @@ onBeforeUnmount(() => {
</v-card-text>
</v-card>
</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-menu
v-model="contextMenu"
absolute
@ -407,14 +531,18 @@ onBeforeUnmount(() => {
<v-card-actions>
<v-spacer />
<v-btn text @click="closeDialog">Cancel</v-btn>
<v-btn color="primary" @click="saveProject">
{{ modalMode === "create" ? "Create" : "Save" }}
</v-btn>
<v-btn text @click="closeDialog">Cancel</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</v-container>
</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>>,
'/SignupView': RouteRecordInfo<'/SignupView', '/SignupView', 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>>,
'/WorkflowView': RouteRecordInfo<'/WorkflowView', '/WorkflowView', Record<never, never>, Record<never, never>>,
}

Loading…
Cancel
Save