Multiple bugs and styling (#1975)

* remove updates from marketplace, fix search, link updates to marketplace, styling

* add dependency checks and error handling to updates tab

* add circle around back buttons
This commit is contained in:
Matt Hill
2022-11-26 13:18:10 -07:00
committed by Aiden McClelland
parent 9146c31abf
commit 2336e36314
15 changed files with 388 additions and 336 deletions

View File

@@ -2,12 +2,8 @@
*ngFor="let cat of categories"
fill="clear"
class="category"
[color]="cat === 'updates' && updatesAvailable ? 'success' : undefined"
[class.category_selected]="cat === category"
[class.category_selected]="cat === category && !disableCategories"
(click)="switchCategory(cat)"
>
{{ cat }}
<span *ngIf="cat === 'updates' && updatesAvailable">
&nbsp; ({{ updatesAvailable }})
</span>
</ion-button>

View File

@@ -23,7 +23,7 @@ export class CategoriesComponent {
category = ''
@Input()
updatesAvailable = 0
disableCategories = false
@Output()
readonly categoryChange = new EventEmitter<string>()

View File

@@ -1,110 +1,108 @@
<ion-item-divider>Additional Info</ion-item-divider>
<ion-card *ngIf="pkg.manifest as manifest">
<ion-grid>
<ion-row>
<ion-col sizeXs="12" sizeMd="6">
<ion-item-group>
<ion-item
*ngIf="manifest['git-hash'] as gitHash; else noHash"
button
detail="false"
(click)="copy(gitHash)"
>
<ion-grid *ngIf="pkg.manifest as manifest">
<ion-row>
<ion-col sizeXs="12" sizeMd="6">
<ion-item-group>
<ion-item
*ngIf="manifest['git-hash'] as gitHash; else noHash"
button
detail="false"
(click)="copy(gitHash)"
>
<ion-label>
<h2>Git Hash</h2>
<p>{{ gitHash }}</p>
</ion-label>
<ion-icon slot="end" name="copy-outline"></ion-icon>
</ion-item>
<ng-template #noHash>
<ion-item>
<ion-label>
<h2>Git Hash</h2>
<p>{{ gitHash }}</p>
<p>Unknown</p>
</ion-label>
<ion-icon slot="end" name="copy-outline"></ion-icon>
</ion-item>
<ng-template #noHash>
<ion-item>
<ion-label>
<h2>Git Hash</h2>
<p>Unknown</p>
</ion-label>
</ion-item>
</ng-template>
<ion-item button detail="false" (click)="presentAlertVersions()">
<ion-label>
<h2>Other Versions</h2>
<p>Click to view other versions</p>
</ion-label>
<ion-icon slot="end" name="chevron-forward"></ion-icon>
</ion-item>
<ion-item button detail="false" (click)="presentModalMd('license')">
<ion-label>
<h2>License</h2>
<p>{{ manifest.license }}</p>
</ion-label>
<ion-icon slot="end" name="chevron-forward"></ion-icon>
</ion-item>
<ion-item
button
detail="false"
(click)="presentModalMd('instructions')"
>
<ion-label>
<h2>Instructions</h2>
<p>Click to view instructions</p>
</ion-label>
<ion-icon slot="end" name="chevron-forward"></ion-icon>
</ion-item>
</ion-item-group>
</ion-col>
<ion-col sizeXs="12" sizeMd="6">
<ion-item-group>
<ion-item
[href]="manifest['upstream-repo']"
target="_blank"
rel="noreferrer"
detail="false"
>
<ion-label>
<h2>Source Repository</h2>
<p>{{ manifest['upstream-repo'] }}</p>
</ion-label>
<ion-icon slot="end" name="open-outline"></ion-icon>
</ion-item>
<ion-item
[href]="manifest['wrapper-repo']"
target="_blank"
rel="noreferrer"
detail="false"
>
<ion-label>
<h2>Wrapper Repository</h2>
<p>{{ manifest['wrapper-repo'] }}</p>
</ion-label>
<ion-icon slot="end" name="open-outline"></ion-icon>
</ion-item>
<ion-item
[href]="manifest['support-site']"
[disabled]="!manifest['support-site']"
target="_blank"
rel="noreferrer"
detail="false"
>
<ion-label>
<h2>Support Site</h2>
<p>{{ manifest['support-site'] || 'Not provided' }}</p>
</ion-label>
<ion-icon slot="end" name="open-outline"></ion-icon>
</ion-item>
<ion-item
[href]="manifest['marketing-site']"
[disabled]="!manifest['marketing-site']"
target="_blank"
rel="noreferrer"
detail="false"
>
<ion-label>
<h2>Marketing Site</h2>
<p>{{ manifest['marketing-site'] || 'Not provided' }}</p>
</ion-label>
<ion-icon slot="end" name="open-outline"></ion-icon>
</ion-item>
</ion-item-group>
</ion-col>
</ion-row>
</ion-grid>
</ion-card>
</ng-template>
<ion-item button detail="false" (click)="presentAlertVersions()">
<ion-label>
<h2>Other Versions</h2>
<p>Click to view other versions</p>
</ion-label>
<ion-icon slot="end" name="chevron-forward"></ion-icon>
</ion-item>
<ion-item button detail="false" (click)="presentModalMd('license')">
<ion-label>
<h2>License</h2>
<p>{{ manifest.license }}</p>
</ion-label>
<ion-icon slot="end" name="chevron-forward"></ion-icon>
</ion-item>
<ion-item
button
detail="false"
(click)="presentModalMd('instructions')"
>
<ion-label>
<h2>Instructions</h2>
<p>Click to view instructions</p>
</ion-label>
<ion-icon slot="end" name="chevron-forward"></ion-icon>
</ion-item>
</ion-item-group>
</ion-col>
<ion-col sizeXs="12" sizeMd="6">
<ion-item-group>
<ion-item
[href]="manifest['upstream-repo']"
target="_blank"
rel="noreferrer"
detail="false"
>
<ion-label>
<h2>Source Repository</h2>
<p>{{ manifest['upstream-repo'] }}</p>
</ion-label>
<ion-icon slot="end" name="open-outline"></ion-icon>
</ion-item>
<ion-item
[href]="manifest['wrapper-repo']"
target="_blank"
rel="noreferrer"
detail="false"
>
<ion-label>
<h2>Wrapper Repository</h2>
<p>{{ manifest['wrapper-repo'] }}</p>
</ion-label>
<ion-icon slot="end" name="open-outline"></ion-icon>
</ion-item>
<ion-item
[href]="manifest['support-site']"
[disabled]="!manifest['support-site']"
target="_blank"
rel="noreferrer"
detail="false"
>
<ion-label>
<h2>Support Site</h2>
<p>{{ manifest['support-site'] || 'Not provided' }}</p>
</ion-label>
<ion-icon slot="end" name="open-outline"></ion-icon>
</ion-item>
<ion-item
[href]="manifest['marketing-site']"
[disabled]="!manifest['marketing-site']"
target="_blank"
rel="noreferrer"
detail="false"
>
<ion-label>
<h2>Marketing Site</h2>
<p>{{ manifest['marketing-site'] || 'Not provided' }}</p>
</ion-label>
<ion-icon slot="end" name="open-outline"></ion-icon>
</ion-item>
</ion-item-group>
</ion-col>
</ion-row>
</ion-grid>

View File

@@ -1,6 +1,6 @@
import { NgModule, Pipe, PipeTransform } from '@angular/core'
import { Emver } from '@start9labs/shared'
import { MarketplaceManifest, MarketplacePkg } from '../types'
import { MarketplacePkg } from '../types'
import Fuse from 'fuse.js'
@Pipe({
@@ -13,75 +13,40 @@ export class FilterPackagesPipe implements PipeTransform {
packages: MarketplacePkg[],
query: string,
category: string,
local: Record<string, { manifest: MarketplaceManifest }> = {},
): MarketplacePkg[] {
// query
if (query) {
let options: Fuse.IFuseOptions<MarketplacePkg> = {
includeScore: true,
includeMatches: true,
ignoreLocation: true,
useExtendedSearch: true,
keys: [
{
name: 'manifest.title',
weight: 1,
},
{
name: 'manifest.id',
weight: 0.5,
},
{
name: 'manifest.description.short',
weight: 0.4,
},
{
name: 'manifest.description.long',
weight: 0.1,
},
],
}
if (query.length < 4) {
options = {
...options,
threshold: 0,
location: 0,
distance: 1,
keys: [
{
name: 'manifest.title',
weight: 1,
},
{
name: 'manifest.id',
weight: 0.5,
},
],
}
} else {
options = {
...options,
ignoreLocation: true,
useExtendedSearch: true,
keys: [
{
name: 'manifest.title',
weight: 1,
},
{
name: 'manifest.id',
weight: 0.5,
},
{
name: 'manifest.description.short',
weight: 0.4,
},
{
name: 'manifest.description.long',
weight: 0.1,
},
],
}
query = `'${query}`
}
query = `'${query}`
const fuse = new Fuse(packages, options)
return fuse.search(query).map(p => p.item)
}
// updates
if (category === 'updates') {
return packages.filter(
({ manifest }) =>
local[manifest.id] &&
this.emver.compare(
manifest.version,
local[manifest.id].manifest.version,
) === 1,
)
}
// category
return packages
.filter(p => category === 'all' || p.categories.includes(category))