-
Notifications
You must be signed in to change notification settings - Fork 320
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
4036: Disambiguate Schema Name, Schema Variant Name, and Schema Variant Display Name across the UI. On import, if there's no display name, hydrate with Schema name. Same thing on regenerate. This is a step towards schema names being immutable. r=britmyerss a=britmyerss This PR does the following: - On import, if the schema variant we're importing doesn't already have a display name, we copy the schema name to it - On regenerate, if the variant doesn't have a display name, copy the schema name to it - Return schema name separately in list routes - Allow mutating the schema name separately from the variant name - Throughout the UI, default to Variant Display Name, and if it doesn't exist, show the Schema Name. This PR sets us up to be able to make schema names immutable by exposing what is necessary for us to update builtins with what we want the immutable schema name to be. For now though, we must keep the names of builtins the same until we match by unique ID vs name on import. <div><img src="https://media1.giphy.com/media/9PqOegBqgBnMHvERV3/giphy.gif?cid=5a38a5a2rbyw6q3hziwhfewsun0y3jrclt210uhrhjqfnsvb&ep=v1_gifs_search&rid=giphy.gif&ct=g" style="border:0;height:231px;width:300px"/><br/>via <a href="https://giphy.com/channel/hauntsss/">Haunts</a> on <a href="https://giphy.com/gifs/hello-my-name-is-9PqOegBqgBnMHvERV3">GIPHY</a></div> Co-authored-by: Brit Myers <[email protected]>
- Loading branch information
Showing
27 changed files
with
186 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ use telemetry::prelude::*; | |
use thiserror::Error; | ||
|
||
use crate::actor_view::ActorView; | ||
use crate::{pk, DalContext, Timestamp, UserPk}; | ||
use crate::{pk, DalContext, Timestamp, User, UserPk}; | ||
use crate::{Tenancy, TransactionsError}; | ||
|
||
#[remain::sorted] | ||
|
@@ -23,6 +23,8 @@ pub enum HistoryEventError { | |
StandardModel(String), | ||
#[error("transactions error: {0}")] | ||
Transactions(#[from] TransactionsError), | ||
#[error("user error: {0}")] | ||
User(String), | ||
} | ||
|
||
pub type HistoryEventResult<T> = Result<T, HistoryEventError>; | ||
|
@@ -41,6 +43,16 @@ impl HistoryActor { | |
HistoryActor::SystemInit => "unknown-backend".to_string(), | ||
} | ||
} | ||
pub async fn email(&self, ctx: &DalContext) -> HistoryEventResult<String> { | ||
Ok(match self { | ||
HistoryActor::SystemInit => "[email protected]".to_string(), | ||
HistoryActor::User(user_pk) => User::get_by_pk_or_error(ctx, *user_pk) | ||
.await | ||
.map_err(|e| HistoryEventError::User(e.to_string()))? | ||
.email() | ||
.clone(), | ||
}) | ||
} | ||
} | ||
|
||
impl From<UserPk> for HistoryActor { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.