Skip to content

Commit

Permalink
Merge pull request #2 from sonic-screwdriver-cd/wahapo-patch-2
Browse files Browse the repository at this point in the history
use ember-cli-update
  • Loading branch information
wahapo authored Aug 1, 2020
2 parents ea58642 + affb61c commit 6bf0bfe
Show file tree
Hide file tree
Showing 78 changed files with 20,377 additions and 14,318 deletions.
1 change: 0 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

root = true


[*]
end_of_line = lf
charset = utf-8
Expand Down
14 changes: 13 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
'use strict';

module.exports = {
root: true,
parser: 'babel-eslint',
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module'
sourceType: 'module',
ecmaFeatures: {
legacyDecorators: true
}
},
plugins: ['ember', 'prettier'],
extends: [
Expand Down Expand Up @@ -45,6 +51,9 @@ module.exports = {
'ember/avoid-leaking-state-in-ember-objects': 'off',
'ember/jquery-ember-run': 'off',
'ember/no-global-jquery': 'off',
'ember/no-jquery': 'off',
'ember/no-new-mixins': 'off',
'ember/no-observers': 'off',
'ember/no-side-effects': 'off',
'prettier/prettier': 'error'
},
Expand All @@ -61,6 +70,9 @@ module.exports = {
'lib/*/index.js',
'server/**/*.js'
],
parserOptions: {
sourceType: 'script'
},
env: {
browser: false,
node: true
Expand Down
2 changes: 2 additions & 0 deletions .template-lintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

module.exports = {
extends: 'recommended',
rules: {
Expand Down
27 changes: 27 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
language: node_js
node_js:
- "10"

dist: trusty

addons:
chrome: stable

cache:
directories:
- $HOME/.npm

env:
global:
# See https://git.io/vdao3 for details.
- JOBS=1

branches:
only:
- master

script:
- npm run lint:hbs
- npm run lint:js
- npm test
16 changes: 8 additions & 8 deletions app/app.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import Application from '@ember/application';
import loadInitializers from 'ember-load-initializers';
import { run } from '@ember/runloop';
import Resolver from './resolver';
import Resolver from 'ember-resolver';
import config from './config/environment';

const App = Application.extend({
modulePrefix: config.modulePrefix,
podModulePrefix: config.podModulePrefix,
Resolver
});
export default class App extends Application {
modulePrefix = config.modulePrefix;

podModulePrefix = config.podModulePrefix;

Resolver = Resolver;
}

loadInitializers(App, config.modulePrefix);

if (config.environment === 'development') {
run.backburner.DEBUG = true;
}

export default App;
1 change: 1 addition & 0 deletions app/application/adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ export default DS.RESTAdapter.extend(DataAdapterMixin, {
}

let data = {};

let key;

const requestUrl = new URL(requestData.url);
Expand Down
1 change: 1 addition & 0 deletions app/build-artifact/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ function changeFiles(tree) {
*/
function arrangeIntoTree(paths, baseUrl) {
const tree = [];

let currentLevel;

paths.forEach(path => {
Expand Down
1 change: 1 addition & 0 deletions app/build-logs/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export default Service.extend({
started = false
}) {
let lines = [];

let done = false;
const inProgress = sortOrder === 'ascending';

Expand Down
1 change: 1 addition & 0 deletions app/build/adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export default BaseAdapter.extend({
queryRecord(store, type, data) {
this.modelKey = 'build';
let url = `${ENV.APP.SDAPI_HOSTNAME}/${ENV.APP.SDAPI_NAMESPACE}/jobs/${data.jobId}/latestBuild`;

let query = { status: data.status };

return this.ajax(url, 'GET', { data: query });
Expand Down
1 change: 1 addition & 0 deletions app/build/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import DS from 'ember-data';
*/
function calcDuration(start, end) {
let endTime = new Date();

let startTime = this.get(start);

if (end !== 'now') {
Expand Down
1 change: 1 addition & 0 deletions app/command/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export default Service.extend({
},
getAllCommands(namespace) {
const url = `${ENV.APP.SDAPI_HOSTNAME}/${ENV.APP.SDAPI_NAMESPACE}/commands`;

let params = { compact: true, sortBy: 'createTime' };

if (namespace) {
Expand Down
2 changes: 2 additions & 0 deletions app/commands/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export default Controller.extend({
routeParams: computed('model', {
get() {
let route = this.model;

let params = Object.assign(
{},
route.paramsFor('commands.namespace'),
Expand All @@ -17,6 +18,7 @@ export default Controller.extend({
crumbs: computed('routeParams', {
get() {
let breadcrumbs = [];

let params = this.routeParams;

if (params.namespace || params.detail) {
Expand Down
1 change: 1 addition & 0 deletions app/commands/detail/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export default Route.extend({
this.command.getCommandTags(params.namespace, params.name)
]).then(arr => {
const [verPayload, tagPayload] = arr;

let version;

if (params.version) {
Expand Down
2 changes: 2 additions & 0 deletions app/components/artifact-tree/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ export default Component.extend({
const artifactPath = this.getWithDefault('selectedArtifact', '');
const paths = artifactPath.split('/');
const jstree = this.jstreeActionReceiver.target.treeObject.jstree(true);

let nodeList = jstree.get_json();

let targetNode = null;

// traversing jstree to find target artifact node
Expand Down
1 change: 1 addition & 0 deletions app/components/build-log/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export default Component.extend({
}),
getPageSize(fetchMax = false) {
const { totalLine, inProgress, justFinished } = this;

let itemSize = this.logService.getCache(this.buildId, this.stepName, 'nextLine') || totalLine;

if (justFinished) {
Expand Down
1 change: 0 additions & 1 deletion app/components/collection-view/component.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint ember/avoid-leaking-state-in-components: [2, ["sortBy", "selectedPipelines", "searchedPipelines", "selectedSearchedPipelines", "metricsMap"]] */
import { sort } from '@ember/object/computed';
import { computed } from '@ember/object';
import { inject as service } from '@ember/service';
Expand Down
2 changes: 2 additions & 0 deletions app/components/create-pipeline/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export default Component.extend({
checkoutUrl: scmUrl,
rootDir
};

let pipeline;

try {
Expand Down Expand Up @@ -102,6 +103,7 @@ export default Component.extend({
}
} catch (err) {
const { payload: responsePayload } = err;

let { message } = responsePayload;

this.setProperties({
Expand Down
2 changes: 2 additions & 0 deletions app/components/events-thumbnail/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ export default Component.extend({
};

const svg = select(this.element.getElementsByTagName('svg')[0]);

let [barSpace, barWidth, paddingLeft, paddingRight] = getParameters(svg);
const totalNumberOfEvents = this.events.length;

let maxDuration = Math.max(...this.events.map(event => event.duration));

if (maxDuration === -Infinity) {
Expand Down
1 change: 0 additions & 1 deletion app/components/loading-view/component.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint ember/avoid-leaking-state-in-components: [2, ["funnies"]] */
import { computed } from '@ember/object';
import Component from '@ember/component';

Expand Down
2 changes: 2 additions & 0 deletions app/components/pipeline-event-row/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export default Component.extend({
get() {
const startFrom = this.get('event.startFrom');
const pipelineId = this.get('event.pipelineId');

let isExternal = false;

if (startFrom && startFrom.match(/^~sd@(\d+):([\w-]+)$/)) {
Expand All @@ -65,6 +66,7 @@ export default Component.extend({
// using underscore because router.js doesn't pick up camelcase
/* eslint-disable camelcase */
let pipeline_id = this.get('event.startFrom').match(/^~sd@(\d+):[\w-]+$/);

let build_id = this.get('event.causeMessage').match(/\s(\d+)$/);

if (build_id) {
Expand Down
5 changes: 5 additions & 0 deletions app/components/pipeline-list-view/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export default Component.extend({
this._super(...arguments);
const sortedRows = this.getRows(this.jobsDetails);
const table = new Table(this.get('columns'), sortedRows);

let sortColumn = table.get('allColumns').findBy('valuePath', this.get('sortingValuePath'));

// Setup initial sort column
Expand Down Expand Up @@ -146,9 +147,13 @@ export default Component.extend({
const prNumMatch = jobName.match(prRegex);

let duration;

let startTime;

let status;

let buildId;

let coverageData = {};

if (latestBuild) {
Expand Down
2 changes: 1 addition & 1 deletion app/components/pipeline-options/component.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint ember/avoid-leaking-state-in-components: [2, ["jobSorting"]] */
import $ from 'jquery';
import { inject as service } from '@ember/service';
import { not, or, sort } from '@ember/object/computed';
Expand Down Expand Up @@ -124,6 +123,7 @@ export default Component.extend({
},
clearCache(scope, id) {
const pipelineId = this.get('pipeline.id');

let config = {
scope,
cacheId: id,
Expand Down
24 changes: 21 additions & 3 deletions app/components/pipeline-parameterized-build/component.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Component from '@ember/component';
import { set } from '@ember/object';
import { getWithDefault, set } from '@ember/object';

/**
@class PipelineParameterizedBuild
Expand Down Expand Up @@ -70,7 +70,7 @@ export default Component.extend({
const normalizedParameterizedModel = {};

Object.entries(parameters).forEach(([propertyName, propertyVal]) => {
const value = propertyVal.value || propertyVal || '';
let value = propertyVal.value || propertyVal || '';
const description = propertyVal.description || '';

normalizedParameters.push({
Expand All @@ -79,6 +79,10 @@ export default Component.extend({
description
});

if (Array.isArray(value)) {
value = getWithDefault(value, '0', '');
}

normalizedParameterizedModel[propertyName] = value;
});

Expand Down Expand Up @@ -109,9 +113,23 @@ export default Component.extend({
throw new Error('Not implemented');
},

updateValue({ model, propertyName, value }) {
set(model, propertyName, value);
},

actions: {
searchOrAddtoList(model, propertyName, value, e) {
if (e.keyCode === 13) {
this.updateValue({ model, propertyName, value: value.searchText });
}
},

onUpdateDropdownValue(model, propertyName, value) {
this.updateValue({ model, propertyName, value });
},

onUpdateValue(value, model, propertyName) {
set(model, propertyName, value);
this.updateValue({ model, propertyName, value });
},

/**
Expand Down
30 changes: 25 additions & 5 deletions app/components/pipeline-parameterized-build/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,31 @@
onSubmit=(action "onSave" parameters) as |form|}}

{{#each parameters as |parameter|}}
{{form.element
label=parameter.name
placeholder=parameter.value
property=parameter.name
onChange=(action "onUpdateValue")}}
{{#if (is-array parameter.value)}}
{{#form.group}}
<label class="control-label col-md-4">{{parameter.name}}</label>
<div class="col-md-8">
{{#power-select
options=parameter.value
renderInPlace=true
selected=(get parameterizedModel parameter.name)
onchange=(action (action "onUpdateDropdownValue" parameterizedModel parameter.name))
onkeydown=(action (action "searchOrAddtoList" parameterizedModel parameter.name))
searchPlaceholder="Type to filter"
noMatchesMessage="Hit enter to override"
as |selectedValue|
}}
{{selectedValue}}
{{/power-select}}
</div>
{{/form.group}}
{{else}}
{{form.element
label=parameter.name
placeholder=parameter.value
property=parameter.name
onChange=(action "onUpdateValue")}}
{{/if}}
{{/each}}

{{#if showSubmitButton}}
Expand Down
1 change: 0 additions & 1 deletion app/components/pipeline-secret-settings/component.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint ember/avoid-leaking-state-in-components: [2, ["secretsSorting"]] */
import { sort } from '@ember/object/computed';
import { computed } from '@ember/object';
import Component from '@ember/component';
Expand Down
2 changes: 2 additions & 0 deletions app/components/pipeline-workflow/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ export default Component.extend({
const EXTERNAL_TRIGGER_REGEX = /^~?sd@(\d+):([\w-]+)$/;
const edges = get(this, 'directedGraph.edges');
const isTrigger = job ? /(^~)|(^~?sd@)/.test(job.name) : false;

let isRootNode = true;

let toolTipProperties = {};

// Find root nodes to determine position of tooltip
Expand Down
1 change: 0 additions & 1 deletion app/components/search-list/component.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint ember/avoid-leaking-state-in-components: [2, ["pipelineSorting"]] */
import { computed, get, set } from '@ember/object';
import { empty } from '@ember/object/computed';
import { inject as service } from '@ember/service';
Expand Down
Loading

0 comments on commit 6bf0bfe

Please sign in to comment.