3012 - Hotfix: Get ticket list
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
878e989c02
commit
ea78db1441
|
@ -1,9 +1,7 @@
|
||||||
<vn-crud-model
|
<vn-crud-model
|
||||||
vn-id="ticketsModel"
|
vn-id="ticketsModel"
|
||||||
url="InvoiceOuts/{{$ctrl.$params.id}}/getTickets"
|
|
||||||
limit="10"
|
limit="10"
|
||||||
data="tickets"
|
data="tickets">
|
||||||
auto-load="true">
|
|
||||||
</vn-crud-model>
|
</vn-crud-model>
|
||||||
<vn-card class="summary">
|
<vn-card class="summary">
|
||||||
<h5>
|
<h5>
|
||||||
|
@ -56,7 +54,7 @@
|
||||||
</vn-two>
|
</vn-two>
|
||||||
<vn-auto>
|
<vn-auto>
|
||||||
<h4 translate>Ticket</h4>
|
<h4 translate>Ticket</h4>
|
||||||
<vn-table model="model">
|
<vn-table>
|
||||||
<vn-thead>
|
<vn-thead>
|
||||||
<vn-tr>
|
<vn-tr>
|
||||||
<vn-th number>Ticket id</vn-th>
|
<vn-th number>Ticket id</vn-th>
|
||||||
|
|
|
@ -5,8 +5,10 @@ import './style.scss';
|
||||||
class Controller extends Summary {
|
class Controller extends Summary {
|
||||||
set invoiceOut(value) {
|
set invoiceOut(value) {
|
||||||
this._invoiceOut = value;
|
this._invoiceOut = value;
|
||||||
if (value && value.id)
|
if (value && value.id) {
|
||||||
this.getSummary();
|
this.getSummary();
|
||||||
|
this.getTickets();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get invoiceOut() {
|
get invoiceOut() {
|
||||||
|
@ -17,6 +19,14 @@ class Controller extends Summary {
|
||||||
return this.$http.get(`InvoiceOuts/${this.invoiceOut.id}/summary`)
|
return this.$http.get(`InvoiceOuts/${this.invoiceOut.id}/summary`)
|
||||||
.then(res => this.summary = res.data);
|
.then(res => this.summary = res.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getTickets() {
|
||||||
|
this.$.$applyAsync(() => {
|
||||||
|
const query = `InvoiceOuts/${this.invoiceOut.id}/getTickets`;
|
||||||
|
this.$.ticketsModel.url = query;
|
||||||
|
this.$.ticketsModel.refresh();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ngModule.vnComponent('vnInvoiceOutSummary', {
|
ngModule.vnComponent('vnInvoiceOutSummary', {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import './index.js';
|
import './index.js';
|
||||||
|
import crudModel from 'core/mocks/crud-model';
|
||||||
|
|
||||||
describe('InvoiceOut', () => {
|
describe('InvoiceOut', () => {
|
||||||
describe('Component summary', () => {
|
describe('Component summary', () => {
|
||||||
|
@ -13,17 +14,30 @@ describe('InvoiceOut', () => {
|
||||||
$scope = $rootScope.$new();
|
$scope = $rootScope.$new();
|
||||||
const $element = angular.element('<vn-invoice-out-summary></vn-invoice-out-summary>');
|
const $element = angular.element('<vn-invoice-out-summary></vn-invoice-out-summary>');
|
||||||
controller = $componentController('vnInvoiceOutSummary', {$element, $scope});
|
controller = $componentController('vnInvoiceOutSummary', {$element, $scope});
|
||||||
controller.invoiceOut = {id: 1};
|
controller._invoiceOut = {id: 1};
|
||||||
|
controller.$.ticketsModel = crudModel;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
describe('getSummary()', () => {
|
describe('getSummary()', () => {
|
||||||
it('should perform a query to set summary', () => {
|
it('should perform a query to set summary', () => {
|
||||||
$httpBackend.when('GET', `InvoiceOuts/1/summary`).respond(200, 'the data you are looking for');
|
$httpBackend.expect('GET', `InvoiceOuts/1/summary`).respond(200, 'the data you are looking for');
|
||||||
controller.getSummary();
|
controller.getSummary();
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
expect(controller.summary).toEqual('the data you are looking for');
|
expect(controller.summary).toEqual('the data you are looking for');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('getTickets()', () => {
|
||||||
|
it('should perform a and then call to the ticketModel refresh() method', () => {
|
||||||
|
jest.spyOn(controller.$.ticketsModel, 'refresh');
|
||||||
|
|
||||||
|
controller.getTickets();
|
||||||
|
$scope.$apply();
|
||||||
|
|
||||||
|
expect(controller.$.ticketsModel.url).toEqual('InvoiceOuts/1/getTickets');
|
||||||
|
expect(controller.$.ticketsModel.refresh).toHaveBeenCalledWith();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue