Admin basket: fix import error message and import date display update
This commit is contained in:
parent
3b59249531
commit
aa955a1b3b
2 changed files with 194 additions and 183 deletions
|
@ -1,5 +1,7 @@
|
||||||
import { Component, OnInit, Input, ViewChild, ElementRef,
|
import {
|
||||||
ChangeDetectorRef, ChangeDetectionStrategy } from '@angular/core'
|
Component, OnInit, Input, ViewChild, ElementRef,
|
||||||
|
ChangeDetectorRef, ChangeDetectionStrategy
|
||||||
|
} from '@angular/core'
|
||||||
import { ActivatedRoute } from '@angular/router'
|
import { ActivatedRoute } from '@angular/router'
|
||||||
import { UntypedFormGroup, UntypedFormControl } from '@angular/forms'
|
import { UntypedFormGroup, UntypedFormControl } from '@angular/forms'
|
||||||
|
|
||||||
|
@ -81,17 +83,24 @@ export class AdminBasketComponent implements OnInit {
|
||||||
basket: this.basket.name,
|
basket: this.basket.name,
|
||||||
fileId: item.id,
|
fileId: item.id,
|
||||||
dryRun: dryRun
|
dryRun: dryRun
|
||||||
}).subscribe(
|
}).subscribe({
|
||||||
resp => {
|
next: resp => {
|
||||||
this.basket.files.find(row => row.id == item.id).time = new Date(resp.time).toLocaleString()
|
this.basket.files.find(row => row.id == item.id).time = new Date(resp.time)
|
||||||
this.snackBar.openFromComponent(HtmlSnackbarComponent, {
|
this.snackBar.openFromComponent(HtmlSnackbarComponent, {
|
||||||
data: resp,
|
data: resp,
|
||||||
//duration: 3000
|
//duration: 3000
|
||||||
})
|
})
|
||||||
this.cdr.markForCheck()
|
this.cdr.markForCheck()
|
||||||
}
|
},
|
||||||
|
error: err => {
|
||||||
|
this.snackBar.open(
|
||||||
|
`Cannot import: ${err.body['detail'] || err.message || err.statusText}`,
|
||||||
|
'Got it',
|
||||||
|
{ 'politeness': 'assertive' }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
deleteItem(item: FileImport) {
|
deleteItem(item: FileImport) {
|
||||||
return this.adminService.deleteBasketFileApiAdminBasketDeleteBasketFileIdGet({
|
return this.adminService.deleteBasketFileApiAdminBasketDeleteBasketFileIdGet({
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
import { Component, Input, ViewChild, OnInit, HostBinding,
|
import {
|
||||||
ChangeDetectorRef, ChangeDetectionStrategy } from '@angular/core'
|
Component, Input, ViewChild, OnInit, HostBinding,
|
||||||
|
ChangeDetectorRef, ChangeDetectionStrategy
|
||||||
|
} from '@angular/core'
|
||||||
import { ActivatedRoute, ParamMap, Router } from '@angular/router'
|
import { ActivatedRoute, ParamMap, Router } from '@angular/router'
|
||||||
|
|
||||||
import { SelectionModel } from '@angular/cdk/collections'
|
import { SelectionModel } from '@angular/cdk/collections'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue