Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SubsemesterScheduler, component reorganization, Prettier code style, add jsdocs #51

Merged
merged 24 commits into from
Mar 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
a6d9100
Move common functionality to separate modules. Started as mixins but …
123joshuawu Mar 13, 2020
38b20ea
Moved data parsing and 'enrichment' to YacsService
123joshuawu Mar 13, 2020
33dd98a
Added new service for managing multiple schedules, one for each subse…
123joshuawu Mar 13, 2020
d600db6
Moved courseIdentifier to YacsService. Added option to provide confli…
123joshuawu Mar 13, 2020
3fbe643
Reorganized modules. Moved CourseList out of Main and SelectedCourses…
123joshuawu Mar 13, 2020
2a94ac4
Cosmetic changes and inclusion of index.js files to allow module impo…
123joshuawu Mar 13, 2020
3dd0c40
Changed to singleton
123joshuawu Mar 13, 2020
7941bf0
Added proxy to devServer so CORS no longer required on backend. Chang…
123joshuawu Mar 13, 2020
0c6b3b0
Use only one schedule component for each subsemester, dynamically cha…
CoreyBuckley Mar 14, 2020
d338175
Revert to v-show and add v-if wrapper
123joshuawu Mar 14, 2020
1a198f0
Allow adding multiple sections from a course
123joshuawu Mar 14, 2020
ceb5c25
Refactor semester.text to semester.display_string
123joshuawu Mar 14, 2020
02f9d06
Moved .schedule-event css from Schedule to ScheduleEvent
123joshuawu Mar 14, 2020
d418cc5
Remove all ics calendar implementation
123joshuawu Mar 14, 2020
ae339d0
Use scheduler.scheduleSubsemesters as subsemester options
123joshuawu Mar 14, 2020
cca5ef7
Remove index.js for components to fix some weird import errors
123joshuawu Mar 14, 2020
1d106ab
Add sorting to YacsService
123joshuawu Mar 14, 2020
980f974
Add prettier code formatter to start to enforce code style
123joshuawu Mar 14, 2020
3af1e95
Move section.selected from Schedule.addCourseSection to Main.vue
123joshuawu Mar 14, 2020
eaa22e0
Update config files to enable @ webpack import alias for src/ directory
123joshuawu Mar 15, 2020
ccb36ef
Use Prettier as code style. Added type definitions in index.d.ts. Add…
123joshuawu Mar 15, 2020
2376bcf
Move type definitions back to jsdoc and store in typedef.js
123joshuawu Mar 15, 2020
58f0ffe
Add directory for controllers. Move ScheduleService and SubsemesterSc…
123joshuawu Mar 15, 2020
9a9739e
Add config file for generating documentation for .js files using jsdoc
123joshuawu Mar 15, 2020
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
3 changes: 0 additions & 3 deletions src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
import db.courses as Courses
from io import StringIO

from flask_cors import CORS

# - init interfaces to db
db_conn = connection.db
class_info = ClassInfo.ClassInfo(db_conn)
Expand All @@ -21,7 +19,6 @@
app = Flask(
__name__,
template_folder='./public/templates')
CORS(app)


# - web routes break into routes/ ... later
Expand Down
1 change: 0 additions & 1 deletion src/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
Flask==1.1.1
Flask-Cors==3.0.8
gevent==1.4.0
gunicorn==19.9.0
Jinja2==2.10.3
Expand Down
7 changes: 2 additions & 5 deletions src/yacs-web/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@ module.exports = {
env: {
node: true
},
'extends': [
'plugin:vue/essential',
'eslint:recommended'
],
extends: ['plugin:vue/essential', 'eslint:recommended', 'prettier'],
parserOptions: {
parser: 'babel-eslint'
},
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
}
}
};
1 change: 1 addition & 0 deletions src/yacs-web/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.DS_Store
node_modules
/dist
docs

# local env files
.env.local
Expand Down
16 changes: 16 additions & 0 deletions src/yacs-web/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"printWidth": 100,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"quoteProps": "as-needed",
"jsxSingleQuote": false,
"trailingComma": "none",
"bracketSpacing": true,
"jsxBracketSameLine": false,
"arrowParens": "avoid",
"proseWrap": "preserve",
"htmlWhitespaceSensitivity": "css",
"vueIndentScriptAndStyle": false
}
11 changes: 11 additions & 0 deletions src/yacs-web/README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,35 @@
# yacs-web

[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)

# Note for vscode users

If you're having trouble getting intellisense or '@' import alias working in .vue files, try using yacs-web as the root directory. For some reason, vscode has a hard time with jsconfig.json when it isn't in the root directory of your current workspace.

## Project setup

```
npm install
```

### Compiles and hot-reloads for development

```
npm run serve
```

### Compiles and minifies for production

```
npm run build
```

### Lints and fixes files

