Skip to content

Commit

Permalink
feat: support electron for on premise solution (#333)
Browse files Browse the repository at this point in the history
* feat: support electron for on premise solution

* refactor: remove trailing whitespaces and empty lines

* feat: add app icon for os taskbar

* refactor: fix indent, variable naming, and brackets

* docs: update test runbook and third party notices
  • Loading branch information
stew-ro authored Jun 23, 2020
1 parent 8297b18 commit ca0bd0c
Show file tree
Hide file tree
Showing 38 changed files with 857 additions and 65 deletions.
3 changes: 2 additions & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
react: npm run react-start
react: yarn react-start
electron: yarn electron-start
78 changes: 78 additions & 0 deletions ThirdPartyNotices.txt
Original file line number Diff line number Diff line change
Expand Up @@ -330,3 +330,81 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

==========

foreman

The MIT License

Copyright (c) IBM Corp. 2012,2016. All Rights Reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

==========

file-type

The MIT License

Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

==========

electron

The MIT License

Copyright (c) 2013-2020 GitHub Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

==========
Binary file added app-icons/Tag.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 44 additions & 4 deletions docs/manual_testing/manual-test-runbook.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,49 @@
# Test Runbook

## **Feat: support Electron for on premise solution**

> ### Feature description ###
- Support FoTT's existing features in Electon
- Support local file system provider in Electron

> ### Use Case ###
**`As`** a user
**`I want`** to use FoTT's existing features through a desktop app
**`So`** I don't have to use a browser to use FoTT

**`As`** a user
**`I want`** to use files in my local file system
**`So`** I can keep all files on premise

> ### Acceptance criteria ###
#### Scenario One ####

**`Given`** I've installed new dependencies and started FoTT in Electron.\
**`When`** I click a command item in the title bar.\
**`Then`** FoTT should perform the command as expected.\

#### **Scenario Two** ####

**`Given`** I've installed new dependencies and started FoTT in Electron.\
**`When`** I perform an action for any existing feature.\
**`Then`** FoTT should perform as expected (the same as through a browser).\

#### ***Scenario Three*** ####

**`Given`** I've installed new dependencies and started FoTT in Electron.\
**`When`** I create a new connection with local file system as the provider.\
**`Then`** I should be able to create a project with the created connection.\

#### ***Scenario Four*** ####

**`Given`** I've installed new dependencies and started FoTT in Electron. And, I have an existing project in my local file system.\
**`When`** I click "Open local project" on the home page and select the existing project.\
**`Then`** FoTT should load the project as expected.\

___

## **Fix: enable to reorder tags quickly**

> ### Feature description ###
Expand All @@ -20,7 +64,6 @@ Enable reordering tags quickly
**`When`** I clicking fast on tags buttons `'Move tag up'` or `'Move tag down'`\
**`Then`** it moves without visible jittering.

___
___

## **Enable rerun OCR for current or all documents**
Expand Down Expand Up @@ -51,8 +94,6 @@ Adding the following buttons to the canvas command bar:
**`When`** I click "Run OCR on all documents" in the canvas command bar\
**`Then`** I should see "Running OCR..." for all documents. When running OCR finishes for each document, I should be ale to view each document's updated OCR JSON file.


___
___

## **Feat: enable compose model and add model name when training a new model**
Expand Down Expand Up @@ -87,7 +128,6 @@ ___
**`When`** I type customerized model name in input field and click compose button on modal\
**`Then`** I should see "Model is composing, please wait...". After that the list shows up again, new composed model with given name will be on the top of the list. The new composed model also has a "combine" icon.


#### ***Scenario Three*** ####

**`Given`** I've opened a project containing documents and I'm on the Model Compose page.\
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"private": true,
"main": "build/main.js",
"dependencies": {
"file-type": "^14.6.2",
"@azure/storage-blob": "10.3.0",
"@fluentui/react": "^7.117.2",
"axios": "^0.19.0",
Expand Down Expand Up @@ -55,9 +56,9 @@
"webpack:prod": "webpack --config ./config/webpack.prod.js",
"electron:run:dev": "yarn webpack:dev && electron . --remote-debugging-port=9223",
"electron:run:prod": "yarn webpack:prod && electron . --remote-debugging-port=9223",
"electron:start:dev": "yarn webpack:dev && yarn electron-start",
"electron:start:dev": "yarn electron-start",
"electron:start:prod": "yarn webpack:prod && yarn electron-start",
"electron-start": "node src/electron/start",
"electron-start": "yarn webpack:dev && node src/electron/start",
"tslint": "./node_modules/.bin/tslint 'src/**/*.ts*'",
"tslintfix": "./node_modules/.bin/tslint 'src/**/*.ts*' --fix"
},
Expand Down Expand Up @@ -92,6 +93,7 @@
"@types/reactstrap": "^8.2.0",
"@types/redux-logger": "^3.0.7",
"acorn": "^7.1.1",
"foreman": "^3.0.1",
"electron": "^8.3.0",
"electron-builder": "^22.6.1",
"enzyme": "^3.10.0",
Expand Down
12 changes: 9 additions & 3 deletions src/assets/sass/fabric-icons-inline.scss

Large diffs are not rendered by default.

11 changes: 8 additions & 3 deletions src/common/crypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,14 @@ export async function decryptObject<T = any>(encodedMessage: string, secret: str
return JSON.parse(json) as T;
}

export async function sha256Hash(message: string) {
const buffer = await crypto.subtle.digest("SHA-256", encodeUtf8(message));
return encodeHex(buffer);
export async function sha256Hash(message: string, nodejsMode?: boolean) {
if (nodejsMode) {
const nodejsCrypto = await require('crypto');
return await nodejsCrypto.createHash('sha256').update(message).digest("hex");
} else {
const buffer = await crypto.subtle.digest("SHA-256", encodeUtf8(message));
return encodeHex(buffer);
}
}

async function importKey(secretBytes: ArrayBuffer) {
Expand Down
13 changes: 8 additions & 5 deletions src/common/localization/en-us.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,15 @@ export const english: IAppStrings = {
},
},
train: {
modelNameTitle: "Model name",
labelFolderTitle: "Label folder URI",
defaultLabelFolderURL: "https://example.com/folder",
title: "Train",
training: "Training",
pleaseWait: "Please wait",
notTrainedYet: "Not trained yet",
backEndNotAvailable: "Checkbox feature will work in future version of Form Recognizer service, please stay tuned.",
addName: "Add model name...",
addName: "Add a model name...",
},
modelCompose: {
title: "Model compose",
Expand Down Expand Up @@ -287,10 +290,10 @@ export const english: IAppStrings = {
},
},
local: {
title: "Local File System",
folderPath: "Folder Path",
selectFolder: "Select Folder",
chooseFolder: "Choose Folder",
title: "Local file system",
folderPath: "Browse",
selectFolder: "Select folder",
chooseFolder: "Choose folder",
},
},
},
Expand Down
3 changes: 3 additions & 0 deletions src/common/localization/es-cl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ export const spanish: IAppStrings = {
},
},
train: {
modelNameTitle: "Nombre del modelo",
labelFolderTitle: "URI de carpeta de etiquetas",
defaultLabelFolderURL: "https://example.com/folder",
title: "Entrenar",
training: "Entrenamiento",
pleaseWait: "Por favor espera",
Expand Down
3 changes: 3 additions & 0 deletions src/common/strings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ export interface IAppStrings {
},
};
train: {
modelNameTitle: string;
labelFolderTitle: string;
defaultLabelFolderURL: string;
title: string;
training: string;
pleaseWait: string;
Expand Down
63 changes: 62 additions & 1 deletion src/common/themes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,58 @@ const DarkDefaultPalette: Partial<IPalette> = {
neutralLighterAlt: "#201f1e",
white: "#1b1a19",
redDark: "#F1707B",
};
};

