aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/account
diff options
context:
space:
mode:
authorStas Vilchik <stas.vilchik@sonarsource.com>2018-12-05 17:32:18 +0100
committerSonarTech <sonartech@sonarsource.com>2018-12-05 20:20:59 +0100
commit41c98779d38bda9fdfdca182a5f20c73fcff9a84 (patch)
treed895a9f8bfd0276aee5ffacf7bb33a0109436cbd /server/sonar-web/src/main/js/apps/account
parenta9c22c1185c5fd8c8dc4c9388f4a3b967e3f463d (diff)
downloadsonarqube-41c98779d38bda9fdfdca182a5f20c73fcff9a84.tar.gz
sonarqube-41c98779d38bda9fdfdca182a5f20c73fcff9a84.zip
create global type definitions (#1017)
Diffstat (limited to 'server/sonar-web/src/main/js/apps/account')
-rw-r--r--server/sonar-web/src/main/js/apps/account/components/Account.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/account/components/Password.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/account/components/Security.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/account/components/UserCard.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/account/notifications/GlobalNotifications.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/account/notifications/Notifications.tsx13
-rw-r--r--server/sonar-web/src/main/js/apps/account/notifications/NotificationsList.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/account/notifications/ProjectNotifications.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/account/notifications/Projects.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/account/organizations/OrganizationCard.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/account/organizations/OrganizationsList.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/account/organizations/UserOrganizations.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/account/profile/Profile.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/account/profile/UserExternalIdentity.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/account/profile/UserScmAccounts.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/account/projects/ProjectCard.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/account/projects/Projects.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/account/projects/ProjectsContainer.tsx3
18 files changed, 35 insertions, 53 deletions
diff --git a/server/sonar-web/src/main/js/apps/account/components/Account.tsx b/server/sonar-web/src/main/js/apps/account/components/Account.tsx
index 02711b9d407..4018f461da5 100644
--- a/server/sonar-web/src/main/js/apps/account/components/Account.tsx
+++ b/server/sonar-web/src/main/js/apps/account/components/Account.tsx
@@ -22,7 +22,6 @@ import { connect } from 'react-redux';
import Helmet from 'react-helmet';
import Nav from './Nav';
import UserCard from './UserCard';
-import { CurrentUser, LoggedInUser } from '../../../app/types';
import { getCurrentUser, areThereCustomOrganizations, Store } from '../../../store/rootReducer';
import { translate } from '../../../helpers/l10n';
import handleRequiredAuthentication from '../../../app/utils/handleRequiredAuthentication';
@@ -30,7 +29,7 @@ import Suggestions from '../../../app/components/embed-docs-modal/Suggestions';
import '../account.css';
interface Props {
- currentUser: CurrentUser;
+ currentUser: T.CurrentUser;
customOrganizations?: boolean;
}
@@ -55,7 +54,7 @@ class Account extends React.PureComponent<Props> {
<Helmet defaultTitle={title} titleTemplate={'%s - ' + title} />
<header className="account-header">
<div className="account-container clearfix">
- <UserCard user={currentUser as LoggedInUser} />
+ <UserCard user={currentUser as T.LoggedInUser} />
<Nav customOrganizations={this.props.customOrganizations} />
</div>
</header>
diff --git a/server/sonar-web/src/main/js/apps/account/components/Password.tsx b/server/sonar-web/src/main/js/apps/account/components/Password.tsx
index b3cc2f831ae..38a241b0f6a 100644
--- a/server/sonar-web/src/main/js/apps/account/components/Password.tsx
+++ b/server/sonar-web/src/main/js/apps/account/components/Password.tsx
@@ -21,11 +21,10 @@ import * as React from 'react';
import { changePassword } from '../../../api/users';
import { SubmitButton } from '../../../components/ui/buttons';
import { translate } from '../../../helpers/l10n';
-import { LoggedInUser } from '../../../app/types';
import { Alert } from '../../../components/ui/Alert';
interface Props {
- user: LoggedInUser;
+ user: T.LoggedInUser;
}
interface State {
diff --git a/server/sonar-web/src/main/js/apps/account/components/Security.tsx b/server/sonar-web/src/main/js/apps/account/components/Security.tsx
index bca85261333..1286898bdac 100644
--- a/server/sonar-web/src/main/js/apps/account/components/Security.tsx
+++ b/server/sonar-web/src/main/js/apps/account/components/Security.tsx
@@ -24,10 +24,9 @@ import Password from './Password';
import Tokens from './Tokens';
import { translate } from '../../../helpers/l10n';
import { getCurrentUser, Store } from '../../../store/rootReducer';
-import { LoggedInUser } from '../../../app/types';
interface Props {
- user: LoggedInUser;
+ user: T.LoggedInUser;
}
function Security({ user }: Props) {
@@ -41,7 +40,7 @@ function Security({ user }: Props) {
}
const mapStateToProps = (state: Store) => ({
- user: getCurrentUser(state) as LoggedInUser
+ user: getCurrentUser(state) as T.LoggedInUser
});
export default connect(mapStateToProps)(Security);
diff --git a/server/sonar-web/src/main/js/apps/account/components/UserCard.tsx b/server/sonar-web/src/main/js/apps/account/components/UserCard.tsx
index 6afeeaaf967..550522f5a86 100644
--- a/server/sonar-web/src/main/js/apps/account/components/UserCard.tsx
+++ b/server/sonar-web/src/main/js/apps/account/components/UserCard.tsx
@@ -19,10 +19,9 @@
*/
import * as React from 'react';
import Avatar from '../../../components/ui/Avatar';
-import { LoggedInUser } from '../../../app/types';
interface Props {
- user: LoggedInUser;
+ user: T.LoggedInUser;
}
export default function UserCard({ user }: Props) {
diff --git a/server/sonar-web/src/main/js/apps/account/notifications/GlobalNotifications.tsx b/server/sonar-web/src/main/js/apps/account/notifications/GlobalNotifications.tsx
index 0ac75ce0151..5ca04b775f8 100644
--- a/server/sonar-web/src/main/js/apps/account/notifications/GlobalNotifications.tsx
+++ b/server/sonar-web/src/main/js/apps/account/notifications/GlobalNotifications.tsx
@@ -19,14 +19,13 @@
*/
import * as React from 'react';
import NotificationsList from './NotificationsList';
-import { Notification } from '../../../app/types';
import { translate } from '../../../helpers/l10n';
interface Props {
- addNotification: (n: Notification) => void;
+ addNotification: (n: T.Notification) => void;
channels: string[];
- notifications: Notification[];
- removeNotification: (n: Notification) => void;
+ notifications: T.Notification[];
+ removeNotification: (n: T.Notification) => void;
types: string[];
}
diff --git a/server/sonar-web/src/main/js/apps/account/notifications/Notifications.tsx b/server/sonar-web/src/main/js/apps/account/notifications/Notifications.tsx
index 949b0285c7e..a6eadc5ff65 100644
--- a/server/sonar-web/src/main/js/apps/account/notifications/Notifications.tsx
+++ b/server/sonar-web/src/main/js/apps/account/notifications/Notifications.tsx
@@ -25,7 +25,6 @@ import GlobalNotifications from './GlobalNotifications';
import Projects from './Projects';
import { NotificationProject } from './types';
import * as api from '../../../api/notifications';
-import { Notification } from '../../../app/types';
import DeferredSpinner from '../../../components/common/DeferredSpinner';
import { translate } from '../../../helpers/l10n';
import { Alert } from '../../../components/ui/Alert';
@@ -38,7 +37,7 @@ interface State {
channels: string[];
globalTypes: string[];
loading: boolean;
- notifications: Notification[];
+ notifications: T.Notification[];
perProjectTypes: string[];
}
@@ -94,13 +93,13 @@ export default class Notifications extends React.PureComponent<Props, State> {
);
};
- addNotificationToState = (added: Notification) => {
+ addNotificationToState = (added: T.Notification) => {
this.setState(state => ({
notifications: uniqWith([...state.notifications, added], areNotificationsEqual)
}));
};
- removeNotificationFromState = (removed: Notification) => {
+ removeNotificationFromState = (removed: T.Notification) => {
this.setState(state => ({
notifications: state.notifications.filter(
notification => !areNotificationsEqual(notification, removed)
@@ -108,7 +107,7 @@ export default class Notifications extends React.PureComponent<Props, State> {
}));
};
- addNotification = (added: Notification) => {
+ addNotification = (added: T.Notification) => {
// optimistic update
this.addNotificationToState(added);
@@ -119,7 +118,7 @@ export default class Notifications extends React.PureComponent<Props, State> {
});
};
- removeNotification = (removed: Notification) => {
+ removeNotification = (removed: T.Notification) => {
// optimistic update
this.removeNotificationFromState(removed);
@@ -175,6 +174,6 @@ export default class Notifications extends React.PureComponent<Props, State> {
}
}
-function areNotificationsEqual(a: Notification, b: Notification) {
+function areNotificationsEqual(a: T.Notification, b: T.Notification) {
return a.channel === b.channel && a.type === b.type && a.project === b.project;
}
diff --git a/server/sonar-web/src/main/js/apps/account/notifications/NotificationsList.tsx b/server/sonar-web/src/main/js/apps/account/notifications/NotificationsList.tsx
index 35915a0f4f1..c091dbde451 100644
--- a/server/sonar-web/src/main/js/apps/account/notifications/NotificationsList.tsx
+++ b/server/sonar-web/src/main/js/apps/account/notifications/NotificationsList.tsx
@@ -18,18 +18,17 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
-import { Notification } from '../../../app/types';
import Checkbox from '../../../components/controls/Checkbox';
import { translate, hasMessage } from '../../../helpers/l10n';
interface Props {
- onAdd: (n: Notification) => void;
- onRemove: (n: Notification) => void;
+ onAdd: (n: T.Notification) => void;
+ onRemove: (n: T.Notification) => void;
channels: string[];
checkboxId: (type: string, channel: string) => string;
project?: boolean;
types: string[];
- notifications: Notification[];
+ notifications: T.Notification[];
}
export default class NotificationsList extends React.PureComponent<Props> {
diff --git a/server/sonar-web/src/main/js/apps/account/notifications/ProjectNotifications.tsx b/server/sonar-web/src/main/js/apps/account/notifications/ProjectNotifications.tsx
index f5e29f76ba1..1031b6afc1f 100644
--- a/server/sonar-web/src/main/js/apps/account/notifications/ProjectNotifications.tsx
+++ b/server/sonar-web/src/main/js/apps/account/notifications/ProjectNotifications.tsx
@@ -21,17 +21,16 @@ import * as React from 'react';
import { Link } from 'react-router';
import NotificationsList from './NotificationsList';
import { NotificationProject } from './types';
-import { Notification } from '../../../app/types';
import Organization from '../../../components/shared/Organization';
import { translate } from '../../../helpers/l10n';
import { getProjectUrl } from '../../../helpers/urls';
interface Props {
- addNotification: (n: Notification) => void;
+ addNotification: (n: T.Notification) => void;
channels: string[];
- notifications: Notification[];
+ notifications: T.Notification[];
project: NotificationProject;
- removeNotification: (n: Notification) => void;
+ removeNotification: (n: T.Notification) => void;
types: string[];
}
diff --git a/server/sonar-web/src/main/js/apps/account/notifications/Projects.tsx b/server/sonar-web/src/main/js/apps/account/notifications/Projects.tsx
index 87534d86b24..dedd0456093 100644
--- a/server/sonar-web/src/main/js/apps/account/notifications/Projects.tsx
+++ b/server/sonar-web/src/main/js/apps/account/notifications/Projects.tsx
@@ -22,17 +22,16 @@ import { differenceWith } from 'lodash';
import ProjectNotifications from './ProjectNotifications';
import { NotificationProject } from './types';
import { getSuggestions } from '../../../api/components';
-import { Notification } from '../../../app/types';
import { AsyncSelect } from '../../../components/controls/Select';
import Organization from '../../../components/shared/Organization';
import { translate } from '../../../helpers/l10n';
export interface Props {
- addNotification: (n: Notification) => void;
+ addNotification: (n: T.Notification) => void;
channels: string[];
- notificationsByProject: { [project: string]: Notification[] };
+ notificationsByProject: { [project: string]: T.Notification[] };
projects: NotificationProject[];
- removeNotification: (n: Notification) => void;
+ removeNotification: (n: T.Notification) => void;
types: string[];
}
diff --git a/server/sonar-web/src/main/js/apps/account/organizations/OrganizationCard.tsx b/server/sonar-web/src/main/js/apps/account/organizations/OrganizationCard.tsx
index 99cc1b00272..4648d2fd377 100644
--- a/server/sonar-web/src/main/js/apps/account/organizations/OrganizationCard.tsx
+++ b/server/sonar-web/src/main/js/apps/account/organizations/OrganizationCard.tsx
@@ -21,10 +21,9 @@ import * as React from 'react';
import OrganizationAvatar from '../../../components/common/OrganizationAvatar';
import OrganizationLink from '../../../components/ui/OrganizationLink';
import { translate } from '../../../helpers/l10n';
-import { Organization } from '../../../app/types';
interface Props {
- organization: Organization;
+ organization: T.Organization;
}
export default function OrganizationCard({ organization }: Props) {
diff --git a/server/sonar-web/src/main/js/apps/account/organizations/OrganizationsList.tsx b/server/sonar-web/src/main/js/apps/account/organizations/OrganizationsList.tsx
index fa9cbfe6052..13681b72508 100644
--- a/server/sonar-web/src/main/js/apps/account/organizations/OrganizationsList.tsx
+++ b/server/sonar-web/src/main/js/apps/account/organizations/OrganizationsList.tsx
@@ -20,11 +20,10 @@
import * as React from 'react';
import { sortBy } from 'lodash';
import OrganizationCard from './OrganizationCard';
-import { Organization } from '../../../app/types';
import { translate } from '../../../helpers/l10n';
interface Props {
- organizations: Organization[];
+ organizations: T.Organization[];
}
export default function OrganizationsList({ organizations }: Props) {
diff --git a/server/sonar-web/src/main/js/apps/account/organizations/UserOrganizations.tsx b/server/sonar-web/src/main/js/apps/account/organizations/UserOrganizations.tsx
index 3ec744841b8..22ccbe76fdf 100644
--- a/server/sonar-web/src/main/js/apps/account/organizations/UserOrganizations.tsx
+++ b/server/sonar-web/src/main/js/apps/account/organizations/UserOrganizations.tsx
@@ -30,12 +30,11 @@ import {
getGlobalSettingValue,
Store
} from '../../../store/rootReducer';
-import { Organization } from '../../../app/types';
interface StateProps {
anyoneCanCreate: boolean;
canAdmin?: boolean;
- organizations: Organization[];
+ organizations: T.Organization[];
}
interface DispatchProps {
diff --git a/server/sonar-web/src/main/js/apps/account/profile/Profile.tsx b/server/sonar-web/src/main/js/apps/account/profile/Profile.tsx
index f03d64cac11..a156f980763 100644
--- a/server/sonar-web/src/main/js/apps/account/profile/Profile.tsx
+++ b/server/sonar-web/src/main/js/apps/account/profile/Profile.tsx
@@ -24,11 +24,10 @@ import UserGroups from './UserGroups';
import UserScmAccounts from './UserScmAccounts';
import { getCurrentUser, areThereCustomOrganizations, Store } from '../../../store/rootReducer';
import { translate } from '../../../helpers/l10n';
-import { LoggedInUser } from '../../../app/types';
interface Props {
customOrganizations?: boolean;
- user: LoggedInUser;
+ user: T.LoggedInUser;
}
function Profile({ customOrganizations, user }: Props) {
@@ -69,7 +68,7 @@ function Profile({ customOrganizations, user }: Props) {
const mapStateToProps = (state: Store) => ({
customOrganizations: areThereCustomOrganizations(state),
- user: getCurrentUser(state) as LoggedInUser
+ user: getCurrentUser(state) as T.LoggedInUser
});
export default connect(mapStateToProps)(Profile);
diff --git a/server/sonar-web/src/main/js/apps/account/profile/UserExternalIdentity.tsx b/server/sonar-web/src/main/js/apps/account/profile/UserExternalIdentity.tsx
index a71dad75ff4..0441ae13aac 100644
--- a/server/sonar-web/src/main/js/apps/account/profile/UserExternalIdentity.tsx
+++ b/server/sonar-web/src/main/js/apps/account/profile/UserExternalIdentity.tsx
@@ -21,15 +21,14 @@ import * as React from 'react';
import { getIdentityProviders } from '../../../api/users';
import * as theme from '../../../app/theme';
import { getTextColor } from '../../../helpers/colors';
-import { LoggedInUser, IdentityProvider } from '../../../app/types';
import { getBaseUrl } from '../../../helpers/urls';
interface Props {
- user: LoggedInUser;
+ user: T.LoggedInUser;
}
interface State {
- identityProvider?: IdentityProvider;
+ identityProvider?: T.IdentityProvider;
loading: boolean;
}
diff --git a/server/sonar-web/src/main/js/apps/account/profile/UserScmAccounts.tsx b/server/sonar-web/src/main/js/apps/account/profile/UserScmAccounts.tsx
index 13be6a89f97..39d0240bb7c 100644
--- a/server/sonar-web/src/main/js/apps/account/profile/UserScmAccounts.tsx
+++ b/server/sonar-web/src/main/js/apps/account/profile/UserScmAccounts.tsx
@@ -19,11 +19,10 @@
*/
import * as React from 'react';
import { translate } from '../../../helpers/l10n';
-import { LoggedInUser } from '../../../app/types';
interface Props {
scmAccounts: string[];
- user: LoggedInUser;
+ user: T.LoggedInUser;
}
export default function UserScmAccounts({ user, scmAccounts }: Props) {
diff --git a/server/sonar-web/src/main/js/apps/account/projects/ProjectCard.tsx b/server/sonar-web/src/main/js/apps/account/projects/ProjectCard.tsx
index f9946715f89..dbbe4e2ce6f 100644
--- a/server/sonar-web/src/main/js/apps/account/projects/ProjectCard.tsx
+++ b/server/sonar-web/src/main/js/apps/account/projects/ProjectCard.tsx
@@ -26,10 +26,9 @@ import DateTimeFormatter from '../../../components/intl/DateTimeFormatter';
import Level from '../../../components/ui/Level';
import Tooltip from '../../../components/controls/Tooltip';
import { translateWithParameters, translate } from '../../../helpers/l10n';
-import { MyProject } from '../../../app/types';
interface Props {
- project: MyProject;
+ project: T.MyProject;
}
export default function ProjectCard({ project }: Props) {
diff --git a/server/sonar-web/src/main/js/apps/account/projects/Projects.tsx b/server/sonar-web/src/main/js/apps/account/projects/Projects.tsx
index 15a00318c4b..071e23289ce 100644
--- a/server/sonar-web/src/main/js/apps/account/projects/Projects.tsx
+++ b/server/sonar-web/src/main/js/apps/account/projects/Projects.tsx
@@ -21,12 +21,11 @@ import * as React from 'react';
import ProjectCard from './ProjectCard';
import ListFooter from '../../../components/controls/ListFooter';
import { translate } from '../../../helpers/l10n';
-import { MyProject } from '../../../app/types';
interface Props {
loading: boolean;
loadMore: () => void;
- projects: MyProject[];
+ projects: T.MyProject[];
total?: number;
}
diff --git a/server/sonar-web/src/main/js/apps/account/projects/ProjectsContainer.tsx b/server/sonar-web/src/main/js/apps/account/projects/ProjectsContainer.tsx
index a5d62ac64a3..115b2954cae 100644
--- a/server/sonar-web/src/main/js/apps/account/projects/ProjectsContainer.tsx
+++ b/server/sonar-web/src/main/js/apps/account/projects/ProjectsContainer.tsx
@@ -22,12 +22,11 @@ import Helmet from 'react-helmet';
import Projects from './Projects';
import { getMyProjects } from '../../../api/components';
import { translate } from '../../../helpers/l10n';
-import { MyProject } from '../../../app/types';
interface State {
loading: boolean;
page: number;
- projects?: MyProject[];
+ projects?: T.MyProject[];
total?: number;
}