diff --git a/.circleci/config.yml b/.circleci/config.yml index eba2a629f7..64395e67b2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -22,7 +22,7 @@ references: test-results: &TEST_RESULTS_DIR /tmp/test-results cache: - yarn: &YARN_CACHE_KEY consul-ui-v6-{{ checksum "ui/yarn.lock" }} + yarn: &YARN_CACHE_KEY consul-ui-v7-{{ checksum "ui/yarn.lock" }} environment: &ENVIRONMENT TEST_RESULTS_DIR: *TEST_RESULTS_DIR diff --git a/ui/package.json b/ui/package.json index 3707970b17..a474ecf731 100644 --- a/ui/package.json +++ b/ui/package.json @@ -11,7 +11,7 @@ "scripts": { "doc:toc": "doctoc README.md", "compliance": "npm-run-all compliance:*", - "compliance:licenses": "license-checker --summary --onlyAllow 'Python-2.0;Apache*;Apache License, Version 2.0;Apache-2.0;Apache 2.0;Artistic-2.0;BSD;BSD-3-Clause;CC-BY-3.0;CC-BY-4.0;CC0-1.0;ISC;MIT;MPL-2.0;Public Domain;Unicode-TOU;Unlicense;WTFPL' --excludePackages 'consul-ui@2.2.0;consul-acls@0.1.0;consul-partitions@0.1.0;consul-nspaces@0.1.0'" + "compliance:licenses": "license-checker --summary --onlyAllow 'Python-2.0;Apache*;Apache License, Version 2.0;Apache-2.0;Apache 2.0;Artistic-2.0;BSD;BSD-3-Clause;CC-BY-3.0;CC-BY-4.0;CC0-1.0;ISC;MIT;MPL-2.0;Public Domain;Unicode-TOU;Unlicense;WTFPL' --excludePackages 'consul-ui@2.2.0;consul-acls@0.1.0;consul-lock-sessions@0.1.0;consul-partitions@0.1.0;consul-nspaces@0.1.0'" }, "devDependencies": { diff --git a/ui/packages/consul-ui/app/components/consul/lock-session/form/README.mdx b/ui/packages/consul-lock-sessions/app/components/consul/lock-session/form/README.mdx similarity index 100% rename from ui/packages/consul-ui/app/components/consul/lock-session/form/README.mdx rename to ui/packages/consul-lock-sessions/app/components/consul/lock-session/form/README.mdx diff --git a/ui/packages/consul-ui/app/components/consul/lock-session/form/index.hbs b/ui/packages/consul-lock-sessions/app/components/consul/lock-session/form/index.hbs similarity index 100% rename from ui/packages/consul-ui/app/components/consul/lock-session/form/index.hbs rename to ui/packages/consul-lock-sessions/app/components/consul/lock-session/form/index.hbs diff --git a/ui/packages/consul-ui/app/components/consul/lock-session/form/index.scss b/ui/packages/consul-lock-sessions/app/components/consul/lock-session/form/index.scss similarity index 100% rename from ui/packages/consul-ui/app/components/consul/lock-session/form/index.scss rename to ui/packages/consul-lock-sessions/app/components/consul/lock-session/form/index.scss diff --git a/ui/packages/consul-ui/app/components/consul/lock-session/list/README.mdx b/ui/packages/consul-lock-sessions/app/components/consul/lock-session/list/README.mdx similarity index 100% rename from ui/packages/consul-ui/app/components/consul/lock-session/list/README.mdx rename to ui/packages/consul-lock-sessions/app/components/consul/lock-session/list/README.mdx diff --git a/ui/packages/consul-ui/app/components/consul/lock-session/list/index.hbs b/ui/packages/consul-lock-sessions/app/components/consul/lock-session/list/index.hbs similarity index 100% rename from ui/packages/consul-ui/app/components/consul/lock-session/list/index.hbs rename to ui/packages/consul-lock-sessions/app/components/consul/lock-session/list/index.hbs diff --git a/ui/packages/consul-ui/app/components/consul/lock-session/list/index.scss b/ui/packages/consul-lock-sessions/app/components/consul/lock-session/list/index.scss similarity index 100% rename from ui/packages/consul-ui/app/components/consul/lock-session/list/index.scss rename to ui/packages/consul-lock-sessions/app/components/consul/lock-session/list/index.scss diff --git a/ui/packages/consul-lock-sessions/app/components/consul/lock-session/notifications/README.mdx b/ui/packages/consul-lock-sessions/app/components/consul/lock-session/notifications/README.mdx new file mode 100644 index 0000000000..6d90f0fff9 --- /dev/null +++ b/ui/packages/consul-lock-sessions/app/components/consul/lock-session/notifications/README.mdx @@ -0,0 +1,52 @@ + +# Consul::LockSession::Notifications + + + +A Notification component specifically for LockSessions. + + + +```hbs preview-template +
+ +
+ Provide a widget for to change the @type +
+ + +
+ +
+ +
+ Use the component +
+ + + +
+``` + +## Arguments + + +| Argument | Type | Default | Description | +| :-------- | :--------------- | :------ | :------------------------------------------------- | +| type | "remove" \| "kv" | | The type of Notification to use | +| error | error | | Consul UI shaped error only used for `remove` type | + + + diff --git a/ui/packages/consul-ui/app/components/consul/lock-session/notifications/index.hbs b/ui/packages/consul-lock-sessions/app/components/consul/lock-session/notifications/index.hbs similarity index 57% rename from ui/packages/consul-ui/app/components/consul/lock-session/notifications/index.hbs rename to ui/packages/consul-lock-sessions/app/components/consul/lock-session/notifications/index.hbs index 8653429328..8cf81c45e2 100644 --- a/ui/packages/consul-ui/app/components/consul/lock-session/notifications/index.hbs +++ b/ui/packages/consul-lock-sessions/app/components/consul/lock-session/notifications/index.hbs @@ -33,4 +33,15 @@ {{/if}} -{{/if}} \ No newline at end of file +{{else if (eq @type 'kv')}} + + +

+ Warning. This KV has a lock session. You can edit KV's with lock sessions, but we recommend doing so with care, or not doing so at all. It may negatively impact the active node it's associated with. See below for more details on the Lock Session and see our documentation for more information. +

+
+
+{{/if}} diff --git a/ui/packages/consul-ui/app/templates/dc/nodes/show/sessions.hbs b/ui/packages/consul-lock-sessions/app/templates/dc/nodes/show/sessions.hbs similarity index 100% rename from ui/packages/consul-ui/app/templates/dc/nodes/show/sessions.hbs rename to ui/packages/consul-lock-sessions/app/templates/dc/nodes/show/sessions.hbs diff --git a/ui/packages/consul-lock-sessions/package.json b/ui/packages/consul-lock-sessions/package.json new file mode 100644 index 0000000000..835990215b --- /dev/null +++ b/ui/packages/consul-lock-sessions/package.json @@ -0,0 +1,5 @@ +{ + "name": "consul-lock-sessions", + "version": "0.1.0", + "private": true +} diff --git a/ui/packages/consul-lock-sessions/vendor/consul-lock-sessions/routes.js b/ui/packages/consul-lock-sessions/vendor/consul-lock-sessions/routes.js new file mode 100644 index 0000000000..6b7cb8a583 --- /dev/null +++ b/ui/packages/consul-lock-sessions/vendor/consul-lock-sessions/routes.js @@ -0,0 +1,15 @@ +(routes => routes({ + dc: { + nodes: { + show: { + sessions: { + _options: { path: '/lock-sessions' }, + }, + }, + }, + }, +}))( + (json, data = (typeof document !== 'undefined' ? document.currentScript.dataset : module.exports)) => { + data[`routes`] = JSON.stringify(json); + } +); diff --git a/ui/packages/consul-lock-sessions/vendor/consul-lock-sessions/services.js b/ui/packages/consul-lock-sessions/vendor/consul-lock-sessions/services.js new file mode 100644 index 0000000000..159a7a96ec --- /dev/null +++ b/ui/packages/consul-lock-sessions/vendor/consul-lock-sessions/services.js @@ -0,0 +1,7 @@ +(services => services({ + +}))( + (json, data = (typeof document !== 'undefined' ? document.currentScript.dataset : module.exports)) => { + data[`services`] = JSON.stringify(json); + } +); diff --git a/ui/packages/consul-ui/.docfy-config.js b/ui/packages/consul-ui/.docfy-config.js index d55ba88b92..323469c843 100644 --- a/ui/packages/consul-ui/.docfy-config.js +++ b/ui/packages/consul-ui/.docfy-config.js @@ -106,6 +106,12 @@ module.exports = { urlSchema: 'auto', urlPrefix: 'docs/consul-acls', }, + { + root: `${path.dirname(require.resolve('consul-lock-sessions/package.json'))}/app/components`, + pattern: '**/README.mdx', + urlSchema: 'auto', + urlPrefix: 'docs/consul-lock-sessions', + }, { root: `${path.dirname(require.resolve('consul-partitions/package.json'))}/app/components`, pattern: '**/README.mdx', diff --git a/ui/packages/consul-ui/app/templates/dc/kv/edit.hbs b/ui/packages/consul-ui/app/templates/dc/kv/edit.hbs index 04bea52630..2bdd511f5e 100644 --- a/ui/packages/consul-ui/app/templates/dc/kv/edit.hbs +++ b/ui/packages/consul-ui/app/templates/dc/kv/edit.hbs @@ -97,16 +97,7 @@ as |parts|}} {{! if a KV has a session `Session` will always be populated despite any specific session permissions }} {{#if item.Session}} - - -

- Warning. This KV has a lock session. You can edit KV's with lock sessions, but we recommend doing so with care, or not doing so at all. It may negatively impact the active node it's associated with. See below for more details on the Lock Session and see our documentation for more information. -

-
-
+ {{/if}} - + {{item.Address}} diff --git a/ui/packages/consul-ui/ember-cli-build.js b/ui/packages/consul-ui/ember-cli-build.js index ec8397f89c..65c72fe9b3 100644 --- a/ui/packages/consul-ui/ember-cli-build.js +++ b/ui/packages/consul-ui/ember-cli-build.js @@ -29,6 +29,7 @@ module.exports = function(defaults, $ = process.env) { const apps = [ 'consul-ui', 'consul-acls', + 'consul-lock-sessions', 'consul-partitions', 'consul-nspaces' ].map(item => { diff --git a/ui/packages/consul-ui/lib/startup/templates/body.html.js b/ui/packages/consul-ui/lib/startup/templates/body.html.js index 9a2b3fe09a..6956c24b93 100644 --- a/ui/packages/consul-ui/lib/startup/templates/body.html.js +++ b/ui/packages/consul-ui/lib/startup/templates/body.html.js @@ -44,6 +44,7 @@ ${environment === 'production' ? `{{jsonEncode .}}` : JSON.stringify(config.oper + ${ environment === 'development' || environment === 'staging' ? ` diff --git a/ui/packages/consul-ui/package.json b/ui/packages/consul-ui/package.json index 4b12825962..eb4f2c92d9 100644 --- a/ui/packages/consul-ui/package.json +++ b/ui/packages/consul-ui/package.json @@ -79,6 +79,7 @@ "chalk": "^4.1.0", "clipboard": "^2.0.4", "consul-acls": "*", + "consul-lock-sessions": "*", "consul-nspaces": "*", "consul-partitions": "*", "css.escape": "^1.5.1", diff --git a/ui/packages/consul-ui/translations/routes/en-us.yaml b/ui/packages/consul-ui/translations/routes/en-us.yaml index ffa2a2c94a..d529b7ee22 100644 --- a/ui/packages/consul-ui/translations/routes/en-us.yaml +++ b/ui/packages/consul-ui/translations/routes/en-us.yaml @@ -2,6 +2,7 @@ dc: nodes: show: healthchecks: + title: Health Checks empty: |

This node has no health checks{items, select, @@ -15,6 +16,14 @@ dc:

This node has a failing serf node check. The health statuses shown on this page are the statuses as they were known before the node became unreachable.

+ services: + title: Service Instances + rtt: + title: Round Trip Time + sessions: + title: Lock Sessions + metadata: + title: Metadata services: show: topology: diff --git a/ui/packages/consul-ui/vendor/consul-ui/routes.js b/ui/packages/consul-ui/vendor/consul-ui/routes.js index 01cb9b67e3..026f80086a 100644 --- a/ui/packages/consul-ui/vendor/consul-ui/routes.js +++ b/ui/packages/consul-ui/vendor/consul-ui/routes.js @@ -240,9 +240,6 @@ rtt: { _options: { path: '/round-trip-time' }, }, - sessions: { - _options: { path: '/lock-sessions' }, - }, metadata: { _options: { path: '/metadata' }, },