repository.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. var App = require('app');
  19. App.Repository = DS.Model.extend({
  20. id: DS.attr('string'), // This is ${osType}-${repoId}.
  21. repoId: DS.attr('string'),
  22. osType: DS.attr('string'),
  23. baseUrl: DS.attr('string'),
  24. defaultBaseUrl: DS.attr('string'),
  25. latestBaseUrl: DS.attr('string'),
  26. repoName: DS.attr('string'),
  27. stackName: DS.attr('string'),
  28. stackVersion: DS.attr('string'),
  29. operatingSystem: DS.belongsTo('App.OperatingSystem'),
  30. validation: DS.attr('string', {defaultValue: ''}),
  31. errorContent: DS.attr('string', {defaultValue: ''}),
  32. errorTitle: DS.attr('string', {defaultValue: ''}),
  33. isSelected: function() {
  34. return this.get('operatingSystem.isSelected');
  35. }.property('id','operatingSystem.isSelected'),
  36. emptyError: function() {
  37. return !this.get('baseUrl');
  38. }.property('baseUrl'),
  39. invalidError: function() {
  40. return this.get('validation') == App.Repository.validation['INVALID'];
  41. }.property('validation'),
  42. undo: function() {
  43. return this.get('baseUrl') != this.get('latestBaseUrl');
  44. }.property('baseUrl','latestBaseUrl'),
  45. clearAll: function() {
  46. return this.get('baseUrl')
  47. }.property('baseUrl')
  48. });
  49. App.Repository.validation = {
  50. PENDING: '',
  51. INVALID: 'icon-exclamation-sign',
  52. OK: 'icon-ok',
  53. INPROGRESS: 'icon-repeat'
  54. };
  55. App.Repository.FIXTURES = [];