Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
filipslezaklab committed Sep 20, 2023
1 parent 14dc322 commit 0414cf8
Show file tree
Hide file tree
Showing 11 changed files with 489 additions and 190 deletions.
27 changes: 25 additions & 2 deletions src/i18n/en/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ const en = {
close: 'Close',
reset: 'Reset',
},
messages: {
error: 'Unexpected error occurred!',
},
},
components: {
adminInfo: {
Expand All @@ -50,7 +53,7 @@ const en = {
title: 'Locations',
sideBar: {
instances: 'Instances',
addInstance: 'Add Instance',
addInstance: 'Enter token',
copyright: {
copyright: `Copyright © 2023`,
appVersion: 'Application version: {version:string}',
Expand Down Expand Up @@ -90,7 +93,10 @@ const en = {
},
modals: {
addInstanceModal: {
title: 'Add instance',
titles: {
addInstance: 'Enter token',
addDevice: 'Add device',
},
messages: {
success: {
add: 'Instance added',
Expand All @@ -99,13 +105,20 @@ const en = {
error: 'Operation failed, check url and token.',
},
form: {
submit: {
submitToken: 'Submit token',
addDevice: 'Add device',
},
fields: {
token: {
label: 'Token',
},
url: {
label: 'Proxy URL',
},
name: {
label: 'Name',
},
},
},
},
Expand Down Expand Up @@ -179,6 +192,16 @@ If you have any questions, please consult your assigned admin.All necessary info
},
},
deviceSetup: {
desktopSetup: {
title: 'Configure this device',
controls: {
create: 'Configure device',
success: 'Device is configured',
},
messages: {
deviceConfigured: 'Device is configured',
},
},
optionalMessage: `* This step is OPTIONAL. You can skip it if you wish. This can be configured later in defguard.`,
cards: {
device: {
Expand Down
120 changes: 110 additions & 10 deletions src/i18n/i18n-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ type RootTranslation = {
*/
reset: string
}
messages: {
/**
* U​n​e​x​p​e​c​t​e​d​ ​e​r​r​o​r​ ​o​c​c​u​r​r​e​d​!
*/
error: string
}
}
components: {
adminInfo: {
Expand All @@ -135,7 +141,7 @@ type RootTranslation = {
*/
instances: string
/**
* A​d​d​ ​I​n​s​t​a​n​c​e
* E​n​t​e​r​ ​t​o​k​e​n
*/
addInstance: string
copyright: {
Expand Down Expand Up @@ -228,10 +234,16 @@ type RootTranslation = {
}
modals: {
addInstanceModal: {
/**
* A​d​d​ ​i​n​s​t​a​n​c​e
*/
title: string
titles: {
/**
* E​n​t​e​r​ ​t​o​k​e​n
*/
addInstance: string
/**
* A​d​d​ ​d​e​v​i​c​e
*/
addDevice: string
}
messages: {
success: {
/**
Expand All @@ -249,6 +261,16 @@ type RootTranslation = {
error: string
}
form: {
submit: {
/**
* S​u​b​m​i​t​ ​t​o​k​e​n
*/
submitToken: string
/**
* A​d​d​ ​d​e​v​i​c​e
*/
addDevice: string
}
fields: {
token: {
/**
Expand All @@ -262,6 +284,12 @@ type RootTranslation = {
*/
label: string
}
name: {
/**
* N​a​m​e
*/
label: string
}
}
}
}
Expand Down Expand Up @@ -402,6 +430,28 @@ type RootTranslation = {
}
}
deviceSetup: {
desktopSetup: {
/**
* C​o​n​f​i​g​u​r​e​ ​t​h​i​s​ ​d​e​v​i​c​e
*/
title: string
controls: {
/**
* C​o​n​f​i​g​u​r​e​ ​d​e​v​i​c​e
*/
create: string
/**
* D​e​v​i​c​e​ ​i​s​ ​c​o​n​f​i​g​u​r​e​d
*/
success: string
}
messages: {
/**
* D​e​v​i​c​e​ ​i​s​ ​c​o​n​f​i​g​u​r​e​d
*/
deviceConfigured: string
}
}
/**
* *​ ​T​h​i​s​ ​s​t​e​p​ ​i​s​ ​O​P​T​I​O​N​A​L​.​ ​Y​o​u​ ​c​a​n​ ​s​k​i​p​ ​i​t​ ​i​f​ ​y​o​u​ ​w​i​s​h​.​ ​T​h​i​s​ ​c​a​n​ ​b​e​ ​c​o​n​f​i​g​u​r​e​d​ ​l​a​t​e​r​ ​i​n​ ​d​e​f​g​u​a​r​d​.
*/
Expand Down Expand Up @@ -707,6 +757,12 @@ export type TranslationFunctions = {
*/
reset: () => LocalizedString
}
messages: {
/**
* Unexpected error occurred!
*/
error: () => LocalizedString
}
}
components: {
adminInfo: {
Expand All @@ -728,7 +784,7 @@ export type TranslationFunctions = {
*/
instances: () => LocalizedString
/**
* Add Instance
* Enter token
*/
addInstance: () => LocalizedString
copyright: {
Expand Down Expand Up @@ -820,10 +876,16 @@ export type TranslationFunctions = {
}
modals: {
addInstanceModal: {
/**
* Add instance
*/
title: () => LocalizedString
titles: {
/**
* Enter token
*/
addInstance: () => LocalizedString
/**
* Add device
*/
addDevice: () => LocalizedString
}
messages: {
success: {
/**
Expand All @@ -841,6 +903,16 @@ export type TranslationFunctions = {
error: () => LocalizedString
}
form: {
submit: {
/**
* Submit token
*/
submitToken: () => LocalizedString
/**
* Add device
*/
addDevice: () => LocalizedString
}
fields: {
token: {
/**
Expand All @@ -854,6 +926,12 @@ export type TranslationFunctions = {
*/
label: () => LocalizedString
}
name: {
/**
* Name
*/
label: () => LocalizedString
}
}
}
}
Expand Down Expand Up @@ -992,6 +1070,28 @@ export type TranslationFunctions = {
}
}
deviceSetup: {
desktopSetup: {
/**
* Configure this device
*/
title: () => LocalizedString
controls: {
/**
* Configure device
*/
create: () => LocalizedString
/**
* Device is configured
*/
success: () => LocalizedString
}
messages: {
/**
* Device is configured
*/
deviceConfigured: () => LocalizedString
}
}
/**
* * This step is OPTIONAL. You can skip it if you wish. This can be configured later in defguard.
*/
Expand Down
17 changes: 17 additions & 0 deletions src/pages/client/clientAPI/clientApi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { invoke } from '@tauri-apps/api';

import { DefguardInstance, DefguardLocation } from '../types';

const getInstances = async (): Promise<DefguardInstance[]> => invoke('all_instances');

type GetLocationsRequest = {
instance_id: number;
};

const getLocations = async (data: GetLocationsRequest): Promise<DefguardLocation[]> =>
invoke('all_locations', data);

export const clientApi = () => ({
getInstances,
getLocations,
});
Empty file.
Loading

0 comments on commit 0414cf8

Please sign in to comment.