diff --git a/console b/console deleted file mode 160000 index 8e43f513..00000000 --- a/console +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8e43f5139d7ef5e10cef99b011f3af1f219cadb7 diff --git a/console/.dockerignore b/console/.dockerignore new file mode 100644 index 00000000..8933b7c9 --- /dev/null +++ b/console/.dockerignore @@ -0,0 +1,25 @@ +# Ignore files not needed for docker to build microservice image +node_modules/* +postgres/* +typings/* +*/.git* +*.git* +*.git +*.md +!gulpfile.js +ci/ +.circleci/ +Vagrantfile +concourse/ +infra/* +vagrant/* +docker/* +deploy/* +media/* +data/* +appspec.yml +compose.yml +docker-compose-prod.yml +docker-compose.yml +$virtualenv.tar.gz +$node_modules.tar.gz diff --git a/console/.editorconfig b/console/.editorconfig new file mode 100644 index 00000000..c35a0024 --- /dev/null +++ b/console/.editorconfig @@ -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 diff --git a/console/.ember-cli b/console/.ember-cli new file mode 100644 index 00000000..4ccb4bf4 --- /dev/null +++ b/console/.ember-cli @@ -0,0 +1,15 @@ +{ + /** + 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, + + /** + Setting `isTypeScriptProject` to true will force the blueprint generators to generate TypeScript + rather than JavaScript by default, when a TypeScript version of a given blueprint is available. + */ + "isTypeScriptProject": false +} diff --git a/console/.eslintignore b/console/.eslintignore new file mode 100644 index 00000000..d474a40b --- /dev/null +++ b/console/.eslintignore @@ -0,0 +1,25 @@ +# unconventional js +/blueprints/*/files/ +/vendor/ + +# compiled output +/dist/ +/tmp/ + +# dependencies +/bower_components/ +/node_modules/ + +# misc +/coverage/ +!.* +.*/ +.eslintcache + +# ember-try +/.node_modules.ember-try/ +/bower.json.ember-try +/npm-shrinkwrap.json.ember-try +/package.json.ember-try +/package-lock.json.ember-try +/yarn.lock.ember-try diff --git a/console/.eslintrc.js b/console/.eslintrc.js new file mode 100644 index 00000000..1cb05e98 --- /dev/null +++ b/console/.eslintrc.js @@ -0,0 +1,82 @@ +'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', 'plugin:prettier/recommended'], + ignorePatterns: ['prebuild.js'], + env: { + browser: true, + }, + globals: { + socketClusterClient: 'readonly', + L: 'readonly', + module: 'readonly', + require: 'readonly', + }, + rules: { + 'ember/no-array-prototype-extensions': 'off', + 'ember/no-computed-properties-in-native-classes': 'off', + 'ember/no-controller-access-in-routes': 'off', + 'ember/no-empty-glimmer-component-classes': 'off', + 'ember/no-get': 'off', + 'ember/classic-decorator-no-classic-methods': 'off', + 'node/no-unpublished-require': [ + 'error', + { + allowModules: [ + 'ember-cli', + 'tailwindcss', + '@tailwindcss/forms', + 'postcss-import', + 'postcss-preset-env', + 'postcss-each', + 'postcss-mixins', + 'postcss-conditionals-renewed', + 'autoprefixer', + 'broccoli-funnel', + 'ember-auto-import', + ], + }, + ], + 'no-prototype-builtins': 'off', + }, + overrides: [ + // node files + { + files: [ + './.eslintrc.js', + './.prettierrc.js', + './.template-lintrc.js', + './ember-cli-build.js', + './index.js', + './testem.js', + './blueprints/*/index.js', + './config/**/*.js', + './tests/dummy/config/**/*.js', + ], + parserOptions: { + sourceType: 'script', + }, + env: { + browser: false, + node: true, + }, + plugins: ['node'], + extends: ['plugin:node/recommended'], + }, + { + // test files + files: ['tests/**/*-test.{js,ts}'], + extends: ['plugin:qunit/recommended'], + }, + ], +}; diff --git a/console/.github/workflows/ci.yml b/console/.github/workflows/ci.yml new file mode 100644 index 00000000..cf5964ba --- /dev/null +++ b/console/.github/workflows/ci.yml @@ -0,0 +1,60 @@ +name: Ember CI + +on: + push: + branches: [ main ] + tags: + - 'v*' + pull_request: + branches: [ main ] + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [16.x] # Build on Node.js 16 + + steps: + - uses: actions/checkout@v2 + + - name: Setup Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + + - name: Setup pnpm + uses: pnpm/action-setup@v2.0.1 + with: + version: latest + + - name: Get pnpm Store Directory + id: pnpm-cache + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT + + - uses: actions/cache@v3 + name: Setup pnpm Cache + with: + path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: Create .npmrc + run: | + if [[ -n "${{ secrets._GITHUB_AUTH_TOKEN }}" ]]; then + echo "@fleetbase:registry=https://npm.pkg.github.com/" > .npmrc + echo "//npm.pkg.github.com/:_authToken=${{ secrets._GITHUB_AUTH_TOKEN }}" >> .npmrc + fi + + - name: Install Dependencies + run: pnpm install + + - name: Lint + run: pnpm run lint + + - name: Build + run: npx ember build --environment production diff --git a/console/.gitignore b/console/.gitignore new file mode 100644 index 00000000..77ae0999 --- /dev/null +++ b/console/.gitignore @@ -0,0 +1,35 @@ +# See https://help.github.com/ignore-files/ for more about ignoring files. + +# compiled output +/dist/ +/tmp/ + +# dependencies +/bower_components/ +/node_modules/ + +# misc +/.env* +/environments/.env* +/.pnp* +/.sass-cache +/.eslintcache +/connect.lock +/coverage/ +/libpeerconnection.log +/npm-debug.log* +/testem.log +/yarn-error.log +/.npmrc +/pnpm-lock.yaml + +# ember-try +/.node_modules.ember-try/ +/bower.json.ember-try +/npm-shrinkwrap.json.ember-try +/package.json.ember-try +/package-lock.json.ember-try +/yarn.lock.ember-try + +# broccoli-debug +/DEBUG/ diff --git a/console/.prettierignore b/console/.prettierignore new file mode 100644 index 00000000..4178fd57 --- /dev/null +++ b/console/.prettierignore @@ -0,0 +1,25 @@ +# unconventional js +/blueprints/*/files/ +/vendor/ + +# compiled output +/dist/ +/tmp/ + +# dependencies +/bower_components/ +/node_modules/ + +# misc +/coverage/ +!.* +.eslintcache +.lint-todo/ + +# ember-try +/.node_modules.ember-try/ +/bower.json.ember-try +/npm-shrinkwrap.json.ember-try +/package.json.ember-try +/package-lock.json.ember-try +/yarn.lock.ember-try diff --git a/console/.prettierrc.js b/console/.prettierrc.js new file mode 100644 index 00000000..cd88cc9f --- /dev/null +++ b/console/.prettierrc.js @@ -0,0 +1,17 @@ +'use strict'; + +module.exports = { + trailingComma: 'es5', + tabWidth: 4, + semi: true, + singleQuote: true, + printWidth: 190, + overrides: [ + { + files: '*.hbs', + options: { + singleQuote: false, + }, + }, + ], +}; diff --git a/console/.template-lintrc.js b/console/.template-lintrc.js new file mode 100644 index 00000000..77c8fc74 --- /dev/null +++ b/console/.template-lintrc.js @@ -0,0 +1,14 @@ +'use strict'; + +module.exports = { + extends: 'recommended', + rules: { + 'no-bare-strings': 'off', + 'no-invalid-interactive': 'off', + 'no-yield-only': 'off', + 'no-down-event-binding': 'off', + 'table-groups': 'off', + 'link-href-attributes': 'off', + 'require-input-label': 'off', + }, +}; diff --git a/console/.watchmanconfig b/console/.watchmanconfig new file mode 100644 index 00000000..e7834e3e --- /dev/null +++ b/console/.watchmanconfig @@ -0,0 +1,3 @@ +{ + "ignore_dirs": ["tmp", "dist"] +} diff --git a/console/Dockerfile b/console/Dockerfile new file mode 100644 index 00000000..7dd675a1 --- /dev/null +++ b/console/Dockerfile @@ -0,0 +1,51 @@ +# ---- Build Stage ---- +FROM node:16.20-alpine AS builder + +# Set the working directory in the container to /app +WORKDIR /app + +# Create the pnpm directory and set the PNPM_HOME environment variable +RUN mkdir -p ~/.pnpm +ENV PNPM_HOME /root/.pnpm + +# Add the pnpm global bin to the PATH +ENV PATH /root/.pnpm/bin:$PATH + +# Copy pnpm-lock.yaml (or package.json) into the directory /app in the container +COPY console/package.json console/pnpm-lock.yaml ./ + +# Copy over .npmrc if applicable +COPY console/.npmr[c] ./ + +# Install global dependencies +RUN npm install -g ember-cli pnpm + +# Install git +RUN apk update && apk add git openssh-client + +# Trust GitHub's RSA host key +RUN mkdir -p -m 0600 ~/.ssh && ssh-keyscan github.com >> ~/.ssh/known_hosts + +# Install app dependencies +RUN pnpm install + +# Copy the console directory contents into the container at /app +COPY console . + +# Build the application +RUN pnpm build + +# ---- Serve Stage ---- +FROM nginx:alpine + +# Copy the built app to our served directory +COPY --from=builder /app/dist /usr/share/nginx/html + +# Expose the port nginx is bound to +EXPOSE 4200 + +# Use custom nginx.conf +COPY console/nginx.conf /etc/nginx/conf.d/default.conf + +# Start Nginx server +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/console/README.md b/console/README.md new file mode 100644 index 00000000..a3284d62 --- /dev/null +++ b/console/README.md @@ -0,0 +1,22 @@ +
+

