Skip to content

Commit

Permalink
no more report
Browse files Browse the repository at this point in the history
  • Loading branch information
rouk1 committed Oct 2, 2024
1 parent ae049db commit fe836d2
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 15 deletions.
9 changes: 6 additions & 3 deletions frontend/src/ShareApp.vue
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
<script setup lang="ts">
import Simplebar from "simplebar-vue";
import ReportCanvas from "@/components/ProjectViewCanvas.vue";
import ProjectViewCanvas from "@/components/ProjectViewCanvas.vue";
import { useProjectStore } from "@/stores/project";
const projectStore = useProjectStore();
</script>

<template>
<div class="share">
<div class="share-header">
<h1>Report</h1>
<h1>{{ projectStore.currentView }}</h1>
</div>
<Simplebar class="canvas-wrapper">
<ReportCanvas :showCardActions="false" />
<ProjectViewCanvas :showCardActions="false" />
</Simplebar>
</div>
</template>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { createRouter, createWebHashHistory } from "vue-router";
import ProjectView from "./views/ProjectView.vue";

export enum ROUTE_NAMES {
REPORT_BUILDER = "report-builder",
VIEW_BUILDER = "view-builder",
COMPONENTS = "components",
}

Expand All @@ -12,7 +12,7 @@ const router = createRouter({
routes: [
{
path: "/",
name: "report-builder",
name: "view-builder",
component: ProjectView,
},
{
Expand Down
3 changes: 1 addition & 2 deletions frontend/src/stores/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ export const useProjectStore = defineStore("project", () => {
}

/**
* Fetch all reports URI
* and eventually the detail of the currently selected view
* Fetch project data from the backend.
*/
let _isCanceledCall = false;
async function fetch() {
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/views/ProjectView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const isInFocusMode = ref(false);
const views = ref<EditableListItemModel[]>([]);
let unsavedViewsIds: string[] = [];
async function onShareReport() {
async function onShareView() {
const currentView = projectStore.currentView;
if (currentView) {
const shareable = await fetchShareableBlob(currentView);
Expand Down Expand Up @@ -170,7 +170,7 @@ onBeforeUnmount(() => {
<div class="editor-header">
<SimpleButton icon="icon-maximize" @click="onFocusMode" />
<h1>{{ projectStore.currentView }}</h1>
<SimpleButton label="Share report" @click="onShareReport" :is-primary="true" />
<SimpleButton label="Share view" @click="onShareView" :is-primary="true" />
</div>
<div class="drop-indicator" :class="{ visible: isDropIndicatorVisible }"></div>
<Transition name="fade">
Expand Down
12 changes: 6 additions & 6 deletions frontend/tests/views/ProjectView.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { createApp } from "vue";
import { useRoute } from "vue-router";

import { ROUTE_NAMES } from "@/router";
import ReportBuilderView from "@/views/ProjectView.vue";
import ProjectView from "@/views/ProjectView.vue";
import { mountSuspense } from "../test.utils";

vi.mock("@/services/api", () => {
Expand All @@ -22,7 +22,7 @@ vi.hoisted(() => {
window.URL.revokeObjectURL = mockObjectURL;
});

describe("ReportBuilderView", () => {
describe("ProjectView", () => {
beforeEach(() => {
vi.mock("vue-router");

Expand All @@ -38,18 +38,18 @@ describe("ReportBuilderView", () => {

it("Renders properly", async () => {
vi.mocked(useRoute).mockImplementationOnce(() => ({
fullPath: `/${ROUTE_NAMES.REPORT_BUILDER}`,
path: `/${ROUTE_NAMES.REPORT_BUILDER}`,
fullPath: `/${ROUTE_NAMES.VIEW_BUILDER}`,
path: `/${ROUTE_NAMES.VIEW_BUILDER}`,
query: {},
params: {},
matched: [],
name: ROUTE_NAMES.REPORT_BUILDER,
name: ROUTE_NAMES.VIEW_BUILDER,
hash: "",
redirectedFrom: undefined,
meta: {},
}));

const builder = await mountSuspense(ReportBuilderView);
const builder = await mountSuspense(ProjectView);
// i.e. not a `VueError`
expect(builder).toBeInstanceOf(VueWrapper);
});
Expand Down

0 comments on commit fe836d2

Please sign in to comment.