Skip to content
This repository was archived by the owner on Jul 27, 2024. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
bbd4416
temporary refactor that involves search-bar
nmdanny Aug 27, 2021
004da2e
WIP FE settings
nmdanny Aug 27, 2021
6b5a987
minor BE auth0 changes
nmdanny Aug 27, 2021
619e781
Settings page can now save the user track
nmdanny Aug 27, 2021
8a6e662
'App' is solely responsible for getting student & claims
nmdanny Aug 27, 2021
38a5d76
Do not include course-groups in TrackViewSet list
nmdanny Aug 27, 2021
5561d96
add courses by track route, use it in FE(WIP)
nmdanny Aug 27, 2021
9709953
fix warnings and test
nmdanny Aug 27, 2021
ef02272
add course type to huji import + add more coursetype colors
nmdanny Aug 27, 2021
085c051
Adjust colors
nmdanny Aug 27, 2021
cec3a1f
Change phrasing in some places
nmdanny Aug 27, 2021
ff0d38b
get rid of unused Home code
nmdanny Aug 27, 2021
06bf053
Use better select component, refactor course navigation
nmdanny Aug 27, 2021
d98d671
WIP add course detail, refactor Home
nmdanny Aug 27, 2021
a7eac21
use kebab case in FE components
nmdanny Aug 27, 2021
156811b
refactoring of Take and Student, add CoursePlan
nmdanny Aug 28, 2021
c7c4b34
Forgot to remove TakeSerializer (renamed to CoursePlanSerializer)
nmdanny Aug 28, 2021
7c793d2
move 'track' and 'remaining' from Student into CoursePlan
nmdanny Aug 28, 2021
656bebe
Add "IsAdminOrAuthenticatedReadOnly" permission
nmdanny Aug 29, 2021
9456810
Show course type for courses by tracks endpoint only
nmdanny Aug 29, 2021
ec42187
Take type depends on course_plan track, not student
nmdanny Aug 29, 2021
67b044b
standardize take of a course in FE
nmdanny Aug 30, 2021
2602369
Use 'id' instead of 'pk' in serializers
nmdanny Aug 30, 2021
e48ad40
Add FE support for saving a course plan
nmdanny Aug 31, 2021
9b8cb57
Take/Courseplan retrieve endpoints include detail view for GET
nmdanny Aug 31, 2021
cb05fe8
fix save state footer
nmdanny Aug 31, 2021
b31d1f2
Add 'swrv' data fetching library to FE
nmdanny Aug 31, 2021
a2cd6f9
Implement loading of course plans via FE
nmdanny Aug 31, 2021
04f5345
Move save/load components to their own folder
nmdanny Aug 31, 2021
4ea153d
Refactor 'Home' to use composition API
nmdanny Aug 31, 2021
7dd71f0
BE fix + show course type within courseplan
nmdanny Sep 3, 2021
841c604
BE remove unnecessary line
nmdanny Sep 3, 2021
7a34e9a
FE store fix typo
nmdanny Sep 3, 2021
d7c416d
FE - WIP add course plan settings component
nmdanny Sep 3, 2021
851f806
FE WIP adjustments to save modal
nmdanny Sep 3, 2021
ffc6c84
WIP load plan from link
nmdanny Sep 3, 2021
95fe248
FE minor fixes regarding track shown after saving
nmdanny Sep 3, 2021
3ca5102
Use scoped CSS for a few components
nmdanny Sep 4, 2021
a481a98
FE WIP more changes to loading
nmdanny Sep 4, 2021
d0738b9
Add copyable link to save as modal
nmdanny Sep 4, 2021
047f7bd
Remove unused stuff in Settings page (now useless)
nmdanny Sep 6, 2021
b510ba6
Refactor select components
nmdanny Sep 6, 2021
9b1776a
Refactor course color to component, use in course selection
nmdanny Sep 6, 2021
3de45ed
Some fixes regarding course plan navigation
nmdanny Sep 6, 2021
7662cba
BE: undo useless max_limit check in pagination
nmdanny Sep 7, 2021
c1e6071
BE: add inclusion filters for Course viewsets
nmdanny Sep 7, 2021
7972d45
FE: add a cached course service
nmdanny Sep 7, 2021
8b2c4e6
add hook for syncing course types from current track
nmdanny Sep 7, 2021
0901c1c
refactor course detail to show all possible years
nmdanny Sep 7, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions Closure_Front_End/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Closure_Front_End/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
"axios": "^0.21.1",
"bulma": "^0.9.3",
"core-js": "^3.6.5",
"dexie": "^3.0.3",
"swrv": "^1.0.0-beta.8",
"vue": "^3.0.0",
"vue-multiselect": "^3.0.0-alpha.2",
"vue-router": "^4.0.0-0"
},
"devDependencies": {
Expand Down
89 changes: 58 additions & 31 deletions Closure_Front_End/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,18 @@
<router-link class="navbar-item" to="/"><b>Closure()</b></router-link>
</div>
<div class="navbar-start is-hidden-mobile is-hidden-touch">

<div v-if="currentCourseplan" class="navbar-item">
<span>שם תכנית:
{{ currentCourseplan.name}}
</span>
</div>
<save-menu/>

<div class="navbar-item">
<div class="buttons">
<router-link
v-if="auth.isAuthenticated.value"
class="button is-small is-dark"
to="/data-import"
>
Expand All @@ -19,25 +28,25 @@
</router-link>
<!-- Check that the SDK client is not currently loading before accessing is methods -->
<router-link
v-if="$auth.isAuthenticated.value"
v-if="auth.isAuthenticated.value"
class="button is-small is-dark"
to="/settings"
>
<span class="icon is-small is-right">
<i class="fas fa-user-cog"></i>
</span>
</router-link>
<div v-if="!$auth.loading.value">
<div v-if="!auth.loading.value">
<button
class="button is-small is-dark menu-label"
v-if="!$auth.isAuthenticated.value"
v-if="!auth.isAuthenticated.value"
@click="login"
>
Log in
</button>
<button
class="button is-small is-dark menu-label"
v-if="$auth.isAuthenticated.value"
v-if="auth.isAuthenticated.value"
@click="logout"
>
Log out
Expand All @@ -49,41 +58,59 @@
</nav>

<router-view />

<save-state-footer />
</template>

<script>
import ErrorNotification from './components/ErrorNotification.vue';
import SaveMenu from './save-load/SaveMenu.vue';
import SaveStateFooter from './components/SaveStateFooter.vue';
import { toRefs, reactive, onMounted, provide, inject, readonly} from 'vue';
import { currentCourseplan } from '@/course-store.js'
export default {
name: "App",
components: {ErrorNotification},
data() {
return {
username: "",
components: {ErrorNotification, SaveMenu, SaveStateFooter},
setup() {
const state = reactive({
student: null,
};
},
created() {
/** if the user is loged in, then fetching his data from DB, else doing nothing */
if (this.$auth.isAuthenticated.value) {
this.$auth
.getIdTokenClaims()
.then((response) => (this.username = response.nickname));
this.$http.get(`students/${this.username}`)
.then((response) => this.student = response);
}
},
methods: {
// Log the user in
login() {
this.$auth.loginWithRedirect();
},
// Log the user out
logout() {
this.$auth.logout({
idClaims: null
});

provide("studentAndClaims", readonly(state))
provide("setStudent", (newStudent) => {
state.student = newStudent;
});


const http = inject("http");
const auth = inject("auth");


onMounted(async () => {
if (auth.isAuthenticated.value) {
const claims = await auth.getIdTokenClaims();
const student = (await http.get("student/me")).data;
window.student = student;
window.claims = claims;

state.idClaims = claims;
state.student = student;

console.log(`Authenticated, got claims and student profile`)
}
});

const login = () => auth.loginWithRedirect();
const logout = () => auth.logout({
returnTo: import.meta.env.VITE_AUTH0_REDIRECT_URI
});
},
},
});

return {
...toRefs(state), login, logout, auth, currentCourseplan
}

}
};
</script>
<style src="bulma/css/bulma-rtl.css"></style>
11 changes: 5 additions & 6 deletions Closure_Front_End/src/auth/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,22 +133,21 @@ export const routeGuard = (to, from, next) => {
})
}

