Skip to content

Commit

Permalink
refactor(dcos): Make dcos a separate npm package
Browse files Browse the repository at this point in the history
  • Loading branch information
vigneshm committed Jul 8, 2021
1 parent 80fc525 commit cc42f53
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 16 deletions.
30 changes: 30 additions & 0 deletions app/scripts/modules/dcos/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "@spinnaker/dcos",
"license": "Apache-2.0",
"version": "0.0.1",
"module": "dist/index.js",
"typings": "dist/index.d.ts",
"private": true,
"scripts": {
"clean": "shx rm -rf dist",
"prepublishOnly": "npm run build",
"build": "npm run clean && spinnaker-scripts build",
"dev": "spinnaker-scripts start",
"dev:push": "spinnaker-scripts start --push",
"lib": "npm run build"
},
"dependencies": {
"@spinnaker/core": "*",
"@spinnaker/docker": "*",
"angular": "1.6.10",
"lodash": "4.17.21",
"ngimport": "0.6.1",
"rxjs": "6.6.7"
},
"devDependencies": {
"@spinnaker/eslint-plugin": "1.0.13",
"@spinnaker/scripts": "0.0.14",
"shx": "0.3.3",
"typescript": "4.0.2"
}
}
11 changes: 3 additions & 8 deletions app/scripts/modules/dcos/src/dcos.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { DCOS_INSTANCE_DETAILS_DETAILS_DCOS_MODULE } from './instance/details/de
import { DCOS_LOADBALANCER_CONFIGURE_CONFIGURE_DCOS_MODULE } from './loadBalancer/configure/configure.dcos.module';
import { DCOS_LOADBALANCER_DETAILS_DETAILS_DCOS_MODULE } from './loadBalancer/details/details.dcos.module';
import { DCOS_LOADBALANCER_TRANSFORMER } from './loadBalancer/transformer';
import logo from './logo/dcos.logo.png';
import { DCOS_PIPELINE_STAGES_DESTROYASG_DCOSDESTROYASGSTAGE } from './pipeline/stages/destroyAsg/dcosDestroyAsgStage';
import { DCOS_PIPELINE_STAGES_DISABLEASG_DCOSDISABLEASGSTAGE } from './pipeline/stages/disableAsg/dcosDisableAsgStage';
import { DCOS_PIPELINE_STAGES_DISABLECLUSTER_DCOSDISABLECLUSTERSTAGE } from './pipeline/stages/disableCluster/dcosDisableClusterStage';
Expand All @@ -26,13 +27,7 @@ import { DCOS_SERVERGROUP_DETAILS_DETAILS_DCOS_MODULE } from './serverGroup/deta
import { DCOS_SERVERGROUP_TRANSFORMER } from './serverGroup/transformer';
import { DCOS_VALIDATION_APPLICATIONNAME_VALIDATOR } from './validation/applicationName.validator';

require('./logo/dcos.logo.less');

// load all templates into the $templateCache
const templates = require.context('./', true, /\.html$/);
templates.keys().forEach(function (key) {
templates(key);
});
import './logo/dcos.logo.less';

export const DCOS_DCOS_MODULE = 'spinnaker.dcos';
export const name = DCOS_DCOS_MODULE; // for backwards compatibility
Expand Down Expand Up @@ -61,7 +56,7 @@ module(DCOS_DCOS_MODULE, [
CloudProviderRegistry.registerProvider('dcos', {
name: 'DC/OS',
logo: {
path: require('./logo/dcos.logo.png'),
path: logo,
},
instance: {
detailsTemplateUrl: require('./instance/details/details.html'),
Expand Down
2 changes: 2 additions & 0 deletions app/scripts/modules/dcos/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { DCOS_DCOS_MODULE } from './dcos.module';
export * from './dcos.settings';
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
<div class="form-group">
<div ng-class="$ctrl.labelClass" class="sm-label-right">Organization</div>
<div ng-class="$ctrl.fieldClass">
<input class="form-control input-sm" ng-if="$ctrl.organization.includes('${')" ng-model="$ctrl.organization" />
<input class="form-control input-sm" ng-if="$ctrl.hasTag($ctrl.organization)" ng-model="$ctrl.organization" />
<ui-select
ng-model="$ctrl.organization"
ng-if="!$ctrl.organization.includes('${')"
ng-if="!$ctrl.hasTag($ctrl.organization)"
ng-disabled="$ctrl.viewState.imagesRefreshing"
ng-change="$ctrl.updateRepositoryList()"
class="form-control input-sm"
Expand All @@ -45,10 +45,10 @@
<div class="form-group">
<div ng-class="$ctrl.labelClass" class="sm-label-right">Image</div>
<div ng-class="$ctrl.fieldClass">
<input class="form-control input-sm" ng-if="$ctrl.repository.includes('${')" ng-model="$ctrl.repository" />
<input class="form-control input-sm" ng-if="$ctrl.hasTag($ctrl.repository)" ng-model="$ctrl.repository" />
<ui-select
ng-model="$ctrl.repository"
ng-if="!$ctrl.repository.includes('${')"
ng-if="!$ctrl.hasTag($ctrl.repository)"
ng-disabled="$ctrl.viewState.imagesRefreshing"
ng-change="$ctrl.updateTag()"
class="form-control input-sm"
Expand Down Expand Up @@ -79,10 +79,10 @@
<div class="form-group" ng-if="!$ctrl.specifyTagByRegex">
<div ng-class="$ctrl.labelClass" class="sm-label-right">Tag</div>
<div ng-class="$ctrl.fieldClass">
<input class="form-control input-sm" ng-if="$ctrl.tag.includes('${')" ng-model="$ctrl.tag" />
<input class="form-control input-sm" ng-if="$ctrl.hasSpel($ctrl.tag)" ng-model="$ctrl.tag" />
<ui-select
ng-model="$ctrl.tag"
ng-if="!$ctrl.tag.includes('${')"
ng-if="!$ctrl.hasSpel($ctrl.tag)"
ng-disabled="$ctrl.viewState.imagesRefreshing || !$ctrl.repository"
ng-change="$ctrl.updateTag()"
class="form-control input-sm"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,10 @@ export class DockerImageAndTagSelectorController implements IController {
this.initializeImages();
}

public hasSpel(value: string): boolean {
return value.includes('${');
}

public $onInit(): void {
this.labelClass = this.labelClass || 'col-md-3';
this.fieldClass = this.fieldClass || 'col-md-8';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
'use strict';

import { module } from 'angular';
import { DCOS_JOB_GENERAL_COMPONENT } from 'dcos/job/general.component';
import { DCOS_JOB_LABELS_COMPONENT } from 'dcos/job/labels.component';
import _ from 'lodash';

import { AccountService, Registry } from '@spinnaker/core';

import { DcosProviderSettings } from '../../../dcos.settings';
import { DOCKER_IMAGE_AND_TAG_SELECTOR_COMPONENT } from './dockerImageAndTagSelector.component';
import { DCOS_JOB_GENERAL_COMPONENT } from '../../../job/general.component';
import { DCOS_JOB_LABELS_COMPONENT } from '../../../job/labels.component';

export const DCOS_PIPELINE_STAGES_RUNJOB_RUNJOBSTAGE = 'spinnaker.dcos.pipeline.stage.runJobStage';
export const name = DCOS_PIPELINE_STAGES_RUNJOB_RUNJOBSTAGE; // for backwards compatibility
Expand Down
13 changes: 13 additions & 0 deletions app/scripts/modules/dcos/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"baseUrl": "../../../../",
"outDir": "dist",
"paths": {
"core/*": ["app/scripts/modules/core/dist/*"]
},
"rootDir": "./src"
},
"include": ["src/**/*.ts", "src/**/*.tsx"],
"exclude": ["**/*.spec.*"]
}

0 comments on commit cc42f53

Please sign in to comment.