diff --git a/app/adapters/repo.js b/app/adapters/repo.js index 3485918a88..61059c0902 100644 --- a/app/adapters/repo.js +++ b/app/adapters/repo.js @@ -19,16 +19,21 @@ export default V3Adapter.extend({ const prefix = this.urlPrefix(); if (query) { - const { provider, slug, custom } = query; + const { provider, slug, serverType, custom } = query; const providerPrefix = provider ? `${provider}/` : ''; delete query.provider; delete query.slug; delete query.custom; + delete query.serverType; // fetch repo by slug if (!id && slug) { - return `${prefix}/repo/${providerPrefix}${encodeURIComponent(slug)}`; + let url = `${prefix}/repo/${providerPrefix}${encodeURIComponent(slug)}`; + if (serverType) { + url = `${url}?server_type=${serverType}`; + } + return url; } if (custom && custom.type === 'byOwner') { diff --git a/app/components/dashboard-row.js b/app/components/dashboard-row.js index 94636c81aa..afec5b4805 100644 --- a/app/components/dashboard-row.js +++ b/app/components/dashboard-row.js @@ -1,4 +1,5 @@ import Component from '@ember/component'; +import { computed } from '@ember/object'; import { inject as service } from '@ember/service'; import { alias, reads } from '@ember/object/computed'; import { task, timeout } from 'ember-concurrency'; @@ -24,6 +25,21 @@ export default Component.extend({ displayMenuTofu: alias('repo.permissions.create_request'), + repositoryProvider: computed('repo.provider', function () { + return this.repo.provider.capitalize(); + }), + + repositoryType: computed('repo.serverType', function () { + switch (this.repo.serverType) { + case 'git': + return 'GIT'; + case 'subversion': + return 'SVN'; + case 'perforce': + return 'P4'; + } + }), + openDropup() { this.set('dropupIsOpen', true); }, diff --git a/app/components/github-apps-repository.js b/app/components/github-apps-repository.js index 5025b17d36..22e0aa95d6 100644 --- a/app/components/github-apps-repository.js +++ b/app/components/github-apps-repository.js @@ -22,6 +22,21 @@ export default Component.extend({ isMatchGithub: match('vcsType', /Github\S+$/), isNotMatchGithub: not('isMatchGithub'), + repositoryProvider: computed('repository.provider', function () { + return this.repository.provider.capitalize(); + }), + + repositoryType: computed('repository.serverType', function () { + switch (this.repository.serverType) { + case 'git': + return 'GIT'; + case 'subversion': + return 'SVN'; + case 'perforce': + return 'P4'; + } + }), + accessSettingsUrl: computed('user.vcsType', 'user.vcsId', function () { return this.user && vcsLinks.accessSettingsUrl(this.user.vcsType, { owner: this.user.login }); }), diff --git a/app/components/repository-layout.js b/app/components/repository-layout.js index c6e9a7dfca..c4b4b0342c 100644 --- a/app/components/repository-layout.js +++ b/app/components/repository-layout.js @@ -14,6 +14,21 @@ export default Component.extend({ currentUser: alias('auth.currentUser'), userRoMode: reads('currentUser.roMode'), + repositoryProvider: computed('repo.provider', function () { + return this.repo.provider.capitalize(); + }), + + repositoryType: computed('repo.serverType', function () { + switch (this.repo.serverType) { + case 'git': + return 'GIT'; + case 'subversion': + return 'SVN'; + case 'perforce': + return 'P4'; + } + }), + repoUrl: computed('repo.{ownerName,vcsName,vcsType}', function () { const owner = this.get('repo.ownerName'); const repo = this.get('repo.vcsName'); diff --git a/app/controllers/repo.js b/app/controllers/repo.js index 16f85a16fd..ebc33cb8b4 100644 --- a/app/controllers/repo.js +++ b/app/controllers/repo.js @@ -16,7 +16,8 @@ export default Controller.extend({ features: service(), updateTimesService: service('updateTimes'), - queryParams: ['migrationStatus'], + queryParams: ['migrationStatus', 'serverType'], + serverType: null, migrationStatus: null, jobController: controller('job'), diff --git a/app/models/repo.js b/app/models/repo.js index c9e076dfc7..41bb6d98f2 100644 --- a/app/models/repo.js +++ b/app/models/repo.js @@ -50,6 +50,7 @@ const Repo = VcsEntity.extend({ migrationStatus: attr('string'), historyMigrationStatus: attr('string'), scanFailedAt: attr('date'), + serverType: attr('string', { defaultValue: 'git' }), currentScan: computed('scanFailedAt', function () { let scanFailedAt = this.get('scanFailedAt'); @@ -425,12 +426,15 @@ Repo.reopenClass({ }); }, - fetchBySlug(store, slug, provider = defaultVcsConfig.urlPrefix) { - const loadedRepos = store.peekAll('repo').filterBy('provider', provider).filterBy('slug', slug); + fetchBySlug(store, slug, provider = defaultVcsConfig.urlPrefix, serverType = undefined) { + let loadedRepos = store.peekAll('repo').filterBy('provider', provider).filterBy('slug', slug); + if (serverType) { + loadedRepos = loadedRepos.filterBy('serverType', serverType); + } if (!isEmpty(loadedRepos)) { return EmberPromise.resolve(loadedRepos.firstObject); } - return store.queryRecord('repo', { slug, provider }); + return store.queryRecord('repo', { slug, provider, serverType }); }, }); diff --git a/app/models/user.js b/app/models/user.js index 115e96b047..91c7f31402 100644 --- a/app/models/user.js +++ b/app/models/user.js @@ -78,8 +78,7 @@ export default Owner.extend({ this.set('applyFilterRepos', !isOrganization); return this.api .post(`/user/${this.id}/sync`) - .then(() => this.poll(), - () => this.set('isSyncing', false)); + .then(() => this.poll()); }, schedulePoll() { @@ -91,7 +90,7 @@ export default Owner.extend({ poll() { return this.reload().then(() => { - if (!this.isSyncing) { + if (this.isSyncing) { this.schedulePoll(); } else { this.permissionsService.fetchPermissions.perform(); diff --git a/app/router.js b/app/router.js index eed7e29f99..23a17a84f1 100644 --- a/app/router.js +++ b/app/router.js @@ -93,6 +93,8 @@ Router.map(function () { this.route('legacy-repo-url', { path: '/:owner/:repo/:method' }); this.route('legacy-repo-url', { path: '/:owner/:repo/:method/:id' }); this.route('legacy-repo-url', { path: '/:owner/:repo/:method/:id/:view' }); + this.route('legacy-repo-url', { path: '/:provider/:owner/:repo/:serverType/:method/:id' }); + this.route('legacy-repo-url', { path: '/:provider/:owner/:repo/:serverType/:method/:id/:view' }); this.route('error404', { path: '/404' }); this.route('page-not-found', { path: '/*wildcard' }); diff --git a/app/routes/legacy-repo-url.js b/app/routes/legacy-repo-url.js index 05f2897741..98e7ff6fa7 100644 --- a/app/routes/legacy-repo-url.js +++ b/app/routes/legacy-repo-url.js @@ -7,19 +7,32 @@ export default Route.extend({ beforeModel(transition) { const { params, queryParams } = transition.to; - let { owner, repo, method, id, view } = params; - let provider, routeName = 'provider', routeModels = []; + let { owner, repo, method, id, view, provider, serverType } = params; + let vcsConfig, routeName = 'provider', routeModels = []; - const vcsConfig = vcsConfigByUrlPrefix(owner); + if (provider) { + vcsConfig = vcsConfigByUrlPrefix(provider); + } else { + vcsConfig = vcsConfigByUrlPrefix(owner); + } const isLegacyUrl = isEmpty(vcsConfig); + const serverTypes = ['git', 'svn', 'perforce']; + const isServerTypeUrl = serverTypes.includes(serverType) || serverTypes.includes(id); + if (isLegacyUrl) { provider = defaultVcsConfig.urlPrefix; } else { // params include provider, so swap them accordingly - [provider, owner, repo, method, id] = [owner, repo, method, id, view]; + if (!isServerTypeUrl) { + [provider, owner, repo, method, id] = [owner, repo, method, id, view]; + } else if (serverTypes.includes(id)) { + [provider, owner, repo, serverType, method, id, view] = [owner, repo, method, id, view]; + } } + const newQueryParams = { serverType: serverType, ...queryParams }; + routeModels.push(provider); if (owner) { @@ -43,7 +56,7 @@ export default Route.extend({ if (this._router.hasRoute(routeName)) { transition.abort(); - this.transitionTo(routeName, ...routeModels, { queryParams }); + this.transitionTo(routeName, ...routeModels, { queryParams: newQueryParams }); } } }); diff --git a/app/routes/repo.js b/app/routes/repo.js index bbcc7443be..66166441ff 100644 --- a/app/routes/repo.js +++ b/app/routes/repo.js @@ -52,10 +52,10 @@ export default TravisRoute.extend(ScrollResetMixin, { return { provider, owner, name }; }, - model({ provider, owner, name }) { + model({ provider, owner, name, serverType }) { const slug = `${owner}/${name}`; this.set('slug', slug); - return Repo.fetchBySlug(this.store, slug, provider); + return Repo.fetchBySlug(this.store, slug, provider, serverType); }, beforeModel() { diff --git a/app/routes/settings.js b/app/routes/settings.js index 94e125871b..bc781cfb1a 100644 --- a/app/routes/settings.js +++ b/app/routes/settings.js @@ -43,6 +43,8 @@ export default TravisRoute.extend({ fetchSshKey() { if (config.endpoints.sshKey) { const repo = this.modelFor('repo'); + if (repo.serverType === 'perforce') return; + const url = `/repos/${repo.get('id')}/key`; return this.api.get(url, { travisApiVersion: null }).then((data) => { const fingerprint = EmberObject.create({ diff --git a/app/styles/app/layout.scss b/app/styles/app/layout.scss index 2b5d8ac634..02eb488bbe 100644 --- a/app/styles/app/layout.scss +++ b/app/styles/app/layout.scss @@ -167,3 +167,6 @@ $padding-top: 24px; display: none !important; } } +.mr-1_2 { + margin-right: 1.2rem; +} diff --git a/app/styles/app/layouts/profile.scss b/app/styles/app/layouts/profile.scss index a97e4e4a62..48e3e6680a 100644 --- a/app/styles/app/layouts/profile.scss +++ b/app/styles/app/layouts/profile.scss @@ -220,13 +220,13 @@ $profile-breakpoint: 600px; .profile-repo { display: flex; position: relative; - flex: 1; + flex: 0; padding: 0.25em 0.5em 0.3em; border-radius: 2px; - margin-right: 1rem; .profile-repo-name { height: 21px; + white-space: nowrap; overflow: hidden; } @@ -239,6 +239,18 @@ $profile-breakpoint: 600px; } } +.profile-repo-type { + display: flex; + flex: 1; + + .profile-repo-type-span { + background-color: #d8d8d8; + padding: 2px 6px; + border-radius: 25%; + font-weight: 600; + } +} + .profile-text, .profile-additional, .profile-betafeatures { diff --git a/app/templates/account/settings.hbs b/app/templates/account/settings.hbs index 4ff73a8e91..b878b28980 100644 --- a/app/templates/account/settings.hbs +++ b/app/templates/account/settings.hbs @@ -105,7 +105,10 @@ {{#each this.unsubscribedRepos as |repo|}}
- + {{repo.formattedSlug}}
diff --git a/app/templates/components/dashboard-row.hbs b/app/templates/components/dashboard-row.hbs index 2dd57ff861..5a6337fe43 100644 --- a/app/templates/components/dashboard-row.hbs +++ b/app/templates/components/dashboard-row.hbs @@ -33,6 +33,7 @@ @route="repo" @models={{array this.repo.provider this.repo.urlOwnerName this.repo.urlName}} @title={{this.repo.name}} + @query={{hash serverType=this.repo.serverType}} > {{this.repo.name}} {{#if this.repo.shared}} @@ -70,6 +71,16 @@ {{/if}}

+ {{#if (eq this.repo.provider 'assembla')}} +
+

+ Repo type +

+

+ {{this.repositoryType}} +

+
+ {{/if}} {{#if this.repo.currentBuild}}

diff --git a/app/templates/components/email-unsubscribe.hbs b/app/templates/components/email-unsubscribe.hbs index b12388b23e..4f8fc7c828 100644 --- a/app/templates/components/email-unsubscribe.hbs +++ b/app/templates/components/email-unsubscribe.hbs @@ -29,6 +29,7 @@ @@ -72,6 +73,7 @@ {{this.name}} @@ -13,6 +13,14 @@ {{/if}} +{{#if (eq this.repository.provider 'assembla')}} + + + {{this.repositoryType}} + + + +{{/if}} {{#if this.hasSettingsPermission}} {{#if this.isNotMatchGithub}}

-{{/if}} \ No newline at end of file +{{/if}} diff --git a/app/templates/components/my-build.hbs b/app/templates/components/my-build.hbs index b5fef0fdf9..a9771ca83f 100644 --- a/app/templates/components/my-build.hbs +++ b/app/templates/components/my-build.hbs @@ -24,6 +24,7 @@ {{this.build.repo.name}} diff --git a/app/templates/components/owner-repo-tile.hbs b/app/templates/components/owner-repo-tile.hbs index 429dc4110b..fff5ef2bba 100644 --- a/app/templates/components/owner-repo-tile.hbs +++ b/app/templates/components/owner-repo-tile.hbs @@ -17,6 +17,7 @@ diff --git a/app/templates/components/plan_usage.hbs b/app/templates/components/plan_usage.hbs index dc475cc668..07423ecbf9 100644 --- a/app/templates/components/plan_usage.hbs +++ b/app/templates/components/plan_usage.hbs @@ -108,7 +108,10 @@ {{#each this.summarizedRepositories as |repository|}} - + {{repository.formattedSlug}} diff --git a/app/templates/components/repos-list-item.hbs b/app/templates/components/repos-list-item.hbs index 91f9e42696..27feab45a1 100644 --- a/app/templates/components/repos-list-item.hbs +++ b/app/templates/components/repos-list-item.hbs @@ -1,7 +1,7 @@

{{#if this.repo.slug}} - + {{this.repo.slug}} diff --git a/app/templates/components/repository-layout.hbs b/app/templates/components/repository-layout.hbs index df177b3862..4c7be473fe 100644 --- a/app/templates/components/repository-layout.hbs +++ b/app/templates/components/repository-layout.hbs @@ -9,7 +9,10 @@ {{this.repo.owner.login}} / - + {{this.repo.name}}

@@ -22,6 +25,16 @@ > + {{#if (eq this.repo.provider 'assembla')}} +
+ + + {{this.repositoryType}} + + + +
+ {{/if}}
diff --git a/app/templates/components/repository-status-toggle.hbs b/app/templates/components/repository-status-toggle.hbs index f87e440067..23f38875eb 100644 --- a/app/templates/components/repository-status-toggle.hbs +++ b/app/templates/components/repository-status-toggle.hbs @@ -2,6 +2,7 @@ diff --git a/app/templates/settings.hbs b/app/templates/settings.hbs index 35954ef9f1..1705e9b5c5 100644 --- a/app/templates/settings.hbs +++ b/app/templates/settings.hbs @@ -235,7 +235,7 @@ - {{#if (and (config-get 'endpoints.sshKey') (or this.features.enterpriseVersion this.repo.private))}} + {{#if (and (and (config-get 'endpoints.sshKey') (or this.features.enterpriseVersion this.repo.private)) (not (eq this.repo.serverType 'perforce')))}}

SSH Key