Skip to content

Commit

Permalink
Fix get account info call
Browse files Browse the repository at this point in the history
  • Loading branch information
rmn-boiko committed Sep 26, 2024
1 parent 9c25603 commit f0481ec
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 20 deletions.
8 changes: 5 additions & 3 deletions src/app/cli/src/commands/login_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,17 @@ impl LoginCommand {

fn new_login_with_token(
&self,
odf_server_frontend_url: &Url,
odf_server_backend_url: &Url,
access_token: &str,
) -> Result<(), CLIError> {
self.access_token_registry_service.save_access_token(
self.scope,
Some(odf_server_frontend_url),
odf_server_frontend_url,
Some(odf_server_backend_url),
odf_server_backend_url,
access_token.to_string(),
)?;
self.add_repository(odf_server_backend_url, odf_server_backend_url)?;

Ok(())
}

Expand Down
3 changes: 3 additions & 0 deletions src/app/cli/src/commands/push_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ impl PushCommand {
repo_name_maybe
} else {
let remote_repo_names: Vec<_> = self.remote_repo_reg.get_all_repositories().collect();
if remote_repo_names.len() > 1 {
return Ok(None);
}
remote_repo_names.first().cloned()
};
if let Some(remote_repo_name) = repo_name {
Expand Down
27 changes: 15 additions & 12 deletions src/app/cli/src/services/odf_server/login_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,19 +280,22 @@ impl LoginService {

let gql_query = r#"
{
accounts {
byAccessToken(
accessToken: "{access_token}"
) {
id
accountName
displayName
accountType
avatarUrl
isAdmin
accounts {
byAccessToken(
accessToken: "{access_token}"
) {
isMultiTenant
account {
id
accountName
displayName
accountType
avatarUrl
isAdmin
}
}
}
}
}
}
"#
.replace("{access_token}", access_token);

Expand Down
9 changes: 4 additions & 5 deletions src/infra/core/src/push_service_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,19 +157,18 @@ impl PushServiceImpl {
} else {
local_handle.alias.dataset_name.clone()
};
let dataset_alias = DatasetAlias::new(
remote_repo_opts.remote_account_name.clone(),
push_dataset_name,
);
let mut res_url = remote_repo_opts
.remote_repo_url
.clone()
.as_odf_protoocol()
.unwrap();
if let Some(account_name) = &remote_repo_opts.remote_account_name {
res_url.path_segments_mut().unwrap().push(account_name);
}
res_url
.path_segments_mut()
.unwrap()
.push(&dataset_alias.to_string());
.push(&push_dataset_name);
return Ok(res_url.into());
}
Err(PushError::NoTarget)
Expand Down

0 comments on commit f0481ec

Please sign in to comment.