Skip to content

Commit

Permalink
Merge pull request #111 from fleetbase/feature/bulk-import-resources
Browse files Browse the repository at this point in the history
bulk import resources
  • Loading branch information
roncodes authored May 30, 2024
2 parents de16599 + 919b51a commit cfc3b2e
Show file tree
Hide file tree
Showing 175 changed files with 24,964 additions and 753 deletions.
1 change: 1 addition & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
$rules = [
'@Symfony' => true,
'phpdoc_no_empty_return' => false,
'phpdoc_to_comment' => false,
'array_syntax' => ['syntax' => 'short'],
'yoda_style' => false,
'binary_operator_spaces' => [
Expand Down
12 changes: 11 additions & 1 deletion addon/components/activity-event-selector.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,17 @@
</div>
<div class="activity-event-selector-events-container">
<div class="px-4 mb-2">
<DropdownButton @text={{t "fleet-ops.component.activity-event-selector.select-event-to-add"}} @buttonClass="flex-row-reverse justify-between w-48" @icon="caret-down" @iconClass="mr-0i" @size="sm" @iconPrefix="fas" @triggerClass="hidden md:flex" @helpText={{t "fleet-ops.component.activity-event-selector.activity-events-select-events-info"}} as |dd|>
<DropdownButton
@text={{t "fleet-ops.component.activity-event-selector.select-event-to-add"}}
@buttonClass="flex-row-reverse justify-between w-48"
@icon="caret-down"
@iconClass="mr-0i"
@size="sm"
@iconPrefix="fas"
@triggerClass="hidden md:flex"
@helpText={{t "fleet-ops.component.activity-event-selector.activity-events-select-events-info"}}
as |dd|
>
<div class="next-dd-menu mt-1 mx-0" aria-labelledby="user-menu">
<div class="p-1 overflow-y-scroll h-40">
{{#each-in this.availableEvents as |eventName event|}}
Expand Down
36 changes: 32 additions & 4 deletions addon/components/activity-form-panel.hbs
Original file line number Diff line number Diff line change
@@ -1,14 +1,42 @@
<Overlay @onLoad={{this.setOverlayContext}} @onOpen={{this.onOpen}} @onClose={{this.onClose}} @onToggle={{this.onToggle}} @position="right" @noBackdrop={{true}} @fullHeight={{true}} @isResizable={{or this.isResizable @isResizable}} @width={{or this.width @width "570px"}}>
<Overlay::Header @title={{if this.activity.status (concat (t "fleet-ops.component.activity-form-panel.title-concat") this.activity.status) (t "fleet-ops.component.activity-form-panel.new-activity-title") }} @hideStatusDot={{true}} @titleWrapperClass="leading-5">
<Overlay
@onLoad={{this.setOverlayContext}}
@onOpen={{this.onOpen}}
@onClose={{this.onClose}}
@onToggle={{this.onToggle}}
@position="right"
@noBackdrop={{true}}
@fullHeight={{true}}
@isResizable={{or this.isResizable @isResizable}}
@width={{or this.width @width "570px"}}
>
<Overlay::Header
@title={{if
this.activity.status
(concat (t "fleet-ops.component.activity-form-panel.title-concat") this.activity.status)
(t "fleet-ops.component.activity-form-panel.new-activity-title")
}}
@hideStatusDot={{true}}
@titleWrapperClass="leading-5"
>
<div class="flex flex-1 justify-end">
<Button @type="primary" @icon="save" @text={{t "common.save"}} @onClick={{perform this.save}} @isLoading={{this.save.isRunning}} @wrapperClass="mr-2" />
<Button @type="default" @icon="times" @text={{t "fleet-ops.common.cancel"}} @onClick={{this.onPressCancel}} />
</div>
</Overlay::Header>

<Overlay::Body @wrapperClass="px-4 pt-4">
<InputGroup @name={{t "fleet-ops.component.activity-form-panel.key"}} @value={{this.activity.key}} @helpText={{t "fleet-ops.component.activity-form-panel.key-help"}} {{on "input" this.setActivityKey}} />
<InputGroup @name={{t "fleet-ops.component.activity-form-panel.code"}} @value={{this.activity.code}} @helpText={{t "fleet-ops.component.activity-form-panel.code-help"}} {{on "input" this.setActivityCode}} />
<InputGroup
@name={{t "fleet-ops.component.activity-form-panel.key"}}
@value={{this.activity.key}}
@helpText={{t "fleet-ops.component.activity-form-panel.key-help"}}
{{on "input" this.setActivityKey}}
/>
<InputGroup
@name={{t "fleet-ops.component.activity-form-panel.code"}}
@value={{this.activity.code}}
@helpText={{t "fleet-ops.component.activity-form-panel.code-help"}}
{{on "input" this.setActivityCode}}
/>
<InputGroup @name={{t "fleet-ops.component.activity-form-panel.status"}} @value={{this.activity.status}} @helpText={{t "fleet-ops.component.activity-form-panel.status-help"}} />
<InputGroup @name={{t "fleet-ops.component.activity-form-panel.details"}} @value={{this.activity.details}} @helpText={{t "fleet-ops.component.activity-form-panel.details-help"}} />
<InputGroup>
Expand Down
62 changes: 55 additions & 7 deletions addon/components/activity-logic-builder.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,30 @@
</Attach::Tooltip>
</div>
<div>
<Button @type="magic" @icon="plus" @text={{t "fleet-ops.component.activity-logic-builder.add-logic"}} @onClick={{this.addLogic}} @helpText={{t "fleet-ops.component.activity-logic-builder.activity-logic-add-logic-help-text"}} />
<Button
@type="magic"
@icon="plus"
@text={{t "fleet-ops.component.activity-logic-builder.add-logic"}}
@onClick={{this.addLogic}}
@helpText={{t "fleet-ops.component.activity-logic-builder.activity-logic-add-logic-help-text"}}
/>
</div>
</div>
<div class="activity-logic-builder-logic-container">
{{#each this.logic as |logic index|}}
<div class="activity-logic-builder-logic">
<div class="activity-logic-builder-condition-type-container space-x-2">
<DropdownButton @text={{smart-humanize logic.type}} @buttonClass="activity-logic-builder-condition-type flex-row-reverse justify-between" @icon="caret-down" @iconClass="mr-0i" @size="sm" @iconPrefix="fas" @triggerClass="hidden md:flex" @helpText={{t "fleet-ops.component.activity-logic-builder.activity-logic-select-logic-type-help-text"}} as |dd|>
<DropdownButton
@text={{smart-humanize logic.type}}
@buttonClass="activity-logic-builder-condition-type flex-row-reverse justify-between"
@icon="caret-down"
@iconClass="mr-0i"
@size="sm"
@iconPrefix="fas"
@triggerClass="hidden md:flex"
@helpText={{t "fleet-ops.component.activity-logic-builder.activity-logic-select-logic-type-help-text"}}
as |dd|
>
<div class="next-dd-menu mt-1 mx-0" aria-labelledby="user-menu">
<div class="p-1 overflow-y-scroll h-40">
{{#each this.types as |type|}}
Expand All @@ -28,7 +44,15 @@
</div>
</div>
</DropdownButton>
<Button class="activity-logic-builder-add-condition" @type="default" @size="xs" @icon="plus" @text="Add condition" @onClick={{fn this.addCondition index}} @helpText={{t "fleet-ops.component.activity-logic-builder.activity-logic-add-condition-help-text"}} />
<Button
class="activity-logic-builder-add-condition"
@type="default"
@size="xs"
@icon="plus"
@text="Add condition"
@onClick={{fn this.addCondition index}}
@helpText={{t "fleet-ops.component.activity-logic-builder.activity-logic-add-condition-help-text"}}
/>
<Button class="activity-logic-builder-add-condition" @type="danger" @size="xs" @icon="trash" @onClick={{fn this.removeLogic index}} />
</div>
<div class="activity-logic-builder-conditions">
Expand All @@ -38,15 +62,34 @@
<div class="flex flex-row">
<div class="activity-logic-builder-condition">
<div class="activity-logic-builder-condition-field">
<Input placeholder={{t "fleet-ops.component.activity-logic-builder.field"}} class="form-input" @value={{condition.field}} {{on "blur" this.trackConditionInputChanges}} />
<Input
placeholder={{t "fleet-ops.component.activity-logic-builder.field"}}
class="form-input"
@value={{condition.field}}
{{on "blur" this.trackConditionInputChanges}}
/>
</div>
<div class="activity-logic-builder-condition-operator">
{{#let (get this.operators condition.operator) as |operatorMap|}}
<DropdownButton @text={{operatorMap.symbol}} @textClass="text-xs" @buttonClass="flex-row-reverse justify-between" @icon="caret-down" @iconClass="mr-0i" @size="sm" @iconPrefix="fas" @triggerClass="hidden md:flex" as |dd|>
<DropdownButton
@text={{operatorMap.symbol}}
@textClass="text-xs"
@buttonClass="flex-row-reverse justify-between"
@icon="caret-down"
@iconClass="mr-0i"
@size="sm"
@iconPrefix="fas"
@triggerClass="hidden md:flex"
as |dd|
>
<div class="next-dd-menu mt-1 mx-0" aria-labelledby="user-menu">
<div class="p-1">
{{#each-in this.operators as |key|}}
<a href="javascript:;" class="next-dd-item" {{on "click" (dropdown-fn dd this.selectConditionOperator index conditionIndex key)}}>
<a
href="javascript:;"
class="next-dd-item"
{{on "click" (dropdown-fn dd this.selectConditionOperator index conditionIndex key)}}
>
<div class="flex-1 flex flex-row items-center">
<span>{{smart-humanize key}}</span>
</div>
Expand All @@ -63,7 +106,12 @@
{{/let}}
</div>
<div class="activity-logic-builder-condition-value">
<Input placeholder={{t "fleet-ops.component.activity-logic-builder.value"}} class="form-input" @value={{condition.value}} {{on "blur" this.trackConditionInputChanges}} />
<Input
placeholder={{t "fleet-ops.component.activity-logic-builder.value"}}
class="form-input"
@value={{condition.value}}
{{on "blur" this.trackConditionInputChanges}}
/>
</div>
</div>
<div class="px-1">
Expand Down
12 changes: 10 additions & 2 deletions addon/components/admin/avatar-management.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@
<div class="flex flex-row items-stretch rounded-lg border border-gray-200 dark:border-gray-700">
<div class="w-48 h-full bg-white dark:bg-gray-700 rounded-l-lg">
{{#each this.categories as |category index|}}
<a href="#" class="flex flex-row px-4 py-2 border-b border-gray-200 dark:border-gray-900 hover:bg-blue-400 {{if (eq this.currentCategory.type category.type) 'bg-blue-500'}} {{if (eq index 1) "rounded-tl-lg"}}" {{on "click" (fn this.switchCategory category)}}>
<a
href="#"
class="flex flex-row px-4 py-2 border-b border-gray-200 dark:border-gray-900 hover:bg-blue-400
{{if (eq this.currentCategory.type category.type) 'bg-blue-500'}}
{{if (eq index 1) 'rounded-tl-lg'}}"
{{on "click" (fn this.switchCategory category)}}
>
<div class="w-6">
<FaIcon @icon={{category.icon}} @size="sm" />
</div>
Expand All @@ -13,7 +19,9 @@
<div class="flex-1 border-l border-gray-200 dark:border-gray-700">
<div class="p-4">
{{#if this.isUploading}}
<div class="dropzone w-full rounded-lg px-4 py-8 bg-gray-50 dark:bg-gray-900 bg-opacity-25 text-gray-900 dark:text-white text-center flex flex-col items-center justify-center border-2 border-dashed border-gray-200 dark:border-indigo-500">
<div
class="dropzone w-full rounded-lg px-4 py-8 bg-gray-50 dark:bg-gray-900 bg-opacity-25 text-gray-900 dark:text-white text-center flex flex-col items-center justify-center border-2 border-dashed border-gray-200 dark:border-indigo-500"
>
<div class="flex items-center justify-center py-5">
<Spinner class="text-sm dar:text-gray-100" @loadingMessage={{t "fleet-ops.common.uploading"}} />
</div>
Expand Down
17 changes: 15 additions & 2 deletions addon/components/admin/visibility-controls.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,24 @@
<p class="mb-4 dark:text-white text-gray-800">{{t "fleet-ops.component.admin.visibility-controls.message"}}</p>
{{#each this.visibilitySettings as |visibilityControl|}}
<InputGroup @wrapperClass="mb-1i">
<Checkbox @value={{visibilityControl.visible}} @label={{concat visibilityControl.name " Visible"}} @onToggle={{fn (mut visibilityControl.visible)}} @helpText={{t "fleet-ops.component.admin.visibility-controls.checkbox-text"}} />
<Checkbox
@value={{visibilityControl.visible}}
@label={{concat visibilityControl.name " Visible"}}
@onToggle={{fn (mut visibilityControl.visible)}}
@helpText={{t "fleet-ops.component.admin.visibility-controls.checkbox-text"}}
/>
</InputGroup>
{{/each}}
</ContentPanel>

<div class="mt-3 flex items-center justify-end">
<Button @type="primary" @size="lg" @icon="save" @text={{t "fleet-ops.common.save-changes"}} @onClick={{this.saveVisibilitySettings}} @disabled={{this.isLoading}} @isLoading={{this.isLoading}} />
<Button
@type="primary"
@size="lg"
@icon="save"
@text={{t "fleet-ops.common.save-changes"}}
@onClick={{this.saveVisibilitySettings}}
@disabled={{this.isLoading}}
@isLoading={{this.isLoading}}
/>
</div>
10 changes: 9 additions & 1 deletion addon/components/avatar-picker.hbs
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
<div class="grid grid-cols-1 gap-4 lg:grid-cols-2 lg:gap-2">
<div class="input-group mb-2">
<InputLabel @labelText={{t "fleet-ops.component.avatar-picker.select-map-avatar"}} @helpText={{t "fleet-ops.component.avatar-picker.select-avatar-rendering"}} />
<FetchSelect @wrapperClass="w-60" @placeholder={{t "fleet-ops.component.avatar-picker.select-avatar"}} @endpoint={{this.endpoint}} @selected={{this.model.avatar_value}} @optionValue="value" @onChange={{this.selectAvatar}} as |option|>
<FetchSelect
@wrapperClass="w-60"
@placeholder={{t "fleet-ops.component.avatar-picker.select-avatar"}}
@endpoint={{this.endpoint}}
@selected={{this.model.avatar_value}}
@optionValue="value"
@onChange={{this.selectAvatar}}
as |option|
>
{{titleize (humanize option.key)}}
</FetchSelect>
</div>
Expand Down
4 changes: 2 additions & 2 deletions addon/components/cell/driver-name.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{#if this.driver}}
<div class="relative flex items-center" ...attributes>
<img src={{this.driver.photo_url}} alt={{this.driver.name}} {{fallback-img-src (config 'defaultValues.driverImage')}} class="w-5 h-5 mr-2 rounded-md" />
<img src={{this.driver.photo_url}} alt={{this.driver.name}} {{fallback-img-src (config "defaultValues.driverImage")}} class="w-5 h-5 mr-2 rounded-md" />
<a href="javascript:;" class="relative flex flex-row items-center" {{on "click" (fn this.onClick this.driver)}}>
<span>{{get-default-value this.driver.name}}</span>
{{#if @row.vehicle_assigned}}
Expand All @@ -15,7 +15,7 @@
</div>
{{/if}}
</a>
<FaIcon @icon="circle" @size="2xs" class="absolute left-0 top-0 -mt-1 -ml-1 {{if this.driver.online "text-green-500" "text-yellow-200"}}" />
<FaIcon @icon="circle" @size="2xs" class="absolute left-0 top-0 -mt-1 -ml-1 {{if this.driver.online 'text-green-500' 'text-yellow-200'}}" />
</div>
{{else}}
<div class="flex items-center">
Expand Down
10 changes: 8 additions & 2 deletions addon/components/cell/vehicle-name.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<div class="relative flex items-center">
<Image src={{this.mediaUrl}} @fallbackSrc={{config "defaultValues.vehicleAvatar"}} data-vehicle={{@row.id}} alt={{this.altText}} class="w-4 h-4 rounded-md {{if @column.hasOnline "mx-2" "mr-2"}}" />
<Image
src={{this.mediaUrl}}
@fallbackSrc={{config "defaultValues.vehicleAvatar"}}
data-vehicle={{@row.id}}
alt={{this.altText}}
class="w-4 h-4 rounded-md {{if @column.hasOnline 'mx-2' 'mr-2'}}"
/>
<span class="relative block">
<a href="javascript:;" class="relative block" {{on "click" this.onClick}}>
{{#if (has-block)}}
Expand All @@ -12,6 +18,6 @@
</a>
</span>
{{#if @column.showOnlineIndicator}}
<FaIcon @icon="circle" class="absolute left-0 top-0 -mt-1 -ml-2 h-2 w-2 {{if @row.online "text-green-500" "text-yellow-200"}}" />
<FaIcon @icon="circle" class="absolute left-0 top-0 -mt-1 -ml-2 h-2 w-2 {{if @row.online 'text-green-500' 'text-yellow-200'}}" />
{{/if}}
</div>
Loading

0 comments on commit cfc3b2e

Please sign in to comment.