diff --git a/ui-v2/.editorconfig b/ui-v2/.editorconfig index 13bc6da1f4..189bfcf026 100644 --- a/ui-v2/.editorconfig +++ b/ui-v2/.editorconfig @@ -4,7 +4,6 @@ root = true - [*] end_of_line = lf charset = utf-8 diff --git a/ui-v2/.eslintrc.js b/ui-v2/.eslintrc.js index e35e1db2a9..03e383b181 100644 --- a/ui-v2/.eslintrc.js +++ b/ui-v2/.eslintrc.js @@ -1,8 +1,12 @@ module.exports = { root: true, + parser: 'babel-eslint', parserOptions: { ecmaVersion: 2018, - sourceType: 'module' + sourceType: 'module', + ecmaFeatures: { + legacyDecorators: true + } }, plugins: ['ember'], extends: ['eslint:recommended', 'plugin:ember/recommended'], @@ -11,7 +15,8 @@ module.exports = { }, rules: { 'no-unused-vars': ['error', { args: 'none' }], - 'ember/no-new-mixins': ['warn'] + 'ember/no-new-mixins': ['warn'], + 'ember/no-jquery': 'warn' }, overrides: [ // node files diff --git a/ui-v2/.template-lintrc.js b/ui-v2/.template-lintrc.js index c80b1341e6..a87bfda6cc 100644 --- a/ui-v2/.template-lintrc.js +++ b/ui-v2/.template-lintrc.js @@ -1,7 +1,7 @@ 'use strict'; module.exports = { - extends: 'recommended', + extends: 'octane', rules: { 'no-partial': false, @@ -10,6 +10,7 @@ module.exports = { 'self-closing-void-elements': false, 'no-unnecessary-concat': false, + 'no-quoteless-attributes': false, 'no-nested-interactive': false, 'block-indentation': false, @@ -19,6 +20,15 @@ module.exports = { 'no-triple-curlies': false, 'no-unused-block-params': false, 'style-concatenation': false, - 'link-rel-noopener': false + 'link-rel-noopener': false, + + 'no-implicit-this': false, + 'no-curly-component-invocation': false, + 'no-action': false, + 'no-negated-condition': false, + 'no-invalid-role': false, + + 'no-unnecessary-component-helper': false, + 'link-href-attributes': false }, }; diff --git a/ui-v2/.travis.yml b/ui-v2/.travis.yml new file mode 100644 index 0000000000..a0208ca37f --- /dev/null +++ b/ui-v2/.travis.yml @@ -0,0 +1,27 @@ +--- +language: node_js +node_js: + - "10" + +dist: trusty + +addons: + chrome: stable + +cache: + directories: + - $HOME/.npm + +env: + global: + # See https://git.io/vdao3 for details. + - JOBS=1 + +branches: + only: + - master + +script: + - npm run lint:hbs + - npm run lint:js + - npm test diff --git a/ui-v2/app/app.js b/ui-v2/app/app.js index f08aaaf030..d8e2088b6b 100644 --- a/ui-v2/app/app.js +++ b/ui-v2/app/app.js @@ -1,14 +1,12 @@ import Application from '@ember/application'; -import Resolver from './resolver'; +import Resolver from 'ember-resolver'; import loadInitializers from 'ember-load-initializers'; import config from './config/environment'; -const App = Application.extend({ - modulePrefix: config.modulePrefix, - podModulePrefix: config.podModulePrefix, - Resolver, -}); +export default class App extends Application { + modulePrefix = config.modulePrefix; + podModulePrefix = config.podModulePrefix; + Resolver = Resolver; +} loadInitializers(App, config.modulePrefix); - -export default App; diff --git a/ui-v2/app/mixins/with-event-source.js b/ui-v2/app/mixins/with-event-source.js index 4fe7e0f529..3eb796e3db 100644 --- a/ui-v2/app/mixins/with-event-source.js +++ b/ui-v2/app/mixins/with-event-source.js @@ -53,6 +53,10 @@ export default Mixin.create(WithListeners, { } return this._super(...arguments); }, + willDestroy: function() { + this._super(...arguments); + this.reset(true); + }, }); export const listen = purify(catchable, function(props) { return props.map(item => `${PREFIX}${item}`); diff --git a/ui-v2/app/resolver.js b/ui-v2/app/resolver.js deleted file mode 100644 index 2fb563d6c0..0000000000 --- a/ui-v2/app/resolver.js +++ /dev/null @@ -1,3 +0,0 @@ -import Resolver from 'ember-resolver'; - -export default Resolver; diff --git a/ui-v2/app/router.js b/ui-v2/app/router.js index eb38d7de54..2dc3338889 100644 --- a/ui-v2/app/router.js +++ b/ui-v2/app/router.js @@ -2,10 +2,6 @@ import EmberRouter from '@ember/routing/router'; import { env } from 'consul-ui/env'; import walk from 'consul-ui/utils/routing/walk'; -const Router = EmberRouter.extend({ - location: env('locationType'), - rootURL: env('rootURL'), -}); export const routes = { // Our parent datacenter resource sets the namespace // for the entire application @@ -122,4 +118,9 @@ if (env('CONSUL_NSPACES_ENABLED')) { dc: routes.dc, }; } -export default Router.map(walk(routes)); +export default class Router extends EmberRouter { + location = env('locationType'); + rootURL = env('rootURL'); +} + +Router.map(walk(routes)); diff --git a/ui-v2/app/services/repository/nspace.js b/ui-v2/app/services/repository/nspace.js index 24176e52fd..9027a8dd94 100644 --- a/ui-v2/app/services/repository/nspace.js +++ b/ui-v2/app/services/repository/nspace.js @@ -1,7 +1,14 @@ import RepositoryService from 'consul-ui/services/repository'; +import { PRIMARY_KEY, SLUG_KEY } from 'consul-ui/models/nspace'; const modelName = 'nspace'; export default RepositoryService.extend({ + getPrimaryKey: function() { + return PRIMARY_KEY; + }, + getSlugKey: function() { + return SLUG_KEY; + }, getModelName: function() { return modelName; }, diff --git a/ui-v2/app/services/repository/nspace/disabled.js b/ui-v2/app/services/repository/nspace/disabled.js index bff1a55a99..f1233f02ad 100644 --- a/ui-v2/app/services/repository/nspace/disabled.js +++ b/ui-v2/app/services/repository/nspace/disabled.js @@ -1,9 +1,16 @@ import RepositoryService from 'consul-ui/services/repository'; import { Promise } from 'rsvp'; +import { PRIMARY_KEY, SLUG_KEY } from 'consul-ui/models/nspace'; const modelName = 'nspace'; const DEFAULT_NSPACE = 'default'; export default RepositoryService.extend({ + getPrimaryKey: function() { + return PRIMARY_KEY; + }, + getSlugKey: function() { + return SLUG_KEY; + }, getModelName: function() { return modelName; }, diff --git a/ui-v2/app/services/repository/nspace/enabled.js b/ui-v2/app/services/repository/nspace/enabled.js index 7a640b44a1..2d6fd22267 100644 --- a/ui-v2/app/services/repository/nspace/enabled.js +++ b/ui-v2/app/services/repository/nspace/enabled.js @@ -2,11 +2,18 @@ import { inject as service } from '@ember/service'; import { get } from '@ember/object'; import { env } from 'consul-ui/env'; import RepositoryService from 'consul-ui/services/repository'; +import { PRIMARY_KEY, SLUG_KEY } from 'consul-ui/models/nspace'; const modelName = 'nspace'; export default RepositoryService.extend({ router: service('router'), settings: service('settings'), + getPrimaryKey: function() { + return PRIMARY_KEY; + }, + getSlugKey: function() { + return SLUG_KEY; + }, getModelName: function() { return modelName; }, diff --git a/ui-v2/app/styles/app.scss b/ui-v2/app/styles/app.scss index a7ee633928..4361e8e8f0 100644 --- a/ui-v2/app/styles/app.scss +++ b/ui-v2/app/styles/app.scss @@ -6,10 +6,6 @@ /*TODO: Move this to its own local component*/ @import 'ember-power-select'; -#ember-basic-dropdown-wormhole { - z-index: 510; - position: relative; -} /**/ @import 'components/index'; diff --git a/ui-v2/app/templates/components/child-selector.hbs b/ui-v2/app/templates/components/child-selector.hbs index e78a62989d..d982b821bb 100644 --- a/ui-v2/app/templates/components/child-selector.hbs +++ b/ui-v2/app/templates/components/child-selector.hbs @@ -2,7 +2,14 @@ {{yield}} diff --git a/ui-v2/app/templates/components/code-editor.hbs b/ui-v2/app/templates/components/code-editor.hbs index 572cc49ad5..a3d12d9e36 100644 --- a/ui-v2/app/templates/components/code-editor.hbs +++ b/ui-v2/app/templates/components/code-editor.hbs @@ -1,7 +1,11 @@
{{yield}}
{{#if (and (not readonly) (not syntax))}} - + {{mode.name}} {{/if}} diff --git a/ui-v2/app/templates/dc/intentions/-form.hbs b/ui-v2/app/templates/dc/intentions/-form.hbs index 00b0e45ea5..0af22f5798 100644 --- a/ui-v2/app/templates/dc/intentions/-form.hbs +++ b/ui-v2/app/templates/dc/intentions/-form.hbs @@ -5,24 +5,40 @@

Source

{{#if (env 'CONSUL_NSPACES_ENABLED')}} @@ -32,24 +48,40 @@

Destination

{{#if (env 'CONSUL_NSPACES_ENABLED')}} diff --git a/ui-v2/app/templates/dc/kv/-form.hbs b/ui-v2/app/templates/dc/kv/-form.hbs index 3e0f4baf17..e92f88cb45 100644 --- a/ui-v2/app/templates/dc/kv/-form.hbs +++ b/ui-v2/app/templates/dc/kv/-form.hbs @@ -15,7 +15,7 @@ Code -