@spinnaker/core 0.14.0 → 0.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (218) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/dist/config/settings.d.ts +1 -1
  3. package/dist/core.module.d.ts +1 -1
  4. package/dist/index.js +89 -47
  5. package/dist/index.js.map +1 -1
  6. package/dist/instance/instanceType.service.d.ts +3 -2
  7. package/dist/managed/artifactActions/ArtifactActions.d.ts +24 -0
  8. package/dist/managed/constraints/registry.d.ts +13 -2
  9. package/dist/managed/environmentBaseElements/EnvironmentItem.d.ts +3 -2
  10. package/dist/managed/graphql/graphql-sdk.d.ts +123 -11
  11. package/dist/managed/overview/Resource.d.ts +5 -2
  12. package/dist/managed/overview/artifact/Artifact.d.ts +2 -1
  13. package/dist/managed/overview/artifact/ArtifactActionModal.d.ts +20 -9
  14. package/dist/managed/overview/artifact/ArtifactCollapsibleSection.d.ts +7 -0
  15. package/dist/managed/overview/artifact/ArtifactVersions.d.ts +9 -0
  16. package/dist/managed/overview/artifact/CurrentVersion.d.ts +7 -6
  17. package/dist/managed/overview/artifact/VersionTitle.d.ts +9 -0
  18. package/dist/managed/overview/artifact/hooks.d.ts +6 -11
  19. package/dist/managed/overview/artifact/useCreateRollbackActions.hook.d.ts +3 -0
  20. package/dist/managed/overview/artifact/utils.d.ts +15 -14
  21. package/dist/managed/overview/useIsUpdatingResources.hook.d.ts +1 -0
  22. package/dist/managed/resources/ResourceTitle.d.ts +3 -3
  23. package/dist/managed/resources/resourceRegistry.d.ts +1 -1
  24. package/dist/managed/utils/ActionModal.d.ts +1 -0
  25. package/dist/managed/utils/defaults.d.ts +1 -0
  26. package/dist/managed/versionMetadata/MetadataComponents.d.ts +18 -19
  27. package/dist/managed/versionMetadata/VersionMetadata.d.ts +6 -2
  28. package/dist/search/infrastructure/infrastructureSearch.service.d.ts +2 -1
  29. package/dist/securityGroup/index.d.ts +2 -1
  30. package/package.json +7 -7
  31. package/src/account/AccountSelectInput.spec.tsx +9 -4
  32. package/src/account/AccountService.spec.ts +6 -6
  33. package/src/api/ApiService.spec.ts +2 -2
  34. package/src/api/ApiServiceDeprecated.spec.ts +5 -2
  35. package/src/application/application.model.spec.ts +78 -79
  36. package/src/application/config/applicationAttributes.directive.html +6 -2
  37. package/src/application/config/applicationAttributes.directive.js +4 -0
  38. package/src/application/config/applicationConfig.view.html +14 -1
  39. package/src/application/config/customBanner/CustomBannerConfig.spec.tsx +3 -3
  40. package/src/application/config/dataSources/applicationDataSourceEditor.component.spec.ts +4 -3
  41. package/src/application/config/footer/configSectionFooter.component.spec.ts +2 -1
  42. package/src/application/listExtractor/AppListExtractor.spec.ts +4 -4
  43. package/src/application/modal/PermissionsConfigurer.spec.tsx +3 -2
  44. package/src/application/modal/editApplication.controller.modal.js +1 -0
  45. package/src/application/modal/editApplication.html +2 -2
  46. package/src/application/modal/validation/ApplicationNameValidator.spec.ts +2 -1
  47. package/src/application/modal/validation/validateApplicationName.directive.spec.ts +3 -2
  48. package/src/application/nav/ApplicationNavigation.spec.tsx +12 -11
  49. package/src/application/nav/NavItem.spec.tsx +7 -5
  50. package/src/application/nav/NavSection.spec.tsx +3 -2
  51. package/src/application/service/ApplicationReader.spec.ts +13 -8
  52. package/src/application/service/ApplicationWriter.spec.ts +4 -2
  53. package/src/application/service/InferredApplicationWarningService.spec.ts +2 -3
  54. package/src/artifact/expectedArtifact.service.spec.ts +2 -1
  55. package/src/artifact/react/ExpectedArtifactSelector.spec.tsx +2 -3
  56. package/src/authentication/AuthenticationInitializer.spec.ts +2 -1
  57. package/src/authentication/AuthenticationService.spec.ts +2 -1
  58. package/src/authentication/authentication.interceptor.spec.ts +4 -2
  59. package/src/cache/cacheInitializer.service.spec.ts +7 -4
  60. package/src/cache/infrastructureCaches.spec.ts +4 -4
  61. package/src/chaosMonkey/chaosMonkeyExceptions.component.spec.ts +4 -2
  62. package/src/cloudProvider/providerSelection/ProviderSelectionService.spec.ts +23 -21
  63. package/src/cluster/ClusterRuleMatcher.spec.ts +2 -1
  64. package/src/cluster/cluster.service.spec.ts +7 -7
  65. package/src/cluster/filter/ClusterFilterService.spec.ts +15 -14
  66. package/src/cluster/filter/LabelFilter.spec.tsx +3 -3
  67. package/src/cluster/filter/MultiselectModel.spec.ts +2 -2
  68. package/src/cluster/filter/labelFilterUtils.spec.ts +3 -7
  69. package/src/config/settings.ts +1 -3
  70. package/src/core.module.ts +1 -1
  71. package/src/filterModel/dependentFilter/DependentFilterService.spec.ts +1 -1
  72. package/src/function/filter/FunctionFilterService.spec.ts +5 -3
  73. package/src/function/function.read.service.spec.ts +4 -3
  74. package/src/header/customBanner/CustomBanner.spec.tsx +3 -4
  75. package/src/healthCounts/HealthCounts.spec.tsx +2 -2
  76. package/src/history/recentHistory.service.spec.ts +2 -1
  77. package/src/insight/InsightMenu.spec.tsx +9 -6
  78. package/src/instance/instance.write.service.spec.ts +8 -7
  79. package/src/instance/instanceType.service.ts +12 -2
  80. package/src/instance/instanceTypeService.spec.ts +2 -1
  81. package/src/loadBalancer/LoadBalancersTag.spec.tsx +8 -6
  82. package/src/loadBalancer/filter/LoadBalancerFilterService.spec.ts +2 -2
  83. package/src/managed/Environments.less +4 -4
  84. package/src/managed/Environments.tsx +1 -1
  85. package/src/managed/RelativeTimestamp.tsx +8 -6
  86. package/src/managed/artifactActions/ArtifactActions.tsx +77 -0
  87. package/src/managed/constraints/AllowedTimes.spec.ts +2 -1
  88. package/src/managed/constraints/registry.tsx +27 -1
  89. package/src/managed/environmentBaseElements/BaseEnvironment.less +3 -3
  90. package/src/managed/environmentBaseElements/EnvironmentItem.tsx +11 -4
  91. package/src/managed/graphql/graphql-sdk.ts +218 -29
  92. package/src/managed/graphql/schema.graphql +14 -1
  93. package/src/managed/overview/EnvironmentOverview.tsx +12 -15
  94. package/src/managed/overview/EnvironmentsOverview.less +6 -5
  95. package/src/managed/overview/PreviewEnvironments.tsx +0 -3
  96. package/src/managed/overview/Resource.less +1 -1
  97. package/src/managed/overview/Resource.tsx +62 -47
  98. package/src/managed/overview/artifact/Artifact.less +27 -52
  99. package/src/managed/overview/artifact/Artifact.tsx +86 -22
  100. package/src/managed/overview/artifact/ArtifactActionModal.less +19 -0
  101. package/src/managed/overview/artifact/ArtifactActionModal.tsx +150 -68
  102. package/src/managed/overview/artifact/ArtifactCollapsibleSection.tsx +32 -0
  103. package/src/managed/overview/artifact/ArtifactVersionTasks.tsx +2 -0
  104. package/src/managed/overview/artifact/{PendingVersion.tsx → ArtifactVersions.tsx} +35 -25
  105. package/src/managed/overview/artifact/Constraints.tsx +61 -21
  106. package/src/managed/overview/artifact/CurrentVersion.tsx +42 -27
  107. package/src/managed/overview/artifact/VersionTitle.tsx +18 -0
  108. package/src/managed/overview/artifact/hooks.ts +71 -34
  109. package/src/managed/overview/artifact/useCreateRollbackActions.hook.ts +75 -0
  110. package/src/managed/overview/artifact/utils.spec.ts +1 -1
  111. package/src/managed/overview/artifact/utils.ts +47 -80
  112. package/src/managed/overview/baseStyles.less +124 -88
  113. package/src/managed/overview/queries.graphql +54 -13
  114. package/src/managed/overview/useIsUpdatingResources.hook.ts +9 -0
  115. package/src/managed/resources/ResourceTitle.tsx +12 -5
  116. package/src/managed/utils/ActionModal.tsx +4 -1
  117. package/src/managed/utils/defaults.ts +3 -0
  118. package/src/managed/utils/useNotifyOnError.hook.ts +1 -1
  119. package/src/managed/versionMetadata/MetadataComponents.tsx +102 -70
  120. package/src/managed/versionMetadata/VersionMetadata.less +17 -18
  121. package/src/managed/versionMetadata/VersionMetadata.tsx +23 -31
  122. package/src/managed/versionsHistory/VersionContent.tsx +20 -13
  123. package/src/managed/versionsHistory/VersionHeading.tsx +2 -1
  124. package/src/managed/versionsHistory/VersionsHistory.less +11 -3
  125. package/src/manifest/PodNameProvider.spec.ts +1 -1
  126. package/src/navigation/customParamTypes.spec.ts +1 -1
  127. package/src/pagerDuty/pagerDuty.read.service.spec.ts +4 -2
  128. package/src/pagerDuty/pagerDutyTag.component.spec.ts +7 -3
  129. package/src/pipeline/config/PipelineRegistry.spec.ts +38 -37
  130. package/src/pipeline/config/actions/templateJson/ShowPipelineTemplateJsonModal.spec.tsx +3 -3
  131. package/src/pipeline/config/pipelineConfigurer.controller.spec.ts +3 -3
  132. package/src/pipeline/config/services/PipelineConfigService.spec.ts +4 -3
  133. package/src/pipeline/config/stages/bakeManifest/helm/BakeHelmConfigForm.spec.tsx +51 -8
  134. package/src/pipeline/config/stages/bakeManifest/helm/BakeHelmConfigForm.tsx +36 -6
  135. package/src/pipeline/config/stages/findArtifactFromExecution/findArtifactFromExecution.controller.spec.ts +2 -1
  136. package/src/pipeline/config/stages/manualJudgment/manualJudgment.service.spec.ts +6 -4
  137. package/src/pipeline/config/stages/travis/travisExecutionDetails.controller.spec.ts +5 -2
  138. package/src/pipeline/config/stages/travis/travisStage.controller.spec.ts +3 -2
  139. package/src/pipeline/config/stages/unmatchedStageTypeStage/unmatchedStageTypeStage.controller.spec.ts +2 -1
  140. package/src/pipeline/config/stages/wait/SkipWait.tsx +3 -1
  141. package/src/pipeline/config/stages/wercker/werckerExecutionDetails.controller.spec.ts +5 -2
  142. package/src/pipeline/config/stages/wercker/werckerStage.controller.spec.ts +3 -2
  143. package/src/pipeline/config/templates/Variable.spec.tsx +6 -5
  144. package/src/pipeline/config/templates/configurePipelineTemplateModal.controller.spec.ts +7 -8
  145. package/src/pipeline/config/templates/v2/configurePipelineTemplateModalV2.controller.spec.ts +7 -8
  146. package/src/pipeline/config/templates/v2/pipelineTemplateV2.service.spec.ts +1 -1
  147. package/src/pipeline/config/triggers/TriggersPageContent.spec.tsx +4 -4
  148. package/src/pipeline/config/triggers/TriggersPageContent.tsx +1 -2
  149. package/src/pipeline/config/triggers/artifacts/docker/defaultDocker.artifact.spec.ts +1 -2
  150. package/src/pipeline/config/validation/pipelineConfig.validator.spec.ts +14 -15
  151. package/src/pipeline/create/CreatePipelineModal.spec.tsx +9 -7
  152. package/src/pipeline/details/executionDetailsSection.service.spec.ts +3 -2
  153. package/src/pipeline/executions/Executions.spec.tsx +9 -6
  154. package/src/pipeline/executions/executionAction/ExecutionAction.spec.tsx +1 -1
  155. package/src/pipeline/executions/executionGroup/ExecutionGroup.tsx +2 -1
  156. package/src/pipeline/filter/executionFilter.service.spec.ts +1 -1
  157. package/src/pipeline/pipeline.dataSource.spec.ts +8 -7
  158. package/src/pipeline/service/ExecutionsTransformer.spec.ts +2 -2
  159. package/src/pipeline/service/execution.service.spec.ts +7 -5
  160. package/src/pipeline/status/Artifact.spec.tsx +7 -6
  161. package/src/pipeline/status/ArtifactList.spec.tsx +7 -6
  162. package/src/pipeline/status/ExecutionParameters.spec.tsx +5 -4
  163. package/src/pipeline/status/ResolvedArtifactList.spec.tsx +7 -6
  164. package/src/plugins/deck.plugin.spec.ts +4 -2
  165. package/src/plugins/plugin.registry.spec.ts +6 -4
  166. package/src/presentation/forms/SpinFormik.spec.tsx +3 -2
  167. package/src/presentation/forms/fields/FormikFormField.spec.tsx +3 -3
  168. package/src/presentation/forms/hooks/useSaveRestoreMutuallyExclusiveFields.hook.spec.tsx +4 -3
  169. package/src/presentation/forms/inputs/ChecklistInput.spec.tsx +1 -1
  170. package/src/presentation/forms/inputs/RadioButtonInput.spec.tsx +2 -1
  171. package/src/presentation/forms/inputs/SelectInput.spec.tsx +2 -1
  172. package/src/presentation/forms/inputs/hooks/useInternalValidator.hook.spec.tsx +4 -3
  173. package/src/presentation/forms/validation/FormValidator.spec.ts +2 -2
  174. package/src/presentation/forms/validation/useValidationData.spec.tsx +4 -3
  175. package/src/presentation/hooks/useContainerClassNames.hook.spec.tsx +2 -1
  176. package/src/presentation/hooks/useData.hook.spec.tsx +3 -2
  177. package/src/presentation/hooks/useDebouncedValue.hook.spec.tsx +1 -1
  178. package/src/presentation/hooks/useDeepObjectDiff.hook.spec.tsx +2 -1
  179. package/src/presentation/hooks/useEventListener.hook.spec.tsx +2 -1
  180. package/src/presentation/hooks/useForceUpdate.hook.spec.tsx +2 -1
  181. package/src/presentation/hooks/useInterval.hook.spec.tsx +2 -1
  182. package/src/presentation/hooks/useIsMountedRef.hook.spec.tsx +1 -1
  183. package/src/presentation/hooks/useLatestCallback.hook.spec.tsx +2 -1
  184. package/src/presentation/hooks/useLatestPromise.hook.spec.tsx +9 -3
  185. package/src/presentation/hooks/useMountStatusRef.hook.spec.tsx +3 -1
  186. package/src/presentation/hooks/usePollingData.hook.spec.tsx +3 -2
  187. package/src/presentation/hooks/usePrevious.hook.spec.tsx +2 -1
  188. package/src/presentation/navigation/pageNavigator.component.spec.ts +6 -6
  189. package/src/presentation/spel/SpelInput.spec.tsx +9 -4
  190. package/src/presentation/spel/SpelService.spec.ts +1 -1
  191. package/src/scheduler/SchedulerFactory.spec.ts +2 -1
  192. package/src/search/infrastructure/infrastructureSearch.service.ts +3 -2
  193. package/src/search/widgets/Filter.spec.tsx +5 -3
  194. package/src/search/widgets/Filters.spec.tsx +5 -3
  195. package/src/search/widgets/Search.spec.tsx +4 -2
  196. package/src/securityGroup/index.ts +2 -1
  197. package/src/securityGroup/securityGroupReader.service.spec.ts +8 -10
  198. package/src/serverGroup/configure/common/deployInitializer.component.spec.ts +7 -3
  199. package/src/serverGroup/configure/common/v2instanceArchetypeSelector.component.ts +1 -1
  200. package/src/serverGroup/details/capacity/CapacityDetailsSection.spec.tsx +1 -1
  201. package/src/serverGroup/details/scalingActivities/ScalingActivitiesModal.spec.ts +2 -1
  202. package/src/serverGroup/details/serverGroupWarningMessage.service.spec.ts +4 -4
  203. package/src/serverGroup/serverGroupWriter.service.spec.ts +10 -8
  204. package/src/slack/SlackReader.spec.ts +2 -1
  205. package/src/subnet/subnet.read.service.spec.ts +4 -3
  206. package/src/task/monitor/taskMonitor.spec.ts +6 -5
  207. package/src/task/task.dataSource.spec.ts +5 -4
  208. package/src/task/task.write.service.spec.ts +3 -1
  209. package/src/utils/clipboard/CopyToClipboard.spec.tsx +2 -1
  210. package/src/utils/json/json.utility.service.spec.ts +2 -1
  211. package/src/utils/timeFormatters.spec.ts +3 -2
  212. package/src/utils/workerPool.spec.ts +2 -1
  213. package/src/widgets/ApplicationsPickerInput.spec.tsx +3 -2
  214. package/src/widgets/spelText/SpelAutocompleteService.spec.ts +4 -3
  215. package/src/widgets/tags/Tag.spec.tsx +4 -2
  216. package/src/widgets/tags/TagList.spec.tsx +5 -3
  217. package/src/yamlEditor/yamlEditorUtils.spec.ts +1 -1
  218. package/dist/managed/overview/artifact/PendingVersion.d.ts +0 -7