```
npm run lint
```

### Customize configuration

See [Configuration Reference](https://cli.vuejs.org/config/).
6 changes: 2 additions & 4 deletions src/yacs-web/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
module.exports = {
"presets": [
"@vue/cli-plugin-babel/preset"
]
}
presets: ['@vue/cli-plugin-babel/preset']
};
11 changes: 11 additions & 0 deletions src/yacs-web/jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"allowSyntheticDefaultImports": false,
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["src/*"]
}
},
"exclude": ["node_modules", "dist"],
"include": ["./src/**/*"]
}
12 changes: 12 additions & 0 deletions src/yacs-web/jsdoc.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"source": {
"includePattern": ".+\\.js(doc|x)?$",
"include": ["src"],
"exclude": ["node_modules", "dist", "docs"]
},
"plugins": ["plugins/markdown"],
"opts": {
"destination": "./docs/",
"recurse": true
}
}
16 changes: 14 additions & 2 deletions src/yacs-web/package-lock.json

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

2 changes: 2 additions & 0 deletions src/yacs-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
"axios": "^0.19.2",
"bootstrap-vue": "^2.1.0",
"core-js": "^3.6.4",
"eslint-config-prettier": "^6.10.0",
"moment": "^2.24.0",
"moment-locales-webpack-plugin": "^1.1.2",
"prettier": "^1.19.1",
"vue": "^2.6.11",
"vue-router": "^3.1.6"
},
Expand Down
9 changes: 4 additions & 5 deletions src/yacs-web/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@
</template>

<script>

export default {
name: 'App'
}
};
</script>

<style lang="scss">
body {
overflow-x: hidden;
}
body {
overflow-x: hidden;
}
</style>
98 changes: 98 additions & 0 deletions src/yacs-web/src/components/CourseList.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<template>
<div>
<div class="course-search">
<b-form-group label="Search" label-for="search">
<b-form-input
id="search"
v-model="textSearch"
trim
placeholder="Intro to College - COLG 1030 - 5/2"
></b-form-input>
</b-form-group>

<b-form-group label="Filter Sub-Semester" for="sub-semester">
<b-form-select v-model="selectedSubsemester" :options="subsemesterOptions"></b-form-select>
</b-form-group>

<b-form-group label="Filter Department" for="department">
<b-form-select v-model="selectedDepartment" :options="departmentOptions"></b-form-select>
</b-form-group>
</div>

<hr />

<b-list-group class="course-list" flush>
<b-list-group-item
button
v-for="course in filteredCourses"
:key="course.name + course.date_end + course.date_start"
:disabled="course.selected"
:class="{ 'bg-light': course.selected }"
@click="$emit('addCourse', course)"
>
<b>{{ course.name }}</b>
({{ readableDate(course.date_start) }} - {{ readableDate(course.date_end) }})
<br />
{{ course.title }}
</b-list-group-item>
</b-list-group>
</div>
</template>

<script>
import '@/typedef';

import { readableDate } from '@/utils';

import { getCourses, getDepartments, getSubSemesters } from '@/services/YacsService';

export default {
name: 'CourseList',
data() {
return {
textSearch: null,
selectedSubsemester: null,
subsemesterOptions: [{ text: 'All', value: null }],
selectedDepartment: null,
departmentOptions: [{ text: 'All', value: null }],
/** @type {Course[]} */
courses: []
};
},
created() {
getCourses().then(courses => this.courses.push(...courses));
getDepartments().then(departments => {
this.departmentOptions.push(...departments.map(d => d.department));
});
getSubSemesters().then(subsemesters => {
this.subsemesterOptions.push(
...subsemesters.map(subsemester => {
return { text: subsemester.display_string, value: subsemester };
})
);
});
},
methods: {
readableDate
},
computed: {
/**
* Returns a list of courses that match the selected filters
* @returns {Course[]}
*/
filteredCourses() {
return this.courses.filter(({ date_start, date_end, department, str }) => {
return (
(!this.selectedSubsemester ||
(this.selectedSubsemester.date_start.getTime() === date_start.getTime() &&
this.selectedSubsemester.date_end.getTime() === date_end.getTime())) &&
(!this.selectedDepartment || this.selectedDepartment === department) &&
(!this.textSearch || str.includes(this.textSearch.toUpperCase()))
);
});
}
}
};
</script>

<style></style>
14 changes: 6 additions & 8 deletions src/yacs-web/src/components/Header.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
<template>
<b-navbar variant="info">
<b-navbar-brand href="#">YACS</b-navbar-brand>
</b-navbar>
<b-navbar variant="info">
<b-navbar-brand href="#">YACS</b-navbar-brand>
</b-navbar>
</template>

<script>
export default {
name: 'Header'
}
name: 'Header'
};
</script>

<style>

</style>
<style></style>
Loading