Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.2.1 #27

Merged
merged 5 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions addon/services/fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -546,16 +546,24 @@ export default class FetchService extends Service {
.then((response) => response.json())
.catch((error) => {
this.notifications.serverError(error, 'File upload failed.');

if (typeof errorCallback === 'function') {
errorCallback(error);
}
});

const model = this.store.push(this.store.normalize('file', upload.file));
set(file, 'model', model);
if (upload) {
const model = this.store.push(this.store.normalize('file', upload.file));
set(file, 'model', model);

if (typeof callback === 'function') {
callback(model);
}

if (typeof callback === 'function') {
callback(model);
return model;
}

return model;
return null;
} catch (error) {
queue.remove(file);
this.notifications.serverError(error, 'File upload failed.');
Expand Down
6 changes: 5 additions & 1 deletion addon/services/notifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ export default class NotificationsService extends EmberNotificationsService {
return this.error(errorMessage, options);
}

return this.error(error ?? fallbackMessage, options);
if (typeof error === 'string') {
return this.error(error, options);
}

return this.error(fallbackMessage, options);
}

invoke(type, message, ...params) {
Expand Down
12 changes: 12 additions & 0 deletions addon/services/universe.js
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,12 @@ export default class UniverseService extends Service.extend(Evented) {
const index = this._getOption(options, 'index', 0);
const onClick = this._getOption(options, 'onClick', null);
const section = this._getOption(options, 'section', null);
const iconSize = this._getOption(options, 'iconSize', null);
const iconClass = this._getOption(options, 'iconClass', null);
const itemClass = this._getOption(options, 'class', null);
const inlineClass = this._getOption(options, 'inlineClass', null);
const wrapperClass = this._getOption(options, 'wrapperClass', null);
const overwriteWrapperClass = this._getOption(options, 'overwriteWrapperClass', false);

// dasherize route segments
if (typeof route === 'string') {
Expand All @@ -784,6 +790,12 @@ export default class UniverseService extends Service.extend(Evented) {
index,
section,
onClick,
iconSize,
iconClass,
class: itemClass,
inlineClass,
wrapperClass,
overwriteWrapperClass,
};

return menuItem;
Expand Down
8 changes: 7 additions & 1 deletion addon/utils/get-resource-name-from-transition.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
export default function getResourceNameFromTransition(transition) {
import humanize from './humanize';

export default function getResourceNameFromTransition(transition, options = {}) {
const { to } = transition;

if (typeof to.name === 'string') {
let routePathSegments = to.name.split('.');
let resourceName = routePathSegments[3];

if (options.humanize === true) {
return humanize(resourceName);
}

return resourceName;
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fleetbase/ember-core",
"version": "0.2.0",
"version": "0.2.1",
"description": "Provides all the core services, decorators and utilities for building a Fleetbase extension for the Console.",
"keywords": [
"fleetbase-core",
Expand Down
Loading