Merge branch 'main' into chore-add-host-route
This commit is contained in:
35 files changed
+532
-236
No files matched your search
@@ -1,9 +1,118 @@
|
||||
import BreadCrumbsComponent from 'ember-breadcrumbs/components/bread-crumbs';
|
||||
import Component from '@glimmer/component';
|
||||
import EmberObject, { computed, get } from '@ember/object';
|
||||
import { inject as service } from '@ember/service';
|
||||
import { isBlank, isPresent } from '@ember/utils';
|
||||
import { A } from '@ember/array';
|
||||
|
||||
export default class crumbs extends BreadCrumbsComponent {
|
||||
// This component copies and modifies source from ember-breadcrumbs 0.2.3,
|
||||
// updating it for Ember v4 compatibility.
|
||||
|
||||
// The original copyright is below.
|
||||
|
||||
/*
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-2019 Chris Farber
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
export default class BreadcrumbsComponent extends Component {
|
||||
// =services
|
||||
|
||||
@service session;
|
||||
@service scope;
|
||||
@service router;
|
||||
|
||||
// =properties
|
||||
|
||||
/* eslint-disable-next-line ember/require-computed-property-dependencies */
|
||||
@computed('router.currentRouteName')
|
||||
get routeInfos() {
|
||||
/* eslint-disable-next-line ember/no-private-routing-service */
|
||||
return this.router._router._routerMicrolib.currentRouteInfos;
|
||||
}
|
||||
|
||||
/*
|
||||
For the pathNames and controllers properties, we must be careful not to NOT
|
||||
specify the properties of the route in our dependent keys.
|
||||
|
||||
Observing the controller property of the route causes some serious problems:
|
||||
https://github.com/chrisfarber/ember-breadcrumbs/issues/21
|
||||
*/
|
||||
|
||||
@computed('routeInfos.[]')
|
||||
get pathNames() {
|
||||
return this.routeInfos.map(function (routeInfo) {
|
||||
return routeInfo.name;
|
||||
});
|
||||
}
|
||||
|
||||
@computed('routeInfos.[]')
|
||||
get controllers() {
|
||||
return this.routeInfos.map(function (routeInfo) {
|
||||
var route = routeInfo.route || routeInfo.handler;
|
||||
return route.controller;
|
||||
});
|
||||
}
|
||||
|
||||
@computed(
|
||||
'controllers.@each.{breadCrumbs,breadCrumb,breadCrumbPath,breadCrumbModel}',
|
||||
'pathNames.[]'
|
||||
)
|
||||
get breadCrumbs() {
|
||||
var controllers = this.controllers;
|
||||
var defaultPaths = this.pathNames;
|
||||
var breadCrumbs = A([]);
|
||||
|
||||
controllers.forEach(function (controller, index) {
|
||||
var crumbs = controller.breadCrumbs || A([]);
|
||||
var singleCrumb = controller.breadCrumb;
|
||||
|
||||
if (!isBlank(singleCrumb)) {
|
||||
crumbs.push({
|
||||
label: singleCrumb,
|
||||
path: controller.breadCrumbPath,
|
||||
model: controller.breadCrumbModel,
|
||||
});
|
||||
}
|
||||
|
||||
crumbs.forEach(function (crumb) {
|
||||
breadCrumbs.addObject(
|
||||
EmberObject.create({
|
||||
label: crumb.label,
|
||||
path: crumb.path || defaultPaths[index],
|
||||
model: crumb.model,
|
||||
linkable: isPresent(crumb.linkable)
|
||||
? crumb.linkable
|
||||
: crumb.path !== false,
|
||||
isCurrent: false,
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
var deepestCrumb = get(breadCrumbs, 'lastObject');
|
||||
if (deepestCrumb) {
|
||||
deepestCrumb.isCurrent = true;
|
||||
}
|
||||
|
||||
return breadCrumbs;
|
||||
}
|
||||
}
|
||||
@@ -74,6 +74,94 @@
|
||||
</:body>
|
||||
</form.fieldset>
|
||||
|
||||
<Rose::Form::Fieldset>
|
||||
<:title>{{t 'resources.host-set.form.preferred_endpoints.label'}}</:title>
|
||||
<:description>{{t
|
||||
'resources.host-set.form.preferred_endpoints.help'
|
||||
}}</:description>
|
||||
<:body>
|
||||
{{#if @model.errors.preferred_endpoints}}
|
||||
<Rose::Form::Errors as |errors|>
|
||||
{{#each @model.errors.preferred_endpoints as |error|}}
|
||||
<errors.message>{{error.message}}</errors.message>
|
||||
{{/each}}
|
||||
</Rose::Form::Errors>
|
||||
{{/if}}
|
||||
<Rose::Table @style='condensed' as |table|>
|
||||
<table.header as |header|>
|
||||
<header.row @hidden={{true}} as |row|>
|
||||
<row.headerCell>{{t 'titles.value'}}</row.headerCell>
|
||||
<row.headerCell />
|
||||
</header.row>
|
||||
</table.header>
|
||||
<table.body as |body|>
|
||||
{{#each @model.preferred_endpoints as |endpoint i|}}
|
||||
<body.row as |row|>
|
||||
<row.cell>
|
||||
<form.input
|
||||
@type='text'
|
||||
@value={{endpoint.value}}
|
||||
@error={{@model.errors.preferred_endpoints}}
|
||||
@contextual={{true}}
|
||||
placeholder='cidr:2001:4860:4860::8888/32'
|
||||
as |field|
|
||||
>
|
||||
<field.field />
|
||||
</form.input>
|
||||
</row.cell>
|
||||
<row.cell @shrink={{true}}>
|
||||
<Rose::Button
|
||||
@style='warning'
|
||||
@iconOnly='flight-icons/svg/trash-16'
|
||||
title={{t 'actions.remove'}}
|
||||
@disabled={{if
|
||||
@model.isNew
|
||||
false
|
||||
(if form.isEditable false true)
|
||||
}}
|
||||
{{on 'click' (fn @removeItemByIndex 'preferred_endpoints' i)}}
|
||||
>
|
||||
{{t 'actions.remove'}}
|
||||
</Rose::Button>
|
||||
</row.cell>
|
||||
</body.row>
|
||||
{{/each}}
|
||||
|
||||
<body.row as |row|>
|
||||
<row.cell>
|
||||
<form.input
|
||||
@type='text'
|
||||
@value={{@model.preferred_endpoint}}
|
||||
placeholder='cidr:2001:4860:4860::8888/32'
|
||||
/>
|
||||
</row.cell>
|
||||
<row.cell @shrink={{true}}>
|
||||
<Rose::Button
|
||||
@style='secondary'
|
||||
title={{t 'actions.add'}}
|
||||
@disabled={{if
|
||||
@model.isNew
|
||||
false
|
||||
(if form.isEditable false true)
|
||||
}}
|
||||
{{on
|
||||
'click'
|
||||
(fn
|
||||
@addStringItem
|
||||
'preferred_endpoints'
|
||||
@model.preferred_endpoint
|
||||
)
|
||||
}}
|
||||
>
|
||||
{{t 'actions.add'}}
|
||||
</Rose::Button>
|
||||
</row.cell>
|
||||
</body.row>
|
||||
</table.body>
|
||||
</Rose::Table>
|
||||
</:body>
|
||||
</Rose::Form::Fieldset>
|
||||
|
||||
<Rose::Form::Fieldset>
|
||||
<:title>{{t 'resources.host-set.form.filter.label'}}</:title>
|
||||
<:description>{{t 'resources.host-set.form.filter.help'}}</:description>
|
||||
|
||||
@@ -74,6 +74,94 @@
|
||||
</:body>
|
||||
</form.fieldset>
|
||||
|
||||
<Rose::Form::Fieldset>
|
||||
<:title>{{t 'resources.host-set.form.preferred_endpoints.label'}}</:title>
|
||||
<:description>{{t
|
||||
'resources.host-set.form.preferred_endpoints.help'
|
||||
}}</:description>
|
||||
<:body>
|
||||
{{#if @model.errors.preferred_endpoints}}
|
||||
<Rose::Form::Errors as |errors|>
|
||||
{{#each @model.errors.preferred_endpoints as |error|}}
|
||||
<errors.message>{{error.message}}</errors.message>
|
||||
{{/each}}
|
||||
</Rose::Form::Errors>
|
||||
{{/if}}
|
||||
<Rose::Table @style='condensed' as |table|>
|
||||
<table.header as |header|>
|
||||
<header.row @hidden={{true}} as |row|>
|
||||
<row.headerCell>{{t 'titles.value'}}</row.headerCell>
|
||||
<row.headerCell />
|
||||
</header.row>
|
||||
</table.header>
|
||||
<table.body as |body|>
|
||||
{{#each @model.preferred_endpoints as |endpoint i|}}
|
||||
<body.row as |row|>
|
||||
<row.cell>
|
||||
<form.input
|
||||
@type='text'
|
||||
@value={{endpoint.value}}
|
||||
@error={{@model.errors.preferred_endpoints}}
|
||||
@contextual={{true}}
|
||||
placeholder='cidr:2001:4860:4860::8888/32'
|
||||
as |field|
|
||||
>
|
||||
<field.field />
|
||||
</form.input>
|
||||
</row.cell>
|
||||
<row.cell @shrink={{true}}>
|
||||
<Rose::Button
|
||||
@style='warning'
|
||||
@iconOnly='flight-icons/svg/trash-16'
|
||||
title={{t 'actions.remove'}}
|
||||
@disabled={{if
|
||||
@model.isNew
|
||||
false
|
||||
(if form.isEditable false true)
|
||||
}}
|
||||
{{on 'click' (fn @removeItemByIndex 'preferred_endpoints' i)}}
|
||||
>
|
||||
{{t 'actions.remove'}}
|
||||
</Rose::Button>
|
||||
</row.cell>
|
||||
</body.row>
|
||||
{{/each}}
|
||||
|
||||
<body.row as |row|>
|
||||
<row.cell>
|
||||
<form.input
|
||||
@type='text'
|
||||
@value={{@model.preferred_endpoint}}
|
||||
placeholder='cidr:2001:4860:4860::8888/32'
|
||||
/>
|
||||
</row.cell>
|
||||
<row.cell @shrink={{true}}>
|
||||
<Rose::Button
|
||||
@style='secondary'
|
||||
title={{t 'actions.add'}}
|
||||
@disabled={{if
|
||||
@model.isNew
|
||||
false
|
||||
(if form.isEditable false true)
|
||||
}}
|
||||
{{on
|
||||
'click'
|
||||
(fn
|
||||
@addStringItem
|
||||
'preferred_endpoints'
|
||||
@model.preferred_endpoint
|
||||
)
|
||||
}}
|
||||
>
|
||||
{{t 'actions.add'}}
|
||||
</Rose::Button>
|
||||
</row.cell>
|
||||
</body.row>
|
||||
</table.body>
|
||||
</Rose::Table>
|
||||
</:body>
|
||||
</Rose::Form::Fieldset>
|
||||
|
||||
<form.textarea
|
||||
@name='filter'
|
||||
@type='filter'
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
<layout.header>
|
||||
<Rose::Header class='{{if (is-loading) ' loading'}}' as |header|>
|
||||
<header.brand @logo='logo-app' @text={{app-name}} />
|
||||
<header.brand @logo='logo-app' @text={{(app-name)}} />
|
||||
|
||||
{{#if this.session.isAuthenticated}}
|
||||
<header.nav>
|
||||
@@ -71,11 +71,11 @@
|
||||
|
||||
<layout.footer>
|
||||
<Rose::Footer as |footer|>
|
||||
<footer.brand @logo='logo-company' @text={{company-name}} />
|
||||
<footer.brand @logo='logo-company' @text={{(company-name)}} />
|
||||
<footer.text>{{company-copyright}}</footer.text>
|
||||
<footer.text>{{app-name}}</footer.text>
|
||||
<footer.nav as |nav|>
|
||||
<nav.link @href={{doc-url}}>
|
||||
<nav.link @href={{(doc-url)}}>
|
||||
{{t 'titles.documentation'}}
|
||||
</nav.link>
|
||||
</footer.nav>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<Form::Authenticate
|
||||
@model={{@model}}
|
||||
@submit={{route-action 'authenticate'}}
|
||||
@disabled={{is-loading}}
|
||||
@disabled={{(is-loading)}}
|
||||
/>
|
||||
{{else}}
|
||||
{{! OIDC disabled: hide OIDC auth form}}
|
||||
@@ -11,7 +11,7 @@
|
||||
<Form::Authenticate
|
||||
@model={{@model}}
|
||||
@submit={{route-action 'authenticate'}}
|
||||
@disabled={{is-loading}}
|
||||
@disabled={{(is-loading)}}
|
||||
/>
|
||||
{{/unless}}
|
||||
{{/if}}
|
||||
@@ -32,13 +32,13 @@
|
||||
"posttest": "ember coverage-merge && yarn clean:coverage"
|
||||
},
|
||||
"dependencies": {
|
||||
"ember-named-blocks-polyfill": "^0.2.4"
|
||||
"ember-named-blocks-polyfill": "^0.2.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.16.5",
|
||||
"@ember/optional-features": "^2.0.0",
|
||||
"@ember/render-modifiers": "^2.0.2",
|
||||
"@ember/test-helpers": "^2.4.2",
|
||||
"@ember/test-helpers": "^2.6.0",
|
||||
"@glimmer/component": "^1.0.4",
|
||||
"@glimmer/tracking": "^1.0.4",
|
||||
"babel-eslint": "^10.1.0",
|
||||
@@ -46,10 +46,9 @@
|
||||
"broccoli-asset-rev": "^3.0.0",
|
||||
"clipboard": "^2.0.8",
|
||||
"core": "*",
|
||||
"doctoc": "^2.0.1",
|
||||
"doctoc": "^2.1.0",
|
||||
"ember-a11y-testing": "^4.2.0",
|
||||
"ember-auto-import": "^1.12.0",
|
||||
"ember-breadcrumbs": "^0.2.3",
|
||||
"ember-cli": "~4.1.0",
|
||||
"ember-cli-app-version": "^5.0.0",
|
||||
"ember-cli-babel": "^7.26.8",
|
||||
|
||||
@@ -64,7 +64,7 @@ module('Acceptance | auth methods | oidc', function (hooks) {
|
||||
await visit(urls.authMethod);
|
||||
await click('.rose-layout-page-actions .rose-dropdown-trigger');
|
||||
assert.equal(
|
||||
find('.rose-dropdown[open] input[aria-checked=true]').value,
|
||||
find('.rose-dropdown[open] input:checked').value,
|
||||
instances.authMethod.attributes.state
|
||||
);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user