Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

routes migration js to ts #1309

Merged
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
6 changes: 6 additions & 0 deletions app/components/password-reset/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,9 @@ export default class PasswordResetComponent extends Component<PasswordResetSigna
}
});
}

declare module '@glint/environment-ember-loose/registry' {
export default interface Registry {
PasswordReset: typeof PasswordResetComponent;
}
}
2 changes: 1 addition & 1 deletion app/models/partner/partner.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Model, { attr } from '@ember-data/model';

interface PartnerAccessData {
export interface PartnerAccessData {
view_plans: boolean;
transfer_credits: boolean;
list_projects: boolean;
Expand Down
46 changes: 34 additions & 12 deletions app/router.js → app/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,32 @@ import EmberRouter from '@ember/routing/router';
import ENV from 'irene/config/environment';
import config from './config/environment';

type RouterLocationType = 'history' | 'hash' | 'none' | 'auto';

export default class Router extends EmberRouter {
location = config.locationType;
location = config.locationType as RouterLocationType;
rootURL = config.rootURL;
}

Router.map(function () {
this.route('login');

this.route('saml2', function () {
this.route('redirect');
});

this.route('register');

this.route('register-via-invite', {
path: 'register-via-invite/:token',
});

this.route('recover');

this.route('reset', {
path: '/reset/:token',
});

this.route(
'authenticated',
{
Expand All @@ -43,6 +51,7 @@ Router.map(function () {
this.route('security');
this.route('developersettings');
});

this.route('billing');
this.route('marketplace');
this.route('projects');
Expand All @@ -60,6 +69,7 @@ Router.map(function () {
path: '/dast-automation-scenario/:scenario_id',
});
});

this.route('files');
}
);
Expand All @@ -72,37 +82,46 @@ Router.map(function () {

this.route('payment-success');
this.route('payment-failure');

this.route('security', function () {
this.route('projects');
this.route('downloadapp');
this.route('purgeanalysis');

this.route('files', {
path: '/:projectid/files',
});

this.route('file', {
path: '/file/:fileid',
});

this.route('analysis', {
path: '/analysis/:analysisid',
});
});

this.route('analytics');

this.route('github-cloud', function () {
this.route('redirect');
});

this.route('partner', function () {
this.route('clients', function () {
this.route('overview');
this.route('invitations');
this.route('registration-requests');
});

this.route('client', {
path: '/clients/:id',
});

this.route('project', {
path: '/clients/:client_id/projects/:project_id',
});

this.route('analytics');
});

Expand Down Expand Up @@ -159,9 +178,11 @@ Router.map(function () {
});
}
);

this.route('invitation', {
path: '/invitation/:uuid',
});

this.route('invite', {
path: '/invite/:token',
});
Expand All @@ -170,19 +191,20 @@ Router.map(function () {
this.route('not-found', {
path: '/*path',
});

this.route('status');
});

export const CSBMap = {
'authenticated.projects': ENV.csb.navigateToProjects,
'authenticated.analytics': ENV.csb.navigateToAnalytics,
'authenticated.dashboard.file': ENV.csb.clickProjectCard,
'authenticated.settings': ENV.csb.navigateToSettings,
'authenticated.project.files': ENV.csb.navigateToAllScans,
'authenticated.choose': ENV.csb.naigateToCompareScans,
'authenticated.organization.namespaces': ENV.csb.navigateToOrganization,
'authenticated.organization-settings': ENV.csb.navigateToOrgSettings,
'authenticated.settings.index': ENV.csb.navigateToAccountSettings,
'authenticated.marketplace': ENV.csb.navigateToMarketPlace,
'authenticated.billing': ENV.csb.navigateToBilling,
'authenticated.projects': ENV.csb['navigateToProjects'],
'authenticated.analytics': ENV.csb['navigateToAnalytics'],
'authenticated.dashboard.file': ENV.csb['clickProjectCard'],
'authenticated.settings': ENV.csb['navigateToSettings'],
'authenticated.project.files': ENV.csb['navigateToAllScans'],
'authenticated.choose': ENV.csb['naigateToCompareScans'],
'authenticated.organization.namespaces': ENV.csb['navigateToOrganization'],
'authenticated.organization-settings': ENV.csb['navigateToOrgSettings'],
'authenticated.settings.index': ENV.csb['navigateToAccountSettings'],
'authenticated.marketplace': ENV.csb['navigateToMarketPlace'],
'authenticated.billing': ENV.csb['navigateToBilling'],
};
18 changes: 11 additions & 7 deletions app/routes/application.js → app/routes/application.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
import IntlService from 'ember-intl/services/intl';
import { all } from 'rsvp';

import ConfigurationService from 'irene/services/configuration';
import WhitelabelService from 'irene/services/whitelabel';

export default class ApplicationRoute extends Route {
@service headData;
@service intl;
@service whitelabel;
@service configuration;
@service session;
@service declare headData: any;
@service declare intl: IntlService;
@service declare whitelabel: WhitelabelService;
@service declare configuration: ConfigurationService;
@service declare session: any;

async beforeModel() {
async beforeModel(): Promise<void> {
await this.session.setup();

await all([
Expand All @@ -20,7 +24,7 @@ export default class ApplicationRoute extends Route {
return this.intl.setLocale(['en']);
}

afterModel() {
afterModel(): void {
this.headData.title = this.whitelabel.name;
this.headData.favicon = this.whitelabel.favicon;
}
Expand Down
118 changes: 0 additions & 118 deletions app/routes/authenticated.js

This file was deleted.

Loading
Loading