+ + Fleetbase logo + +

+

+ Fleetbase Console +

+
+ +

+ Fleetbase Console +

+ +# ⭐️ Overview + +

The Fleetbase Console, a vital component of the Fleetbase Platform, serves as the graphical user interface that facilitates interaction with all Fleetbase extensions. It's architecturally designed to be lightweight, primarily employing Ember Engines for its operational foundation. Ember Engines, a scalable development paradigm for ambitious web applications, allow the Console to dynamically load and manage extensions, ensuring a streamlined and efficient user experience.

+ +

The responsibilities of the Console are kept minimalistic to maintain its performance and agility. The Console's key responsibilities encompass administration management, configuration of organization and user settings, and establishing a robust connection to the Fleetbase extensions repository. In its administrative capacity, it provides an intuitive interface for configuring the Fleetbas instance.

+ +

Lastly, the Console plays a pivotal role in connecting to the Fleetbase extensions repository. This provides the flexibility to add, update, or remove extensions as per the organizational needs and preferences, all while ensuring the seamless operation and integrity of the Fleetbase Platform.

diff --git a/console/app/adapters/application.js b/console/app/adapters/application.js new file mode 100644 index 00000000..ac44c25f --- /dev/null +++ b/console/app/adapters/application.js @@ -0,0 +1 @@ +export { default } from '@fleetbase/ember-core/adapters/application'; diff --git a/console/app/adapters/brand.js b/console/app/adapters/brand.js new file mode 100644 index 00000000..2ab9bd26 --- /dev/null +++ b/console/app/adapters/brand.js @@ -0,0 +1,15 @@ +import ApplicationAdapter from './application'; + +export default class BrandAdapter extends ApplicationAdapter { + urlForFindRecord() { + return `${this.host}/${this.namespace}/settings/branding`; + } + + urlForUpdateRecord() { + return `${this.host}/${this.namespace}/settings/branding`; + } + + urlForCreateRecord() { + return `${this.host}/${this.namespace}/settings/branding`; + } +} diff --git a/console/app/app.js b/console/app/app.js new file mode 100644 index 00000000..ab948fd0 --- /dev/null +++ b/console/app/app.js @@ -0,0 +1,23 @@ +import Application from '@ember/application'; +import Resolver from 'ember-resolver'; +import loadInitializers from 'ember-load-initializers'; +import config from '@fleetbase/console/config/environment'; +import loadExtensions from '@fleetbase/ember-core/utils/load-extensions'; +import mapEngines from '@fleetbase/ember-core/utils/map-engines'; + +export default class App extends Application { + modulePrefix = config.modulePrefix; + podModulePrefix = config.podModulePrefix; + Resolver = Resolver; + extensions = []; + engines = {}; + + async ready() { + const extensions = await loadExtensions(); + + this.extensions = extensions; + this.engines = mapEngines(extensions); + } +} + +loadInitializers(App, config.modulePrefix); diff --git a/console/app/components/.gitkeep b/console/app/components/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/console/app/components/configure/filesystem.hbs b/console/app/components/configure/filesystem.hbs new file mode 100644 index 00000000..82d89f20 --- /dev/null +++ b/console/app/components/configure/filesystem.hbs @@ -0,0 +1,21 @@ + + + + + {{#if (eq this.mailer "smtp")}} + + + + + + + + {{/if}} + + + {{#if this.testResponse}} +
+ + {{this.this.testResponse.message}} +
+ {{/if}} +