Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Commit

Permalink
ui/project: force refresh after settings change
Browse files Browse the repository at this point in the history
This is rather inelegant but the [RouterService.refresh] method is
not yet available to us.

[RouterService.refresh]: emberjs/rfcs#631
  • Loading branch information
jgwhite committed Aug 30, 2021
1 parent 4445558 commit 75315e7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ui/app/components/app-form/project-repository-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import RouterService from '@ember/routing/router-service';
import { isEmpty } from '@ember/utils';
import ApiService from 'waypoint/services/api';
import FlashMessagesService from 'waypoint/services/flash-messages';
import PollModelService from 'waypoint/services/poll-model';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
import { Project } from 'waypoint-pb';
Expand Down Expand Up @@ -53,6 +54,7 @@ export default class AppFormProjectRepositorySettings extends Component<ProjectS
@service api!: ApiService;
@service flashMessages!: FlashMessagesService;
@service router!: RouterService;
@service pollModel!: PollModelService;
@tracked project: Project.AsObject;
@tracked authCase: number;
@tracked serverHcl: boolean;
Expand Down Expand Up @@ -200,6 +202,7 @@ export default class AppFormProjectRepositorySettings extends Component<ProjectS
try {
await this.api.upsertProject(this.project, this.authCase);
this.flashMessages.success('Settings saved');
this.pollModel.expedite();
this.router.transitionTo('workspace.projects.project', this.project.name);
} catch (err) {
this.flashMessages.error('Failed to save Settings', { content: err.message, sticky: true });
Expand Down
4 changes: 4 additions & 0 deletions ui/app/services/poll-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ export default class PollModelService extends Service {
taskFor(this.poll).cancelAll();
}

expedite(): void {
this.route?.refresh();
}

@task({
restartable: true,
maxConcurrency: 1,
Expand Down

0 comments on commit 75315e7

Please sign in to comment.