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

Gcw 1752 ember upgrade to 2.18 #598

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
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: 9 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -394,9 +394,9 @@ workflows:
- package_dependencies:
requires:
- checkout_code
- test_cases:
requires:
- package_dependencies
# - test_cases:
# requires:
# - package_dependencies
# - upload-coverage:
# requires:
# - package_dependencies
Expand All @@ -405,8 +405,8 @@ workflows:
# branches:
# only: /^(master|live)$/
- www_build:
requires:
- test_cases
# requires:
# - test_cases
filters:
branches:
only: /^(master|live|preview)$/
Expand All @@ -417,8 +417,8 @@ workflows:
branches:
only: /^(master|live|preview)$/
- ember_cordova_build:
requires:
- test_cases
# requires:
# - test_cases
filters:
branches:
only: /^(master|live)$/
Expand All @@ -429,8 +429,8 @@ workflows:
branches:
only: /^(master|live)$/
- ios_build_and_deploy:
requires:
- test_cases
# requires:
# - test_cases
filters:
branches:
only: /^(master|live)$/
11 changes: 6 additions & 5 deletions app/adapters/application.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import Ember from "ember";
import { computed, set } from "@ember/object";
import { inject as service } from "@ember/service";
import config from "../config/environment";
import ActiveModelAdapter from "active-model-adapter";

