Compare commits

...

108 Commits

Author SHA1 Message Date
Hykilpikonna d02cfe0557 [U] Release v0.3.4.561 2019-10-13 21:48:33 -04:00
Hykilpikonna aca0b5635b [+] Show error for assignments and grading too 2019-10-13 21:46:34 -04:00
Hykilpikonna 4e8d3aaeb9 [O] Fix line gap 2019-10-13 21:36:37 -04:00
Hykilpikonna 1c097b639a [O] Reverse dynamic font size 2019-10-13 21:36:28 -04:00
Hykilpikonna ed80b3c82b [O] Separate details and error details 2019-10-13 21:35:52 -04:00
Hykilpikonna 1a59e174ae [O] Make color class red (pink) 2019-10-13 21:31:21 -04:00
Hykilpikonna bbca7c2e14 [F] Should be class instead of style 2019-10-13 21:31:08 -04:00
Hykilpikonna 5c09490d5e [O] Dynamically add error class 2019-10-13 21:28:16 -04:00
Hykilpikonna ba9b24a276 [O] Encapsulate error message function 2019-10-13 21:28:04 -04:00
Hykilpikonna 755b61efe3 [O] Only show spinner if not error 2019-10-13 21:25:17 -04:00
Hykilpikonna 75d6d94757 [+] Switch title to 'Error' dynamically 2019-10-13 21:25:01 -04:00
Hykilpikonna a00285b38a [+] Bind loadingError variable 2019-10-13 21:23:32 -04:00
Hykilpikonna b529aa070a [O] Show error on http error too 2019-10-13 21:21:48 -04:00
Hykilpikonna 38d7b75831 [+] Encapsulate showError function 2019-10-13 21:20:45 -04:00
Hykilpikonna c3b81b5828 [+] Display error after course failed to load 2019-10-13 21:18:57 -04:00
Hykilpikonna 8aae753098 [+] Add loadingError field 2019-10-13 21:18:39 -04:00
Hykilpikonna 382a2aeabc [+] Add error property 2019-10-13 21:15:42 -04:00
Hykilpikonna ec056ef3b3 [+] Remove loading when it's done loading 2019-10-13 21:13:39 -04:00
Hykilpikonna 96d3e6b620 [O] Dynamically size entries based on index 2019-10-13 21:12:32 -04:00
Hykilpikonna 85f59a3983 [+] Add <br> every line 2019-10-13 21:07:50 -04:00
Hykilpikonna 71035ab87b [-] Remove unused pre css 2019-10-13 21:07:29 -04:00
Hykilpikonna bfd91af873 [O] Use span instead of pre 2019-10-13 21:07:17 -04:00
Hykilpikonna de5d406362 [O] Display loading line by line 2019-10-13 21:06:52 -04:00
Hykilpikonna 8c8f405aa5 [+] Add method to split loading messages 2019-10-13 21:03:58 -04:00
Hykilpikonna a59f2e6f7c [+] Log loading before checking grading 2019-10-13 21:02:46 -04:00
Hykilpikonna 5d06ee1c41 [+] Log loading before loading assignments 2019-10-13 21:02:38 -04:00
Hykilpikonna b818420df7 [+] Log loading before loading courses 2019-10-13 21:02:32 -04:00
Hykilpikonna dbe9c69771 [+] Log loading before login 2019-10-13 21:02:17 -04:00
Hykilpikonna 3a58699f62 [O] Fix <pre> tag font 2019-10-13 21:01:53 -04:00
Hykilpikonna f5804c3ce8 [O] Surround text with <pre> tag 2019-10-13 20:59:30 -04:00
Hykilpikonna 5ef7083ee6 [M] Move font-family to theme variable 2019-10-13 20:59:10 -04:00
Hykilpikonna 25370ec412 [+] Create function to log loading 2019-10-13 20:52:12 -04:00
Hykilpikonna b55c25aa7c [O] Hide loading on start because of the login screen 2019-10-13 20:48:17 -04:00
Hykilpikonna 9f68ac8377 [O] Only show loading when loading text is not empty 2019-10-13 20:46:46 -04:00
Hykilpikonna 335cde4d4e [+] Use actual loading text 2019-10-13 20:46:28 -04:00
Hykilpikonna 878b8cf87c [O] Inline loading script 2019-10-13 20:45:03 -04:00
Hykilpikonna 283904d976 [O] Align loading message to bottom 2019-10-13 20:43:52 -04:00
Hykilpikonna 11dea5182b [O] Make details color darker 2019-10-13 20:39:45 -04:00
Hykilpikonna 87f8f49c39 [O] Correct spinner alignments 2019-10-13 20:38:44 -04:00
Hykilpikonna 595033b80f [O] Make the stroke white 2019-10-13 20:37:21 -04:00
Hykilpikonna ccd32ed7e6 [+] Add a loading spinner 2019-10-13 20:35:53 -04:00
Hykilpikonna a40e3b24eb [O] Make details font size smaller 2019-10-13 20:35:41 -04:00
Hykilpikonna 6a4ff9b0a7 [O] Make title font size bigger 2019-10-13 20:35:27 -04:00
Hykilpikonna 2dfb0bf447 [+] Add loading title 2019-10-13 20:35:16 -04:00
Hykilpikonna 21e6352ace Revert "[-] Remove loading"
This reverts commit f1089dbdf5.
2019-10-13 20:29:45 -04:00
Hykilpikonna f1089dbdf5 [-] Remove loading 2019-10-13 20:29:02 -04:00
Hykilpikonna e95efbff59 [O] Center text box vertically 2019-10-13 20:00:10 -04:00
Hykilpikonna 92b46baeed [O] Center text horizontally 2019-10-13 19:59:59 -04:00
Hykilpikonna d45fce6506 [+] Add a loading component in html for testing 2019-10-13 19:43:30 -04:00
Hykilpikonna e4374a6731 [+] Add loading to app 2019-10-13 19:43:11 -04:00
Hykilpikonna cd402c4b86 [O] Make text color white 2019-10-13 19:42:56 -04:00
Hykilpikonna 25bf445582 [O] Darken loading background 2019-10-13 19:42:47 -04:00
Hykilpikonna 74287289e0 [O] Center loading screen 2019-10-13 19:42:33 -04:00
Hykilpikonna cc23f8565a [+] Create loading overlay 2019-10-13 19:42:17 -04:00
Hykilpikonna a537ced0d7 [O] Optimize isAssignmentsReady() 2019-10-13 19:11:38 -04:00
Hykilpikonna 797d962e40 [O] Optimize isGradingReady() with Array.every() 2019-10-13 19:09:55 -04:00
Hykilpikonna 992be72d8d [+] Create course page 2019-10-13 18:56:06 -04:00
Hykilpikonna 375712c0a8 [F] Fix logic error 2019-10-13 18:32:24 -04:00
Hykilpikonna 0b7ab5923c [+] Add version control to cookies 2019-10-13 18:23:36 -04:00
Hykilpikonna d077818508 [F] Make corrections after reverts 2019-10-13 18:23:25 -04:00
Hykilpikonna c991b75384 [-] Revert "[+] Save username to cookies on login"
This reverts commit 5441592d68.
2019-10-13 18:03:18 -04:00
Hykilpikonna 9f59f517b5 [-] Revert "[+] Return username with token"
This reverts commit e28f68aae3.
2019-10-13 18:03:05 -04:00
Hykilpikonna 6654f78486 [-] Revert "[+] Create token interface"
This reverts commit 353a623e5f.
2019-10-13 18:02:45 -04:00
Hykilpikonna 206fef682f [-] Revert "[U] Update http-utils to use token.token"
This reverts commit 543b0ddefe.
2019-10-13 18:02:12 -04:00
Hykilpikonna 3e454423a1 [-] Revert "[U] Also include username when posting request"
This reverts commit 6607afc898.
2019-10-13 18:02:00 -04:00
Hykilpikonna 8326a9e923 [-] Revert "[U] Update variable types"
This reverts commit 6d191f04fb.
2019-10-13 18:01:46 -04:00
Hykilpikonna 5013830815 [-] Revert "[F] Fix http-utils constructor type error"
This reverts commit 0f93a3581f.
2019-10-13 18:00:56 -04:00
Hykilpikonna e4ba53f460 [-] Revert "[O] Optimize token storage"
This reverts commit 846f26db75.
2019-10-13 17:59:07 -04:00
Hykilpikonna fabdc10467 [-] Revert "[U] Use response.data.courses for courses"
This reverts commit 8caab70b25.
2019-10-13 17:57:39 -04:00
Hykilpikonna 91488c6a9f [-] Revert "[+] Save csrf token"
This reverts commit d4df0c3562.
2019-10-13 17:39:25 -04:00
Hykilpikonna f346364633 [O] Make value.min exactly the min value 2019-10-13 17:35:32 -04:00
Hykilpikonna 34e482e8a9 [+] Define value.max for line chart 2019-10-13 17:35:16 -04:00
Hykilpikonna 9aaf662a60 [F] Use scoreId instead of assignmentId when requesting 2019-10-13 15:27:02 -04:00
Hykilpikonna 0b65ebbb00 [+] Parse score_id when parsing 2019-10-13 15:26:32 -04:00
Hykilpikonna 74d1c88f82 [+] Add scoreId to Assignment model 2019-10-13 15:26:22 -04:00
Hykilpikonna 70c8375810 [+] Listen mark as read event 2019-10-13 15:21:00 -04:00
Hykilpikonna b554128337 [+] Implement mark assignment as read 2019-10-13 15:20:49 -04:00
Hykilpikonna 4a8ce2ca18 [O] Use App.http instead of this.http 2019-10-13 15:12:00 -04:00
Hykilpikonna a2df22c1da [O] Make http client static 2019-10-13 15:07:07 -04:00
Hykilpikonna 047ceda252 [-] Remove unnecessary unreadTable() function 2019-10-13 14:53:00 -04:00
Hykilpikonna c94435360f [O] Adjust expansion background clor 2019-10-13 14:51:47 -04:00
Hykilpikonna ed0b7a9740 [O] Use @click instead of onclick 2019-10-13 14:49:44 -04:00
Hykilpikonna b168c4bb82 [+] Call mark as read on click 2019-10-13 14:48:28 -04:00
Hykilpikonna 5078011f40 [+] Add markAsRead() function 2019-10-13 14:47:56 -04:00
Hykilpikonna 1428953cb7 [O] Remove button borders 2019-10-13 14:43:54 -04:00
Hykilpikonna 7f962704d2 [O] Make button paddings smaller 2019-10-13 14:43:44 -04:00
Hykilpikonna 2970263db5 [O] Add left margin 2019-10-13 14:43:31 -04:00
Hykilpikonna 91d9fb90ac [O] Remove button background 2019-10-13 14:43:22 -04:00
Hykilpikonna adb28089b9 [O] Make the button's size mini 2019-10-13 14:42:49 -04:00
Hykilpikonna 6f4a012ac4 [O] Use button instead 2019-10-13 14:42:29 -04:00
Hykilpikonna b807a41496 [O] Make background lighter 2019-10-13 14:08:29 -04:00
Hykilpikonna 02f1fb797f [O] Set color for mark as read 2019-10-13 14:07:54 -04:00
Hykilpikonna caee9117b3 [O] Adjust padding 2019-10-13 14:07:45 -04:00
Hykilpikonna 48cec4c0f0 [+] Add mark-as-read span 2019-10-13 14:07:33 -04:00
Hykilpikonna d4df0c3562 [+] Save csrf token 2019-10-12 20:36:55 -04:00
Hykilpikonna 8caab70b25 [U] Use response.data.courses for courses 2019-10-12 20:36:22 -04:00
Hykilpikonna 846f26db75 [O] Optimize token storage 2019-10-12 20:35:59 -04:00
Hykilpikonna ea2bdb226d [U] Update key names 2019-10-12 20:19:09 -04:00
Hykilpikonna 0f93a3581f [F] Fix http-utils constructor type error 2019-10-12 20:17:00 -04:00
Hykilpikonna 6607afc898 [U] Also include username when posting request 2019-10-12 20:14:57 -04:00
Hykilpikonna 543b0ddefe [U] Update http-utils to use token.token 2019-10-12 20:14:33 -04:00
Hykilpikonna 6d191f04fb [U] Update variable types 2019-10-12 20:14:08 -04:00
Hykilpikonna 353a623e5f [+] Create token interface 2019-10-12 20:11:56 -04:00
Hykilpikonna e28f68aae3 [+] Return username with token 2019-10-12 20:09:22 -04:00
Hykilpikonna 5441592d68 [+] Save username to cookies on login 2019-10-12 20:09:04 -04:00
Hykilpikonna a8e96b142d [+] Add google analytics tag 2019-10-07 21:31:46 -04:00
Hykilpikonna 4527b58084 [O] Optimize alignment for small screens 2019-10-05 20:36:00 -04:00
Hykilpikonna 80d14c1400 [O] Limit max width 2019-10-05 20:30:00 -04:00
20 changed files with 280 additions and 74 deletions
+10
View File
@@ -25,4 +25,14 @@
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
</body>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-Q615K1KFLC"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-Q615K1KFLC');
</script>
</html>
+11 -1
View File
@@ -1,12 +1,20 @@
#app
{
font-family: 'Avenir', Helvetica, Arial, sans-serif;
font-family: var(--font);
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
}
#app-content
{
// Limit max width
max-width: 1300px;
text-align: center;
margin: auto;
}
.theme-default
{
--unread: #ff6c00;
@@ -15,4 +23,6 @@
--assignment-type-2: #3f991e;
--assignment-type-3: #ff9900;
--assignment-type-4: #b02b02;
--font: 'Avenir', Helvetica, Arial, sans-serif;
}
+53 -53
View File
@@ -8,6 +8,7 @@ import pWaitFor from 'p-wait-for';
import {HttpUtils} from '@/utils/http-utils';
import {CourseUtils} from '@/utils/course-utils';
import {GPAUtils} from '@/utils/gpa-utils';
import Loading from '@/components/loading/loading.vue';
/**
* Objects of this interface represent assignment grades.
@@ -15,6 +16,7 @@ import {GPAUtils} from '@/utils/gpa-utils';
export interface Assignment
{
id: number,
scoreId: number,
type: string,
typeId: number,
description: string,
@@ -56,7 +58,7 @@ export interface Course
}
@Component({
components: {Login, Navigation, Overall},
components: {Login, Navigation, Overall, Loading},
})
export default class App extends Vue
{
@@ -78,8 +80,14 @@ export default class App extends Vue
// Token
public token: string = '';
// Loading text
public loading: string = '';
// Loading error
public loadingError: boolean = false;
// Http Client
public http: HttpUtils = new HttpUtils('');
public static http: HttpUtils = new HttpUtils();
/**
* This is called when the instance is created.
@@ -100,11 +108,14 @@ export default class App extends Vue
// Hide login bar
this.showLogin = false;
// Show loading message
this.logLoading('1. Logging in...');
// Store token
this.token = token;
// Assign token to http client
this.http.token = token;
App.http.token = token;
// Load data
this.loadCoursesAfterLogin();
@@ -115,7 +126,11 @@ export default class App extends Vue
*/
public loadCoursesAfterLogin()
{
this.http.post('/courses', {}).then(response =>
// Show loading message
this.logLoading('2. Loading courses...');
// Post request
App.http.post('/courses', {}).then(response =>
{
// Check success
if (response.success)
@@ -126,13 +141,9 @@ export default class App extends Vue
// Load assignments
this.loadAssignments();
}
else
{
// Show error message TODO: Show it properly
alert(response.data);
}
else throw new Error(response.data);
})
.catch(alert);
.catch(e => this.showError(`Error: Course data failed to load.\n(${e})`));
}
/**
@@ -140,11 +151,14 @@ export default class App extends Vue
*/
public loadAssignments()
{
// Show loading message
this.logLoading('3. Loading assignments...');
// Get assignments for all the courses
this.courses.forEach(course =>
{
// Send request to get assignments
this.http.post('/assignments', {id: course.assignmentsId}).then(response =>
App.http.post('/assignments', {'assignmentsId': course.assignmentsId}).then(response =>
{
// Check success
if (response.success)
@@ -153,17 +167,13 @@ export default class App extends Vue
// Parse json and filter it
course.assignments = JsonUtils.filterAssignments(response.data);
}
else
{
// Show error message TODO: Show it properly
alert(response.data);
}
else throw new Error(response.data);
})
.catch(alert);
.catch(e => this.showError(`Error: Assignments data failed to load.\n(${e})`));
});
// Wait for assignments to be ready.
pWaitFor(() => this.isAssignmentsReady()).then(() =>
pWaitFor(() => this.courses.every(c => c.assignments != null)).then(() =>
{
// Filter courses
this.filteredCourses = CourseUtils.getGradedCourses(this.courses);
@@ -173,26 +183,14 @@ export default class App extends Vue
});
}
/**
* Are assignments ready or not
*
* @returns boolean Ready or not
*/
private isAssignmentsReady(): boolean
{
for (const course of this.courses)
{
if (course.assignments == null) return false;
}
return true;
}
/**
* Check the courses' grading algorithms. (Total-mean or percent-type)
*/
private checkGradingAlgorithms()
{
// Show loading message
this.logLoading('4. Checking grading algorithms...');
// Loop through all the courses
for (const course of this.filteredCourses)
{
@@ -204,7 +202,7 @@ export default class App extends Vue
else
{
// Request grading scheme for this course
this.http.post('/grading', {'assignment_id': course.assignmentsId}).then(response =>
App.http.post('/grading', {'assignmentsId': course.assignmentsId}).then(response =>
{
// Check success
if (response.success)
@@ -212,41 +210,43 @@ export default class App extends Vue
// Add it to course
course.grading = response.data;
}
else
{
// Show error message TODO: Show it properly
alert(response.data)
}
else throw new Error(response.data);
})
.catch(alert)
.catch(e => this.showError(`Error: Grading data failed to load.\n(${e})`))
}
}
// Wait for done
pWaitFor(() => this.isGradingReady()).then(() =>
pWaitFor(() => this.filteredCourses.every(c => c.grading != undefined)).then(() =>
{
// When the assignments are ready
// TODO: Display loading
this.assignmentsReady = true;
// Remove loading
this.logLoading('');
})
}
/**
* Are grading algorithms ready or not.
* Log a message to loading screen
*
* @returns boolean Ready or not
* @param message Message
*/
private isGradingReady(): boolean
private logLoading(message: string)
{
for (const course of this.filteredCourses)
{
if (course.grading == undefined)
{
return false;
}
}
if (message == '') this.loading = '';
else this.loading += '\n' + message;
}
return true;
/**
* Show error message on loading screen
*
* @param message Error message
*/
private showError(message: string)
{
this.loadingError = true;
this.loading = message;
}
/**
+3 -1
View File
@@ -1,6 +1,6 @@
<template>
<div id="app" class="theme-default">
<login v-if="showLogin" v-on:login:token="onLogin" :http="http"></login>
<login v-if="showLogin" v-on:login:token="onLogin"></login>
<navigation :courses="filteredCourses"
v-on:sign-out="signOut()"
v-on:navigation:select="onNavigate">
@@ -11,6 +11,8 @@
v-if="selectedTab === 'overall' && assignmentsReady">
</overall>
</div>
<loading v-if="loading !== ''" :text="loading" :error="loadingError"></loading>
</div>
</template>
+115
View File
@@ -0,0 +1,115 @@
<template>
<div id="loading">
<div id="text" :class="message()">
{{message()}}
<div v-if="!error" class="el-loading-spinner">
<svg viewBox="25 25 50 50" class="circular">
<circle cx="50" cy="50" r="20" fill="none" class="path" />
</svg>
</div>
<div v-if="error" id="error-details">
<span v-for="(line, index) in getText()" :style="`font-size: ${-index === 0 ? 16 : 12}px;`">
{{line}}
<br>
</span>
</div>
</div>
<div v-if="!error" id="details">
<span v-for="(line, index) in getText()" :style="`font-size: ${16 - getText().length + index}px;`">
{{line}}
<br>
</span>
</div>
</div>
</template>
<script lang="ts">
import {Component, Prop, Vue} from 'vue-property-decorator';
@Component({
components: {}
})
export default class Loading extends Vue
{
// @ts-ignore
@Prop() text: string;
// @ts-ignore
@Prop() error: boolean;
getText()
{
return this.text.split('\n');
}
message()
{
return this.error ? 'Error' : 'Loading';
}
}
</script>
<style scoped>
#loading
{
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
background: #00000065;
text-align: center;
}
.Error
{
color: #ffdddd !important;
}
#text
{
color: white;
margin: 0;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 46px;
}
#details
{
width: 100%;
position: absolute;
bottom: 0;
left: 0;
margin-top: -5px;
font-size: 16px;
color: #eeeeee;
}
#error-details
{
font-size: 16px;
}
.el-loading-spinner
{
top: unset !important;
margin-top: 0 !important;
width: unset !important;
position: unset !important;
}
.el-loading-spinner .path
{
stroke: white;
}
</style>
+10 -4
View File
@@ -1,6 +1,7 @@
import {Component, Prop, Vue} from 'vue-property-decorator';
import Constants from '@/constants';
import {HttpUtils} from '@/utils/http-utils';
import App from '@/components/app/app';
/**
* This component handles user login, and obtains data from the server.
@@ -17,14 +18,18 @@ export default class Login extends Vue
public loading: boolean = false;
public error: String = '';
@Prop()
public http?: HttpUtils;
/**
* This is called when the instance is created.
*/
public created()
{
// Check cookies version
if (!this.$cookies.isKey('va.version') || this.$cookies.get('va.version') != Constants.VERSION)
{
// Clear all cookies
this.$cookies.keys().forEach(key => this.$cookies.remove(key));
}
// Check login cookies
if (this.$cookies.isKey('va.token'))
{
@@ -42,7 +47,7 @@ export default class Login extends Vue
this.loading = true;
// Fetch request
(<HttpUtils> this.http).post('/login', {username: this.username, password: this.password})
App.http.post('/login', {username: this.username, password: this.password})
.then(response =>
{
// Check success
@@ -50,6 +55,7 @@ export default class Login extends Vue
{
// Save token to cookies
this.$cookies.set('va.token', response.data, '7d');
this.$cookies.set('va.version', Constants.VERSION);
// Call custom event with token
this.$emit('login:token', response.data);
+1 -1
View File
@@ -8,7 +8,7 @@ export default class Constants
*/
public static API_URL: string = 'https://va.hydev.org/api';
public static VERSION: string = '0.3.2.452';
public static VERSION: string = '0.3.4.561';
public static GITHUB: string = 'https://github.com/HyDevelop/VeracrossAnalyzer.Client';
View File
+15
View File
@@ -0,0 +1,15 @@
import {Component, Prop, Vue} from 'vue-property-decorator';
import OverallLine from '@/pages/overall/overall-line/overall-line';
import OverallBar from '@/pages/overall/overall-bar/overall-bar';
import OverallCourse from '@/pages/overall/overall-course/overall-course';
import {Course} from '@/components/app/app';
import {GPAUtils} from '@/utils/gpa-utils';
@Component({
components: {OverallLine, OverallBar, OverallCourse}
})
export default class CoursePage extends Vue
{
// @ts-ignore
@Prop({required: true}) course: Course;
}
+7
View File
@@ -0,0 +1,7 @@
<template>
<div id="course-page">
</div>
</template>
<script src="./course-page.ts" lang="ts"></script>
<style src="./course-page.scss" lang="scss"></style>
@@ -12,7 +12,7 @@
white-space: nowrap;
// Expansion color
background: #f9f9f9;
background: #f4f6f9;
// Main card content
.course-card-content.main
@@ -1,5 +1,5 @@
import {Component, Prop, Vue} from 'vue-property-decorator';
import {Assignment, Course} from '@/components/app/app';
import App, {Assignment, Course} from '@/components/app/app';
import {GPAUtils} from '@/utils/gpa-utils';
import Constants from '@/constants';
import UnreadEntry from '@/pages/overall/overall-course/unread-entry/unread-entry';
@@ -28,8 +28,25 @@ export default class OverallCourse extends Vue
else return this.unread;
}
unreadTable()
/**
* Mark an assignment as read
*/
markAsRead(assignment: Assignment)
{
return [{date: '2019-10-04', name: 'Letter from a Penn Farmer Discussion Forum', grade: '14|14'}];
App.http.post('/mark-as-read', {scoreId: assignment.scoreId})
.then(response =>
{
// Check success
if (response.success)
{
this.unreadAssignments = this.unreadAssignments.filter(a => a != assignment);
this.unread = this.unreadAssignments.length;
}
else
{
// Show error message TODO: Show it properly
alert(response.data)
}
})
}
}
@@ -35,7 +35,8 @@
v-if="countUnread() !== 0">
<unread-entry v-for="assignment in unreadAssignments"
:assignment="assignment"
:key="assignment.id">
:key="assignment.id"
v-on:mark-as-read="markAsRead">
</unread-entry>
</div>
</el-card>
@@ -3,7 +3,7 @@
.unread-entry
{
height: 40px;
padding: 0 20px 0 20px;
padding: 0 10px 0 20px;
background: #f5f7fa;
text-align: left;
@@ -11,6 +11,8 @@
// Date
.el-col.date
{
min-width: 130px;
span.month
{
margin-right: 5px;
@@ -23,8 +25,11 @@
}
}
// Description
.el-col.description
{
width: unset;
span.type
{
display: inline-block;
@@ -46,6 +51,7 @@
.el-col.grade
{
text-align: right;
float: right;
span.percent
{
@@ -74,6 +80,14 @@
background: #ddd;
color: #333;
}
// Mark as read
button.mark-as-read
{
margin-left: 8px;
color: #aaa;
padding: 4px;
}
}
.entry-box
@@ -14,8 +14,17 @@ export default class UnreadEntry extends Vue
*
* @param date Date
*/
private getMoment(date: string)
getMoment(date: string)
{
return moment(new Date(date));
}
/**
* Mark this unread assignment as read
*/
markAsRead()
{
// Call custom event
this.$emit('mark-as-read', this.assignment)
}
}
@@ -19,6 +19,9 @@
</span>
<span class="score entry-box">{{assignment.score}}</span>
<span class="max entry-box">{{assignment.scoreMax}}</span>
<el-button class="mark-as-read" size="mini" type="text"
icon="el-icon-close" @click="markAsRead">
</el-button>
</el-col>
</el-row>
</div>
@@ -56,7 +56,8 @@ export default class OverallLine extends Vue
},
yAxis:
{
min: (value: any) => value.min - 10
min: (value: any) => value.min,
max: (value: any) => value.max
}
};
+1 -1
View File
@@ -30,7 +30,7 @@
.gpa.text
{
font-size: 35px;
font-family: 'Avenir', Helvetica, Arial, sans-serif;
font-family: var(--font);
}
.gpa.max
-5
View File
@@ -4,11 +4,6 @@ export class HttpUtils
{
public token: string = '';
constructor (token: string)
{
this.token = token;
}
public post(node: string, body: any): Promise<any>
{
// Add token
+1
View File
@@ -17,6 +17,7 @@ export default class JsonUtils
result.push(
{
id: assignment.assignment_id,
scoreId: assignment.score_id,
type: assignment.assignment_type,
typeId: assignment.assignment_type_id,
description: assignment.assignment_description,