Skip to content

Commit

Permalink
Merge pull request #41 from spectresystems/feature/GH-38
Browse files Browse the repository at this point in the history
Show version in UI
  • Loading branch information
patriksvensson committed Feb 9, 2020
2 parents c1f945c + 94f9d50 commit e08a009
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "duck"
version = "0.1.0"
version = "0.7.0"
authors = ["Patrik Svensson <patrik@patriksvensson.se>"]
edition = "2018"
license = "MIT"
Expand Down
2 changes: 2 additions & 0 deletions src/api/endpoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ use actix_web::{get, web};
use actix_web::{HttpResponse, Responder};

use crate::engine::state::EngineState;
use crate::utils::VERSION;

use super::models::{BuildViewModel, ServerInfoModel, ViewInfoModel};

#[get("/api/server")]
pub fn server_info(state: web::Data<Arc<EngineState>>) -> impl Responder {
let info = ServerInfoModel {
title: &state.title[..],
version: VERSION,
views: state
.views
.get_views()
Expand Down
1 change: 1 addition & 0 deletions src/api/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use crate::config::ViewConfiguration;
#[derive(Serialize, Clone)]
pub struct ServerInfoModel<'a> {
pub title: &'a str,
pub version: &'static str,
pub views: Vec<ViewInfoModel>,
}

Expand Down
2 changes: 2 additions & 0 deletions src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ pub mod http;
pub mod text;

pub type DuckResult<T> = Result<T, Error>;

pub const VERSION: &'static str = env!("CARGO_PKG_VERSION");
2 changes: 1 addition & 1 deletion web/src/components/Menu/Sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default {
top: 0;
height: 100vh;
z-index: 999;
padding: 3rem 20px 2rem 20px;
padding: 1rem 20px 1rem 0px;
width: 300px;
}
</style>
20 changes: 19 additions & 1 deletion web/src/components/Navigation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
<a :class="{ 'active' : isActive(view) }" :href="get_view_url(view)">{{ view.name }}</a>
</li>
</ul>
<div class="version">
Duck v{{ this.serverInfo.version }} |
<a href="https://github.com/spectresystems/duck" target="_blank">GitHub</a>
</div>
</Sidebar>
</div>
</template>
Expand Down Expand Up @@ -66,9 +70,9 @@ export default {
padding-right: 48px;
padding-top: 8px;
}
ul.sidebar-panel-nav {
list-style-type: none;
padding-left: 2rem;
}
ul.sidebar-panel-nav > li > a {
Expand All @@ -87,4 +91,18 @@ ul.sidebar-panel-nav > li > a.active {
ul.sidebar-panel-nav > li > a:hover {
color: #fff;
}
.version {
position: fixed;
bottom: 0;
padding-left: 2rem;
padding-bottom: 1rem;
color:#aaa
}
.version > a {
text-decoration: none;
color: #aaa;
}
.version > a:hover {
font-weight: bold;
}
</style>

0 comments on commit e08a009

Please sign in to comment.