workspace-ionic-app/src/app/model/actions/copy-item.ts

33 lines
1008 B
TypeScript
Raw Normal View History

import { AlertOptions, ModalOptions } from "@ionic/angular";
import { Observable } from "rxjs";
import { StoragehubService } from "src/app/storagehub.service";
import { WsViewerComponent } from "src/app/ws-viewer/ws-viewer.component";
import { WSItem } from "../ws-item";
import { Action } from "./action";
export class CopyAction extends Action {
override getModalOptions(item: WSItem, storagehub: StoragehubService, postOp?: Function): ModalOptions | undefined {
return {
component: WsViewerComponent,
componentProps: {
finishLabel: "Copy here",
title: "Copy "+item.getTitle()
}
};
}
actionHandler(data: {item: WSItem, newName : string}, storagehub: StoragehubService): Observable<any> {
return storagehub.renameItem(data.item.item.id, data.newName);
}
getName(): string {
return "Copy";
}
getActionType(): string | undefined {
return undefined;
}
}