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

Added BackgroundLayer model #581

Open
wants to merge 17 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 9 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
export default {
projections: {
BackgroundLayerE: {
},
BackgroundLayerL: {
name: {
__caption__: 'name'
},
description: {
__caption__: 'description'
},
keyWords: {
__caption__: 'keyWords'
},
anyText: {
__caption__: 'anyText'
},
index: {
__caption__: 'index'
},
visibility: {
__caption__: 'visibility'
},
type: {
__caption__: 'type'
},
settings: {
__caption__: 'settings'
},
scale: {
__caption__: 'scale'
},
coordinateReferenceSystem: {
__caption__: 'coordinateReferenceSystem'
},
boundingBox: {
__caption__: 'boundingBox'
},
public: {
__caption__: 'public'
},
owner: {
__caption__: 'owner'
},
securityKey: {
__caption__: 'securityKey'
}
}
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
export default {
projections: {
BackgroundLayerE: {
},
BackgroundLayerL: {
name: {
__caption__: ''
},
description: {
__caption__: ''
},
keyWords: {
__caption__: ''
},
anyText: {
__caption__: ''
},
index: {
__caption__: ''
},
visibility: {
__caption__: ''
},
type: {
__caption__: ''
},
settings: {
__caption__: ''
},
scale: {
__caption__: ''
},
coordinateReferenceSystem: {
__caption__: ''
},
boundingBox: {
__caption__: ''
},
public: {
__caption__: ''
},
owner: {
__caption__: ''
},
securityKey: {
__caption__: ''
}
}
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import Ember from 'ember';
import DS from 'ember-data';
import { attr } from 'ember-flexberry-data/utils/attributes';

export let Model = Ember.Mixin.create({
name: DS.attr('string'),
description: DS.attr('string'),
keyWords: DS.attr('string'),
/**
Non-stored property.

@property anyText
*/
anyText: DS.attr('string'),
/**
Method to set non-stored property.
Please, use code below in model class (outside of this mixin) otherwise it will be replaced during regeneration of models.
Please, implement 'anyTextCompute' method in model class (outside of this mixin) if you want to compute value of 'anyText' property.

@method _anyTextCompute
@private
@example
```javascript
_anyTextChanged: Ember.on('init', Ember.observer('anyText', function() {
Ember.run.once(this, '_anyTextCompute');
}))
```
*/
_anyTextCompute: function() {
let result = (this.anyTextCompute && typeof this.anyTextCompute === 'function') ? this.anyTextCompute() : null;
this.set('anyText', result);
},
index: DS.attr('number'),
visibility: DS.attr('boolean', { defaultValue: true }),
type: DS.attr('string'),
settings: DS.attr('string'),
scale: DS.attr('number'),
coordinateReferenceSystem: DS.attr('string'),
boundingBox: DS.attr('string'),
public: DS.attr('boolean'),
owner: DS.attr('string'),
securityKey: DS.attr('string'),
createTime: DS.attr('date'),
creator: DS.attr('string'),
editTime: DS.attr('date'),
editor: DS.attr('string'),
getValidations: function () {
let parentValidations = this._super();
let thisValidations = {
};
return Ember.$.extend(true, {}, parentValidations, thisValidations);
},
init: function () {
this.set('validations', this.getValidations());
this._super.apply(this, arguments);
}
});

export let defineNamespace = function (modelClass) {
modelClass.reopenClass({
namespace: 'NewPlatform.Flexberry.GIS',
});
};

export let defineProjections = function (modelClass) {
modelClass.defineProjection('BackgroundLayerE', 'new-platform-flexberry-g-i-s-background-layer', {
});

modelClass.defineProjection('BackgroundLayerL', 'new-platform-flexberry-g-i-s-background-layer', {
name: attr('', { index: 0 }),
description: attr('', { index: 1 }),
keyWords: attr('', { index: 2 }),
anyText: attr('', { index: 3 }),
index: attr('', { index: 4 }),
visibility: attr('', { index: 5 }),
type: attr('', { index: 6 }),
settings: attr('', { index: 7 }),
scale: attr('', { index: 8 }),
coordinateReferenceSystem: attr('', { index: 9 }),
boundingBox: attr('', { index: 10 }),
public: attr('', { index: 11 }),
owner: attr('', { index: 12 }),
securityKey: attr('', { index: 13 })
});
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import Ember from 'ember';

/**
Mixin containing initializetion logic for background layer serializer.

@class NewPlatformFlexberyGISBackgroundLayerSerializerMixin
@extends <a href="http://emberjs.com/api/classes/Ember.Mixin.html">Ember.Mixin</a>
*/
export let Serializer = Ember.Mixin.create({
getAttrs: function () {
let parentAttrs = this._super();
let attrs = {

};

return Ember.$.extend(true, {}, parentAttrs, attrs);
},
init: function () {
this.set('attrs', this.getAttrs());
this._super(...arguments);
}
});
16 changes: 16 additions & 0 deletions addon/models/new-platform-flexberry-g-i-s-background-layer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import {
defineNamespace,
defineProjections,
Model as BackgroundLayerMixin
} from '../mixins/regenerated/models/new-platform-flexberry-g-i-s-background-layer';

import EmberFlexberryDataModel from 'ember-flexberry-data/models/model';
import OfflineModelMixin from 'ember-flexberry-data/mixins/offline-model';

let Model = EmberFlexberryDataModel.extend(OfflineModelMixin, BackgroundLayerMixin, {
});

defineNamespace(Model);
defineProjections(Model);

export default Model;
4 changes: 0 additions & 4 deletions addon/routes/edit-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,6 @@ export default EditFormRoute.extend({
let hierarchy = this.sortLayersByIndex(rootLayers);
model.set('hierarchy', hierarchy);

let backgroundLayers = Ember.A();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тут весь этот метод был добавлен для того чтобы подложки была возможность отфильтровать - посмотри ПР где он добавлен, и убери его совсем.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Исправлено

backgroundLayers.addObjects(hierarchy.filterBy('settingsAsObject.backgroundSettings.canBeBackground', true));
model.set('backgroundLayers', backgroundLayers);

let other = hierarchy.filter((layer) => {
return Ember.isNone(layer.get('settingsAsObject')) || !layer.get('settingsAsObject.backgroundSettings.canBeBackground');
});
Expand Down
16 changes: 16 additions & 0 deletions addon/serializers/new-platform-flexberry-g-i-s-background-layer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import FlexberryData from 'ember-flexberry-data';
import { Serializer as BackgroundLayerSerializer } from '../mixins/regenerated/serializers/new-platform-flexberry-g-i-s-background-layer';

/**
Background layer serializer.

@class NewPlatformFlexberryGISBackgroundLayerSerializer
@extends OdataSerializer
@uses NewPlatformFlexberryGISBackgroundLayerSerializerMixin
*/
export default FlexberryData.Serializer.Odata.extend(BackgroundLayerSerializer, {
/**
* Field name where object identifier is kept.
*/
primaryKey: '__PrimaryKey'
});
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from 'ember-flexberry-gis/models/new-platform-flexberry-g-i-s-background-layer';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from 'ember-flexberry-gis/serializers/new-platform-flexberry-g-i-s-background-layer';
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"ember-cli-test-loader": "0.2.2",
"ember-qunit-notifications": "0.1.0",
"jquery-mockjax": "2.2.0",
"semantic-ui": "git://github.com/Flexberry/Semantic-UI.git#fixed-abort",
"daterangepicker": "git://github.com/dangrossman/daterangepicker.git#3.0.5",
"semantic-ui": "https://github.com/Flexberry/Semantic-UI.git#fixed-abort",
"daterangepicker": "https://github.com/dangrossman/daterangepicker.git#3.0.5",
"moment": "2.24.0",
"blob-polyfill": "~1.0.20150320",
"devicejs": "0.2.7",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { moduleForModel, test } from 'ember-qunit';

moduleForModel('new-platform-flexberry-g-i-s-background-layer', 'Unit | Model | new-platform-flexberry-g-i-s-background-layer', {
// Specify the other units that are required for this test.
needs: [
'model:custom-inflector-rules',
'model:new-platform-flexberry-g-i-s-background-layer',
'model:new-platform-flexberry-g-i-s-layer-link',
'model:new-platform-flexberry-g-i-s-layer-metadata',
'model:new-platform-flexberry-g-i-s-link-metadata',
'model:new-platform-flexberry-g-i-s-link-parameter',
'model:new-platform-flexberry-g-i-s-map-layer',
'model:new-platform-flexberry-g-i-s-map-object-setting',
'model:new-platform-flexberry-g-i-s-map',
'model:new-platform-flexberry-g-i-s-parameter-metadata'
]
});

test('it exists', function(assert) {
let model = this.subject();

// let store = this.store();
assert.ok(!!model);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { moduleForModel, test } from 'ember-qunit';

moduleForModel('new-platform-flexberry-g-i-s-background-layer', 'Unit | Serializer | new-platform-flexberry-g-i-s-background-layer', {
// Specify the other units that are required for this test.
needs: [
'serializer:new-platform-flexberry-g-i-s-background-layer',
'transform:file',
'transform:decimal',
'transform:json',

'model:custom-inflector-rules',
'model:new-platform-flexberry-g-i-s-layer-link',
'model:new-platform-flexberry-g-i-s-layer-metadata',
'model:new-platform-flexberry-g-i-s-link-metadata',
'model:new-platform-flexberry-g-i-s-link-parameter',
'model:new-platform-flexberry-g-i-s-map-layer',
'model:new-platform-flexberry-g-i-s-map-object-setting',
'model:new-platform-flexberry-g-i-s-map',
'model:new-platform-flexberry-g-i-s-parameter-metadata'
]
});

// Replace this with your real tests.
test('it serializes records', function(assert) {
let record = this.subject();

let serializedRecord = record.serialize();

assert.ok(serializedRecord);
});
Loading