Route refactor
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Joan Sanchez 2020-03-17 15:24:55 +01:00
parent 526a92fd32
commit 3cb98eaf5f
9 changed files with 20 additions and 61 deletions

View File

@ -1,19 +1,13 @@
import ngModule from '../module';
import Section from 'salix/components/section';
class Controller {
constructor($scope, vnApp, $translate) {
this.$ = $scope;
this.vnApp = vnApp;
this.$translate = $translate;
}
class Controller extends Section {
onSubmit() {
this.$.watcher.submit().then(() => {
this.card.reload();
});
this.$.watcher.submit().then(() =>
this.card.reload()
);
}
}
Controller.$inject = ['$scope', 'vnApp', '$translate'];
ngModule.component('vnRouteBasicData', {
template: require('./index.html'),

View File

@ -1,18 +1,13 @@
import ngModule from '../module';
import Section from 'salix/components/section';
export default class Controller {
constructor($scope, $state) {
this.$scope = $scope;
this.$state = $state;
}
export default class Controller extends Section {
onSubmit() {
this.$scope.watcher.submit().then(
this.$.watcher.submit().then(
res => this.$state.go('route.card.summary', {id: res.data.id})
);
}
}
Controller.$inject = ['$scope', '$state'];
ngModule.component('vnRouteCreate', {
template: require('./index.html'),

View File

@ -3,11 +3,8 @@ import Component from 'core/lib/component';
import './style.scss';
class Controller extends Component {
constructor($element, $scope, $http, $timeout, $q) {
super($element, $scope);
this.$timeout = $timeout;
this.$http = $http;
this.$q = $q;
constructor($element, $) {
super($element, $);
this.route = null;
this._quicklinks = {};
}
@ -118,7 +115,6 @@ class Controller extends Component {
});
}
}
Controller.$inject = ['$element', '$scope', '$http', '$timeout', '$q'];
ngModule.component('vnRouteDescriptorPopover', {
template: require('./index.html'),

View File

@ -2,8 +2,8 @@ import ngModule from '../module';
import Component from 'core/lib/component';
class Controller extends Component {
constructor($element, $scope, $httpParamSerializer) {
super($element, $scope);
constructor($element, $, $httpParamSerializer) {
super($element, $);
this.$httpParamSerializer = $httpParamSerializer;
this.moreOptions = [

View File

@ -1,11 +1,7 @@
import ngModule from '../module';
import Section from 'salix/components/section';
export default class Controller {
constructor($scope, vnToken) {
this.$ = $scope;
this.accessToken = vnToken.token;
}
export default class Controller extends Section {
showWorkerDescriptor(event, workerFk) {
if (event.defaultPrevented) return;
event.preventDefault();
@ -32,7 +28,6 @@ export default class Controller {
this.$.model.clear();
}
}
Controller.$inject = ['$scope', 'vnToken'];
ngModule.component('vnRouteIndex', {
template: require('./index.html'),

View File

@ -1,15 +1,7 @@
import ngModule from '../module';
class Controller {
constructor($scope, $stateParams) {
this.$scope = $scope;
this.$stateParams = $stateParams;
}
}
Controller.$inject = ['$scope', '$stateParams'];
import Section from 'salix/components/section';
ngModule.component('vnRouteLog', {
template: require('./index.html'),
controller: Controller,
controller: Section,
});

View File

@ -1,12 +1,8 @@
import ngModule from '../module';
import Section from 'salix/components/section';
import './style.scss';
class Controller {
constructor($scope, $http) {
this.$http = $http;
this.$ = $scope;
}
class Controller extends Section {
set route(value) {
this._route = value;
if (value && value.id)
@ -47,8 +43,6 @@ class Controller {
}
}
Controller.$inject = ['$scope', '$http'];
ngModule.component('vnRouteSummary', {
template: require('./index.html'),
controller: Controller,

View File

@ -9,7 +9,8 @@ describe('Route', () => {
beforeEach(angular.mock.inject(($componentController, _$httpBackend_) => {
$httpBackend = _$httpBackend_;
controller = $componentController('vnRouteSummary');
const $element = angular.element('<vn-route-summary></vn-route-summary>');
controller = $componentController('vnRouteSummary', {$element});
controller.route = {id: 1};
}));

View File

@ -3,12 +3,6 @@ import Section from 'salix/components/section';
import './style.scss';
class Controller extends Section {
constructor($element, $scope, $filter) {
super($element, $scope);
this.$filter = $filter;
}
get route() {
return this._route;
}
@ -200,8 +194,6 @@ class Controller extends Section {
}
}
Controller.$inject = ['$element', '$scope', '$filter'];
ngModule.component('vnRouteTickets', {
template: require('./index.html'),
controller: Controller,