Skip to content

Commit

Permalink
Removes the Gallery from navigation
Browse files Browse the repository at this point in the history
Also removes Gallery-related user settings
  • Loading branch information
gingi committed Dec 5, 2024
1 parent 009f7ec commit 9cca636
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 125 deletions.
36 changes: 6 additions & 30 deletions desktop/src/app/components/gallery/home/gallery.component.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnDestroy, OnInit } from "@angular/core";
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnDestroy } from "@angular/core";
import { FormControl } from "@angular/forms";
import { ActivatedRoute, Router } from "@angular/router";
import { UserConfigurationService, autobind } from "@batch-flask/core";
import { autobind } from "@batch-flask/core";
import { ElectronShell } from "@batch-flask/electron";
import { DialogService } from "@batch-flask/ui";
import { AutoStorageService } from "app/services/storage";
import { BEUserDesktopConfiguration, Constants } from "common";
import { Constants } from "common";
import { Subject } from "rxjs";
import { map, publishReplay, refCount, takeUntil } from "rxjs/operators";
import { takeUntil } from "rxjs/operators";
import { formatDateTime } from "@azure/bonito-core/lib/datetime";

import "./gallery.scss";
Expand All @@ -33,31 +31,9 @@ export class GalleryComponent implements OnDestroy {

constructor(
private changeDetector: ChangeDetectorRef,
private router: Router,
private activeRoute: ActivatedRoute,
private electronShell: ElectronShell,
private dialogService: DialogService,
public autoStorageService: AutoStorageService,
private settingsService: UserConfigurationService<BEUserDesktopConfiguration>) {

this.settingsService.watch("microsoftPortfolio").pipe(
takeUntil(this._destroy),
map((settings) => {
const branch = settings.branch;
const repo = settings.repo;
const path = settings.path;
return {
branch: branch || "master",
repo: repo || "Azure/batch-extension-templates",
path: path || "templates",
};
}),
map(({repo, branch, path}) => {
return this._getRepoUrl(repo, branch, path);
}),
publishReplay(1),
refCount(),
).subscribe(url => this._baseUrl = url);
public autoStorageService: AutoStorageService
) {

this.quicksearch.valueChanges.pipe(takeUntil(this._destroy)).subscribe((query) => {
this.query = query;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@
<i class="fa fa-cloud-upload fa-lg" aria-hidden="true"></i><div class="label">{{'main-navigation.data' | i18n}}</div>
</bl-clickable>
</ng-container>
<ng-container *blHiddenIfNoAccount>
<bl-clickable *blFeatureOn="'gallery'" href="#" routerLink="market" routerLinkActive="active" title="Gallery">
<i class="fa fa-cubes" aria-hidden="true"></i><div class="label">{{'main-navigation.gallery' | i18n}}</div>
</bl-clickable>
</ng-container>
</ng-container>
<ng-container *ngIf="!loggedIn">
<bl-clickable routerLink="welcome" routerLinkActive="active" title="Home">
Expand Down
30 changes: 5 additions & 25 deletions desktop/src/app/components/settings/settings.component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnDestroy } from "@angular/core";
import { FormBuilder, FormGroup } from "@angular/forms";
import { EntityConfigurationView, UserConfigurationService, autobind } from "@batch-flask/core";
import { BEUserDesktopConfiguration, DEFAULT_BE_USER_CONFIGURATION } from "common";
import { BEUserConfiguration, DEFAULT_BE_USER_CONFIGURATION } from "common";
import { Subject } from "rxjs";
import { debounceTime, takeUntil } from "rxjs/operators";

Expand All @@ -17,10 +17,6 @@ export interface SettingsSelection {
updateOnQuit: boolean;
githubDataRepo: string;
githubDataBranch: string;
microsoftPortfolioRepo: string;
microsoftPortfolioBranch: string;
microsoftPortfolioPath: string;
defaultOutputFileGroup: string;
theme: string;
externalBrowserAuth: boolean;
}
Expand All @@ -43,7 +39,7 @@ export class SettingsComponent implements OnDestroy {
private _lastValue: string | null = null;

constructor(
private userConfigurationService: UserConfigurationService<BEUserDesktopConfiguration>,
private userConfigurationService: UserConfigurationService<BEUserConfiguration>,
private changeDetector: ChangeDetectorRef,
formBuilder: FormBuilder) {
this.form = formBuilder.group({
Expand All @@ -58,13 +54,10 @@ export class SettingsComponent implements OnDestroy {
updateOnQuit: [true],
githubDataRepo: [""],
githubDataBranch: [""],
microsoftPortfolioRepo: [""],
microsoftPortfolioBranch: [""],
microsoftPortfolioPath: [""],
defaultOutputFileGroup: [""],
});

this.userConfigurationService.config.pipe(takeUntil(this._destroy)).subscribe((config: BEUserDesktopConfiguration) => {
this.userConfigurationService.config.pipe(takeUntil(this._destroy))
.subscribe((config: BEUserConfiguration) => {
this.modified = JSON.stringify(config) !== JSON.stringify(DEFAULT_BE_USER_CONFIGURATION);
this.changeDetector.markForCheck();

Expand All @@ -80,10 +73,6 @@ export class SettingsComponent implements OnDestroy {
updateOnQuit: config.update.updateOnQuit,
githubDataRepo: config.githubData.repo,
githubDataBranch: config.githubData.branch,
microsoftPortfolioRepo: config.microsoftPortfolio.repo,
microsoftPortfolioBranch: config.microsoftPortfolio.branch,
microsoftPortfolioPath: config.microsoftPortfolio.path,
defaultOutputFileGroup: config.jobTemplate.defaultOutputFileGroup,
};
this._lastValue = JSON.stringify(selection);
this.form.patchValue(selection, { emitEvent: false });
Expand Down Expand Up @@ -120,7 +109,7 @@ export class SettingsComponent implements OnDestroy {
this.userConfigurationService.reset();
}

private _buildConfig(selection: SettingsSelection): Partial<BEUserDesktopConfiguration> {
private _buildConfig(selection: SettingsSelection): Partial<BEUserConfiguration> {
return {
theme: selection.theme,
externalBrowserAuth: selection.externalBrowserAuth,
Expand All @@ -145,15 +134,6 @@ export class SettingsComponent implements OnDestroy {
repo: selection.githubDataRepo,
branch: selection.githubDataBranch,
},
microsoftPortfolio: {
repo: selection.microsoftPortfolioRepo,
branch: selection.microsoftPortfolioBranch,
path: selection.microsoftPortfolioPath,
},
jobTemplate: {
defaultOutputFileGroup: selection.defaultOutputFileGroup,
},

};
}
}
25 changes: 0 additions & 25 deletions desktop/src/app/components/settings/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,31 +72,6 @@ <h2>{{'settings.general' | i18n}}</h2>
</bl-select>
</bl-form-field>



<h2>
{{'settings.gallerySettings' | i18n}}
</h2>

<fieldset>
<legend>Microsoft portfolio</legend>
<div class="grow">
<bl-form-field class="gcol">
<input blInput placeholder="Repository" formControlName="microsoftPortfolioRepo">
</bl-form-field>
<bl-form-field class="gcol">
<input blInput placeholder="Branch" formControlName="microsoftPortfolioBranch">
</bl-form-field>
<bl-form-field class="gcol">
<input blInput placeholder="Path" formControlName="microsoftPortfolioPath">
</bl-form-field>
</div>
</fieldset>

<bl-form-field>
<input blInput placeholder="Default output filegroup" formControlName="defaultOutputFileGroup">
</bl-form-field>

<h2>
{{'settings.advancedSettings' | i18n}}
</h2>
Expand Down
4 changes: 2 additions & 2 deletions desktop/src/app/services/version/version.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Injectable, OnDestroy } from "@angular/core";
import { UserConfigurationService } from "@batch-flask/core";
import { AutoUpdateService, ElectronRemote } from "@batch-flask/electron";
import { BEUserDesktopConfiguration, Constants } from "common";
import { BEUserConfiguration, Constants } from "common";
import { BehaviorSubject, Observable, Subscription } from "rxjs";

export enum VersionType {
Expand Down Expand Up @@ -30,7 +30,7 @@ export class VersionService implements OnDestroy {
constructor(
private autoUpdateService: AutoUpdateService,
remote: ElectronRemote,
settingsService: UserConfigurationService<BEUserDesktopConfiguration>) {
settingsService: UserConfigurationService<BEUserConfiguration>) {
const app = remote.getCurrentWindow().batchExplorerApp;
this.version = app.version;
this.versionType = this._resolveVersionChannel();
Expand Down
39 changes: 1 addition & 38 deletions desktop/src/common/be-user-configuration.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,36 +39,7 @@ export interface BEUserConfiguration extends BatchFlaskUserConfiguration {
}
}

/**
* Configuration specific to the desktop version
* Note this is the only version yet. Planning for the future.
*/
export interface BEUserDesktopConfiguration extends BEUserConfiguration {
/**
* Local templates names and path to show in the template library
*/
localTemplates: {
sources: Array<{ name: string, path: string }>,
};

jobTemplate: {
defaultOutputFileGroup: string | null,
};

/**
* Change the Microsoft portfolio source
*/
microsoftPortfolio: {
repo: string,
branch: string,
path: string,
};
}

export const DEFAULT_BE_USER_CONFIGURATION: BEUserDesktopConfiguration = {
localTemplates: {
sources: [],
},
export const DEFAULT_BE_USER_CONFIGURATION: BEUserConfiguration = {
entityConfiguration: {
defaultView: EntityConfigurationView.Pretty,
},
Expand All @@ -90,14 +61,6 @@ export const DEFAULT_BE_USER_CONFIGURATION: BEUserDesktopConfiguration = {
repo: "Azure/BatchExplorer-data",
branch: "master",
},
microsoftPortfolio: {
repo: "Azure/batch-extension-templates",
branch: "master",
path: "templates",
},
jobTemplate: {
defaultOutputFileGroup: null,
},
theme: "classic",
externalBrowserAuth: true
};

0 comments on commit 9cca636

Please sign in to comment.