Skip to content
Permalink
Browse files

Display Software Version

The frontend display the provided software version, that the service provides
through its .well-known/host-meta.json.

Additionally, dependencies of the backend have been upgraded.
  • Loading branch information...
schrieveslaach committed Sep 17, 2019
1 parent 72f3b5d commit 028374b65e02db80bd18c561ba8ba3779c4bc189

Large diffs are not rendered by default.

@@ -50,9 +50,9 @@ features = ["with_rocket"]

[dependencies.shiplift]
git = "https://github.com/softprops/shiplift.git"
rev = "7d9718b33764dea4a85859e94337e471de091332"
rev = "f10534b3179dcbc2667b1c6aed3039a5f3a40f0f"
default-features = false
features = ["unix-socket"]
features = ["unix-socket", "chrono"]

[dependencies.goji]
git = "https://github.com/softprops/goji.git"
@@ -593,7 +593,7 @@ impl Infrastructure for DockerInfrastructure {

let log_options = match from {
Some(from) => LogsOptions::builder()
.since(from.timestamp())
.since(from)
.stdout(true)
.stderr(true)
.timestamps(true)
@@ -693,8 +693,7 @@ impl TryFrom<&ContainerDetails> for Service {
}
};

let started_at = chrono::DateTime::parse_from_rfc3339(&container_details.state.started_at)
.expect("Docker did not respond with valid RFC3387 date time");
let started_at = container_details.state.started_at.clone();

let mut service = Service::new(
container_details.id.clone(),
@@ -28,7 +28,7 @@ use crate::config::ContainerConfig;
use crate::infrastructure::Infrastructure;
use crate::models::service::Service;
use crate::models::service::ServiceConfig;
use chrono::{DateTime, FixedOffset};
use chrono::{DateTime, FixedOffset, Utc};
use multimap::MultiMap;
use std::collections::HashSet;
use std::sync::Mutex;
@@ -62,7 +62,9 @@ impl Infrastructure for DummyInfrastructure {
app.clone(),
config.service_name().clone(),
config.container_type().clone(),
DateTime::parse_from_rfc3339("2019-07-18T07:30:00.000000000Z").unwrap(),
DateTime::parse_from_rfc3339("2019-07-18T07:30:00.000000000Z")
.unwrap()
.with_timezone(&Utc),
),
);
}
@@ -25,7 +25,7 @@
*/

use crate::models::web_host_meta::WebHostMeta;
use chrono::{DateTime, FixedOffset, Utc};
use chrono::{DateTime, Utc};
use regex::Regex;
use serde::ser::{Serialize, Serializer};
use serde::{de, Deserialize, Deserializer};
@@ -44,7 +44,7 @@ pub struct Service {
base_url: Option<Url>,
endpoint: Option<ServiceEndpoint>,
web_host_meta: Option<WebHostMeta>,
started_at: DateTime<FixedOffset>,
started_at: DateTime<Utc>,
}

#[derive(Clone, Debug)]
@@ -185,7 +185,7 @@ impl Service {
app_name: String,
service_name: String,
container_type: ContainerType,
started_at: DateTime<FixedOffset>,
started_at: DateTime<Utc>,
) -> Service {
Service {
id,
@@ -259,7 +259,7 @@ impl Service {
self.web_host_meta = meta;
}

pub fn started_at(&self) -> &DateTime<FixedOffset> {
pub fn started_at(&self) -> &DateTime<Utc> {
&self.started_at
}
}
@@ -125,8 +125,8 @@
v-tooltip="tooltip( container.type )">{{ container.type }}</span>
<span v-if="container.version && container.version.gitCommit"
class="ra-build-infos ra-build-infos__hash text-right"
:title="container.version.gitCommit">
{{ container.version.gitCommit.slice( 0, 7 ) }}…
:title="container.version | version">
{{ container.version | slicedVersion }}
<!-- only for layout -->
<!-- c63ae57… -->
</span>
@@ -196,6 +196,12 @@
return date.toDate().toLocaleTimeString()
}
return buildDateTime;
},
version(v) {
return formatVersion(v);
},
slicedVersion(v) {
return formatSlicedVersion(v);
}
},
props: {
@@ -221,7 +227,7 @@
this.reviewApp.containers
.filter(container => !!container.version)
.forEach(container => {
res[container.name] = container.version.gitCommit;
res[container.name] = formatVersion(container.version);
});
}
@@ -307,4 +313,32 @@
.map(({version}) => version.dateModified)
.reduce(max, 0);
};
function formatVersion(version) {
if (version.softwareVersion != null) {
if (version.gitCommit != null) {
return `${version.softwareVersion} (Commit: ${version.gitCommit})`;
} else {
return version.softwareVersion;
}
}
if (version.gitCommit != null) {
return version.gitCommit;
}
return '';
}
function formatSlicedVersion(version) {
if (version.softwareVersion != null) {
return version.softwareVersion.slice(0, 16);
}
if (version.gitCommit != null) {
return version.gitCommit.slice(0, 7);
}
return '';
}
</script>

0 comments on commit 028374b

Please sign in to comment.
You can’t perform that action at this time.