return to Approve screen after cancelling unlock during request approval

This commit is contained in:
Joseph Montanaro 2024-02-07 13:03:12 -08:00
parent 87617a0726
commit 64a2927b94
8 changed files with 14 additions and 13 deletions

View File

@ -21,3 +21,4 @@
* Make hotkey configuration a little more tolerant of slight mistiming * Make hotkey configuration a little more tolerant of slight mistiming
* Distinguish between request that was denied and request that was canceled (e.g. due to error) * Distinguish between request that was denied and request that was canceled (e.g. due to error)
* Use atomic types for primitive state values instead of RwLock'd types * Use atomic types for primitive state values instead of RwLock'd types
* Rework approval flow to be a fullscreen overlay instead of mixing with normal navigation (as more views are added the pain of the current situation will only increase)

View File

@ -1,6 +1,6 @@
{ {
"name": "creddy", "name": "creddy",
"version": "0.4.6", "version": "0.4.7",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
"build": "vite build", "build": "vite build",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "creddy" name = "creddy"
version = "0.4.6" version = "0.4.7"
description = "A friendly AWS credentials manager" description = "A friendly AWS credentials manager"
authors = ["Joseph Montanaro"] authors = ["Joseph Montanaro"]
license = "" license = ""

View File

@ -223,7 +223,7 @@ pub enum GetSessionError {
EmptyResponse, // SDK returned successfully but credentials are None EmptyResponse, // SDK returned successfully but credentials are None
#[error("Error response from AWS SDK: {0}")] #[error("Error response from AWS SDK: {0}")]
SdkError(#[from] AwsSdkError<GetSessionTokenError>), SdkError(#[from] AwsSdkError<GetSessionTokenError>),
#[error("Could not construt session: credentials are locked")] #[error("Could not construct session: credentials are locked")]
CredentialsLocked, CredentialsLocked,
#[error("Could not construct session: no credentials are known")] #[error("Could not construct session: no credentials are known")]
CredentialsEmpty, CredentialsEmpty,

View File

@ -8,7 +8,7 @@
}, },
"package": { "package": {
"productName": "creddy", "productName": "creddy",
"version": "0.4.6" "version": "0.4.7"
}, },
"tauri": { "tauri": {
"allowlist": { "allowlist": {

View File

@ -22,7 +22,7 @@ listen('credentials-request', (tauriEvent) => {
listen('request-cancelled', (tauriEvent) => { listen('request-cancelled', (tauriEvent) => {
const id = tauriEvent.payload; const id = tauriEvent.payload;
if (id === $appState.currentRequest?.id) { if (id === $appState.currentRequest?.id) {
cleanupRequest() cleanupRequest();
} }
else { else {
const found = $appState.pendingRequests.find_remove(r => r.id === id); const found = $appState.pendingRequests.find_remove(r => r.id === id);

View File

@ -43,13 +43,6 @@
} }
} }
function approve_base() {
approve(true);
}
function approve_session() {
approve(false);
}
// Denial has only one // Denial has only one
async function deny() { async function deny() {
$appState.currentRequest.response = {approval: 'Denied', base: false}; $appState.currentRequest.response = {approval: 'Denied', base: false};

View File

@ -55,8 +55,15 @@
function cancel() { function cancel() {
emit('credentials-event', 'unlock-canceled'); emit('credentials-event', 'unlock-canceled');
if ($appState.currentRequest !== null) {
// dirty hack to prevent spurious error when returning to approve screen
delete $appState.currentRequest.response;
navigate('Approve');
}
else {
navigate('Home'); navigate('Home');
} }
}
onMount(() => { onMount(() => {
loadTime = Date.now(); loadTime = Date.now();