display account without refresh tokens as non refreshed

This commit is contained in:
Ruben Fiszel
2022-12-09 20:17:39 +01:00
parent 861fa07ace
commit 4c75f243b6
6 changed files with 18 additions and 7 deletions
+5
View File
@@ -4273,6 +4273,8 @@ components:
type: string
is_linked:
type: boolean
is_refreshed:
type: boolean
required:
- workspace_id
- path
@@ -4568,6 +4570,8 @@ components:
type: string
is_linked:
type: boolean
is_refreshed:
type: boolean
account:
type: number
required:
@@ -4575,6 +4579,7 @@ components:
- resource_type
- is_oauth
- is_linked
- is_refreshed
ResourceType:
type: object
+4 -1
View File
@@ -83,6 +83,7 @@ pub struct ListableResource {
pub resource_type: String,
pub extra_perms: serde_json::Value,
pub is_linked: Option<bool>,
pub is_refreshed: Option<bool>,
pub is_oauth: Option<bool>,
pub is_expired: Option<bool>,
pub refresh_error: Option<String>,
@@ -126,6 +127,7 @@ async fn list_resources(
"resource.extra_perms",
"(now() > account.expires_at) as is_expired",
"variable.path IS NOT NULL as is_linked",
"account.refresh_token != '' as is_refreshed",
"variable.is_oauth",
"variable.account",
"account.refresh_error",
@@ -167,7 +169,8 @@ async fn get_resource(
let resource_o = sqlx::query_as!(
ListableResource,
"SELECT resource.*, (now() > account.expires_at) as is_expired, account.refresh_error,
"SELECT resource.*, (now() > account.expires_at) as is_expired, account.refresh_token != '' as is_refreshed,
account.refresh_error,
variable.path IS NOT NULL as is_linked,
variable.is_oauth as \"is_oauth?\",
variable.account
+4 -2
View File
@@ -85,7 +85,8 @@ async fn list_variables(
"SELECT variable.workspace_id, variable.path, CASE WHEN is_secret IS TRUE THEN null ELSE variable.value::text END as value,
is_secret, variable.description, variable.extra_perms, account, is_oauth, (now() > account.expires_at) as is_expired,
account.refresh_error,
resource.path IS NOT NULL as is_linked
resource.path IS NOT NULL as is_linked,
account.refresh_token != '' as is_refreshed
from variable
LEFT JOIN account ON variable.account = account.id AND account.workspace_id = variable.workspace_id
LEFT JOIN resource ON resource.path = variable.path AND resource.workspace_id = variable.workspace_id
@@ -117,7 +118,8 @@ async fn get_variable(
let variable_o = sqlx::query_as::<_, ListableVariable>(
"SELECT variable.*, (now() > account.expires_at) as is_expired, account.refresh_error,
resource.path IS NOT NULL as is_linked
resource.path IS NOT NULL as is_linked,
account.refresh_token != '' as is_refreshed
from variable
LEFT JOIN account ON variable.account = account.id
LEFT JOIN resource ON resource.path = variable.path AND resource.workspace_id = variable.workspace_id
+1
View File
@@ -29,6 +29,7 @@ pub struct ListableVariable {
pub account: Option<i32>,
pub is_oauth: Option<bool>,
pub is_expired: Option<bool>,
pub is_refreshed: Option<bool>,
pub refresh_error: Option<String>,
pub is_linked: Option<bool>,
}
+2 -2
View File
@@ -321,7 +321,7 @@
</tr>
<tbody slot="body">
{#if filteredItems}
{#each filteredItems as { path, description, resource_type, extra_perms, canWrite, is_oauth, is_linked, account, refresh_error, is_expired, marked }}
{#each filteredItems as { path, description, resource_type, extra_perms, canWrite, is_oauth, is_linked, account, refresh_error, is_expired, marked, is_refreshed }}
<tr>
<td>
<a
@@ -372,7 +372,7 @@
{/if}
</div>
<div class="w-10">
{#if account}
{#if is_refreshed}
<Popover>
<Icon data={faRefresh} />
<div slot="text">
+2 -2
View File
@@ -166,7 +166,7 @@
<th />
</tr>
<tbody slot="body">
{#each filteredItems as { path, value, is_secret, description, extra_perms, canWrite, account, is_oauth, is_expired, refresh_error, is_linked, marked }}
{#each filteredItems as { path, value, is_secret, description, extra_perms, canWrite, account, is_refreshed, is_expired, refresh_error, is_linked, marked }}
<tr>
<td
><a
@@ -225,7 +225,7 @@
{/if}
</div>
{#if is_oauth}
{#if is_refreshed}
<div class="w-10">
{#if refresh_error}
<Popover notClickable>