Skip to content

Commit

Permalink
feat: skeleton, upload and download button
Browse files Browse the repository at this point in the history
  • Loading branch information
martsimq committed Jul 3, 2024
1 parent 38df07a commit 42cbac4
Show file tree
Hide file tree
Showing 7 changed files with 113 additions and 42 deletions.
2 changes: 1 addition & 1 deletion src/api/mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const fetchJob = (task: string) =>
),
),
}),
500,
1000,
);
});

Expand Down
6 changes: 6 additions & 0 deletions src/components/WorkflowChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
import { onMounted } from "vue";
import G6 from "@antv/g6";
import { useJobStore } from "@/store/job.ts";
import { useTaskStore } from "@/store/task.ts";

const props = defineProps<{
graphId: string;
}>();

const jobStore = useJobStore();
const taskStore = useTaskStore();

const getGraphNum = function () {
return "mountNode-" + props.graphId;
Expand Down Expand Up @@ -43,6 +45,10 @@ onMounted(() => {

const group = graph.get("edgeGroup");
group.toFront();

graph.on("click", (e) => {

Check failure on line 49 in src/components/WorkflowChart.vue

View workflow job for this annotation

GitHub Actions / build (18.x, chrisgray0626/gis-agent-frontend, 0.1)

'e' is declared but its value is never read.
taskStore.close();
});
});
</script>

Expand Down
23 changes: 21 additions & 2 deletions src/components/taskConfig/index.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { Close } from "@element-plus/icons-vue";
import { Close, Download } from "@element-plus/icons-vue";
import { useTaskStore } from "@/store/task.ts";
import { storeToRefs } from "pinia";
import { reactive, ref } from "vue";
Expand Down Expand Up @@ -45,6 +45,10 @@ async function onExecute(id: string, input: typeof argConfig) {
function onCancel() {
taskStore.close();
}
function handleClick() {
console.log("click");
}
</script>
<template>
<el-card
Expand Down Expand Up @@ -86,10 +90,22 @@ function onCancel() {
</el-table>
</el-form-item>
<el-descriptions v-if="res" direction="vertical" :column="1">
<el-descriptions-item label="Result">
<el-descriptions-item>
<template #label>
Result
<el-button
type="primary"
:icon="Download"
circle
v-if="res.message"
style="float: right"
@click="handleClick"
/>
</template>
{{ res?.message }}
</el-descriptions-item>
</el-descriptions>

<el-form-item>
<div style="width: 100%; display: flex; justify-content: space-between">
<el-button @click="onCancel">Cancel</el-button>
Expand All @@ -108,4 +124,7 @@ function onCancel() {
background-color: aqua;
border-color: aqua;
}
/deep/ .el-textarea__inner {
resize: none;
}
</style>
99 changes: 64 additions & 35 deletions src/pages/Home/components/LeftBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,50 +6,79 @@ const sessionStore = useSessionStore();
</script>

<template>
<div class="container">
<template v-if="sessionStore.graphShow">
<div class="collapse-item">
<div class="collapse-title">
<div>Question</div>
</div>
<div class="collapse-content">
{{ sessionStore.session.question }}
</div>
<el-skeleton animated :loading="sessionStore.loading">
<template #template>
<div style="padding: 20px">
<el-skeleton-item
variant="h1"
style="height: 50px; margin-bottom: 5px"
></el-skeleton-item>
<el-skeleton-item
variant="h3"
style="height: 30px; width: 95%; margin-bottom: 10px"
></el-skeleton-item>
<el-skeleton-item
variant="h3"
style="height: 30px; width: 95%; margin-bottom: 10px"
></el-skeleton-item>
<el-skeleton-item
variant="h3"
style="height: 30px; width: 95%; margin-bottom: 10px"
></el-skeleton-item>
<el-skeleton-item
variant="h1"
style="height: 50px; margin-bottom: 5px"
></el-skeleton-item>
<el-skeleton-item
variant="image"
style="width: 100%; height: 500px"
></el-skeleton-item>
</div>
<div class="collapse-item">
<div class="collapse-title">
<div>Breakdown</div>
</template>

<template #default>
<template v-if="sessionStore.graphShow">
<div class="collapse-item">
<div class="collapse-title">
<div>Question</div>
</div>
<div class="collapse-content">
{{ sessionStore.session.question }}
</div>
</div>
<div class="collapse-content" style="height: calc(100vh - 380px)">
<BreakdownChart
:graph-id="sessionStore.session.sessionId + '-breakdown'"
/>
<div class="collapse-item">
<div class="collapse-title">
<div>Breakdown</div>
</div>
<div class="collapse-content" style="height: calc(100vh - 380px)">
<BreakdownChart
:graph-id="sessionStore.session.sessionId + '-breakdown'"
/>
</div>
</div>
</div>
</template>
</template>
</div>
</el-skeleton>
</template>

<style lang="less" scoped>
.container {
.collapse-item {
.collapse-item {
box-sizing: border-box;
background-color: #ffffff;
border: 1px solid rgb(220, 223, 230);
border-radius: 3px;
margin: 20px 20px 0 20px;
.collapse-title {
box-sizing: border-box;
background-color: #ffffff;
border: 1px solid rgb(220, 223, 230);
border-radius: 3px;
margin: 20px 20px 0 20px;
.collapse-title {
box-sizing: border-box;
margin: 10px;
}
margin: 10px;
}
.collapse-content {
//margin: 15px 20px 20px;
padding: 10px;
font-size: 14px;
}
.collapse-content {
//margin: 15px 20px 20px;
padding: 10px;
font-size: 14px;
border-top: 1px dashed rgba(0, 0, 0, 0.18);
//border-radius: 3px;
}
border-top: 1px dashed rgba(0, 0, 0, 0.18);
//border-radius: 3px;
}
</style>
4 changes: 2 additions & 2 deletions src/pages/Home/components/RightBox.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts" setup>
import WorkflowChart from "@/components/WorkflowChart.vue";
import NodeConfig from "@/components/taskConfig/index.vue";
import TaskConfig from "@/components/taskConfig/index.vue";
import { useTaskStore } from "@/store/task.ts";
import { useSessionStore } from "@/store/session.ts";
Expand All @@ -14,7 +14,7 @@ const sessionStore = useSessionStore();
v-if="sessionStore.graphShow"
:graph-id="sessionStore.session.sessionId + '-workflow'"
/>
<NodeConfig v-if="taskStore.isShowed" />
<TaskConfig v-if="taskStore.isShowed" />
</div>
</template>

Expand Down
10 changes: 9 additions & 1 deletion src/pages/Home/components/TopBox.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
<script lang="ts" setup></script>
<script lang="ts" setup>
function handleClick() {
console.log("click");
}
</script>

<template>
<div class="container">
<div class="title">AI GIS SYSTEM</div>
<el-button style="position: absolute; right: 20px" @click="handleClick"
>Upload</el-button
>
</div>
</template>

Expand All @@ -12,6 +19,7 @@
justify-content: center;
align-items: center;
height: 100%;
position: relative;
//background-color: #fff;
.title {
font-size: 20px;
Expand Down
11 changes: 10 additions & 1 deletion src/store/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,22 @@ export const useSessionStore = defineStore("session", () => {
});
const graphShow = ref(false);
const questionShow = ref(true);
const loading = ref(false);

// TODO chatted?
async function chatted() {
loading.value = true;
await jobStore.updateData(session.question);
graphShow.value = true;
questionShow.value = false;
loading.value = false;
}

return { session, graphShow, questionShow, chatted };
return {
session,
graphShow,
questionShow,
loading,
chatted,
};
});

0 comments on commit 42cbac4

Please sign in to comment.