...
 
Commits (4)
......@@ -58,8 +58,8 @@
"budgets": [
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
"maximumWarning": "1.5mb",
"maximumError": "2mb"
},
{
"type": "anyComponentStyle",
......
......@@ -45,14 +45,19 @@ describe('/health and project table tests', function () {
cy.get('.mat-option-text:first').contains('texta_test_index').should('be.visible').click(); // todo texta test index
cy.closeCurrentCdkOverlay();
}));
cy.get('[data-cy=appProjectCreateDialogSubmit]').should('be.visible').click();
cy.route('GET', 'projects').as('getProjects');
cy.route('DELETE', '**/projects/**').as('deleteProjects');
cy.route('POST', 'projects').as('postProjects');
cy.get('[data-cy=appProjectCreateDialogSubmit]').should('be.visible').click();
cy.wait('@postProjects');
cy.wait('@getProjects');
cy.wait(1000); // projectStore, update table
cy.wait(100); // projectStore, update table
cy.get('tbody > :nth-child(1) > .cdk-column-title').contains('testProject');
cy.get(':nth-child(1) > .cdk-column-Modify > .mat-focus-indicator > .mat-button-wrapper > .mat-icon').click();
cy.get(':nth-child(1) > .mat-focus-indicator.ng-star-inserted').should('be.visible').contains('Delete').click();
cy.get('[data-cy=appConfirmDialogSubmit]').should('be.visible').click();
cy.wait('@getProjects');
cy.wait('@deleteProjects').then(x=>{
cy.wait('@getProjects');
});
});
});
......@@ -31,7 +31,7 @@ describe('dataset-importer should work', function () {
cy.get('[data-cy=appDatasetImporterCreateDialogName]').click().then((name => {
cy.wrap(name).should('have.class', 'mat-focused').type('asd').find('input').clear();
cy.matFormFieldShouldHaveError(name, 'required');
cy.wrap(name).type('newIndex');
cy.wrap(name).type('new_index');
}));
cy.get('input[type=file]').attachFile({
filePath: "testSample.csv",
......
......@@ -70,7 +70,6 @@ describe('mlp should work', function () {
cy.get('[data-cy=appMLPApplyDialogSubmit]').should('be.visible').click();
cy.wait('@MLPTexts').then(created => {
expect(created.status).to.eq(200);
assert.equal(created.response.body.task.status, 'ok');
});
});
});
......@@ -102,6 +102,8 @@ describe('reindexer should work', function () {
headers: {'Authorization': 'Token ' + JSON.parse(localStorage.getItem('user')).key}
}).then(x => {
initReindexerPage();
cy.wait('@getIndices');
// delete reindex task
cy.get('.cdk-column-Modify:nth(1)').should('be.visible').click();
cy.get('[data-cy=appReindexerMenuDelete]').should('be.visible').click();
......
This diff is collapsed.
......@@ -54,6 +54,7 @@ const routes: Routes = [
{
path: 'clustering',
canActivate: [AuthGuard],
data: {breadcrumb: 'clustering', tooltip: 'Clustering list'},
loadChildren: () => import('./models/clustering/cluster.module').then(m => m.ClusterModule)
},
{
......
......@@ -7,6 +7,7 @@ import {SharedModule} from './shared/shared.module';
import {HTTP_INTERCEPTORS, HttpClientModule, HttpClientXsrfModule} from '@angular/common/http';
import {HttpAuthInterceptor} from './core/auth/http-auth.interceptor';
import {NavbarComponent} from './navbar/navbar.component';
import {ToolsModule} from './tools/tools.module';
@NgModule({
......@@ -18,6 +19,7 @@ import {NavbarComponent} from './navbar/navbar.component';
BrowserModule,
BrowserAnimationsModule,
SharedModule,
ToolsModule,
HttpClientModule,
HttpClientXsrfModule.withOptions({
cookieName: 'XSRF-TOKEN',
......
......@@ -42,11 +42,11 @@ export class ProjectStore {
}
refreshProjects() {
this.projectService.getProjects().subscribe((resp: Project[] | HttpErrorResponse) => {
this.projectService.getProjects().subscribe(resp => {
if (resp && !(resp instanceof HttpErrorResponse)) {
this.getLocalStorageProjectSelection(resp);
this.projects$.next(resp);
} else if (resp instanceof HttpErrorResponse) {
} else {
this.logService.snackBarError(resp, 5000);
}
});
......
......@@ -9,7 +9,6 @@ const routes: Routes = [
{
path: '',
canActivate: [AuthGuard],
data: {breadcrumb: 'clustering', tooltip: 'Clustering list'},
children: [
{
path: '',
......
import {
AfterViewInit,
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
OnDestroy,
OnInit,
ViewChild
} from '@angular/core';
import {AfterViewInit, ChangeDetectionStrategy, ChangeDetectorRef, Component, OnDestroy, OnInit, ViewChild} from '@angular/core';
import {ClusterDetails, ClusterDocument} from '../../../../../shared/types/tasks/Cluster';
import {MatTableDataSource} from '@angular/material/table';
import {MatSort} from '@angular/material/sort';
......@@ -70,7 +62,7 @@ export class ViewClusterDocumentsComponent implements OnInit, AfterViewInit, OnD
}
return of(null);
})).subscribe(resp => {
if (resp && !(resp instanceof HttpErrorResponse)) {
if (resp && !(resp instanceof HttpErrorResponse) && resp.documents.length > 0) {
this.significantWords = resp.significant_words;
this.infiniteColumns = Object.getOwnPropertyNames(resp.documents[0].content);
if (this.displayedColumns.length === 0 && this.currentProject && this.clusteringId) {
......@@ -109,9 +101,12 @@ export class ViewClusterDocumentsComponent implements OnInit, AfterViewInit, OnD
this.isLoadingResults = false;
this.tableData.data = resp.documents;
}
} else if (resp instanceof HttpErrorResponse) {
this.logService.snackBarError(resp, 2000);
} else {
this.isLoadingResults = false;
if (resp instanceof HttpErrorResponse) {
this.logService.snackBarError(resp, 2000);
}
this.changeDetectorRef.markForCheck();
}
});
}
......@@ -141,8 +136,8 @@ export class ViewClusterDocumentsComponent implements OnInit, AfterViewInit, OnD
if (!state?.models.clustering[`${this.clusteringId.toString()}`]) {
state.models.clustering[`${this.clusteringId.toString()}`] = {};
}
const clusteringProperty: unknown = state.models.clustering[`${this.clusteringId.toString()}`][accessor];
(clusteringProperty as T) = value;
// @ts-ignore
state.models.clustering[`${this.clusteringId.toString()}`][accessor] = value;
this.localStorageService.updateProjectState(this.currentProject, state);
}
}
......
import {AfterViewInit, Component, OnDestroy, OnInit, ViewChild} from '@angular/core';
import {Field, Project, ProjectFact, ProjectIndex} from '../../../shared/types/Project';
import {mergeMap, switchMap, take, takeUntil} from 'rxjs/operators';
import {filter, mergeMap, switchMap, take, takeUntil} from 'rxjs/operators';
import {LogService} from '../../../core/util/log.service';
import {TaggerOptions} from '../../../shared/types/tasks/TaggerOptions';
import {ErrorStateMatcher} from '@angular/material/core';
......@@ -15,7 +15,6 @@ import {Embedding} from '../../../shared/types/tasks/Embedding';
import {TaggerService} from '../../../core/models/taggers/tagger.service';
import {forkJoin, of, Subject} from 'rxjs';
import {TaggerGroupService} from '../../../core/models/taggers/tagger-group.service';
import {TaggerGroup} from '../../../shared/types/tasks/Tagger';
import {UtilityFunctions} from '../../../shared/UtilityFunctions';
import {MatSelect} from '@angular/material/select';
......@@ -141,7 +140,7 @@ export class CreateTaggerGroupDialogComponent implements OnInit, OnDestroy, Afte
classifier: formData.taggerForm.classifierFormControl.value,
maximum_sample_size: formData.taggerForm.sampleSizeFormControl,
negative_multiplier: formData.taggerForm.negativeMultiplierFormControl,
...formData.taggerForm.embeddingFormControl.id ? {embedding: formData.taggerForm.embeddingFormControl.id} : {},
...formData?.taggerForm?.embeddingFormControl?.id ? {embedding: formData.taggerForm.embeddingFormControl.id} : {},
};
const body = {
......@@ -152,12 +151,11 @@ export class CreateTaggerGroupDialogComponent implements OnInit, OnDestroy, Afte
};
if (this.currentProject) {
this.taggerGroupService.createTaggerGroup(body, this.currentProject.id).subscribe((resp: TaggerGroup | HttpErrorResponse) => {
if (resp && !(resp instanceof HttpErrorResponse)) {
this.dialogRef.close(resp);
} else if (resp instanceof HttpErrorResponse) {
this.dialogRef.close(resp);
this.taggerGroupService.createTaggerGroup(body, this.currentProject.id).subscribe(resp => {
if (resp instanceof HttpErrorResponse) {
this.logService.snackBarError(resp, 4000);
} else if (resp) {
this.dialogRef.close(resp);
}
});
}
......
......@@ -120,11 +120,9 @@ export class TaggerGroupComponent implements OnInit, OnDestroy, AfterViewInit {
width: '700px',
disableClose: true
});
dialogRef.afterClosed().subscribe((resp: TaggerGroup | HttpErrorResponse) => {
if (resp && !(resp instanceof HttpErrorResponse)) {
dialogRef.afterClosed().subscribe((resp: TaggerGroup) => {
if (resp) {
this.tableData.data = [...this.tableData.data, resp];
} else if (resp instanceof HttpErrorResponse) {
this.logService.snackBarError(resp, 5000);
}
});
}
......@@ -136,7 +134,7 @@ export class TaggerGroupComponent implements OnInit, OnDestroy, AfterViewInit {
}).afterClosed().subscribe((x: TaggerGroup | HttpErrorResponse) => {
if (x && !(x instanceof HttpErrorResponse)) {
taggerGroup.description = x.description;
} else {
} else if (x instanceof HttpErrorResponse) {
this.logService.snackBarError(x, 3000);
}
});
......
......@@ -17,6 +17,7 @@ import {ConfirmDialogComponent} from '../shared/components/dialogs/confirm-dialo
import {ProjectService} from '../core/projects/project.service';
import {UserStore} from '../core/users/user.store';
import {FormControl} from '@angular/forms';
import {MatOption} from '@angular/material/core';
@Component({
selector: 'app-project',
......@@ -137,7 +138,7 @@ export class ProjectComponent implements OnInit, OnDestroy {
this.projectService.deleteProject(project.id).subscribe(resp => {
if (resp instanceof HttpErrorResponse) {
this.logService.snackBarError(resp, 4000);
} else if (resp) {
} else {
this.projectStore.refreshProjects(); // we also need to keep the navbar project select in sync not just table
this.logService.snackBarMessage(`Deleted project ${project.title}`, 3000);
}
......@@ -146,9 +147,8 @@ export class ProjectComponent implements OnInit, OnDestroy {
});
}
applyFilter(filterValue: any) {
filterValue = filterValue.value ? filterValue.value : '';
this.tableData.filter = filterValue;
applyFilter(filterValue: MatOption | { value: string }) {
this.tableData.filter = filterValue?.value ? filterValue.value : '';
}
selectProject(val: Project) {
......
......@@ -55,8 +55,8 @@ export class BreadcrumbComponent implements OnInit, OnDestroy {
const nextUrl = path ? `${url}/${path}` : url;
const breadcrumb: IBreadCrumb = {
label: label,
tooltip: tooltip,
label,
tooltip,
url: nextUrl,
};
// Only adding route with non-empty label
......
import {NgModule} from '@angular/core';
import {ReindexerComponent} from './reindexer/reindexer.component';
import {RouterModule, Routes} from '@angular/router';
import {AuthGuard} from 'src/app/core/auth/auth.guard';
import {DatasetImporterComponent} from './dataset-importer/dataset-importer.component';
import {MLPComponent} from './mlp/mlp.component';
import {AuthGuard} from '../core/auth/auth.guard';
const routes: Routes = [
{
......