Merge pull request #77 from hashicorp/desktop-connect-client
Add new ember app for desktop client and install electron addon
This commit is contained in:
43 files changed
+5529
-62
No files matched your search
+17
-6
@@ -3,22 +3,33 @@
|
||||
"description": "Monorepo for Project Watchtower UIs and addons.",
|
||||
"license": "MPL-2.0",
|
||||
"author": "HashiCorp",
|
||||
"workspaces": [
|
||||
"addons/*",
|
||||
"ui/*"
|
||||
],
|
||||
"workspaces": {
|
||||
"packages": [
|
||||
"addons/*",
|
||||
"ui/*"
|
||||
],
|
||||
"nohoist": [
|
||||
"**/electron",
|
||||
"**/electron/**",
|
||||
"**/electron*/**",
|
||||
"**/electron*"
|
||||
]
|
||||
},
|
||||
"scripts": {
|
||||
"build:ui:core": "cd ui/core && yarn build",
|
||||
"lint": "yarn lint:addons:api && yarn lint:addons:auth && yarn lint:addons:rose && yarn lint:ui:core",
|
||||
"build:ui:connect-client": "cd ui/connect-client && yarn build",
|
||||
"lint": "yarn lint:addons:api && yarn lint:addons:auth && yarn lint:addons:rose && yarn lint:ui:core && yarn lint:ui:connect-client",
|
||||
"lint:addons:api": "echo \"\n\nlint: addons/api\n\" && cd addons/api && yarn lint",
|
||||
"lint:addons:auth": "echo \"\n\nlint: addons/auth\n\" && cd addons/auth && yarn lint",
|
||||
"lint:addons:rose": "echo \"\n\nlint: addons/rose\n\" && cd addons/rose && yarn lint",
|
||||
"lint:ui:core": "echo \"\n\nlint: ui/core\n\" && cd ui/core && yarn lint",
|
||||
"test": "yarn test:addons:api && yarn test:addons:auth && yarn test:addons:rose && yarn test:ui:core",
|
||||
"lint:ui:connect-client": "echo \"\n\nlint: ui/connect-client\n\" && cd ui/connect-client && yarn lint",
|
||||
"test": "yarn test:addons:api && yarn test:addons:auth && yarn test:addons:rose && yarn test:ui:core && yarn test:ui:connect-client",
|
||||
"test:addons:api": "echo \"\n\ntest: addons/api\n\" && cd addons/api && yarn test",
|
||||
"test:addons:auth": "echo \"\n\ntest: addons/auth\n\" && cd addons/auth && yarn test",
|
||||
"test:addons:rose": "echo \"\n\ntest: addons/rose\n\" && cd addons/rose && yarn test",
|
||||
"test:ui:core": "echo \"\n\ntest: ui/core\n\" && cd ui/core && yarn test",
|
||||
"test:ui:connect-client": "echo \"\n\ntest: ui/connect-client\n\" && cd ui/connect-client && yarn test",
|
||||
"compliance:audit": "bash ./scripts/yarn-audit.sh",
|
||||
"precommit": "yarn compliance:licenses && yarn compliance:audit && yarn lint && yarn test",
|
||||
"commit": "git-cz",
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
# EditorConfig helps developers define and maintain consistent
|
||||
# coding styles between different editors and IDEs
|
||||
# editorconfig.org
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.hbs]
|
||||
insert_final_newline = false
|
||||
|
||||
[*.{diff,md}]
|
||||
trim_trailing_whitespace = false
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
/**
|
||||
Ember CLI sends analytics information by default. The data is completely
|
||||
anonymous, but there are times when you might want to disable this behavior.
|
||||
|
||||
Setting `disableAnalytics` to true will prevent any data from being sent.
|
||||
*/
|
||||
"disableAnalytics": false
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
# unconventional js
|
||||
/blueprints/*/files/
|
||||
/vendor/
|
||||
|
||||
# compiled output
|
||||
/dist/
|
||||
/tmp/
|
||||
|
||||
# dependencies
|
||||
/bower_components/
|
||||
/node_modules/
|
||||
|
||||
# misc
|
||||
/coverage/
|
||||
!.*
|
||||
|
||||
# ember-try
|
||||
/.node_modules.ember-try/
|
||||
/bower.json.ember-try
|
||||
/package.json.ember-try
|
||||
|
||||
# ember-electron
|
||||
/electron-app/
|
||||
@@ -0,0 +1,58 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
root: true,
|
||||
parser: 'babel-eslint',
|
||||
parserOptions: {
|
||||
ecmaVersion: 2018,
|
||||
sourceType: 'module',
|
||||
ecmaFeatures: {
|
||||
legacyDecorators: true
|
||||
}
|
||||
},
|
||||
plugins: [
|
||||
'ember'
|
||||
],
|
||||
extends: [
|
||||
'eslint:recommended',
|
||||
'plugin:ember/recommended'
|
||||
],
|
||||
env: {
|
||||
browser: true
|
||||
},
|
||||
rules: {
|
||||
'ember/no-jquery': 'error'
|
||||
},
|
||||
overrides: [
|
||||
// node files
|
||||
{
|
||||
files: [
|
||||
'.eslintrc.js',
|
||||
'.template-lintrc.js',
|
||||
'ember-cli-build.js',
|
||||
'testem.js',
|
||||
'testem-electron.js',
|
||||
|
||||
'blueprints/*/index.js',
|
||||
'config/**/*.js',
|
||||
'lib/*/index.js',
|
||||
'server/**/*.js'
|
||||
],
|
||||
parserOptions: {
|
||||
sourceType: 'script'
|
||||
},
|
||||
env: {
|
||||
browser: false,
|
||||
node: true
|
||||
},
|
||||
plugins: ['node'],
|
||||
rules: Object.assign({}, require('eslint-plugin-node').configs.recommended.rules, {
|
||||
// add your custom rules and overrides for node files here
|
||||
|
||||
// this can be removed once the following is fixed
|
||||
// https://github.com/mysticatea/eslint-plugin-node/issues/77
|
||||
'node/no-unpublished-require': 'off'
|
||||
})
|
||||
}
|
||||
]
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"singleQuote": true,
|
||||
"printWidth": 80
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
files:
|
||||
include: 'app/styles/**/*.s+(a|c)ss'
|
||||
rules:
|
||||
leading-zero: 0
|
||||
mixins-before-declarations: 0
|
||||
nesting-depth: 0
|
||||
placeholder-in-extend: 0
|
||||
@@ -0,0 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
extends: 'octane',
|
||||
rules: {
|
||||
'no-bare-strings': true,
|
||||
'no-curly-component-invocation': { allow: ['app-name'] },
|
||||
'no-implicit-this': { allow: ['app-name'] }
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,39 @@
|
||||
---
|
||||
language: node_js
|
||||
node_js:
|
||||
- "10"
|
||||
|
||||
dist: trusty
|
||||
|
||||
addons:
|
||||
chrome: stable
|
||||
apt:
|
||||
packages:
|
||||
- xvfb
|
||||
|
||||
cache:
|
||||
yarn: true
|
||||
|
||||
env:
|
||||
global:
|
||||
# See https://git.io/vdao3 for details.
|
||||
- JOBS=1
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
|
||||
before_install:
|
||||
- curl -o- -L https://yarnpkg.com/install.sh | bash
|
||||
- export PATH=$HOME/.yarn/bin:$PATH
|
||||
|
||||
install:
|
||||
- yarn install --non-interactive
|
||||
- cd electron-app && yarn install --non-interactive
|
||||
- export DISPLAY=':99.0'
|
||||
- Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
|
||||
|
||||
script:
|
||||
- yarn lint:hbs
|
||||
- yarn lint:js
|
||||
- yarn test
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"ignore_dirs": ["tmp", "dist"]
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
# Client Connect UI
|
||||
|
||||
The client UI for Project Watchtower.
|
||||
|
||||
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
||||
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
||||
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
|
||||
|
||||
- [Prerequisites](#prerequisites)
|
||||
- [Installation](#installation)
|
||||
- [Yarn Commands](#yarn-commands)
|
||||
- [Running / Development](#running--development)
|
||||
- [Building for Production](#building-for-production)
|
||||
- [Environment Variables](#environment-variables)
|
||||
- [Running Tests](#running-tests)
|
||||
- [Deploying](#deploying)
|
||||
- [Further Reading / Useful Links](#further-reading--useful-links)
|
||||
|
||||
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
||||
|
||||
## Prerequisites
|
||||
|
||||
You will need the following things properly installed on your computer.
|
||||
|
||||
* [Git](https://git-scm.com/)
|
||||
* [Node.js](https://nodejs.org/)
|
||||
* [Yarn](https://yarnpkg.com/)
|
||||
* [Ember CLI](https://ember-cli.com/)
|
||||
* [Google Chrome](https://google.com/chrome/)
|
||||
|
||||
## Installation
|
||||
|
||||
See watchtower-ui README for installation instructions.
|
||||
|
||||
## Yarn Commands
|
||||
|
||||
List of available project commands. `yarn run <command-name>`
|
||||
|
||||
| Command | Description |
|
||||
| ------- | ----------- |
|
||||
| build:development | Builds the UI in development mode. |
|
||||
| build | Builds the UI for production. |
|
||||
| lint | Runs all lint commands. |
|
||||
| lint:hbs | Lints `hbs` template files. |
|
||||
| lint:js | Lints `js` files. |
|
||||
| lint:sass | Lints `scss` files. |
|
||||
| format | Runs all auto-formatters. |
|
||||
| format:js | Auto-formats `js` files using Prettier. |
|
||||
| format:sass | Auto-formats `scss` files using Prettier. |
|
||||
| start | Runs the dummy app local server. |
|
||||
| start:desktop | Runs the dummy app as an electron app. |
|
||||
| test | Runs all tests in random order, with coverage reporting. |
|
||||
| doc:toc | Automatically generates a table of contents for this README file. |
|
||||
|
||||
|
||||
## Running / Development
|
||||
|
||||
* `yarn start`
|
||||
* Visit your app at [http://localhost:4200](http://localhost:4200).
|
||||
* Visit your tests at [http://localhost:4200/tests](http://localhost:4200/tests).
|
||||
|
||||
To run as a desktop app:
|
||||
* `yarn start:desktop`
|
||||
|
||||
### Building for Production
|
||||
|
||||
Before executing a build, be sure to set any environment variables necessary
|
||||
for your target [environment](#environment-variables). To build this UI for
|
||||
production, run the following commads from this folder:
|
||||
|
||||
```bash
|
||||
yarn install
|
||||
yarn build
|
||||
```
|
||||
|
||||
The static production assets are saved into the `dist/` folder.
|
||||
|
||||
|
||||
#### Environment Variables
|
||||
|
||||
These environment variables may be used to customized the build.
|
||||
|
||||
| Variable | Default Value | Description |
|
||||
| -------- | ------------- | ----------- |
|
||||
| `APP_NAME` | Application Name | The user-facing name of the application, appearing in titles, etc. |
|
||||
| `API_HOST` | | The host of the API, if different than UI (e.g. https://example.net:1234). |
|
||||
|
||||
### Running Tests
|
||||
|
||||
* `yarn test` runs full tests in random order with coverage
|
||||
|
||||
Keep in mind that tests are executed in random order. This is intentional
|
||||
and helps to prevent hard-to-debug order dependencies among tests.
|
||||
|
||||
Please also note that we report test coverage. We strive for "the right amount
|
||||
of testing". Use test coverage as a guide to help you identify untested
|
||||
high-value code.
|
||||
|
||||
We rely on `ember-a11y-testing` to validate accessibility in acceptance tests.
|
||||
If you write acceptance tests, please ensure at least one validation per
|
||||
route using `await a11yAudit();`.
|
||||
|
||||
### Deploying
|
||||
|
||||
TBD
|
||||
|
||||
## Further Reading / Useful Links
|
||||
|
||||
* [ember.js](https://emberjs.com/)
|
||||
* [ember-cli](https://ember-cli.com/)
|
||||
* Development Browser Extensions
|
||||
* [ember inspector for chrome](https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi)
|
||||
* [ember inspector for firefox](https://addons.mozilla.org/en-US/firefox/addon/ember-inspector/)
|
||||
@@ -0,0 +1,12 @@
|
||||
import Application from '@ember/application';
|
||||
import Resolver from 'ember-resolver';
|
||||
import loadInitializers from 'ember-load-initializers';
|
||||
import config from './config/environment';
|
||||
|
||||
export default class App extends Application {
|
||||
modulePrefix = config.modulePrefix;
|
||||
podModulePrefix = config.podModulePrefix;
|
||||
Resolver = Resolver;
|
||||
}
|
||||
|
||||
loadInitializers(App, config.modulePrefix);
|
||||
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
@@ -0,0 +1,25 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>ConnectClient</title>
|
||||
<meta name="description" content="">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
{{content-for "head"}}
|
||||
|
||||
<link integrity="" rel="stylesheet" href="{{rootURL}}assets/vendor.css">
|
||||
<link integrity="" rel="stylesheet" href="{{rootURL}}assets/connect-client.css">
|
||||
|
||||
{{content-for "head-footer"}}
|
||||
</head>
|
||||
<body>
|
||||
{{content-for "body"}}
|
||||
|
||||
<script src="{{rootURL}}assets/vendor.js"></script>
|
||||
<script src="{{rootURL}}assets/connect-client.js"></script>
|
||||
|
||||
{{content-for "body-footer"}}
|
||||
</body>
|
||||
</html>
|
||||
Whitespace-only changes.
@@ -0,0 +1,9 @@
|
||||
import EmberRouter from '@ember/routing/router';
|
||||
import config from './config/environment';
|
||||
|
||||
export default class Router extends EmberRouter {
|
||||
location = config.locationType;
|
||||
rootURL = config.rootURL;
|
||||
}
|
||||
|
||||
Router.map(function () {});
|
||||
Whitespace-only changes.
Whitespace-only changes.
@@ -0,0 +1,5 @@
|
||||
{{!-- The following component displays Ember's default welcome message. --}}
|
||||
<WelcomePage />
|
||||
{{!-- Feel free to remove this! --}}
|
||||
|
||||
{{outlet}}
|
||||
@@ -0,0 +1,62 @@
|
||||
'use strict';
|
||||
|
||||
const APP_NAME = process.env.APP_NAME || 'Application Name';
|
||||
const API_HOST = process.env.API_HOST || '';
|
||||
|
||||
module.exports = function (environment) {
|
||||
let ENV = {
|
||||
modulePrefix: 'connect-client',
|
||||
environment,
|
||||
rootURL: process.env.EMBER_CLI_ELECTRON ? '' : '/',
|
||||
locationType: process.env.EMBER_CLI_ELECTRON ? 'hash' : 'auto',
|
||||
EmberENV: {
|
||||
FEATURES: {
|
||||
// Here you can enable experimental features on an ember canary build
|
||||
// e.g. EMBER_NATIVE_DECORATOR_SUPPORT: true
|
||||
},
|
||||
EXTEND_PROTOTYPES: false,
|
||||
// EXTEND_PROTOTYPES: {
|
||||
// // Prevent Ember Data from overriding Date.parse.
|
||||
// Date: false
|
||||
// }
|
||||
},
|
||||
|
||||
APP: {
|
||||
// Here you can pass flags/options to your application instance
|
||||
// when it is created
|
||||
},
|
||||
|
||||
api: {
|
||||
host: API_HOST,
|
||||
namespace: 'v1',
|
||||
},
|
||||
|
||||
appName: APP_NAME,
|
||||
};
|
||||
|
||||
if (environment === 'development') {
|
||||
// ENV.APP.LOG_RESOLVER = true;
|
||||
// ENV.APP.LOG_ACTIVE_GENERATION = true;
|
||||
// ENV.APP.LOG_TRANSITIONS = true;
|
||||
// ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
|
||||
// ENV.APP.LOG_VIEW_LOOKUPS = true;
|
||||
}
|
||||
|
||||
if (environment === 'test') {
|
||||
// Testem prefers this...
|
||||
ENV.locationType = 'none';
|
||||
|
||||
// keep test console output quieter
|
||||
ENV.APP.LOG_ACTIVE_GENERATION = false;
|
||||
ENV.APP.LOG_VIEW_LOOKUPS = false;
|
||||
|
||||
ENV.APP.rootElement = '#ember-testing';
|
||||
ENV.APP.autoboot = false;
|
||||
}
|
||||
|
||||
if (environment === 'production') {
|
||||
// here you can enable a production-specific feature
|
||||
}
|
||||
|
||||
return ENV;
|
||||
};
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"application-template-wrapper": false,
|
||||
"default-async-observers": true,
|
||||
"jquery-integration": false,
|
||||
"template-only-glimmer-components": true
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
const browsers = [
|
||||
'last 1 Chrome versions',
|
||||
'last 1 Firefox versions',
|
||||
'last 1 Safari versions',
|
||||
];
|
||||
|
||||
const isCI = !!process.env.CI;
|
||||
const isProduction = process.env.EMBER_ENV === 'production';
|
||||
|
||||
if (isCI || isProduction) {
|
||||
browsers.push('ie 11');
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
browsers,
|
||||
};
|
||||
@@ -0,0 +1,93 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
lerna-debug.log*
|
||||
|
||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
.DS_Store
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
*.lcov
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# TypeScript v1 declaration files
|
||||
typings/
|
||||
|
||||
# TypeScript cache
|
||||
*.tsbuildinfo
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
# dotenv environment variables file
|
||||
.env
|
||||
.env.test
|
||||
|
||||
# parcel-bundler cache (https://parceljs.org/)
|
||||
.cache
|
||||
|
||||
# next.js build output
|
||||
.next
|
||||
|
||||
# nuxt.js build output
|
||||
.nuxt
|
||||
|
||||
# vuepress build output
|
||||
.vuepress/dist
|
||||
|
||||
# Serverless directories
|
||||
.serverless/
|
||||
|
||||
# FuseBox cache
|
||||
.fusebox/
|
||||
|
||||
# DynamoDB Local files
|
||||
.dynamodb/
|
||||
|
||||
# Webpack
|
||||
.webpack/
|
||||
|
||||
# Electron-Forge
|
||||
out/
|
||||
|
||||
# Ember build
|
||||
ember-dist/
|
||||
ember-test/
|
||||
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"name": "connect-client",
|
||||
"productName": "connect-client",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"description": "Electron UI for client for Project Watchtower.",
|
||||
"license": "MPL-2.0",
|
||||
"author": "HashiCorp",
|
||||
"main": "src/index.js",
|
||||
"scripts": {
|
||||
"start": "electron-forge start",
|
||||
"package": "electron-forge package",
|
||||
"make": "electron-forge make",
|
||||
"publish": "electron-forge publish",
|
||||
"lint": "echo \"No linting configured\""
|
||||
},
|
||||
"keywords": [],
|
||||
"config": {
|
||||
"forge": {
|
||||
"packagerConfig": {
|
||||
"ignore": [
|
||||
"/ember-test(/|$)",
|
||||
"/tests(/|$)"
|
||||
]
|
||||
},
|
||||
"makers": [
|
||||
{
|
||||
"name": "@electron-forge/maker-squirrel",
|
||||
"config": {
|
||||
"name": "connect_client"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "@electron-forge/maker-zip",
|
||||
"platforms": [
|
||||
"darwin"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "@electron-forge/maker-deb",
|
||||
"config": {}
|
||||
},
|
||||
{
|
||||
"name": "@electron-forge/maker-rpm",
|
||||
"config": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"devtron": "^1.4.0",
|
||||
"electron-devtools-installer": "^3.1.0",
|
||||
"electron-is-dev": "^1.2.0",
|
||||
"electron-squirrel-startup": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@electron-forge/cli": "6.0.0-beta.51",
|
||||
"@electron-forge/maker-deb": "6.0.0-beta.51",
|
||||
"@electron-forge/maker-rpm": "6.0.0-beta.51",
|
||||
"@electron-forge/maker-squirrel": "6.0.0-beta.51",
|
||||
"@electron-forge/maker-zip": "6.0.0-beta.51",
|
||||
"electron": "9.0.5",
|
||||
"ember-inspector": "^4.1.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
const { protocol } = require('electron');
|
||||
const { fileURLToPath } = require('url');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const { promisify } = require('util');
|
||||
|
||||
const access = promisify(fs.access);
|
||||
|
||||
//
|
||||
// Patch asset loading -- Ember apps use absolute paths to reference their
|
||||
// assets, e.g. `<img src="/images/foo.jpg">`. When the current URL is a `file:`
|
||||
// URL, that ends up resolving to the absolute filesystem path `/images/foo.jpg`
|
||||
// rather than being relative to the root of the Ember app. So, we intercept
|
||||
// `file:` URL request and look to see if they point to an asset when
|
||||
// interpreted as being relative to the root of the Ember app. If so, we return
|
||||
// that path, and if not we leave them as-is, as their absolute path.
|
||||
//
|
||||
module.exports = function handleFileURLs(emberAppDir) {
|
||||
protocol.interceptFileProtocol('file', async ({ url }, callback) => {
|
||||
let urlPath = fileURLToPath(url);
|
||||
let appPath = path.join(emberAppDir, urlPath);
|
||||
try {
|
||||
await access(appPath);
|
||||
callback(appPath);
|
||||
} catch (e) {
|
||||
callback(urlPath);
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,99 @@
|
||||
/* eslint-disable no-console */
|
||||
const { default: installExtension, EMBER_INSPECTOR } = require('electron-devtools-installer');
|
||||
const { pathToFileURL } = require('url');
|
||||
const { app, BrowserWindow } = require('electron');
|
||||
const path = require('path');
|
||||
const isDev = require('electron-is-dev');
|
||||
const handleFileUrls = require('./handle-file-urls');
|
||||
|
||||
const emberAppDir = path.resolve(__dirname, '..', 'ember-dist');
|
||||
const emberAppURL = pathToFileURL(path.join(emberAppDir, 'index.html')).toString();
|
||||
|
||||
let mainWindow = null;
|
||||
|
||||
// Uncomment the lines below to enable Electron's crash reporter
|
||||
// For more information, see http://electron.atom.io/docs/api/crash-reporter/
|
||||
// electron.crashReporter.start({
|
||||
// productName: 'YourName',
|
||||
// companyName: 'YourCompany',
|
||||
// submitURL: 'https://your-domain.com/url-to-submit',
|
||||
// autoSubmit: true
|
||||
// });
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') {
|
||||
app.quit();
|
||||
}
|
||||
});
|
||||
|
||||
app.on('ready', async () => {
|
||||
if (isDev) {
|
||||
try {
|
||||
require('devtron').install();
|
||||
} catch (err) {
|
||||
console.log('Failed to install Devtron: ', err);
|
||||
}
|
||||
try {
|
||||
await installExtension(EMBER_INSPECTOR);
|
||||
} catch (err) {
|
||||
console.log('Failed to install Ember Inspector: ', err);
|
||||
}
|
||||
}
|
||||
|
||||
await handleFileUrls(emberAppDir);
|
||||
|
||||
mainWindow = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600,
|
||||
});
|
||||
|
||||
// If you want to open up dev tools programmatically, call
|
||||
// mainWindow.openDevTools();
|
||||
|
||||
// Load the ember application
|
||||
mainWindow.loadURL(emberAppURL);
|
||||
|
||||
// If a loading operation goes wrong, we'll send Electron back to
|
||||
// Ember App entry point
|
||||
mainWindow.webContents.on('did-fail-load', () => {
|
||||
mainWindow.loadURL(emberAppURL);
|
||||
});
|
||||
|
||||
mainWindow.webContents.on('crashed', () => {
|
||||
console.log('Your Ember app (or other code) in the main window has crashed.');
|
||||
console.log('This is a serious issue that needs to be handled and/or debugged.');
|
||||
});
|
||||
|
||||
mainWindow.on('unresponsive', () => {
|
||||
console.log('Your Ember app (or other code) has made the window unresponsive.');
|
||||
});
|
||||
|
||||
mainWindow.on('responsive', () => {
|
||||
console.log('The main window has become responsive again.');
|
||||
});
|
||||
|
||||
mainWindow.on('closed', () => {
|
||||
mainWindow = null;
|
||||
});
|
||||
});
|
||||
|
||||
// Handle an unhandled error in the main thread
|
||||
//
|
||||
// Note that 'uncaughtException' is a crude mechanism for exception handling intended to
|
||||
// be used only as a last resort. The event should not be used as an equivalent to
|
||||
// "On Error Resume Next". Unhandled exceptions inherently mean that an application is in
|
||||
// an undefined state. Attempting to resume application code without properly recovering
|
||||
// from the exception can cause additional unforeseen and unpredictable issues.
|
||||
//
|
||||
// Attempting to resume normally after an uncaught exception can be similar to pulling out
|
||||
// of the power cord when upgrading a computer -- nine out of ten times nothing happens -
|
||||
// but the 10th time, the system becomes corrupted.
|
||||
//
|
||||
// The correct use of 'uncaughtException' is to perform synchronous cleanup of allocated
|
||||
// resources (e.g. file descriptors, handles, etc) before shutting down the process. It is
|
||||
// not safe to resume normal operation after 'uncaughtException'.
|
||||
process.on('uncaughtException', (err) => {
|
||||
console.log('An exception in the main thread was not handled.');
|
||||
console.log('This is a serious issue that needs to be handled and/or debugged.');
|
||||
console.log(`Exception: ${err}`);
|
||||
});
|
||||
@@ -0,0 +1,30 @@
|
||||
const { default: installExtension, EMBER_INSPECTOR } = require('electron-devtools-installer');
|
||||
const path = require('path');
|
||||
const { app } = require('electron');
|
||||
const handleFileUrls = require('../src/handle-file-urls');
|
||||
const { setupTestem, openTestWindow } = require('ember-electron/lib/test-support');
|
||||
|
||||
const emberAppDir = path.resolve(__dirname, '..', 'ember-test');
|
||||
|
||||
app.on('ready', async function onReady() {
|
||||
try {
|
||||
require('devtron').install();
|
||||
} catch (err) {
|
||||
console.log('Failed to install Devtron: ', err);
|
||||
}
|
||||
try {
|
||||
await installExtension(EMBER_INSPECTOR);
|
||||
} catch (err) {
|
||||
console.log('Failed to install Ember Inspector: ', err);
|
||||
}
|
||||
|
||||
await handleFileUrls(emberAppDir);
|
||||
setupTestem();
|
||||
openTestWindow(emberAppDir);
|
||||
});
|
||||
|
||||
app.on('window-all-closed', function onWindowAllClosed() {
|
||||
if (process.platform !== 'darwin') {
|
||||
app.quit();
|
||||
}
|
||||
});
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,34 @@
|
||||
'use strict';
|
||||
|
||||
const EmberApp = require('ember-cli/lib/broccoli/ember-app');
|
||||
|
||||
module.exports = function (defaults) {
|
||||
let app = new EmberApp(defaults, {
|
||||
babel: {
|
||||
sourceMaps: 'inline',
|
||||
},
|
||||
sourcemaps: {
|
||||
enabled: true,
|
||||
extensions: ['js'],
|
||||
},
|
||||
sassOptions: {
|
||||
onlyIncluded: true,
|
||||
extension: 'scss',
|
||||
},
|
||||
});
|
||||
|
||||
// Use `app.import` to add additional libraries to the generated
|
||||
// output files.
|
||||
//
|
||||
// If you need to use different assets in different
|
||||
// environments, specify an object as the first parameter. That
|
||||
// object's keys should be the environment name and the values
|
||||
// should be the asset to use in that environment.
|
||||
//
|
||||
// If the library that you are including contains AMD or ES6
|
||||
// modules that you would like to import into your application
|
||||
// please specify an object with the list of modules as keys
|
||||
// along with the exports of each module as its value.
|
||||
|
||||
return app.toTree();
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
import config from '../config/environment';
|
||||
|
||||
export default function() {
|
||||
|
||||
this.passthrough('/write-coverage');
|
||||
// It's important that the passthrough for coverage is before the namespace, otherwise it will be prefixed.
|
||||
this.namespace = config.api.namespace;
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
{
|
||||
"name": "connect-client",
|
||||
"version": "0.0.0",
|
||||
"description": "Client UI for Project Watchtower.",
|
||||
"license": "MPL-2.0",
|
||||
"author": "HashiCorp",
|
||||
"directories": {
|
||||
"doc": "doc",
|
||||
"test": "tests"
|
||||
},
|
||||
"scripts": {
|
||||
"doc:toc": "doctoc README.md",
|
||||
"build": "ember build --environment=production",
|
||||
"build:development": "ember build",
|
||||
"lint": "yarn lint:hbs && yarn lint:js && yarn lint:sass",
|
||||
"lint:hbs": "ember-template-lint .",
|
||||
"lint:js": "eslint .",
|
||||
"lint:sass": "sass-lint -v -q",
|
||||
"format": "yarn format:js && npm run format:sass",
|
||||
"format:js": "prettier --write '{app,config,stories,tests}/**/*.js' *.js",
|
||||
"format:sass": "prettier --write app/**/*.scss",
|
||||
"start": "ember serve",
|
||||
"start:desktop": "ember electron",
|
||||
"clean:coverage": "rm -rf coverage_*",
|
||||
"pretest": "yarn clean:coverage",
|
||||
"test": "COVERAGE=true ember exam --random",
|
||||
"postinstall": "cd electron-app && yarn install",
|
||||
"posttest": "ember coverage-merge && yarn clean:coverage"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ember/optional-features": "^1.3.0",
|
||||
"@glimmer/component": "^1.0.0",
|
||||
"@glimmer/tracking": "^1.0.0",
|
||||
"babel-eslint": "^10.0.3",
|
||||
"broccoli-asset-rev": "^3.0.0",
|
||||
"doctoc": "^1.4.0",
|
||||
"ember-auto-import": "^1.5.3",
|
||||
"ember-cli": "~3.16.2",
|
||||
"ember-cli-app-version": "^3.2.0",
|
||||
"ember-cli-babel": "^7.17.2",
|
||||
"ember-cli-code-coverage": "^1.0.0-beta.9",
|
||||
"ember-cli-dependency-checker": "^3.2.0",
|
||||
"ember-cli-eslint": "^5.1.0",
|
||||
"ember-cli-htmlbars": "^4.2.2",
|
||||
"ember-cli-inject-live-reload": "^2.0.2",
|
||||
"ember-cli-mirage": "^1.1.7",
|
||||
"ember-cli-sass": "^10.0.1",
|
||||
"ember-cli-sri": "^2.1.1",
|
||||
"ember-cli-template-lint": "^1.0.0-beta.3",
|
||||
"ember-cli-uglify": "^3.0.0",
|
||||
"ember-data": "~3.16.0",
|
||||
"ember-electron": "https://github.com/adopted-ember-addons/ember-electron#v3.0.0-beta.3",
|
||||
"ember-exam": "^5.0.1",
|
||||
"ember-export-application-global": "^2.0.1",
|
||||
"ember-fetch": "^7.0.0",
|
||||
"ember-intl": "^5.2.0",
|
||||
"ember-load-initializers": "^2.1.1",
|
||||
"ember-maybe-import-regenerator": "^0.1.6",
|
||||
"ember-qunit": "^4.6.0",
|
||||
"ember-resolver": "^7.0.0",
|
||||
"ember-source": "~3.16.0",
|
||||
"ember-welcome-page": "^4.0.0",
|
||||
"eslint-plugin-ember": "^7.7.2",
|
||||
"eslint-plugin-node": "^11.0.0",
|
||||
"loader.js": "^4.7.0",
|
||||
"prettier": "^2.0.5",
|
||||
"qunit-dom": "^1.0.0",
|
||||
"sass": "^1.26.5",
|
||||
"sass-lint": "^1.13.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "10.* || >= 12"
|
||||
},
|
||||
"ember": {
|
||||
"edition": "octane"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
# http://www.robotstxt.org
|
||||
User-agent: *
|
||||
Disallow:
|
||||
@@ -0,0 +1,25 @@
|
||||
module.exports = {
|
||||
test_page: 'tests/index.html?hidepassed',
|
||||
disable_watching: true,
|
||||
launchers: {
|
||||
Electron: require('ember-electron/lib/test-runner'),
|
||||
},
|
||||
launch_in_ci: ['Electron'],
|
||||
launch_in_dev: ['Electron'],
|
||||
browser_args: {
|
||||
Electron: {
|
||||
// Note: Some these Chrome options may not be supported in Electron
|
||||
// See https://electronjs.org/docs/api/chrome-command-line-switches
|
||||
ci: [
|
||||
// --no-sandbox is needed when running Chrome inside a container
|
||||
process.env.CI ? '--no-sandbox' : null,
|
||||
'--headless',
|
||||
'--disable-dev-shm-usage',
|
||||
'--disable-software-rasterizer',
|
||||
'--mute-audio',
|
||||
'--remote-debugging-port=0',
|
||||
'--window-size=1440,900',
|
||||
].filter(Boolean),
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,23 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
test_page: 'tests/index.html?hidepassed',
|
||||
disable_watching: true,
|
||||
launch_in_ci: ['Chrome'],
|
||||
launch_in_dev: ['Chrome'],
|
||||
browser_start_timeout: 120,
|
||||
browser_args: {
|
||||
Chrome: {
|
||||
ci: [
|
||||
// --no-sandbox is needed when running Chrome inside a container
|
||||
process.env.CI ? '--no-sandbox' : null,
|
||||
'--headless',
|
||||
'--disable-dev-shm-usage',
|
||||
'--disable-software-rasterizer',
|
||||
'--mute-audio',
|
||||
'--remote-debugging-port=0',
|
||||
'--window-size=1440,900',
|
||||
].filter(Boolean),
|
||||
},
|
||||
},
|
||||
};
|
||||
Whitespace-only changes.
@@ -0,0 +1,33 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>ConnectClient Tests</title>
|
||||
<meta name="description" content="">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
{{content-for "head"}}
|
||||
{{content-for "test-head"}}
|
||||
|
||||
<link rel="stylesheet" href="{{rootURL}}assets/vendor.css">
|
||||
<link rel="stylesheet" href="{{rootURL}}assets/connect-client.css">
|
||||
<link rel="stylesheet" href="{{rootURL}}assets/test-support.css">
|
||||
|
||||
{{content-for "head-footer"}}
|
||||
{{content-for "test-head-footer"}}
|
||||
</head>
|
||||
<body>
|
||||
{{content-for "body"}}
|
||||
{{content-for "test-body"}}
|
||||
|
||||
<script src="/testem.js" integrity=""></script>
|
||||
<script src="{{rootURL}}assets/vendor.js"></script>
|
||||
<script src="{{rootURL}}assets/test-support.js"></script>
|
||||
<script src="{{rootURL}}assets/connect-client.js"></script>
|
||||
<script src="{{rootURL}}assets/tests.js"></script>
|
||||
|
||||
{{content-for "body-footer"}}
|
||||
{{content-for "test-body-footer"}}
|
||||
</body>
|
||||
</html>
|
||||
Whitespace-only changes.
@@ -0,0 +1,8 @@
|
||||
import Application from '../app';
|
||||
import config from '../config/environment';
|
||||
import { setApplication } from '@ember/test-helpers';
|
||||
import { start } from 'ember-qunit';
|
||||
|
||||
setApplication(Application.create(config.APP));
|
||||
|
||||
start();
|
||||
Whitespace-only changes.
Whitespace-only changes.
Reference in new issue
Block a user