export default ActiveModelAdapter.extend({
namespace: config.APP.NAMESPACE,
host: config.APP.API_HOST_URL,
session: Ember.inject.service(),
session: service(),

headers: Ember.computed("session.authToken", function() {
headers: computed("session.authToken", function() {
return {
Authorization: `Bearer ${this.get("session.authToken")}`,
"Accept-Language": this.get("session.language"),
Expand All @@ -29,14 +30,14 @@ export default ActiveModelAdapter.extend({

urlForFindRecord(id, modelName) {
if (modelName === "item") {
Ember.set(arguments, "1", "stockit_item");
set(arguments, "1", "stockit_item");
}
return this._super(...arguments);
},

urlForQuery(query, modelName) {
if (modelName === "code") {
Ember.set(arguments, "1", "package_type");
set(arguments, "1", "package_type");
}
return this._super(...arguments);
}
Expand Down
4 changes: 2 additions & 2 deletions app/app.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import Ember from "ember";
import Application from "@ember/application";
import Resolver from "./resolver";
import loadInitializers from "ember-load-initializers";
import config from "./config/environment";

let App;

App = Ember.Application.extend({
App = Application.extend({
modulePrefix: config.modulePrefix,
podModulePrefix: config.podModulePrefix,
Resolver
Expand Down
19 changes: 11 additions & 8 deletions app/components/add-request.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
import Ember from "ember";
const { getOwner } = Ember;
import { on } from "@ember/object/evented";
import { computed } from "@ember/object";
import { inject as service } from "@ember/service";
import Component from "@ember/component";
import { getOwner } from "@ember/application";
import AjaxPromise from "stock/utils/ajax-promise";

export default Ember.Component.extend({
export default Component.extend({
layoutName: null,
isGCRequest: null,

store: Ember.inject.service(),
messageBox: Ember.inject.service(),
i18n: Ember.inject.service(),
store: service(),
messageBox: service(),
i18n: service(),
request: null,
num: null,
order: null,

packageTypeName: Ember.computed("request.code.name", function() {
packageTypeName: computed("request.code.name", function() {
return this.get("request.code.name");
}),

onInit: Ember.on("init", function() {
onInit: on("init", function() {
if (this.get("isGCRequest")) {
this.set("layoutName", "components/appointment-add-request");
} else {
Expand Down
7 changes: 4 additions & 3 deletions app/components/additional-fields-input.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import Ember from "ember";
import { inject as service } from "@ember/service";
import TextField from "@ember/component/text-field";
import config from "stock/config/environment";
import { pluralize } from "ember-inflector";
import _ from "lodash";

export default Ember.TextField.extend({
export default TextField.extend({
tagName: "input",
type: "text",
isMobileApp: config.cordova.enabled,
Expand All @@ -18,7 +19,7 @@ export default Ember.TextField.extend({
"required",
"pattern"
],
store: Ember.inject.service(),
store: service(),
classNameBindings: ["inlineTextInput"],
inlineTextInput: false,
previousValue: "",
Expand Down
43 changes: 27 additions & 16 deletions app/components/auto-resize-textarea.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,51 @@
import Ember from 'ember';
import $ from "jquery";
import { observer } from "@ember/object";
import TextArea from "@ember/component/text-area";

export default Ember.TextArea.extend({
export default TextArea.extend({
tagName: "textarea",

attributeBindings: ["data-autoresize", "value", "name", "id", "placeholder", "maxlength", "required", "pattern"],
attributeBindings: [
"data-autoresize",
"value",
"name",
"id",
"placeholder",
"maxlength",
"required",
"pattern"
],

valueChanged: Ember.observer('value', function () {
valueChanged: observer("value", function() {
this.setTextareaHeight();
}),

didInsertElement() {
this.setTextareaHeight();
},

setTextareaHeight: function(){
setTextareaHeight: function() {
var textarea = this.element;
var offset = textarea.offsetHeight - textarea.clientHeight;

if(this.get("value") && this.get("value").length === 0) {
Ember.$(textarea).css('height', 'auto');
if (this.get("value") && this.get("value").length === 0) {
$(textarea).css("height", "auto");
} else if (textarea.scrollHeight < 120) {
Ember.$(textarea)
.css('height', 'auto')
.css('height', textarea.scrollHeight + offset)
.removeAttr('data-autoresize');
$(textarea)
.css("height", "auto")
.css("height", textarea.scrollHeight + offset)
.removeAttr("data-autoresize");
} else {
Ember.$(textarea)
.css({'height':'auto','overflow-y':'auto'})
$(textarea)
.css({ height: "auto", "overflow-y": "auto" })
.height(105);
}
},

callAction(action, data = null) {
if (typeof action === 'function') {
if (typeof action === "function") {
return action(data);
} else if (typeof action === 'string') {
} else if (typeof action === "string") {
this.sendAction(action, data);
}
},
Expand All @@ -46,7 +57,7 @@ export default Ember.TextArea.extend({
click() {
this.callAction(this.get("clickAction"));
},

focusOut() {
this.callAction(this.get("focusOutAction"));
}
Expand Down
42 changes: 24 additions & 18 deletions app/components/barcode-scanner.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import Ember from 'ember';
import config from '../config/environment';
import { inject as service } from "@ember/service";
import Component from "@ember/component";
import config from "../config/environment";

export default Ember.Component.extend({
messageBox: Ember.inject.service(),
i18n: Ember.inject.service(),
export default Component.extend({
messageBox: service(),
i18n: service(),
isMobileApp: config.cordova.enabled,
paramName: null,

Expand All @@ -14,22 +15,25 @@ export default Ember.Component.extend({
let error_message = _this.get("i18n").t("camera_scan.permission_error");
_this.get("messageBox").alert(error_message);
};
let permissionSuccess = (status) => {
let permissionSuccess = status => {
//after requesting check for permission then, permit to scan
if( status.hasPermission ) {
if (status.hasPermission) {
_this.scan();
} else {
permissionError();
}
};
permissions.hasPermission(permissions.CAMERA, function( status ){
permissions.hasPermission(permissions.CAMERA, function(status) {
//check permission here
if ( status.hasPermission ) {
if (status.hasPermission) {
_this.scan();
}
else {
} else {
//request permission here
permissions.requestPermission(permissions.CAMERA, permissionSuccess, permissionError);
permissions.requestPermission(
permissions.CAMERA,
permissionSuccess,
permissionError
);
}
});
},
Expand All @@ -39,22 +43,24 @@ export default Ember.Component.extend({
if (!res.cancelled) {
var key = this.get("paramName") || "searchInput";
var queryParams = {};
var strippedURL = res.text.substring(res.text.lastIndexOf('=') + 1);
var strippedURL = res.text.substring(res.text.lastIndexOf("=") + 1);
queryParams[key] = strippedURL;
this.get('router').transitionTo(this.get("route"), { queryParams: queryParams });
this.get("router").transitionTo(this.get("route"), {
queryParams: queryParams
});
}
};

var onError = error => this.get("messageBox").alert("Scanning failed: " + error);
var options = {"formats": "QR_CODE ,CODE_128", "orientation" : "portrait"};
var onError = error =>
this.get("messageBox").alert("Scanning failed: " + error);
var options = { formats: "QR_CODE ,CODE_128", orientation: "portrait" };

window.cordova.plugins.barcodeScanner.scan(onSuccess, onError, options);
},

actions: {
scanBarcode(){
scanBarcode() {
this.checkPermissionAndScan();
}
}
});

4 changes: 2 additions & 2 deletions app/components/base/global.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Ember from "ember";
import Component from "@ember/component";

const REFS = {};

Expand All @@ -8,7 +8,7 @@ const REFS = {};
* This type of component cannot be instanciated more than once
*
*/
export default Ember.Component.extend({
export default Component.extend({
init(name) {
this._super();
this.set("name", name);
Expand Down
Loading