Skip to content

Commit

Permalink
0.13.1 (#235)
Browse files Browse the repository at this point in the history
* fixed issue with material total values (#219)

* fixed issue with material total values

* updated version number

* decimals removed from materials breakdown chart

* delete report issue (#221)

* fixed delete, made it display speckle error message when the issue is out of our control

* updated vesrion #

* Rw/bug/model saving (#223)

* fixed issue with material total values

* mostly fixed, just something weird going on with uploading the objects

* some more testing

* fixed issue with models not saving properly

* updated version # and message

* clean up

* messed around with how much we send to speckle at one time so that we don't break the arup speckle server

* updated viewer version (#227)

* Rw/feat/material selection (#226)

* made most of the UI

* started to work on small-ish refactor

* very basic material selection working

* transport step working (hopefully)

* report review working (I think)

* fixed issues with carbon calc

* uploading works, updating almost works

* updating a report is now working

* custom material grouping working

* grouping by diff params working

* deleted commented out code and funcs that are no longer needed

* removed useless variables

* removed console.logs and some imports that are no longer used

* buildups work, updated models with buildups works

* cleanup

* removed some stuff that is no longer needed

* fixed bug

* updated version update messages

* chips on expandmaterialtype now filter objects in renderer

* fixed issue with large models running out of memory

* Rw/dev/parameter selection 2 (#229)

* added in 'undefined' option to filters that need it

* updated version # and dialog

* Assessment page no streams (#231)

* fixed issue

* updated for pr comments

* report sharing (#233)

* added dialog to get share link

* user given option to change server if they're on the wrong one for the report they're trying to view, user redirected to login if they're not signed in and then sent back to report once signed in

* removed console logs

* couple small last changes. Also fixed the 'no streams' page flashing up on the assessment page

* updated version #

* moved share button on report view page

* login redirect (#234)

* updated loading-container to take additional messages, updated login to redirect users back to where they wanted to go after logging in

* small change to button on assessment view button

* updated version number

* addressed comment
  • Loading branch information
Exilliar authored Oct 3, 2023
1 parent 71d8e3e commit 2015f46
Show file tree
Hide file tree
Showing 16 changed files with 380 additions and 35 deletions.
10 changes: 5 additions & 5 deletions src/components/core/VersionUpdateDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,16 @@ export default class VersionUpdateDialog extends Vue {
@Prop() dialog!: boolean;
@Prop() version!: string;
features: { title: string; subtitle: string }[] = [];
fixes: { title: string; subtitle: string }[] = [
features: { title: string; subtitle: string }[] = [
{
title: "Assessment page bug",
title: "Report sharing",
subtitle:
"Fixed a bug leading to the assessment page not showing anything when a user is not assigned to any Speckle streams",
"Report sharing has been added back in. This can be done from either the report view page or on the stream reports page.",
},
];
fixes: { title: string; subtitle: string }[] = [];
@Emit("close")
close() {
return;
Expand Down
13 changes: 8 additions & 5 deletions src/components/landing/ProjectCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,10 @@
</span>
<span v-else></span>
<span>
<v-btn icon color="primary" @click="share">
<v-icon>mdi-share</v-icon>
</v-btn>
<landing-options @delete="checkDelete" @edit="edit" />
<v-select
:menu-props="{ value: options }"
v-if="options"
:items="['one', 'two']"
/>
<v-btn icon color="primary" @click="open">
<v-icon>mdi-open-in-new</v-icon>
</v-btn>
Expand Down Expand Up @@ -121,6 +119,11 @@ export default class ProjectCard extends Vue {
return this.project.category;
}
@Emit("share")
share() {
return this.project;
}
@Emit("delete")
checkDelete() {
return this.project.branchId;
Expand Down
13 changes: 12 additions & 1 deletion src/components/shared/ErrorRetry.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
<template>
<div class="d-flex align-center flex-column" style="width: 100%">
<p>Error</p>
<p v-if="errorMessage">{{ errorMessage }}</p>
<v-btn color="primary" style="color: black" @click="retry">Retry</v-btn>
<template v-if="!isDashboard">
<p class="mt-4">or</p>
<v-btn color="primary" style="color: black" href="/">Return to dashboard</v-btn>
</template>
</div>
</template>
<script lang="ts">
import { Vue, Component, Emit } from "vue-property-decorator";
import { Vue, Component, Prop, Emit } from "vue-property-decorator";
@Component
export default class ErrorRetry extends Vue {
@Prop() errorMessage!: string;
get isDashboard() {
return this.$route.name === "Landing";
}
@Emit("retry")
retry() {
return;
Expand Down
5 changes: 3 additions & 2 deletions src/components/shared/LoadingContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
color="primary"
></v-progress-linear>
</div>
<error-retry v-else @retry="retry" />
<error-retry v-else :errorMessage="errorMessage" @retry="retry" />
</div>
</template>
<script lang="ts">
import { Vue, Component, Prop, Emit, Watch } from "vue-property-decorator";
import { Vue, Component, Prop, Emit } from "vue-property-decorator";
import LoadingSpinner from "./LoadingSpinner.vue";
import ErrorRetry from "./ErrorRetry.vue";
Expand All @@ -26,6 +26,7 @@ import ErrorRetry from "./ErrorRetry.vue";
export default class LoadingContainer extends Vue {
@Prop() loading!: boolean;
@Prop() error!: boolean;
@Prop() errorMessage!: string;
@Prop() line!: boolean;
get loaded() {
Expand Down
93 changes: 93 additions & 0 deletions src/components/shared/ShareReportDialog.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<template>
<v-dialog v-model="dialog" max-width="50%" persistent>
<v-card>
<v-card-title>Share Report: {{ reportName }}</v-card-title>
<v-card-text class="white--text">
<template v-if="isPublic !== 'nope'">
<template v-if="isPublic === true">
<p>
Your stream is PUBLIC, therefore you should be able to share your
report with anyone with access to your current server.
</p>
</template>
<template v-else>
<p>
Your stream is PRIVATE, therefore you will not be able to share
your report with anyone who is not already added to your stream.
Please consult your stream owner on whether to make your stream
public.
</p>
</template>
</template>
<p v-else>Loading</p>
<p>Please use the link below to share your report with others:</p>
<v-text-field
ref="input"
color="primary"
append-icon="mdi-content-copy"
@focus="highlighted($event)"
@click:append="copyLink"
:messages="messages"
:value="fullShareLink"
:readonly="true"
></v-text-field>
</v-card-text>
<v-card-actions class="d-flex justify-end">
<v-btn @click="close">Close</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<script lang="ts">
import { Vue, Component, Prop, Emit, Watch } from "vue-property-decorator";
@Component
export default class ShareReportDialog extends Vue {
@Prop() dialog!: boolean;
@Prop() shareLink!: string;
@Prop() streamid!: string;
@Prop() reportName!: string;
get fullShareLink() {
return `${this.shareLink}?server=${this.$store.state.selectedServer.url}`;
}
messages: string[] = [];
isPublic?: boolean | string = "nope";
@Emit("close")
close() {
return;
}
async mounted() {
if (this.streamid)
this.isPublic = await this.$store.dispatch("checkStreamPublic", {
streamid: this.streamid,
});
}
@Watch("streamid")
async streamIdChange() {
this.isPublic = await this.$store.dispatch("checkStreamPublic", {
streamid: this.streamid,
});
}
highlighted(event: any) {
event.target.select();
navigator.clipboard.writeText(this.fullShareLink);
this.successMessage();
}
copyLink() {
(this.$refs as any).input.onFocus();
this.successMessage();
}
successMessage() {
this.messages = ["Copied to clipboard"];
setTimeout(() => (this.messages = []), 4000);
}
}
</script>
50 changes: 50 additions & 0 deletions src/components/viewAssessment/ChangeServerDialog.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<template>
<v-dialog v-model="dialog" max-width="50%" persistent>
<v-card>
<v-card-title> Speckle Server Mismatch </v-card-title>
<v-card-text class="white--text">
<p>
The Speckle server that you're signed in to does not match the server
for this report.
</p>
<div class="d-flex justify-space-around">
<div>
<p>Your server:</p>
<p>{{ currentServer }}</p>
</div>
<div>
<p>Report server:</p>
<p>{{ reportServer }}</p>
</div>
</div>
<p>Would you like to attempt to log into the correct server?</p>
<div class="d-flex justify-center">
<v-btn color="primary" outlined @click="attemptLogin">Attempt login</v-btn>
</div>
</v-card-text>
<v-card-actions class="d-flex justify-end">
<v-btn href="/">Back to dashboard</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<script lang="ts">
import { Vue, Component, Prop, Emit } from "vue-property-decorator";
@Component
export default class ChangeServerDialog extends Vue {
@Prop() dialog!: boolean;
@Prop() currentServer!: string;
@Prop() reportServer!: string;
@Emit("close")
close() {
return;
}
@Emit("attemptLogin")
attemptLogin() {
return this.reportServer;
}
}
</script>
18 changes: 14 additions & 4 deletions src/components/viewAssessment/ProjectInfoCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@
<v-card width="" flat outlined>
<v-card-title class="d-flex justify-space-between">
<span class="text-h5">{{ name }}</span>
<v-btn icon @click="show = !show">
<v-icon>{{ show ? "mdi-chevron-up" : "mdi-chevron-down" }}</v-icon>
</v-btn>
<div>
<v-btn icon color="primary" @click="share">
<v-icon>mdi-share</v-icon>
</v-btn>
<v-btn icon @click="show = !show">
<v-icon>{{ show ? "mdi-chevron-up" : "mdi-chevron-down" }}</v-icon>
</v-btn>
</div>
</v-card-title>
<v-card-subtitle class="pa-0">
<BECChipGroup v-if="type.length !== 0" :categories="type" />
Expand Down Expand Up @@ -65,7 +70,7 @@
</template>
<script lang="ts">
import { IProjectInfo } from "@/views/utils/process-report-object";
import { Vue, Component, Prop } from "vue-property-decorator";
import { Vue, Component, Prop, Emit } from "vue-property-decorator";
import BECChipGroup from "../shared/BECChipGroup.vue";
@Component({
Expand All @@ -76,6 +81,11 @@ export default class ProjectInfoCard extends Vue {
show = true;
@Emit("share")
share() {
return;
}
get name() {
return this.projectInfo.name;
}
Expand Down
7 changes: 7 additions & 0 deletions src/models/graphql/StreamIsPublicQuery.interface.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export interface StreamIsPublicQuery {
data: {
stream: {
isPublic: boolean;
};
};
}
1 change: 1 addition & 0 deletions src/models/project/Project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ProjectComponent } from "../newAssessment/projectData.interface";

export interface Project {
title: string;
name: string;
id: string;
branchId: string;
co2Values: ChartData[];
Expand Down
43 changes: 40 additions & 3 deletions src/router/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AuthError } from "@/models/auth";
import { AuthError, Server } from "@/models/auth";
import store from "@/store";
import Vue from "vue";
import VueRouter, { RouteConfig } from "vue-router";
Expand Down Expand Up @@ -79,11 +79,48 @@ router.beforeEach(async (to, from, next) => {
// if the user is going to a page that isn't the login page, check that they're logged in
try {
await store.dispatch("getUser");
// if there is a redirect path set then move the user there
const redirectPath = localStorage.getItem("redirect-path");
if (redirectPath !== null && redirectPath !== "") {
localStorage.setItem("redirect-path", "");
next(redirectPath);
}
next();
} catch (err: any) {
// redirect to login page if the user is not signed in
if (err.message === AuthError.NOT_SIGNED_IN) next("/login");
else next("/");
if (err.message === AuthError.NOT_SIGNED_IN) {
if (to.name === "ViewAssessment") {
const { server } = to.query;

if (server) {
let fullReportServer = {} as Server;
let serverSet = false;
Object.values(
store.state.servers as { [server: string]: Server }
).forEach((s) => {
if (s.url === server) {
fullReportServer = s;
serverSet = true;
}
});
if (!serverSet) {
fullReportServer = store.state.servers.custom;
fullReportServer.url = server as string;
}

localStorage.setItem("redirect-path", to.fullPath);

store.dispatch("redirectToAuth", fullReportServer);
next();
}
}
else {
if (to.fullPath !== "/") {
localStorage.setItem("redirect-path", to.fullPath);
}
}
next("/login");
} else next("/");
}
}
}
Expand Down
7 changes: 6 additions & 1 deletion src/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Vue.use(Vuex);

export default new Vuex.Store({
state: {
version: "0.12.3 \u00DF",
version: "0.13.1 \u00DF",
speckleFolderName: "actcarbonreport",
speckleViewer: {
viewer: undefined,
Expand Down Expand Up @@ -431,6 +431,11 @@ export default new Vuex.Store({
setDarkMode({ commit }) {
commit("setDarkMode");
},
async checkStreamPublic(context, { streamid }): Promise<boolean> {
const res = await speckleUtil.streamIsPublicQuery(context, streamid);

return res.data.stream.isPublic;
},
async getObjectDetails(
context,
{ streamid, objecturl }: ObjectDetailsInput
Expand Down
6 changes: 6 additions & 0 deletions src/store/speckle/graphql/speckleQueries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ export const streamsQuery = () => `query {
}
}`;

export const streamIsPublicQuery = (streamId: string) => `query {
stream(id: "${streamId}") {
isPublic
}
}`

export const streamsDataQuery = (streamId: string, objId: string) => `query {
stream(id: "${streamId}") {
object(id: "${objId}") {
Expand Down
Loading

0 comments on commit 2015f46

Please sign in to comment.