-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from fleetbase/dev-v0.2.3
v0.2.3
- Loading branch information
Showing
18 changed files
with
259 additions
and
52,423 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,72 @@ | ||
import Component from '@glimmer/component'; | ||
import { tracked } from '@glimmer/tracking'; | ||
import { inject as service } from '@ember/service'; | ||
import { action } from '@ember/object'; | ||
import { later } from '@ember/runloop'; | ||
import getWithDefault from '@fleetbase/ember-core/utils/get-with-default'; | ||
|
||
/** | ||
* Represents the `CountryName` component which fetches and sets the name of a country. | ||
* | ||
* @class CountryNameComponent | ||
* @extends {Component} | ||
* @memberof @fleetbase/ember-ui | ||
* | ||
* @property {Service} fetch - Service for fetching data. | ||
* @property {string} countryName - The name of the country. | ||
* | ||
* @example | ||
* // Usage: | ||
* <CountryName @country="US" /> | ||
*/ | ||
export default class CountryNameComponent extends Component { | ||
/** | ||
* Fetch service | ||
* | ||
* @type {Service} | ||
* @memberof CountryNameComponent | ||
*/ | ||
@service fetch; | ||
|
||
/** | ||
* The country name property. | ||
* | ||
* @type {String} | ||
* @memberof CountryNameComponent | ||
*/ | ||
@tracked countryName; | ||
|
||
/** | ||
* Creates an instance of CountryNameComponent. | ||
* @param {ApplicationInstance} owner | ||
* @param {Object|country=string} { country } | ||
* @memberof CountryNameComponent | ||
*/ | ||
constructor(owner, { country }) { | ||
super(...arguments); | ||
|
||
this.setCountryName(country); | ||
} | ||
|
||
@action async setCountryName(country) { | ||
if (typeof country === 'string' && country.length === 2) { | ||
const lookupResponse = await this.fetch.cachedGet(`lookup/country/${country}`); | ||
const countryName = lookupResponse?.name; | ||
|
||
this.countryName = countryName ?? country; | ||
} else { | ||
this.countryName = country; | ||
} | ||
/** | ||
* Asynchronously sets the country name. If the country code is a 2-letter string, | ||
* it fetches the country name; otherwise, it uses the country argument as the country name. | ||
* | ||
* @private | ||
* @param {string} country - The country code or country name. | ||
* @returns {void} | ||
*/ | ||
async setCountryName(country) { | ||
later( | ||
this, | ||
() => { | ||
if (typeof country === 'string' && country.length === 2) { | ||
this.fetch.get(`lookup/country/${country}`).then((response) => { | ||
this.countryName = getWithDefault(response, 'name', country); | ||
}); | ||
} else { | ||
this.countryName = country; | ||
} | ||
}, | ||
300 | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
<a href="javascript:;" class="next-nav-item {{if this.active 'active'}}" {{on "click" this.onClick}} ...attributes> | ||
<div class="next-nav-item-icon-container"> | ||
<div class="next-nav-item-icon-container {{@iconWrapperClass}}"> | ||
{{#if @icon}} | ||
<FaIcon @prefix={{@iconPrefix}} @icon={{@icon}} @size={{or @iconSize "xs"}} class={{@iconClass}} /> | ||
{{/if}} | ||
</div> | ||
<div class="truncate w-10/12">{{yield}}</div> | ||
<div class="truncate w-10/12 {{@itemWrapperClass}}">{{yield}}</div> | ||
</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,19 @@ | ||
<FileUpload @name={{@name}} @accept={{@accept}} @onFileAdded={{@onFileAdded}} as |queue|> | ||
<FileUpload @name={{@name}} @accept={{@accept}} @onFileAdded={{@onFileAdded}} @labelClass={{@labelClass}} as |queue|> | ||
<a tabindex={{0}} class="flex items-center px-0 mt-2 text-xs no-underline truncate cursor-pointer btn {{if @outline 'btn-outline'}} btn-{{or @type 'default'}} btn-{{or @size 'sm'}}" ...attributes> | ||
{{#if queue.files.length}} | ||
<Spinner class="mr-2" /> | ||
<Spinner class={{unless @hideButtonText "mr-2"}} /> | ||
{{#unless @hideButtonText}} | ||
<span> | ||
Uploading... | ||
</span> | ||
{{/unless}} | ||
{{else}} | ||
<FaIcon @icon={{or @uploadIcon "image"}} class="mr-2" /> | ||
<span> | ||
{{or @buttonText "Upload new"}} | ||
</span> | ||
<FaIcon @icon={{or @icon "image"}} class="{{@iconClass}} {{unless @hideButtonText "mr-2"}}" /> | ||
{{#unless @hideButtonText}} | ||
<span> | ||
{{or @buttonText "Upload new"}} | ||
</span> | ||
{{/unless}} | ||
{{/if}} | ||
</a> | ||
</FileUpload> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
:root { | ||
--fleet-summary-toggle-base-padding: 1rem; | ||
--fleet-summary-nav-item-base-padding: 1.125rem; | ||
--fleet-summary-depths: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12; | ||
} | ||
|
||
@each $i in var(--fleet-summary-depths) { | ||
.next-fleet-summary .next-sidebar-panel-container.next-fleet-summary-fleet.fleet-depth-$(i) > .next-sidebar-panel > .next-content-panel > .next-sidebar-panel-toggle { | ||
padding-left: calc(1rem + $i * var(--fleet-summary-toggle-base-padding)); | ||
} | ||
|
||
.next-fleet-summary .next-sidebar-panel-container.next-fleet-summary-fleet.fleet-depth-$(i) > .next-sidebar-panel > .next-content-panel > .next-content-panel-body .next-nav-item { | ||
padding-left: calc(1rem + ($i + 1) * var(--fleet-summary-nav-item-base-padding)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.