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
2 changes: 1 addition & 1 deletion frontend/package.json.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
29dc76b0e558e2ad19151d1e865006ec
2abbe43834ebb72fc1a2bc635219d8a1
23 changes: 2 additions & 21 deletions frontend/wailsjs/go/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ export namespace porter {
}
}
export class ImportPreview {
// Go type: time
exportedAt: any;
exportedAt: string;
hasSettings: boolean;
hasData: boolean;
hasDatabase: boolean;
Expand All @@ -57,32 +56,14 @@ export namespace porter {

constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.exportedAt = this.convertValues(source["exportedAt"], null);
this.exportedAt = source["exportedAt"];
this.hasSettings = source["hasSettings"];
this.hasData = source["hasData"];
this.hasDatabase = source["hasDatabase"];
this.hasDrivers = source["hasDrivers"];
this.driverCount = source["driverCount"];
this.driverSize = source["driverSize"];
}

convertValues(a: any, classs: any, asMap: boolean = false): any {
if (!a) {
return a;
}
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
for (const key of Object.keys(a)) {
a[key] = new classs(a[key]);
}
return a;
}
return new classs(a);
}
return a;
}
}
export class JobSnapshot {
status: status.Status;
Expand Down
18 changes: 10 additions & 8 deletions pkg/porter/porter.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ import (

// ImportPreview describes what's in a ZIP, returned by ValidateZip and DownloadAndValidate.
type ImportPreview struct {
ExportedAt time.Time `json:"exportedAt"`
HasSettings bool `json:"hasSettings"`
HasData bool `json:"hasData"`
HasDatabase bool `json:"hasDatabase"`
HasDrivers bool `json:"hasDrivers"`
DriverCount int `json:"driverCount"`
DriverSize int64 `json:"driverSize"`
// RFC3339 string, not time.Time — Wails binding generator has no model
// for time.Time. Manifest keeps time.Time (internal, never bound).
ExportedAt string `json:"exportedAt"`
HasSettings bool `json:"hasSettings"`
HasData bool `json:"hasData"`
HasDatabase bool `json:"hasDatabase"`
HasDrivers bool `json:"hasDrivers"`
DriverCount int `json:"driverCount"`
DriverSize int64 `json:"driverSize"`
}

// ImportOptions is the user's category selection for import.
Expand Down Expand Up @@ -106,7 +108,7 @@ func (p *Porter) ValidateZip(path string) (ImportPreview, error) {
}

preview := ImportPreview{
ExportedAt: m.ExportedAt,
ExportedAt: m.ExportedAt.Format(time.RFC3339),
}

for _, f := range zr.File {
Expand Down
Loading