Skip to content

Commit 19d15a8

Browse files
authored
Merge pull request #3 from observatorycontrolsystem/feature/add-compose-form
Feature/add compose form
2 parents 2d5181f + 31ad2cd commit 19d15a8

21 files changed

Lines changed: 3441 additions & 19642 deletions

package-lock.json

Lines changed: 2478 additions & 18994 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,14 @@
88
"lint": "vue-cli-service lint"
99
},
1010
"dependencies": {
11-
"babel-plugin-polyfill-corejs2": "^0.2.0",
11+
"@vue/composition-api": "^1.0.0-rc.7",
1212
"bootstrap": "^4.5.3",
13-
"bootstrap-table": "^1.14.2",
1413
"bootstrap-vue": "^2.20.1",
15-
"chart.js": "^2.8.0",
16-
"chartjs-plugin-annotation": "^0.5.7",
1714
"core-js": "^3.6.5",
18-
"html2pdf.js": "^0.9.2",
19-
"http-parser-js": "^0.5.3",
2015
"jquery": "^3.5.0",
2116
"lodash": "^4.17.13",
2217
"moment": "^2.22.1",
23-
"ocs-component-lib": "^0.6.0",
24-
"pdf-lib": "^1.12.0",
25-
"popper.js": "^1.16.1",
26-
"terser": "3.14",
18+
"ocs-component-lib": "^0.7.0",
2719
"vis": "4.19.1",
2820
"vue": "^2.6.11",
2921
"vue-ctk-date-time-picker": "^2.0.9",

src/App.vue

Lines changed: 41 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,16 @@
33
<div>
44
<b-navbar toggleable="lg" variant="dark" type="dark">
55
<b-navbar-brand>
6-
<div id="name-large" class="text-left pl-2 align-top d-none d-lg-inline-block">
7-
Example<br/>Observation Portal
6+
<div
7+
id="name-large"
8+
class="text-left pl-2 align-top d-none d-lg-inline-block"
9+
>
10+
Example<br />Observation Portal
811
</div>
9-
<div id="name-small" class="text-left pl-2 align-middle d-inline-block d-lg-none">
12+
<div
13+
id="name-small"
14+
class="text-left pl-2 align-middle d-inline-block d-lg-none"
15+
>
1016
Observation Portal
1117
</div>
1218
</b-navbar-brand>
@@ -16,12 +22,15 @@
1622
<b-nav-item :to="{ name: 'requests' }">Requests</b-nav-item>
1723
<b-nav-item :to="{ name: 'create' }">Submit Observation</b-nav-item>
1824
<b-nav-item :to="{ name: 'observations' }">Observations</b-nav-item>
19-
2025
<template v-if="userIsAuthenticated">
2126
<hr class="w-100 d-lg-none border-light" />
22-
<b-nav-text class="d-lg-none"><i class="fas fa-user-alt"></i>
23-
<span class="font-weight-bold">{{ profile.username }}</span></b-nav-text >
24-
<b-nav-item class="d-lg-none" :to="{ name: 'profile' }" >Profile</b-nav-item >
27+
<b-nav-text class="d-lg-none">
28+
<i class="fas fa-user-alt"></i>
29+
<span class="font-weight-bold">{{ profile.username }}</span>
30+
</b-nav-text>
31+
<b-nav-item class="d-lg-none" :to="{ name: 'profile' }">
32+
Profile
33+
</b-nav-item>
2534
<passthrough-get
2635
class="d-lg-none"
2736
endpoint="/accounts/logout/"
@@ -33,10 +42,11 @@
3342
/>
3443
</template>
3544
<template v-else>
36-
<b-nav-item class="d-lg-none" :to="{ name: 'login' }">Login</b-nav-item>
45+
<b-nav-item class="d-lg-none" :to="{ name: 'login' }">
46+
Login
47+
</b-nav-item>
3748
</template>
3849
</b-navbar-nav>
39-
4050
<b-navbar-nav class="ml-auto">
4151
<b-nav-item-dropdown
4252
v-if="userIsAuthenticated"
@@ -46,16 +56,14 @@
4656
<template #button-content>
4757
<i class="fas fa-user-alt"></i>
4858
</template>
49-
<b-dropdown-text
50-
>Logged in as
51-
<span class="font-weight-bold">{{
52-
profile.username
53-
}}</span></b-dropdown-text
54-
>
59+
<b-dropdown-text>
60+
Logged in as
61+
<span class="font-weight-bold">{{ profile.username }}</span>
62+
</b-dropdown-text>
5563
<b-dropdown-divider></b-dropdown-divider>
56-
<b-dropdown-item :to="{ name: 'profile' }"
57-
>Profile</b-dropdown-item
58-
>
64+
<b-dropdown-item :to="{ name: 'profile' }">
65+
Profile
66+
</b-dropdown-item>
5967
<passthrough-get
6068
endpoint="/accounts/logout/"
6169
:as-link="true"
@@ -65,12 +73,17 @@
6573
error-message="Oops, there was an error logging out, please try again."
6674
/>
6775
</b-nav-item-dropdown>
68-
<b-nav-item v-else :to="{ name: 'login' }" class="d-none d-lg-block">Login</b-nav-item >
76+
<b-nav-item
77+
v-else
78+
:to="{ name: 'login' }"
79+
class="d-none d-lg-block"
80+
>
81+
Login
82+
</b-nav-item>
6983
</b-navbar-nav>
7084
</b-collapse>
7185
</b-navbar>
7286
</div>
73-
7487
<b-container :fluid="isFluidPage" class="flex-shrink-0 p-1">
7588
<b-row>
7689
<b-col md="12">
@@ -89,19 +102,22 @@
89102
</b-row>
90103
<router-view class="my-3" />
91104
</b-container>
92-
93105
<div class="footer text-center mt-auto pt-2">
94106
<ul>
95107
<li>
96-
<a class="black" title="github" href="https://github.com/observatorycontrolsystem/" >
97-
<i class="fab fa-github"></i> View the Observatory Control System on Github </a>
108+
<a
109+
class="black"
110+
title="github"
111+
href="https://github.com/observatorycontrolsystem/"
112+
>
113+
<i class="fab fa-github"></i> View the Observatory Control System on
114+
Github
115+
</a>
98116
</li>
99117
</ul>
100118
</div>
101-
102119
</div>
103120
</template>
104-
105121
<script>
106122
import PassthroughGet from "@/components/PassthroughGet.vue";
107123
@@ -137,7 +153,6 @@ export default {
137153
#app {
138154
min-height: 100vh;
139155
}
140-
141156
.footer {
142157
background-color: #ced6e0;
143158
}
@@ -151,14 +166,6 @@ export default {
151166
.footer ul li:first-child {
152167
border: none;
153168
}
154-
155-
.brand-image-large {
156-
max-height: 50px;
157-
padding-right: 0.5rem;
158-
}
159-
.brand-image-small {
160-
max-height: 45px;
161-
}
162169
#name-large {
163170
font-size: 1.2rem;
164171
margin-right: 1rem;

src/assets/scss/app.scss

Lines changed: 3 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -1,110 +1,7 @@
1-
// Updated basic colors
2-
$blue: #00adef;
3-
$yellow: #ffc107;
4-
$white: #fff;
5-
$red: #dc3545;
6-
$green: #28a745;
7-
8-
// Updated theme colors
9-
$secondary: #80868c;
10-
$info: #8a6d3b;
11-
12-
$font-family-sans-serif: 'Libre Franklin', sans-serif !default;
13-
$link-hover-decoration: none;
14-
15-
$theme-colors: (
16-
'blue': $blue,
17-
);
18-
19-
$pagination-hover-bg: $yellow;
20-
$navbar-dark-color: $white;
21-
$navbar-dark-hover-color: $white;
22-
$dropdown-link-hover-bg: $yellow;
1+
// Override bootstrap variables here to customize style
2+
// https://bootstrap-vue.org/docs/reference/theming
233

244
@import '~bootstrap';
255
@import '~bootstrap-vue';
266

27-
28-
// Override bootstrap bg-danger class. Soften the danger color when used as a background color.
29-
.bg-danger {
30-
background-color: darken($danger, 12) !important;
31-
}
32-
33-
// Override bootstrap bg-success class. Soften the success color when used as a background color
34-
.bg-success {
35-
background-color: darken($success, 10) !important;
36-
}
37-
38-
// Highlight the text of links on a page when hovered
39-
a:hover {
40-
background-color: $yellow;
41-
color: $black;
42-
}
43-
44-
// Set the background hover color on the links in the page header to
45-
// be a more muted yellow
46-
a.nav-link:hover {
47-
background-color: rgba($yellow, 0.2);
48-
}
49-
50-
// Turn off hover-over coloring on the image in the header
51-
a.navbar-brand:hover {
52-
background-color: rgba(0, 0, 0, 0);
53-
}
54-
55-
// For tabs on the compose page and the request detail page
56-
.nav > li > a:not(.active):hover, .nav > li > a:not(.active):focus {
57-
background-color: rgba($yellow, 0.5);
58-
border-color: darken($yellow, 20);
59-
}
60-
61-
// Custom button styling
62-
63-
.btn-outline-warning {
64-
color: darken($yellow, 25);
65-
}
66-
67-
.btn-outline-primary {
68-
color: darken($primary, 15);
69-
}
70-
71-
.btn-outline-danger {
72-
color: darken($danger, 25);
73-
}
74-
75-
.btn-outline-secondary {
76-
color: darken($secondary, 40);
77-
}
78-
79-
.btn-outline-secondary:hover,
80-
.btn-outline-secondary:focus {
81-
background-color: rgba($yellow, 0.5);
82-
border-color: darken($yellow, 20);
83-
color: $black;
84-
}
85-
86-
// General styling
87-
88-
html {
89-
position: relative;
90-
background-color: $white;
91-
}
92-
93-
p {
94-
margin-top: 1em;
95-
margin-bottom: 1em;
96-
padding: 0em;
97-
}
98-
99-
h1,
100-
h2,
101-
h3,
102-
h4,
103-
h5,
104-
h6 {
105-
padding: 0.1em 0;
106-
}
107-
108-
.small {
109-
font-size: 70%;
110-
}
7+
// Add any other general site styling here

src/clearAndSetErrorsMixin.js

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,39 @@
1-
21
export const clearAndSetErrorsMixin = {
32
/* Methods to modify page messages */
4-
data: function() {
3+
data: function () {
54
return {
6-
errorMessages: []
5+
errorMessages: [],
76
};
87
},
98
methods: {
10-
clearErrors: function() {
9+
clearErrors: function () {
1110
for (let message of this.errorMessages) {
12-
this.$store.commit('deleteMessage', message);
11+
this.$store.commit("deleteMessage", message);
1312
}
1413
this.errorMessages = [];
1514
},
16-
setErrors: function(errorMessagesObject) {
15+
setErrors: function (errorMessagesObject) {
1716
for (let field in errorMessagesObject) {
18-
let message = '';
19-
if (field === 'retrieving') {
17+
let message = "";
18+
if (field === "retrieving") {
2019
message = errorMessagesObject[field];
2120
} else {
22-
message = field + ': ' + errorMessagesObject[field];
21+
message = field + ": " + errorMessagesObject[field];
2322
}
2423
this.errorMessages.push(message);
25-
this.$store.commit('addMessage', { text: message, variant: 'danger' });
24+
this.$store.commit("addMessage", { text: message, variant: "danger" });
2625
}
2726
},
28-
setErrorsOnFailedAJAXCall: function(errorAjaxResponse) {
27+
setErrorsOnFailedAJAXCall: function (errorAjaxResponse) {
2928
this.clearErrors();
3029
if (errorAjaxResponse.status === 400) {
3130
this.setErrors(errorAjaxResponse.responseJSON);
3231
} else {
33-
this.setErrors({ retrieving: 'There was a problem retrieving your data, please try again.' });
32+
this.setErrors({
33+
retrieving:
34+
"There was a problem retrieving your data, please try again.",
35+
});
3436
}
35-
}
36-
}
37+
},
38+
},
3739
};

src/components/NotFound.vue

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,33 @@
22
<div class="row">
33
<div class="col-md-12 text-center">
44
<h2>Oops! This looks like a black hole.</h2>
5-
<p>Either you don't have permission to view this page or it doesn't exist.</p>
5+
<p>
6+
Either you don't have permission to view this page or it doesn't exist.
7+
</p>
68
<p v-if="!userIsAuthenticated">
79
Perhaps you should try
810
<router-link :to="{ name: 'login' }"> logging in </router-link>.
911
</p>
1012
<p v-else-if="userIsStaffWithoutStaffViewSet">
11-
Perhaps you should try turning on staff view. You can do this on your <router-link :to="{ name: 'profile' }">profile page</router-link>.
13+
Perhaps you should try turning on staff view. You can do this on your
14+
<router-link :to="{ name: 'profile' }">profile page</router-link>.
1215
</p>
1316
</div>
1417
</div>
1518
</template>
1619
<script>
1720
export default {
18-
name: 'NotFound',
21+
name: "NotFound",
1922
computed: {
20-
userIsAuthenticated: function() {
23+
userIsAuthenticated: function () {
2124
return this.$store.state.userIsAuthenticated;
2225
},
23-
userIsStaffWithoutStaffViewSet: function() {
24-
return this.$store.state.profile.is_staff && !this.$store.state.profile.profile.staff_view;
25-
}
26-
}
26+
userIsStaffWithoutStaffViewSet: function () {
27+
return (
28+
this.$store.state.profile.is_staff &&
29+
!this.$store.state.profile.profile.staff_view
30+
);
31+
},
32+
},
2733
};
2834
</script>

0 commit comments

Comments
 (0)