Skip to content

Commit

Permalink
Show hyperlinks.
Browse files Browse the repository at this point in the history
  • Loading branch information
DFINITYManu committed Aug 2, 2024
1 parent 721e829 commit 11a2af1
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 2 deletions.
21 changes: 20 additions & 1 deletion rollout-dashboard/frontend/src/lib/Rollout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,26 @@
<section class="rollout">
<div class="general_info">
<div class="name">
{rollout.name}
{#if rollout.url}<a
rel="external"
href={rollout.url}
target="_blank"
data-sveltekit-preload-data="off"
>{rollout.name}
<svg
style="display: inline-block"
xmlns="http://www.w3.org/2000/svg"
width="1em"
height="1em"
viewBox="0 0 15 15"
><path
fill="currentColor"
fill-rule="evenodd"
d="M12 13a1 1 0 0 0 1-1V3a1 1 0 0 0-1-1H3a1 1 0 0 0-1 1v3.5a.5.5 0 0 0 1 0V3h9v9H8.5a.5.5 0 0 0 0 1zM9 6.5v3a.5.5 0 0 1-1 0V7.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 7H5.5a.5.5 0 0 1 0-1h3a.498.498 0 0 1 .5.497"
clip-rule="evenodd"
/></svg
></a
>{:else}{rollout.name}{/if}
{#if rollout.conf.simulate}<i class="simulated">(simulated)</i>{/if}
</div>
<div class="state_icon tooltip">
Expand Down
1 change: 1 addition & 0 deletions rollout-dashboard/frontend/src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export type RolloutConfiguration = {
};
export type Rollout = {
name: String;
url?: string;
note?: String;
conf: RolloutConfiguration;
state: keyof typeof rollout_states;
Expand Down
2 changes: 1 addition & 1 deletion rollout-dashboard/server/src/airflow_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ impl Display for AirflowClientCreationError {
}

pub struct AirflowClient {
url: reqwest::Url,
pub url: reqwest::Url,
username: String,
password: String,
client: Arc<reqwest::Client>,
Expand Down
13 changes: 13 additions & 0 deletions rollout-dashboard/server/src/frontend_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ pub enum RolloutState {
pub struct Rollout {
/// name is unique, enforced by Airflow.
pub name: String,
pub url: String,
pub note: Option<String>,
pub state: RolloutState,
pub dispatch_time: DateTime<Utc>,
Expand All @@ -164,13 +165,15 @@ pub struct Rollout {
impl Rollout {
fn new(
name: String,
url: String,
note: Option<String>,
dispatch_time: DateTime<Utc>,
last_scheduling_decision: Option<DateTime<Utc>>,
conf: HashMap<String, serde_json::Value>,
) -> Self {
Self {
name,
url,
note,
state: RolloutState::Complete,
dispatch_time,
Expand Down Expand Up @@ -543,8 +546,18 @@ impl RolloutApi {
let sorted_task_instances =
sorter.sort_instances(cache_entry.task_instances.clone().into_values());

let mut url = self
.airflow_api
.as_ref()
.url
.join("/dags/rollout_ic_os_to_mainnet_subnets/grid")
.unwrap();
url.query_pairs_mut()
.append_pair("dag_run_id", &dag_run.dag_run_id);

let mut rollout = Rollout::new(
dag_run.dag_run_id.to_string(),
url.to_string(),
dag_run.note.clone(),
dag_run.logical_date,
dag_run.last_scheduling_decision,
Expand Down

0 comments on commit 11a2af1

Please sign in to comment.