my-test123
Version:
A planner front-end for Fabric8.
115 lines • 4.13 kB
JavaScript
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
import { switchModel, modelService } from './common.model';
var WorkItemType = /** @class */ (function (_super) {
__extends(WorkItemType, _super);
function WorkItemType() {
return _super !== null && _super.apply(this, arguments) || this;
}
return WorkItemType;
}(modelService));
export { WorkItemType };
var WorkItemTypeField = /** @class */ (function () {
function WorkItemTypeField() {
}
return WorkItemTypeField;
}());
export { WorkItemTypeField };
var WorkItemTypeMapper = /** @class */ (function () {
function WorkItemTypeMapper() {
this.serviceToUiMapTree = [{
fromPath: ['id'],
toPath: ['id']
}, {
fromPath: ['attributes', 'name'],
toPath: ['name']
}, {
fromPath: ['attributes', 'icon'],
toPath: ['icon']
}, {
fromPath: ['attributes', 'version'],
toPath: ['version']
}, {
fromPath: ['attributes', 'description'],
toPath: ['description']
}, {
fromPath: ['relationships', 'guidedChildTypes', 'data'],
toPath: ['childTypes'],
toFunction: function (item) {
return !!item ? item : [];
}
}, {
fromPath: ['attributes', 'fields'],
toPath: ['fields']
}, {
toPath: ['type'],
toValue: 'workitemtypes'
}
];
this.uiToServiceMapTree = [{
toPath: ['id'],
fromPath: ['id']
}, {
toPath: ['attributes', 'name'],
fromPath: ['name']
}, {
toPath: ['attributes', 'icon'],
fromPath: ['icon']
}, {
toPath: ['attributes', 'version'],
fromPath: ['version']
}, {
toPath: ['attributes', 'description'],
fromPath: ['description']
}, {
toPath: ['type'],
toValue: 'workitemtypes'
}, {
fromPath: ['childTypes'],
toPath: ['relationships', 'guidedChildTypes', 'data'],
toFunction: function (item) {
return !!item ? item : [];
}
}, {
toPath: ['attributes', 'fields'],
fromPath: ['fields']
}
];
}
WorkItemTypeMapper.prototype.toUIModel = function (arg) {
return switchModel(arg, this.serviceToUiMapTree);
};
WorkItemTypeMapper.prototype.toServiceModel = function (arg) {
return switchModel(arg, this.uiToServiceMapTree);
};
return WorkItemTypeMapper;
}());
export { WorkItemTypeMapper };
var WorkItemTypeResolver = /** @class */ (function () {
function WorkItemTypeResolver(allTypes) {
if (allTypes === void 0) { allTypes = []; }
this.allTypes = allTypes;
}
WorkItemTypeResolver.prototype.resolveChildren = function () {
var _this = this;
this.allTypes.forEach(function (type) {
type.childTypes = _this.allTypes.filter(function (t) {
return type.childTypes.findIndex(function (ct) { return ct.id === t.id; }) > -1;
});
});
};
WorkItemTypeResolver.prototype.getResolvedWorkItemTypes = function () {
return this.allTypes;
};
return WorkItemTypeResolver;
}());
export { WorkItemTypeResolver };
//# sourceMappingURL=work-item-type.js.map