Skip to content

Commit

Permalink
login redirect (#234)
Browse files Browse the repository at this point in the history
* 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 committed Sep 8, 2023
1 parent 3fb7062 commit eb117af
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 19 deletions.
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
7 changes: 1 addition & 6 deletions src/components/viewAssessment/ChangeServerDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</div>
</v-card-text>
<v-card-actions class="d-flex justify-end">
<v-btn @click="toDashboard">Back to dashboard</v-btn>
<v-btn href="/">Back to dashboard</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
Expand All @@ -46,10 +46,5 @@ export default class ChangeServerDialog extends Vue {
attemptLogin() {
return this.reportServer;
}
@Emit("toDashboard")
toDashboard() {
return;
}
}
</script>
5 changes: 5 additions & 0 deletions src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ router.beforeEach(async (to, from, next) => {
next();
}
}
else {
if (to.fullPath !== "/") {
localStorage.setItem("redirect-path", to.fullPath);
}
}
next("/login");
} else next("/");
}
Expand Down
2 changes: 1 addition & 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.13.0 \u00DF",
version: "0.13.1 \u00DF",
speckleFolderName: "actcarbonreport",
speckleViewer: {
viewer: undefined,
Expand Down
14 changes: 9 additions & 5 deletions src/views/StreamReports.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<template>
<v-main class="mr-7 ml-7 pb-4">
<loading-container :error="error" :loading="loading" @retry="loadStreams">
<loading-container
:error="error"
errorMessage="Stream not found. Please make sure you are signed into the correct server."
:loading="loading"
@retry="loadStreams"
>
<template v-slot="{ loaded }">
<v-container v-if="loaded">
<v-data-iterator
Expand Down Expand Up @@ -192,9 +197,7 @@ export default class StreamReports extends Vue {
// this.quickBranchName = branchName;
// this.quickReport = true;
// this.$router.push({ name: "UpdateAssessmentBranch"})
this.$router.push(
`assessment/${this.streamid}/${branchName}`
);
this.$router.push(`assessment/${this.streamid}/${branchName}`);
}
quickReportClose() {
this.quickReport = false;
Expand Down Expand Up @@ -258,7 +261,8 @@ export default class StreamReports extends Vue {
} else {
this.snackTimeout = 30000;
this.deleteSuccess = false;
this.deleteSnackTextError = "Something went wrong:" + deleted.errors[0].message;
this.deleteSnackTextError =
"Something went wrong:" + deleted.errors[0].message;
this.deleteSnack = true;
}
} catch (err) {
Expand Down
4 changes: 0 additions & 4 deletions src/views/ViewAssessment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
:reportServer="reportServer"
@close="closeChangeServerDialog"
@attemptLogin="attemptLogin"
@toDashboard="toDashboard"
/>
</v-main>
</template>
Expand Down Expand Up @@ -191,9 +190,6 @@ export default class ViewAssessment extends Vue {
back() {
this.$router.push(`/${this.streamId}`);
}
toDashboard() {
this.$router.push("/");
}
async loadReport() {
this.loading = true;
Expand Down

0 comments on commit eb117af

Please sign in to comment.