const lightGreyPalette = {
themePrimary: "#B8B8B9",
themeLighterAlt: "#070707",
themeLighter: "#1d1d1e",
themeLight: "#373738",
themeTertiary: "#6f6f70",
themeSecondary: "#a2a2a4",
themeDarkAlt: "#bfbfc1",
themeDark: "#c9c9cb",
themeDarker: "#d7d7d8",
neutralLighterAlt: "#4e5257",
neutralLighter: "#55595d",
neutralLight: "#606469",
neutralQuaternaryAlt: "#666b6f",
neutralQuaternary: "#6c7075",
neutralTertiaryAlt: "#83888c",
neutralTertiary: "#373738",
neutralSecondary: "#6f6f70",
neutralPrimaryAlt: "#a2a2a4",
neutralPrimary: "#B8B8B9",
neutralDark: "#c9c9cb",
black: "#d7d7d8",
white: "#474B4F"
}

const subMenuPalette = {
themePrimary: "#f5f5f5",
themeLighterAlt: "#dadada",
themeLighter: "#bfbfbf",
themeLight: "#a4a4a4",
themeTertiary: "#898989",
themeSecondary: "#6e6e6e",
themeDarkAlt: "#535353",
themeDark: "#383838",
themeDarker: "#1d1d1d",
neutralLighterAlt: "#3f4246",
neutralLighter: "#464a4d",
neutralLight: "#525559",
neutralQuaternaryAlt: "#595d61",
neutralQuaternary: "#5f6367",
neutralTertiaryAlt: "#787d81",
neutralTertiary: "#e9e9e9",
neutralSecondary: "#ececec",
neutralPrimaryAlt: "#f0f0f0",
neutralPrimary: "#dedede",
neutralDark: "#f7f7f7",
black: "#fbfbfb",
white: "#373a3d"
}


const defaultDarkTheme = createTheme({palette: DarkDefaultPalette});
const whiteTheme = createTheme({palette: whiteButtonPalette});
Expand All @@ -237,6 +288,8 @@ const blueTheme = createTheme({palette: blueButtonPalette});
const darkTheme = createTheme({palette: darkThemePalette});
const darkGreyTheme = createTheme({palette: darkGreyPalette});
const greenWithWhiteBackgroundTheme = createTheme({palette: greenWithWhiteBackgroundPalette});
const lightGreyTheme = createTheme({palette: lightGreyPalette});
const subMenuTheme = createTheme({palette: subMenuPalette})

export function getPrimaryWhiteTheme() {
return whiteTheme;
Expand Down Expand Up @@ -273,3 +326,11 @@ export function getGreenWithWhiteBackgroundTheme() {
export function getDefaultDarkTheme() {
return defaultDarkTheme;
}

export function getSubMenuTheme() {
return subMenuTheme;
}

export function getLightGreyTheme() {
return lightGreyTheme;
}
16 changes: 16 additions & 0 deletions src/config/fabric-icons.json
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,22 @@
{
"name": "BookAnswers",
"unicode": "F8A4"
},
{
"name": "ChromeRestore",
"unicode": "E923"
},
{
"name": "ChromeMinimize",
"unicode": "E921"
},
{
"name": "System",
"unicode": "E770"
},
{
"name": "SquareShape",
"unicode": "F1A6"
}
]
}
Loading

0 comments on commit ca0bd0c

Please sign in to comment.