Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions app/components/account/account.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { commonModules } from "app/common";
import { EditStorageAccountFormComponent } from "app/components/account/action/edit-storage-account";
import { AutoStorageAccountPickerComponent } from "app/components/account/base/auto-storage-account-picker";
import { PoolBaseModule } from "app/components/pool/base";
import { BatchAccountCommands } from "./action";
import { BatchAccountCreateComponent } from "./action/add";
import { DeleteAccountDialogComponent } from "./action/delete/delete-account-dialog.component";
import { AccountBrowseModule } from "./browse";
Expand Down Expand Up @@ -35,9 +34,6 @@ const modules = [
DeleteAccountDialogComponent,
EditStorageAccountFormComponent,
],
providers: [
BatchAccountCommands,
],
})
export class AccountModule {
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { List } from "immutable";
import { Observable } from "rxjs";

import { FilterBuilder } from "@batch-flask/core";
import { DialogService, InjectorFactory, NotificationService } from "@batch-flask/ui";
import { DialogService, NotificationService } from "@batch-flask/ui";
import { BackgroundTaskService } from "@batch-flask/ui/background-task";
import { SidebarManager } from "@batch-flask/ui/sidebar";
import { AccountListComponent } from "app/components/account/browse";
Expand Down Expand Up @@ -68,7 +68,6 @@ describe("AccountListComponent", () => {
{ provide: BackgroundTaskService, useValue: null },
{ provide: NotificationService, useValue: null },
{ provide: DialogService, useValue: null },
InjectorFactory,
],
schemas: [NO_ERRORS_SCHEMA],
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { Observable, Subscription } from "rxjs";

import { Filter, FilterMatcher, autobind } from "@batch-flask/core";
import { ListBaseComponent, ListSelection } from "@batch-flask/core/list";
import { InjectorFactory } from "@batch-flask/ui";
import { BackgroundTaskService } from "@batch-flask/ui/background-task";
import { ContextMenu, ContextMenuItem } from "@batch-flask/ui/context-menu";
import { LoadingStatus } from "@batch-flask/ui/loading";
Expand All @@ -20,23 +19,25 @@ import { DeleteAccountDialogComponent, DeleteAccountTask } from "../../action/de
@Component({
selector: "bl-account-list",
templateUrl: "account-list.html",
providers: [{
provide: ListBaseComponent,
useExisting: forwardRef(() => AccountListComponent),
}],
providers: [
BatchAccountCommands,
{
provide: ListBaseComponent,
useExisting: forwardRef(() => AccountListComponent),
},
],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class AccountListComponent extends ListBaseComponent implements OnDestroy {

public accounts: List<AccountResource> = List([]);
public displayedAccounts: List<AccountResource> = List([]);
public loadingStatus: LoadingStatus = LoadingStatus.Loading;
public commands: BatchAccountCommands;

private _accountSub: Subscription;

constructor(
public injectorFactory: InjectorFactory,
public commands: BatchAccountCommands,
private accountService: AccountService,
private dialog: MatDialog,
private taskManager: BackgroundTaskService,
Expand All @@ -45,7 +46,6 @@ export class AccountListComponent extends ListBaseComponent implements OnDestroy
changeDetector: ChangeDetectorRef,
subscriptionService: SubscriptionService) {
super(changeDetector);
this.commands = injectorFactory.create(BatchAccountCommands);
this._updateDisplayedAccounts();

this.accountService.accountsLoaded.subscribe(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { RouterTestingModule } from "@angular/router/testing";
import { Subject } from "rxjs";

import { FilterBuilder } from "@batch-flask/core";
import { DialogService, InjectorFactory, NotificationService } from "@batch-flask/ui";
import { DialogService, NotificationService } from "@batch-flask/ui";
import { BackgroundTaskService } from "@batch-flask/ui/background-task";
import { SidebarManager } from "@batch-flask/ui/sidebar";
import { ApplicationListComponent } from "app/components/application/browse";
Expand Down Expand Up @@ -51,7 +51,6 @@ describe("ApplicationListComponent", () => {
{ provide: PinnedEntityService, useValue: pinServiceSpy },
{ provide: BackgroundTaskService, useValue: null },
{ provide: SidebarManager, useValue: null },
InjectorFactory,
],
schemas: [NO_ERRORS_SCHEMA],
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Observable, Subscription } from "rxjs";

import { Filter, autobind } from "@batch-flask/core";
import { ListBaseComponent } from "@batch-flask/core/list";
import { InjectorFactory, LoadingStatus } from "@batch-flask/ui";
import { LoadingStatus } from "@batch-flask/ui";
import { QuickListItemStatus } from "@batch-flask/ui/quick-list";
import { BatchApplication } from "app/models";
import { ApplicationListParams, ApplicationService } from "app/services";
Expand All @@ -17,7 +17,7 @@ import "./application-list.scss";
@Component({
selector: "bl-application-list",
templateUrl: "application-list.html",
providers: [{
providers: [BatchApplicationCommands, {
provide: ListBaseComponent,
useExisting: forwardRef(() => ApplicationListComponent),
}],
Expand All @@ -28,19 +28,17 @@ export class ApplicationListComponent extends ListBaseComponent implements OnIni
public data: ListView<BatchApplication, ApplicationListParams>;
public applications: List<BatchApplication>;
public displayedApplications: List<BatchApplication>;
public commands: BatchApplicationCommands;

private _baseOptions = { maxresults: 50 };
private _subs: Subscription[] = [];

constructor(
router: Router,
changeDetector: ChangeDetectorRef,
injectorFactory: InjectorFactory,
public commands: BatchApplicationCommands,
private applicationService: ApplicationService,
) {
) {
super(changeDetector);
this.commands = injectorFactory.create(BatchApplicationCommands);

this.data = this.applicationService.listView(this._baseOptions);
this._subs.push(this.data.items.subscribe((applications) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { Observable, Subscription } from "rxjs";

import { Filter, FilterMatcher, autobind } from "@batch-flask/core";
import { ListBaseComponent, ListSelection } from "@batch-flask/core/list";
import { InjectorFactory } from "@batch-flask/ui";
import { BackgroundTaskService } from "@batch-flask/ui/background-task";
import { LoadingStatus } from "@batch-flask/ui/loading";
import { QuickListItemStatus } from "@batch-flask/ui/quick-list";
Expand All @@ -24,13 +23,12 @@ import {
selector: "bl-certificate-list",
templateUrl: "certificate-list.html",
changeDetection: ChangeDetectionStrategy.OnPush,
providers: [{
providers: [CertificateCommands, {
provide: ListBaseComponent,
useExisting: forwardRef(() => CertificateListComponent),
}],
})
export class CertificateListComponent extends ListBaseComponent implements OnInit, OnDestroy {
public commands: CertificateCommands;
public certificates: List<Certificate>;
public displayedCertificates: List<Certificate> = List([]);
public LoadingStatus = LoadingStatus;
Expand All @@ -43,12 +41,11 @@ export class CertificateListComponent extends ListBaseComponent implements OnIni
router: Router,
activatedRoute: ActivatedRoute,
changeDetector: ChangeDetectorRef,
injectorFactory: InjectorFactory,
public commands: CertificateCommands,
private certificateService: CertificateService,
private taskManager: BackgroundTaskService,
) {
super(changeDetector);
this.commands = injectorFactory.create(CertificateCommands);

this.data = this.certificateService.listView();
ComponentUtils.setActiveItem(activatedRoute, this.data);
Expand Down
8 changes: 3 additions & 5 deletions app/components/data/browse/data-container-list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ActivatedRoute, Router } from "@angular/router";
import { Filter, autobind } from "@batch-flask/core";
import { ListBaseComponent, ListSelection } from "@batch-flask/core/list";
import {
BackgroundTaskService, InjectorFactory, LoadingStatus, QuickListItemStatus,
BackgroundTaskService, LoadingStatus, QuickListItemStatus,
} from "@batch-flask/ui";
import { List } from "immutable";
import { Observable, Subscription } from "rxjs";
Expand All @@ -26,14 +26,13 @@ const defaultListOptions = {
@Component({
selector: "bl-data-container-list",
templateUrl: "data-container-list.html",
providers: [{
providers: [BlobContainerCommands, {
provide: ListBaseComponent,
useExisting: forwardRef(() => DataContainerListComponent),
}],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class DataContainerListComponent extends ListBaseComponent implements OnInit, OnChanges, OnDestroy {
public commands: BlobContainerCommands;
public LoadingStatus = LoadingStatus;

@Input() public storageAccountId: string;
Expand All @@ -47,13 +46,12 @@ export class DataContainerListComponent extends ListBaseComponent implements OnI
constructor(
router: Router,
changeDetector: ChangeDetectorRef,
injectorFactory: InjectorFactory,
public commands: BlobContainerCommands,
private activeRoute: ActivatedRoute,
private taskManager: BackgroundTaskService,
private storageContainerService: StorageContainerService) {

super(changeDetector);
this.commands = injectorFactory.create(BlobContainerCommands);
this.data = this.storageContainerService.listView();
ComponentUtils.setActiveItem(activeRoute, this.data);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { Observable, Subscription } from "rxjs";

import { Filter, autobind } from "@batch-flask/core";
import { ListBaseComponent, ListSelection } from "@batch-flask/core/list";
import { InjectorFactory } from "@batch-flask/ui";
import { BackgroundTaskService } from "@batch-flask/ui/background-task";
import { ContextMenu, ContextMenuItem } from "@batch-flask/ui/context-menu";
import { LoadingStatus } from "@batch-flask/ui/loading";
Expand All @@ -33,13 +32,12 @@ import {
selector: "bl-job-schedule-list",
templateUrl: "job-schedule-list.html",
changeDetection: ChangeDetectionStrategy.OnPush,
providers: [{
providers: [JobScheduleCommands, {
provide: ListBaseComponent,
useExisting: forwardRef(() => JobScheduleListComponent),
}],
})
export class JobScheduleListComponent extends ListBaseComponent implements OnInit, OnDestroy {
public commands: JobScheduleCommands;
public jobSchedules: List<JobSchedule>;
public LoadingStatus = LoadingStatus;

Expand All @@ -53,15 +51,14 @@ export class JobScheduleListComponent extends ListBaseComponent implements OnIni
router: Router,
activatedRoute: ActivatedRoute,
changeDetector: ChangeDetectorRef,
injectorFactory: InjectorFactory,
public commands: JobScheduleCommands,
private sidebarManager: SidebarManager,
private dialog: MatDialog,
private jobScheduleService: JobScheduleService,
private pinnedEntityService: PinnedEntityService,
private taskManager: BackgroundTaskService) {
super(changeDetector);

this.commands = injectorFactory.create(JobScheduleCommands);
this.data = this.jobScheduleService.listView();
ComponentUtils.setActiveItem(activatedRoute, this.data);
this.data.items.subscribe((jobSchedules) => {
Expand Down
12 changes: 8 additions & 4 deletions app/components/job/action/disable/disable-job.command.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
import { Injectable, Injector } from "@angular/core";
import { Injector } from "@angular/core";
import { autobind } from "@batch-flask/core";
import { DialogService, EntityCommand } from "@batch-flask/ui";

import { Job, JobState } from "app/models";
import { JobService } from "app/services";
import { DisableJobDialogComponent } from "./disable-job-dialog.component";

@Injectable()
export class DisableJobCommand extends EntityCommand<Job, string> {
constructor(injector: Injector, jobService: JobService, private dialog: DialogService) {
private _dialog: DialogService;

constructor(injector: Injector) {
const jobService = injector.get(JobService);

super(injector, {
label: "Disable",
action: (job: Job, option: string) => jobService.disable(job.id, option),
enabled: (job) => job.state !== JobState.completed && job.state !== JobState.disabled,
confirm: (x) => this._confirmAndGetInfo(x),
});
this._dialog = injector.get(DialogService);
}

@autobind()
private _confirmAndGetInfo(entities: Job[]) {
const dialogRef = this.dialog.open(DisableJobDialogComponent);
const dialogRef = this._dialog.open(DisableJobDialogComponent);
dialogRef.componentInstance.jobs = entities;
return dialogRef.componentInstance.onSubmit;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import { JobService } from "app/services";

@Injectable()
export class TerminateJobCommand extends EntityCommand<Job> {
constructor(injector: Injector, jobService: JobService) {
constructor(injector: Injector) {
const jobService = injector.get(JobService);

super(injector, {
label: "Terminate",
action: (job: Job) => jobService.terminate(job.id),
Expand Down
7 changes: 2 additions & 5 deletions app/components/job/browse/job-list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { Observable, Subscription } from "rxjs";

import { Filter, autobind } from "@batch-flask/core";
import { ListBaseComponent, ListSelection } from "@batch-flask/core/list";
import { InjectorFactory } from "@batch-flask/ui";
import { BackgroundTaskService } from "@batch-flask/ui/background-task";
import { LoadingStatus } from "@batch-flask/ui/loading";
import { QuickListItemStatus } from "@batch-flask/ui/quick-list";
Expand All @@ -25,7 +24,7 @@ import {
@Component({
selector: "bl-job-list",
templateUrl: "job-list.html",
providers: [{
providers: [JobCommands, {
provide: ListBaseComponent,
useExisting: forwardRef(() => JobListComponent),
}],
Expand All @@ -37,7 +36,6 @@ export class JobListComponent extends ListBaseComponent implements OnInit, OnDes

public data: ListView<Job, JobListParams>;
public searchQuery = new FormControl();
public commands: JobCommands;

// todo: ask tim about setting difference select options for list and details.
private _baseOptions = {};
Expand All @@ -46,12 +44,11 @@ export class JobListComponent extends ListBaseComponent implements OnInit, OnDes
router: Router,
activatedRoute: ActivatedRoute,
changeDetector: ChangeDetectorRef,
injectorFactory: InjectorFactory,
public commands: JobCommands,
private sidebarManager: SidebarManager,
private jobService: JobService,
private taskManager: BackgroundTaskService) {
super(changeDetector);
this.commands = injectorFactory.create(JobCommands);
this.data = this.jobService.listView();
ComponentUtils.setActiveItem(activatedRoute, this.data);
this.data.items.subscribe((jobs) => {
Expand Down
7 changes: 3 additions & 4 deletions app/components/job/details/job-details.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ import {
PatchJobComponent,
} from "../action";

import { ElectronRemote, InjectorFactory } from "@batch-flask/ui";
import { ElectronRemote } from "@batch-flask/ui";
import "./job-details.scss";

@Component({
selector: "bl-job-details",
templateUrl: "job-details.html",
providers: [JobCommands],
})
export class JobDetailsComponent implements OnInit, OnDestroy {
public static breadcrumb({ id }, { tab }) {
Expand All @@ -40,19 +41,17 @@ export class JobDetailsComponent implements OnInit, OnDestroy {
public data: EntityView<Job, JobParams>;
public JobState = JobState;
public hasHookTask = false;
public jobCommands: JobCommands;

private _paramsSubscriber: Subscription;

constructor(
private injectorFactory: InjectorFactory,
public jobCommands: JobCommands,
private activatedRoute: ActivatedRoute,
private fs: FileSystemService,
private remote: ElectronRemote,
private sidebarManager: SidebarManager,
private jobService: JobService,
private router: Router) {
this.jobCommands = this.injectorFactory.create(JobCommands);

this.data = this.jobService.view();
this.data.item.subscribe((job) => {
Expand Down
Loading