-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
now can upload multiple bundles, added bundle validation, improved ve…
…rsioning and publishing flow
- Loading branch information
Showing
60 changed files
with
1,224 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from './registry-bridge'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<Modal::Default @modalIsOpened={{@modalIsOpened}} @options={{@options}} @confirm={{@onConfirm}} @decline={{@onDecline}}> | ||
{{#if this.bundles}} | ||
<div class="next-table-wrapper auto-height"> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th {{set-width "175px"}}>ID</th> | ||
<th {{set-width "70px"}}>Bundle</th> | ||
<th {{set-width "80px"}}>Version</th> | ||
<th {{set-width "110px"}}>Uploaded</th> | ||
<th {{set-width "100px"}}>Status</th> | ||
<th></th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{{#each this.bundles as |bundle|}} | ||
<tr> | ||
<td>{{bundle.bundle_id}}</td> | ||
<td>{{bundle.bundle_number}}</td> | ||
<td>{{bundle.version}}</td> | ||
<td>{{bundle.createdAgo}}</td> | ||
<td> | ||
<Badge @status={{bundle.status}} /> | ||
</td> | ||
<td> | ||
<Button @text="Select" @size="xs" @type="primary" @onClick={{fn this.selectBundle bundle}} /> | ||
</td> | ||
</tr> | ||
{{/each}} | ||
</tbody> | ||
</table> | ||
</div> | ||
{{else}} | ||
<div>No bundles uploaded.</div> | ||
{{/if}} | ||
</Modal::Default> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import Component from '@glimmer/component'; | ||
import { tracked } from '@glimmer/tracking'; | ||
import { inject as service } from '@ember/service'; | ||
import { action } from '@ember/object'; | ||
import { task } from 'ember-concurrency'; | ||
|
||
export default class ModalsSelectExtensionBundleComponent extends Component { | ||
@service store; | ||
@tracked extension; | ||
@tracked options = {}; | ||
@tracked bundles = []; | ||
|
||
constructor(owner, { options }) { | ||
super(...arguments); | ||
const { extension } = options; | ||
|
||
this.options = options; | ||
this.extension = extension; | ||
this.loadExtensionBundles.perform(extension); | ||
} | ||
|
||
@task *loadExtensionBundles(extension) { | ||
this.bundles = yield this.store.query('registry-extension-bundle', { extension_uuid: extension.id, status: 'pending' }); | ||
} | ||
|
||
@action selectBundle(bundle) { | ||
if (typeof this.options.onBundleSelected === 'function') { | ||
this.options.onBundleSelected(bundle); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import Controller from '@ember/controller'; | ||
import { tracked } from '@glimmer/tracking'; | ||
import { inject as service } from '@ember/service'; | ||
import { task } from 'ember-concurrency'; | ||
|
||
export default class DevelopersExtensionsEditBundlesController extends Controller { | ||
@service store; | ||
@service fetch; | ||
@service hostRouter; | ||
@service notifications; | ||
@tracked extension; | ||
@tracked lastError; | ||
acceptedBundleTypes = [ | ||
'application/zip', | ||
'application/x-zip', | ||
'application/x-zip-compressed', | ||
'application/x-compressed', | ||
'multipart/x-zip', | ||
'application/x-tar', | ||
'application/gzip', | ||
'application/x-gzip', | ||
'application/x-tgz', | ||
'application/x-bzip2', | ||
'application/x-xz', | ||
]; | ||
|
||
@task *uploadBundle(file) { | ||
this.lastError = undefined; | ||
|
||
yield this.fetch.uploadFile.perform( | ||
file, | ||
{ | ||
path: `uploads/extensions/${this.extension.id}/bundles`, | ||
subject_uuid: this.extension.id, | ||
subject_type: 'registry-bridge:registry-extension', | ||
type: 'extension_bundle', | ||
meta: { | ||
version: this.extension.version, | ||
}, | ||
}, | ||
(uploadedFile) => { | ||
return this.createBundle.perform(uploadedFile); | ||
}, | ||
() => { | ||
// remove file from queue | ||
if (file.queue && typeof file.queue.remove === 'function') { | ||
file.queue.remove(file); | ||
} | ||
} | ||
); | ||
} | ||
|
||
@task *createBundle(uploadedFile) { | ||
const bundle = this.store.createRecord('registry-extension-bundle', { | ||
extension_uuid: this.extension.id, | ||
bundle_uuid: uploadedFile.id, | ||
bundle: uploadedFile, | ||
status: 'pending', | ||
}); | ||
|
||
try { | ||
yield bundle.save(); | ||
} catch (error) { | ||
this.lastError = error.message; | ||
return this.notifications.serverError(error); | ||
} | ||
|
||
yield this.hostRouter.refresh(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import Controller from '@ember/controller'; | ||
|
||
export default class DevelopersExtensionsEditIndexController extends Controller {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import Controller from '@ember/controller'; | ||
import { tracked } from '@glimmer/tracking'; | ||
|
||
export default class DevelopersExtensionsEditMonetizeController extends Controller { | ||
@tracked subscriptionModelOptions = ['flat_rate', 'tiered', 'usage']; | ||
@tracked billingPeriodOptions = ['daily', 'weekly', 'monthly', 'quarterly', 'yearly']; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import Model, { attr, belongsTo } from '@ember-data/model'; | ||
import { computed } from '@ember/object'; | ||
import { format as formatDate, formatDistanceToNow, isValid as isValidDate } from 'date-fns'; | ||
|
||
export default class RegistryExtensionBundleModel extends Model { | ||
/** @ids */ | ||
@attr('string') uuid; | ||
@attr('string') company_uuid; | ||
@attr('string') created_by_uuid; | ||
@attr('string') extension_uuid; | ||
@attr('string') bundle_uuid; | ||
@attr('string') bundle_id; | ||
@attr('string') public_id; | ||
|
||
/** @relationships */ | ||
@belongsTo('file') bundle; | ||
|
||
/** @attributes */ | ||
@attr('string') bundle_filename; | ||
@attr('string') bundle_number; | ||
@attr('string') version; | ||
@attr('string') status; | ||
@attr('object') meta; | ||
|
||
/** @dates */ | ||
@attr('date') created_at; | ||
@attr('date') updated_at; | ||
@attr('date') deleted_at; | ||
|
||
/** @computed */ | ||
@computed('updated_at') get updatedAgo() { | ||
if (!isValidDate(this.updated_at)) { | ||
return null; | ||
} | ||
|
||
return formatDistanceToNow(this.updated_at); | ||
} | ||
|
||
@computed('updated_at') get updatedAt() { | ||
if (!isValidDate(this.updated_at)) { | ||
return null; | ||
} | ||
|
||
return formatDate(this.updated_at, 'PP HH:mm'); | ||
} | ||
|
||
@computed('created_at') get createdAgo() { | ||
if (!isValidDate(this.created_at)) { | ||
return null; | ||
} | ||
|
||
return formatDistanceToNow(this.created_at); | ||
} | ||
|
||
@computed('created_at') get createdAt() { | ||
if (!isValidDate(this.created_at)) { | ||
return null; | ||
} | ||
|
||
return formatDate(this.created_at, 'PP HH:mm'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.