@@ -1,8 +1,8 @@
1
- import React from 'react';
2
1
  import { mount, shallow } from 'enzyme';
2
+ import React from 'react';
3
3
 
4
4
  import { HealthCounts } from './HealthCounts';
5
- import { IInstanceCounts } from '../domain';
5
+ import type { IInstanceCounts } from '../domain';
6
6
 
7
7
  describe('<HealthCounts />', () => {
8
8
  it('displays nothing when container has no health info', () => {
@@ -1,7 +1,8 @@
1
1
  import { range, some } from 'lodash';
2
2
 
3
+ import type { ICache } from '../cache/deckCacheFactory';
4
+ import { DeckCacheFactory } from '../cache/deckCacheFactory';
3
5
  import { RecentHistoryService } from '../history/recentHistory.service';
4
- import { DeckCacheFactory, ICache } from '../cache/deckCacheFactory';
5
6
 
6
7
  describe('recent history service', () => {
7
8
  let backingCache: ICache;
@@ -1,12 +1,15 @@
1
- import React from 'react';
2
1
  import { mock } from 'angular';
3
- import { ReactWrapper, mount } from 'enzyme';
4
- import { IInsightMenuProps, IInsightMenuState, InsightMenu } from './InsightMenu';
5
- import { IModalService } from 'angular-ui-bootstrap';
6
- import { OverrideRegistry } from '../overrideRegistry/override.registry';
7
- import { CacheInitializerService } from '../cache/cacheInitializer.service';
2
+ import type { IModalService } from 'angular-ui-bootstrap';
3
+ import type { ReactWrapper } from 'enzyme';
4
+ import { mount } from 'enzyme';
5
+ import React from 'react';
8
6
  import { Button } from 'react-bootstrap';
9
7
 
8
+ import type { IInsightMenuProps, IInsightMenuState } from './InsightMenu';
9
+ import { InsightMenu } from './InsightMenu';
10
+ import type { CacheInitializerService } from '../cache/cacheInitializer.service';
11
+ import { OverrideRegistry } from '../overrideRegistry/override.registry';
12
+
10
13
  beforeEach(() => {
11
14
  mock.module(($provide: any) => {
12
15
  $provide.value('$uibModal', {} as IModalService);
@@ -1,15 +1,16 @@
1
1
  import { mock } from 'angular';
2
2
 
3
+ import type { Application } from '../application/application.model';
4
+ import { ApplicationModelBuilder } from '../application/applicationModel.builder';
3
5
  import { PROVIDER_SERVICE_DELEGATE } from '../cloudProvider';
4
- import { IMultiInstanceGroup, InstanceWriter } from './instance.write.service';
5
- import { Application } from '../application/application.model';
6
+ import type { IInstance, IServerGroup } from '../domain';
7
+ import type { IMultiInstanceGroup } from './instance.write.service';
8
+ import { InstanceWriter } from './instance.write.service';
6
9
  import { REACT_MODULE } from '../reactShims';
7
- import { ApplicationModelBuilder } from '../application/applicationModel.builder';
8
- import { IInstance, IServerGroup } from '../domain';
9
- import * as State from '../state';
10
-
11
10
  import { ServerGroupReader } from '../serverGroup/serverGroupReader.service';
12
- import { IJob, ITaskCommand, TaskExecutor } from '../task/taskExecutor';
11
+ import * as State from '../state';
12
+ import type { IJob, ITaskCommand } from '../task/taskExecutor';
13
+ import { TaskExecutor } from '../task/taskExecutor';
13
14
 
14
15
  describe('Service: instance writer', function () {
15
16
  let $q: ng.IQService;
@@ -1,4 +1,5 @@
1
1
  import { module } from 'angular';
2
+ import { uniq } from 'lodash';
2
3
  import type { ProviderServiceDelegate } from '../cloudProvider/providerService.delegate';
3
4
  import { PROVIDER_SERVICE_DELEGATE } from '../cloudProvider/providerService.delegate';
4
5
 
@@ -15,8 +16,8 @@ export interface IInstanceTypesByRegion {
15
16
 
16
17
  export interface IInstanceStorage {
17
18
  type: string;
18
- size: number;
19
- count: number;
19
+ size?: number;
20
+ count?: number;
20
21
  isDefault?: boolean;
21
22
  }
22
23
 
@@ -81,6 +82,15 @@ export class InstanceTypeService {
81
82
  });
82
83
  }
83
84
 
85
+ public getCategoryForMultipleInstanceTypes(cloudProvider: string, instanceTypes: string[]) {
86
+ const promises = instanceTypes.map((it) => this.getCategoryForInstanceType(cloudProvider, it));
87
+
88
+ return Promise.all(promises).then((categories: string[]) => {
89
+ const distinctCategories = uniq(categories);
90
+ return distinctCategories.length === 1 ? distinctCategories[0] : 'custom';
91
+ });
92
+ }
93
+
84
94
  public getInstanceTypeDetails(cloudProvider: string, instanceType: string): PromiseLike<IPreferredInstanceType> {
85
95
  return this.getInstanceTypeCategory(cloudProvider, instanceType).then((category: IInstanceTypeCategory) => {
86
96
  if (category && category.families && category.families.length && category.families[0].instanceTypes) {
@@ -1,6 +1,7 @@
1
1
  import { mock } from 'angular';
2
2
 
3
- import { INSTANCE_TYPE_SERVICE, InstanceTypeService, IInstanceTypeCategory } from './instanceType.service';
3
+ import type { IInstanceTypeCategory, InstanceTypeService } from './instanceType.service';
4
+ import { INSTANCE_TYPE_SERVICE } from './instanceType.service';
4
5
 
5
6
  describe('Service: instanceTypeService', function () {
6
7
  let instanceTypeService: InstanceTypeService, $q: ng.IQService, $scope: ng.IScope;
@@ -1,12 +1,14 @@
1
- import { mock, IQService, IScope } from 'angular';
1
+ import type { IQService, IScope } from 'angular';
2
+ import { mock } from 'angular';
3
+ import type { ReactWrapper } from 'enzyme';
4
+ import { mount } from 'enzyme';
2
5
  import React from 'react';
3
- import { ReactWrapper, mount } from 'enzyme';
4
6
 
5
- import { Application } from '../application/application.model';
6
- import { ApplicationModelBuilder } from '../application/applicationModel.builder';
7
- import { ILoadBalancersTagProps } from './LoadBalancersTagWrapper';
8
7
  import { LoadBalancersTag } from './LoadBalancersTag';
9
- import { IServerGroup } from '../domain';
8
+ import type { ILoadBalancersTagProps } from './LoadBalancersTagWrapper';
9
+ import type { Application } from '../application/application.model';
10
+ import { ApplicationModelBuilder } from '../application/applicationModel.builder';
11
+ import type { IServerGroup } from '../domain';
10
12
  import { HoverablePopover } from '../presentation';
11
13
 
12
14
  describe('<LoadBalancersTag />', () => {
@@ -1,6 +1,6 @@
1
- import { Application } from '../../application/application.model';
1
+ import type { Application } from '../../application/application.model';
2
2
  import { ApplicationModelBuilder } from '../../application/applicationModel.builder';
3
- import { ILoadBalancer, IServerGroup, ILoadBalancerGroup, IManagedResourceSummary } from '../../domain';
3
+ import type { ILoadBalancer, ILoadBalancerGroup, IManagedResourceSummary, IServerGroup } from '../../domain';
4
4
  import { LoadBalancerState } from '../../state';
5
5
 
6
6
  // Most of this logic has been moved to filter.model.service.js, so these act more as integration tests
@@ -1,7 +1,7 @@
1
- .Environments2 {
1
+ .Environments {
2
2
  width: 100%;
3
3
  padding: 0 var(--l-spacing);
4
- --base-horizontal-padding: var(--xl-spacing);
4
+ --base-horizontal-padding: 20px;
5
5
 
6
6
  @media (max-width: 768px) {
7
7
  padding: 0;
@@ -55,11 +55,11 @@
55
55
  display: grid;
56
56
  gap: var(--m-spacing);
57
57
  align-items: flex-start;
58
- --row-element-icon-width: 40px;
58
+ --row-element-icon-width: 32px;
59
59
 
60
60
  &.grid-view {
61
61
  gap: var(--xl-spacing) var(--m-spacing);
62
- --row-element-icon-width: 32px;
62
+ --row-element-icon-width: 26px;
63
63
  }
64
64
  }
65
65
  }
@@ -31,7 +31,7 @@ export const Environments = () => {
31
31
  }, [params]);
32
32
 
33
33
  return (
34
- <div className="vertical Environments2">
34
+ <div className="vertical Environments">
35
35
  <HorizontalTabs
36
36
  tabs={tabs}
37
37
  rightElement={!state.name?.endsWith('.config') ? <EnvironmentsDirectionController /> : undefined}
@@ -31,6 +31,13 @@ export const DurationRender: React.FC<{ startedAt: string; completedAt?: string
31
31
  return <>{timeDiffToString(startAtDateTime, endTime)}</>;
32
32
  };
33
33
 
34
+ const toDateTime = (timestamp: DateTime | string | number) =>
35
+ typeof timestamp === 'number'
36
+ ? DateTime.fromMillis(timestamp)
37
+ : typeof timestamp === 'string'
38
+ ? DateTime.fromISO(timestamp)
39
+ : timestamp;
40
+
34
41
  export const formatToRelativeTimestamp = (timestamp: DateTime, withSuffix: boolean) => {
35
42
  const distance = getDistanceFromNow(timestamp);
36
43
  const suffix = withSuffix ? ' ago' : '';
@@ -68,12 +75,7 @@ export const RelativeTimestamp = memo(
68
75
  removeStyles,
69
76
  withSuffix = false,
70
77
  }: IRelativeTimestampProps) => {
71
- const dateTimeTimestamp =
72
- typeof originalTimestamp === 'number'
73
- ? DateTime.fromMillis(originalTimestamp)
74
- : typeof originalTimestamp === 'string'
75
- ? DateTime.fromISO(originalTimestamp)
76
- : originalTimestamp;
78
+ const dateTimeTimestamp = toDateTime(originalTimestamp);
77
79
  const timestamp = TIMEZONE ? dateTimeTimestamp.setZone(TIMEZONE) : dateTimeTimestamp;
78
80
  const [formattedTimestamp, setFormattedTimestamp] = useState(formatToRelativeTimestamp(timestamp, withSuffix));
79
81
 
@@ -0,0 +1,77 @@
1
+ import classnames from 'classnames';
2
+ import React from 'react';
3
+ import { Dropdown, MenuItem } from 'react-bootstrap';
4
+
5
+ import { ACTION_BUTTON_CLASS_NAME } from '../utils/defaults';
6
+ import { useLogEvent } from '../utils/logging';
7
+ import type { ICompareLinks } from '../versionMetadata/MetadataComponents';
8
+
9
+ export interface VersionAction {
10
+ onClick?: () => void;
11
+ href?: string;
12
+ content: string;
13
+ disabled?: boolean;
14
+ }
15
+
16
+ interface IArtifactActionsProps {
17
+ actions?: VersionAction[];
18
+ version: string;
19
+ buildNumber?: string;
20
+ compareLinks?: ICompareLinks;
21
+ className?: string;
22
+ }
23
+
24
+ export const ArtifactActions = ({ version, buildNumber, actions, compareLinks, className }: IArtifactActionsProps) => {
25
+ const compareActions: VersionAction[] = [
26
+ { content: 'Current version', href: compareLinks?.current, disabled: !compareLinks?.current },
27
+ { content: 'Previous version', href: compareLinks?.previous, disabled: !compareLinks?.previous },
28
+ ];
29
+ return (
30
+ <div className={classnames('horizontal md-actions-gap', className)}>
31
+ {actions?.map((action) => (
32
+ <button
33
+ key={action.content}
34
+ className={ACTION_BUTTON_CLASS_NAME}
35
+ disabled={action.disabled}
36
+ onClick={action.onClick}
37
+ >
38
+ {action.content}
39
+ </button>
40
+ ))}
41
+ <CompareToMenu id={`${version}-${buildNumber}-compare`} title="Compare to" actions={compareActions} />
42
+ </div>
43
+ );
44
+ };
45
+
46
+ export interface ICompareToMenuProps {
47
+ id: string;
48
+ actions: VersionAction[];
49
+ title: string;
50
+ className?: string;
51
+ pullRight?: boolean;
52
+ }
53
+
54
+ const CompareToMenu = ({ id, title, actions, className, pullRight }: ICompareToMenuProps) => {
55
+ const logEvent = useLogEvent('ArtifactActions');
56
+ return (
57
+ <Dropdown id={id} className={classnames('ArtifactActionsMenu', className)} pullRight={pullRight}>
58
+ <Dropdown.Toggle className="md-btn md-action-button">{title}</Dropdown.Toggle>
59
+ <Dropdown.Menu>
60
+ {actions.map((action, index) => (
61
+ <MenuItem
62
+ key={index}
63
+ disabled={action.disabled}
64
+ onClick={() => {
65
+ action.onClick?.();
66
+ logEvent({ action: `Compare to - ${action.content}` });
67
+ }}
68
+ href={action.href}
69
+ target="_blank"
70
+ >
71
+ {action.content}
72
+ </MenuItem>
73
+ ))}
74
+ </Dropdown.Menu>
75
+ </Dropdown>
76
+ );
77
+ };
@@ -1,4 +1,5 @@
1
- import { groupConsecutiveNumbers, groupDays, groupHours, GroupRange } from './AllowedTimes';
1
+ import type { GroupRange } from './AllowedTimes';
2
+ import { groupConsecutiveNumbers, groupDays, groupHours } from './AllowedTimes';
2
3
 
3
4
  describe('days and hours grouping', () => {
4
5
  it('test grouping', () => {
@@ -29,6 +29,7 @@ export interface IConstraintHandler<K = string> {
29
29
  /** The icon can be a string (from IconNames) or a partial map from statuses to IconNames */
30
30
  iconName: IconNames | { [status in ConstraintStatus | 'DEFAULT']?: IconNames };
31
31
 
32
+ /** Stricter format of the title */
32
33
  displayTitle?: {
33
34
  /** A user friendly name of the constraint */
34
35
  displayName: string;
@@ -37,7 +38,7 @@ export interface IConstraintHandler<K = string> {
37
38
  displayStatus: (props: { constraint: RelaxedConstraint }) => string;
38
39
  };
39
40
 
40
- /** Render function of the constraint title. If displayTitle exists it takes precedence */
41
+ /** DEPRECATED - Render function of the constraint title. If displayTitle exists it takes precedence */
41
42
  titleRender?: React.ComponentType<{ constraint: RelaxedConstraint }>;
42
43
 
43
44
  /** Optional render function of the constraint description */
@@ -45,6 +46,12 @@ export interface IConstraintHandler<K = string> {
45
46
 
46
47
  /** Display actions to override the constraint - (fail or pass) */
47
48
  overrideActions?: { [status in ConstraintStatus]?: IConstraintOverrideAction[] };
49
+
50
+ /** determines when to show the restart constraint button. By default, only when the status is FAIL */
51
+ restartProps?: {
52
+ isVisible?: (props: { constraint: RelaxedConstraint }) => boolean;
53
+ displayName?: string;
54
+ };
48
55
  }
49
56
 
50
57
  class ConstraintsManager extends BasePluginManager<IConstraintHandler> {
@@ -107,6 +114,19 @@ class ConstraintsManager extends BasePluginManager<IConstraintHandler> {
107
114
  const actions = this.getHandler(constraint.type)?.overrideActions;
108
115
  return actions?.[constraint.status];
109
116
  }
117
+
118
+ private defaultShowRestart = ({ constraint }: { constraint: RelaxedConstraint }) => {
119
+ return constraint.status === 'FAIL';
120
+ };
121
+
122
+ isRestartVisible(constraint: IConstraint): boolean {
123
+ const showRestartFunc = this.getHandler(constraint.type)?.restartProps?.isVisible || this.defaultShowRestart;
124
+ return showRestartFunc({ constraint });
125
+ }
126
+
127
+ getRestartDisplayName(constraint: IConstraint): string {
128
+ return this.getHandler(constraint.type)?.restartProps?.displayName || 'Reset';
129
+ }
110
130
  }
111
131
 
112
132
  const baseHandlers: Array<IConstraintHandler<IConstraint['type']>> = [
@@ -126,6 +146,9 @@ const baseHandlers: Array<IConstraintHandler<IConstraint['type']>> = [
126
146
  },
127
147
  ],
128
148
  },
149
+ restartProps: {
150
+ isVisible: () => false,
151
+ },
129
152
  },
130
153
  {
131
154
  kind: 'depends-on',
@@ -134,6 +157,9 @@ const baseHandlers: Array<IConstraintHandler<IConstraint['type']>> = [
134
157
  displayName: 'Depends on',
135
158
  displayStatus: getDependsOnStatus,
136
159
  },
160
+ restartProps: {
161
+ isVisible: () => false,
162
+ },
137
163
  },
138
164
  {
139
165
  kind: 'manual-judgement',
@@ -14,8 +14,8 @@
14
14
  flex-direction: column;
15
15
  justify-content: center;
16
16
  padding: var(--m-spacing) var(--base-horizontal-padding);
17
- color: var(--color-primary);
18
- background-color: var(--color-accent-g4);
17
+ color: var(--color-white);
18
+ background-color: var(--color-primary-g1);
19
19
  border-radius: @borderRadius @borderRadius 0 0;
20
20
 
21
21
  .env-link {
@@ -35,7 +35,7 @@
35
35
  &:not(.preview-env) {
36
36
  text-transform: uppercase;
37
37
  }
38
- font-size: 18px;
38
+ font-size: 20px;
39
39
  font-weight: 700;
40
40
  }
41
41
 
@@ -6,12 +6,14 @@ import { IconTooltip } from '../../presentation';
6
6
 
7
7
  import { TOOLTIP_DELAY_SHOW } from '../utils/defaults';
8
8
 
9
- interface IEnvironmentItemProps {
9
+ export interface IEnvironmentItemProps {
10
10
  title: string | React.ReactElement;
11
11
  className?: string;
12
12
  iconTooltip: string;
13
13
  iconName: IIconProps['name'];
14
+ withPadding?: boolean;
14
15
  size?: 'regular' | 'small';
16
+ rightElement?: React.ReactElement;
15
17
  }
16
18
 
17
19
  export const EnvironmentItem: React.FC<IEnvironmentItemProps> = ({
@@ -20,21 +22,26 @@ export const EnvironmentItem: React.FC<IEnvironmentItemProps> = ({
20
22
  iconName,
21
23
  iconTooltip,
22
24
  className,
25
+ rightElement,
26
+ withPadding = true,
23
27
  children,
24
28
  }) => {
25
29
  return (
26
- <div className={classnames(className, 'environment-row-element')}>
30
+ <div className={classnames(className, 'environment-row-element', { 'with-padding': withPadding })}>
27
31
  <div className={classnames('row-icon', size)}>
28
32
  <IconTooltip
29
33
  tooltip={iconTooltip}
30
34
  name={iconName}
31
35
  color="primary-g1"
32
- size={size === 'regular' ? '18px' : '16px'}
36
+ size={size === 'regular' ? '17px' : '15px'}
33
37
  delayShow={TOOLTIP_DELAY_SHOW}
34
38
  />
35
39
  </div>
36
40
  <div className="row-details">
37
- <div className={classnames('row-title', size)}>{title}</div>
41
+ <div className={classnames('row-title', size)}>
42
+ {title}
43
+ {rightElement && <div>{rightElement}</div>}
44
+ </div>
38
45
  {children}
39
46
  </div>
40
47
  </div>