export const http = axios.create({
baseURL: import.meta.env.VITE_API_URL
});
window.closureAxios = http;

export const setupAuth = async (options, callbackRedirect) => {
client = await createAuth0Client({
...options,
});


let http = axios.create({
baseURL: import.meta.env.VITE_API_URL
});

http.interceptors.response.use((response) => response,
function (error){
errorHandler(error);
return Promise.reject(error);
});
window.closureAxios = http;


watchEffect(async () => {
Expand Down
48 changes: 48 additions & 0 deletions Closure_Front_End/src/components/CopyableLink.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<template>
<div class="field">
<label v-if="label" class="label">{{ label }}</label>
<div class="control">
<div class="field has-addons">
<div class="control is-expanded">
<input class="input" type="text" :value="url" disabled />
</div>
<div class="control">
<button class="button" @click="copy">
<i class="fas fa-copy"></i>
</button>
</div>
</div>
</div>
</div>
</template>

<script>
import { computed } from "vue";
import router from '@/router';
export default {
props: {
routeName: String,
routeParams: {
type: Object, required: false
},
label: {
type: String,
required: false,
},
},
setup(props) {
const base = import.meta.env.VITE_AUTH0_REDIRECT_URI;
const href = computed(() => router.resolve({ name: props.routeName, params: props.routeParams}).href)
const url = computed(() => new URL(href.value, base).toString());

const copy = async () => {
await navigator.clipboard.writeText(url.value);
};

return { url, copy };
},
};
</script>

<style>
</style>
34 changes: 10 additions & 24 deletions Closure_Front_End/src/components/CourseBox.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<template>
<div class="box box-style">
<div class="media">
<span class="icon is-small is-right is-size-7">
<i class="fas fa-circle" :class="colorMatch()"></i>
</span>
<course-color-circle :courseType="course.type" />

<div class="media-content">
{{ course.name }}
Expand All @@ -23,20 +21,20 @@
</template>

<script>
export default {
props: ["course"],
import CourseColorCircle from './CourseColorCircle.vue'

methods: {
colorMatch() {
if (this.course.type == 1) return "must";
if (this.course.type == 2) return "choose_from_list";
return "choice";
},
export default {
props: {
course: {
type: Object, required: true
}
},
emits: ['clickclose'],
components: { CourseColorCircle },
};
</script>

<style>
<style scoped>
.box-style {
padding: 0.25rem;
box-shadow: 0px 0px 0px 0px;
Expand All @@ -54,16 +52,4 @@ export default {
.fa-times-circle:hover {
cursor: pointer;
}

.must {
color: #bc87d0;
}

.choose_from_list {
color: #fbaf5d;
}

.choice {
color: #f06eaa;
}
</style>
Loading