Add support for PostgresDB and save date as Date

This commit is contained in:
Jan Oberhauser
2019-07-22 20:29:06 +02:00
parent d027545986
commit a9453806b8
27 changed files with 310 additions and 73 deletions

View File

@@ -116,7 +116,7 @@ export interface IRestApi {
getActiveWorkflows(): Promise<string[]>;
getActivationError(id: string): Promise<IActivationError | undefined >;
getCurrentExecutions(filter: object): Promise<IExecutionsCurrentSummaryExtended[]>;
getPastExecutions(filter: object, limit: number, lastStartedAt?: number): Promise<IExecutionsListResponse>;
getPastExecutions(filter: object, limit: number, lastStartedAt?: Date): Promise<IExecutionsListResponse>;
stopCurrentExecution(executionId: string): Promise<IExecutionsStopData>;
makeRestApiRequest(method: string, endpoint: string, data?: any): Promise<any>; // tslint:disable-line:no-any
getSettings(): Promise<IN8nUISettings>;
@@ -250,8 +250,8 @@ export interface IExecutionBase {
mode: WorkflowExecuteMode;
retryOf?: string;
retrySuccessId?: string;
startedAt: number;
stoppedAt: number;
startedAt: Date;
stoppedAt?: Date;
workflowId?: string; // To be able to filter executions easily //
}
@@ -283,8 +283,8 @@ export interface IExecutionShortResponse {
};
mode: WorkflowExecuteMode;
finished: boolean;
startedAt: number | string;
stoppedAt: number | string;
startedAt: Date;
stoppedAt: Date;
executionTime?: number;
}
@@ -297,8 +297,8 @@ export interface IExecutionsCurrentSummaryExtended {
id: string;
finished?: boolean;
mode: WorkflowExecuteMode;
startedAt: number | string;
stoppedAt?: number | string;
startedAt: Date;
stoppedAt?: Date;
workflowId: string;
workflowName?: string;
}
@@ -306,8 +306,8 @@ export interface IExecutionsCurrentSummaryExtended {
export interface IExecutionsStopData {
finished?: boolean;
mode: WorkflowExecuteMode;
startedAt: number | string;
stoppedAt: number | string;
startedAt: Date;
stoppedAt: Date;
}
export interface IExecutionsSummary {
@@ -316,14 +316,14 @@ export interface IExecutionsSummary {
finished?: boolean;
retryOf?: string;
retrySuccessId?: string;
startedAt: number | string;
stoppedAt?: number | string;
startedAt: Date;
stoppedAt?: Date;
workflowId: string;
workflowName?: string;
}
export interface IExecutionDeleteFilter {
deleteBefore?: number;
deleteBefore?: Date;
filters?: IDataObject;
ids?: string[];
}

View File

@@ -110,7 +110,7 @@
{{(new Date().getTime() - new Date(scope.row.startedAt).getTime())/1000}} sec.
</span>
<span v-else>
{{(scope.row.stoppedAt - scope.row.startedAt) / 1000}} sec.
{{(new Date(scope.row.stoppedAt).getTime() - new Date(scope.row.startedAt).getTime()) / 1000}} sec.
</span>
</template>
</el-table-column>
@@ -323,7 +323,7 @@ export default mixins(
const sendData: IExecutionDeleteFilter = {};
if (this.checkAll === true) {
sendData.deleteBefore = this.finishedExecutions[0].startedAt as number;
sendData.deleteBefore = this.finishedExecutions[0].startedAt as Date;
} else {
sendData.ids = Object.keys(this.selectedItems);
}
@@ -387,11 +387,11 @@ export default mixins(
this.isDataLoading = true;
const filter = this.workflowFilter;
let lastStartedAt: number | undefined;
let lastStartedAt: Date | undefined;
if (this.finishedExecutions.length !== 0) {
const lastItem = this.finishedExecutions.slice(-1)[0];
lastStartedAt = lastItem.startedAt as number;
lastStartedAt = lastItem.startedAt as Date;
}
let data: IExecutionsListResponse;

View File

@@ -269,7 +269,7 @@ export const restApi = Vue.extend({
// Returns all saved executions
// TODO: For sure needs some kind of default filter like last day, with max 10 results, ...
getPastExecutions: (filter: object, limit: number, lastStartedAt?: number): Promise<IExecutionsListResponse> => {
getPastExecutions: (filter: object, limit: number, lastStartedAt?: Date): Promise<IExecutionsListResponse> => {
let sendData = {};
if (filter) {
sendData = {

View File

@@ -144,8 +144,8 @@ export const workflowRun = mixins(
id: '__IN_PROGRESS__',
finished: false,
mode: 'manual',
startedAt: new Date().getTime(),
stoppedAt: 0,
startedAt: new Date(),
stoppedAt: undefined,
workflowId: workflow.id,
data: {
resultData: {