Merge pull request #14804 from fridajac/bazaar-name

Bazaar UX-changes
This commit is contained in:
Fredrik Adelöw
2022-11-28 11:31:13 +01:00
committed by GitHub
24 changed files with 133 additions and 60 deletions
+28
View File
@@ -0,0 +1,28 @@
/*
* Copyright 2022 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Update with your config settings.
// This file makes it possible to run "yarn knex migrate:make some_file_name"
// to assist in making new migrations
module.exports = {
client: 'better-sqlite3',
connection: ':memory:',
useNullAsDefault: true,
migrations: {
directory: './migrations',
},
};
@@ -0,0 +1,35 @@
/*
* Copyright 2022 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @param { import("knex").Knex } knex
* @returns { Promise<void> }
*/
exports.up = async function up(knex) {
await knex.schema.alterTable('metadata', table => {
table.renameColumn('name', 'title');
});
};
/**
* @param { import("knex").Knex } knex
* @returns { Promise<void> }
*/
exports.down = async function down(knex) {
await knex.schema.alterTable('metadata', table => {
table.renameColumn('title', 'name');
});
};
@@ -19,7 +19,7 @@ import { TestDatabaseId, TestDatabases } from '@backstage/backend-test-utils';
import { Knex as KnexType } from 'knex';
const bazaarProject: any = {
name: 'n1',
title: 'n1',
entityRef: 'ref1',
community: '',
status: 'proposed',
@@ -64,7 +64,7 @@ describe('DatabaseHandler', () => {
await knex('metadata').insert({
entity_ref: bazaarProject.entityRef,
name: bazaarProject.name,
title: bazaarProject.title,
description: bazaarProject.description,
community: bazaarProject.community,
status: bazaarProject.status,
@@ -52,7 +52,7 @@ export class DatabaseHandler {
private columns = [
'metadata.id',
'metadata.entity_ref',
'metadata.name',
'metadata.title',
'metadata.description',
'metadata.status',
'metadata.updated_at',
@@ -116,7 +116,7 @@ export class DatabaseHandler {
async insertMetadata(bazaarProject: any) {
const {
name,
title,
entityRef,
community,
description,
@@ -129,7 +129,7 @@ export class DatabaseHandler {
await this.client
.insert({
name,
title,
entity_ref: entityRef,
community,
description,
@@ -145,7 +145,7 @@ export class DatabaseHandler {
async updateMetadata(bazaarProject: any) {
const {
name,
title,
id,
entityRef,
community,
@@ -158,7 +158,7 @@ export class DatabaseHandler {
} = bazaarProject;
return await this.client('metadata').where({ id: id }).update({
name,
title,
entity_ref: entityRef,
description,
community,